File tree 2 files changed +0
-34
lines changed
2 files changed +0
-34
lines changed Original file line number Diff line number Diff line change 1
1
package mysql
2
2
3
3
import (
4
- "crypto/md5"
5
- "encoding/hex"
6
4
"strings"
7
5
"testing"
8
6
@@ -120,30 +118,6 @@ func (t *mysqlTestSuite) TestMysqlGTIDContain(c *check.C) {
120
118
c .Assert (g1 .Contain (g2 ), check .Equals , false )
121
119
}
122
120
123
- func (t * mysqlTestSuite ) TestHostnameMd5sum (c * check.C ) {
124
- // if os.Hostname() lengther than 60, use md5sum instead
125
- tbl := []struct {
126
- hashStr string
127
- sum int
128
- }{
129
- {`app-f084ccc2f5dd37da027539dc9d2cb1581c2237d4-1-7ff988bd9f-t2cx7` , 32 },
130
- {`jianhaiqingxxx` , 14 },
131
- {`dfmpzqy7wjvwotpadgkiinkl5bjtdkuu.aliyundunwaf.com.dfmpzqy7wjvwotpadgkiinkl5bjtdkuu.aliyundunwaf.com.dfmpzqy7wjvwotpadgkiinkl5bjtdkuu.aliyundunwaf.com.` , 32 },
132
- }
133
- var get int
134
- for _ , t := range tbl {
135
- if len (t .hashStr ) > 60 {
136
- hasher := md5 .New ()
137
- hasher .Write ([]byte (t .hashStr ))
138
- get = len (hex .EncodeToString (hasher .Sum (nil )))
139
- } else {
140
- get = len (t .hashStr )
141
- }
142
- c .Assert (get == t .sum , check .IsTrue )
143
- }
144
-
145
- }
146
-
147
121
func (t * mysqlTestSuite ) TestMysqlParseBinaryInt8 (c * check.C ) {
148
122
i8 := ParseBinaryInt8 ([]byte {128 })
149
123
c .Assert (i8 , check .Equals , int8 (- 128 ))
Original file line number Diff line number Diff line change @@ -2,10 +2,8 @@ package replication
2
2
3
3
import (
4
4
"context"
5
- "crypto/md5"
6
5
"crypto/tls"
7
6
"encoding/binary"
8
- "encoding/hex"
9
7
"fmt"
10
8
"net"
11
9
"os"
@@ -498,12 +496,6 @@ func (b *BinlogSyncer) writeBinlogDumpMariadbGTIDCommand(gset GTIDSet) error {
498
496
func (b * BinlogSyncer ) localHostname () string {
499
497
if len (b .cfg .Localhost ) == 0 {
500
498
h , _ := os .Hostname ()
501
- // if os.Hostname() lengther than 60, use md5sum instead
502
- if len (h ) > 60 {
503
- hasher := md5 .New ()
504
- hasher .Write ([]byte (h ))
505
- return hex .EncodeToString (hasher .Sum (nil ))
506
- }
507
499
return h
508
500
}
509
501
return b .cfg .Localhost
You can’t perform that action at this time.
0 commit comments