Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

set vreplication net read and net write timeout session vars to high values #14203

Merged
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions go/vt/vttablet/tabletmanager/rpc_vreplication_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ const (
getAutoIncrementStep = "select @@session.auto_increment_increment"
setSessionTZ = "set @@session.time_zone = '+00:00'"
setNames = "set names 'binary'"
setNetReadTimeout = "set @@session.net_read_timeout = 300"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We were discussing this yesterday and the consensus was that we should not hardcode values since the actual value might vary based on the cluster environment.

We can add flags for this as common vttablet flags similar to the query timeout PR. Your values seem fine as defaults to me.

setNetWriteTimeout = "set @@session.net_write_timeout = 600"
getBinlogRowImage = "select @@binlog_row_image"
insertStreamsCreatedLog = "insert into _vt.vreplication_log(vrepl_id, type, state, message) values(1, 'Stream Created', '', '%s'"
getVReplicationRecord = "select * from _vt.vreplication where id = 1"
Expand Down Expand Up @@ -324,6 +326,8 @@ func TestMoveTables(t *testing.T) {
ftc.vrdbClient.ExpectRequest(fmt.Sprintf(updatePickedSourceTablet, tenv.cells[0], sourceTabletUID), &sqltypes.Result{}, nil)
ftc.vrdbClient.ExpectRequest(setSessionTZ, &sqltypes.Result{}, nil)
ftc.vrdbClient.ExpectRequest(setNames, &sqltypes.Result{}, nil)
ftc.vrdbClient.ExpectRequest(setNetReadTimeout, &sqltypes.Result{}, nil)
ftc.vrdbClient.ExpectRequest(setNetWriteTimeout, &sqltypes.Result{}, nil)
ftc.vrdbClient.ExpectRequest(getRowsCopied,
sqltypes.MakeTestResult(
sqltypes.MakeTestFields(
Expand Down Expand Up @@ -895,6 +899,8 @@ func TestFailedMoveTablesCreateCleanup(t *testing.T) {
&sqltypes.Result{}, nil)
targetTablet.vrdbClient.ExpectRequest(setSessionTZ, &sqltypes.Result{}, nil)
targetTablet.vrdbClient.ExpectRequest(setNames, &sqltypes.Result{}, nil)
targetTablet.vrdbClient.ExpectRequest(setNetReadTimeout, &sqltypes.Result{}, nil)
targetTablet.vrdbClient.ExpectRequest(setNetWriteTimeout, &sqltypes.Result{}, nil)
targetTablet.vrdbClient.ExpectRequest(getRowsCopied,
sqltypes.MakeTestResult(
sqltypes.MakeTestFields(
Expand Down
6 changes: 6 additions & 0 deletions go/vt/vttablet/tabletmanager/vreplication/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,12 @@ func (ct *controller) runBlp(ctx context.Context) (err error) {
if _, err := dbClient.ExecuteFetch("set names 'binary'", 10000); err != nil {
return err
}
if _, err := dbClient.ExecuteFetch("set @@session.net_read_timeout = 300", 10000); err != nil {
return err
}
if _, err := dbClient.ExecuteFetch("set @@session.net_write_timeout = 600", 10000); err != nil {
return err
}
// We must apply AUTO_INCREMENT values precisely as we got them. This include the 0 value, which is not recommended in AUTO_INCREMENT, and yet is valid.
if _, err := dbClient.ExecuteFetch("set @@session.sql_mode = CONCAT(@@session.sql_mode, ',NO_AUTO_VALUE_ON_ZERO')", 10000); err != nil {
return err
Expand Down
6 changes: 6 additions & 0 deletions go/vt/vttablet/tabletserver/vstreamer/rowstreamer.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,12 @@ func (rs *rowStreamer) Stream() error {
if _, err := rs.conn.ExecuteFetch("set names 'binary'", 1, false); err != nil {
return err
}
if _, err := conn.ExecuteFetch("set @@session.net_read_timeout = 300", 1, false); err != nil {
return err
}
if _, err := conn.ExecuteFetch("set @@session.net_write_timeout = 600", 1, false); err != nil {
return err
}
}
return rs.streamQuery(rs.send)
}
Expand Down
6 changes: 6 additions & 0 deletions go/vt/vttablet/tabletserver/vstreamer/tablestreamer.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,12 @@ func (ts *tableStreamer) Stream() error {
if _, err := conn.ExecuteFetch("set names 'binary'", 1, false); err != nil {
return err
}
if _, err := conn.ExecuteFetch("set @@session.net_read_timeout = 300", 1, false); err != nil {
return err
}
if _, err := conn.ExecuteFetch("set @@session.net_write_timeout = 600", 1, false); err != nil {
return err
}

rs, err := conn.ExecuteFetch("show tables", -1, true)
if err != nil {
Expand Down