зеркало из https://github.com/github/vitess-gh.git
Родитель
47cbd4a116
Коммит
d807daa050
|
@ -23,6 +23,7 @@ import (
|
|||
"strings"
|
||||
|
||||
log "github.com/golang/glog"
|
||||
"github.com/golang/protobuf/proto"
|
||||
"golang.org/x/net/context"
|
||||
|
||||
"github.com/youtube/vitess/go/mysql"
|
||||
|
@ -196,7 +197,7 @@ func (bls *Streamer) Stream(ctx context.Context) (err error) {
|
|||
return fmt.Errorf("can't get charset to check binlog stream: %v", err)
|
||||
}
|
||||
log.Infof("binlog stream client charset = %v, server charset = %v", *bls.clientCharset, cs)
|
||||
if *cs != *bls.clientCharset {
|
||||
if !proto.Equal(cs, bls.clientCharset) {
|
||||
return fmt.Errorf("binlog stream client charset (%v) doesn't match server (%v)", bls.clientCharset, cs)
|
||||
}
|
||||
}
|
||||
|
@ -404,7 +405,7 @@ func (bls *Streamer) parseEvents(ctx context.Context, events <-chan mysql.Binlog
|
|||
// If the statement has a charset and it's different than our client's
|
||||
// default charset, send it along with the statement.
|
||||
// If our client hasn't told us its charset, always send it.
|
||||
if bls.clientCharset == nil || (q.Charset != nil && *q.Charset != *bls.clientCharset) {
|
||||
if bls.clientCharset == nil || (q.Charset != nil && !proto.Equal(q.Charset, bls.clientCharset)) {
|
||||
setTimestamp.Charset = q.Charset
|
||||
statement.Charset = q.Charset
|
||||
}
|
||||
|
|
|
@ -27,6 +27,7 @@ import (
|
|||
"time"
|
||||
|
||||
log "github.com/golang/glog"
|
||||
"github.com/golang/protobuf/proto"
|
||||
"golang.org/x/net/context"
|
||||
|
||||
"github.com/youtube/vitess/go/mysql"
|
||||
|
@ -262,7 +263,7 @@ func (blp *BinlogPlayer) processTransaction(tx *binlogdatapb.BinlogTransaction)
|
|||
// charset we specified in the request.
|
||||
stmtCharset = blp.defaultCharset
|
||||
}
|
||||
if *blp.currentCharset != *stmtCharset {
|
||||
if !proto.Equal(blp.currentCharset, stmtCharset) {
|
||||
// In regular MySQL replication, the charset is silently adjusted as
|
||||
// needed during event playback. Here we also adjust so that playback
|
||||
// proceeds, but in Vitess-land this usually means a misconfigured
|
||||
|
|
|
@ -716,7 +716,7 @@ func TestParseTarget(t *testing.T) {
|
|||
}}
|
||||
|
||||
for _, tcase := range testcases {
|
||||
if target := r.ParseTarget(tcase.targetString); target != tcase.target {
|
||||
if target := r.ParseTarget(tcase.targetString); !proto.Equal(&target, &tcase.target) {
|
||||
t.Errorf("ParseTarget(%s): %v, want %v", tcase.targetString, target, tcase.target)
|
||||
}
|
||||
}
|
||||
|
@ -736,7 +736,7 @@ func TestParseTargetSingleKeyspace(t *testing.T) {
|
|||
Keyspace: KsTestUnsharded,
|
||||
TabletType: topodatapb.TabletType_MASTER,
|
||||
}
|
||||
if got != want {
|
||||
if !proto.Equal(&got, &want) {
|
||||
t.Errorf("ParseTarget(%s): %v, want %v", "@master", got, want)
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче