Skip to content

Commit

Permalink
Fix vreplication panic
Browse files Browse the repository at this point in the history
Fixes #5752

DBClient was setting the connection to nil after close, which was
causing vreplication to panic because it defers a Rollback on all
connections. The safer thing is to close the connection, but not
set it to nil.

There's no test for DBClient, but I've manually verified that this
won't panic any more.

Signed-off-by: Sugu Sougoumarane <[email protected]>
  • Loading branch information
sougou committed Jan 23, 2020
1 parent 5b761bb commit 46bd544
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 7 deletions.
2 changes: 0 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,6 @@ require (
github.com/mattn/go-runewidth v0.0.1 // indirect
github.com/minio/minio-go v0.0.0-20190131015406-c8a261de75c1
github.com/mitchellh/go-testing-interface v1.0.0 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.1 // indirect
github.com/olekukonko/tablewriter v0.0.0-20160115111002-cca8bbc07984
github.com/opentracing-contrib/go-grpc v0.0.0-20180928155321-4b5a12d3ff02
github.com/opentracing/opentracing-go v1.1.0
Expand Down
5 changes: 1 addition & 4 deletions go/vt/binlog/binlogplayer/dbclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,7 @@ func (dc *dbClientImpl) Rollback() error {
}

func (dc *dbClientImpl) Close() {
if dc.dbConn != nil {
dc.dbConn.Close()
dc.dbConn = nil
}
dc.dbConn.Close()
}

func (dc *dbClientImpl) ExecuteFetch(query string, maxrows int) (*sqltypes.Result, error) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,6 @@ func (dbc *realDBClient) Rollback() error {

func (dbc *realDBClient) Close() {
dbc.conn.Close()
dbc.conn = nil
}

func (dbc *realDBClient) ExecuteFetch(query string, maxrows int) (*sqltypes.Result, error) {
Expand Down

0 comments on commit 46bd544

Please sign in to comment.