Skip to content

Commit

Permalink
VReplication Workflows (RowStreamer): explicitly set read only when c…
Browse files Browse the repository at this point in the history
…reating snapshots in the copy phase (#15690)

Signed-off-by: Rohit Nayak <[email protected]>
  • Loading branch information
rohit-nayak-ps authored Apr 10, 2024
1 parent b277107 commit 680d05f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions go/vt/vttablet/tabletserver/vstreamer/snapshot_conn.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ func (conn *snapshotConn) startSnapshot(ctx context.Context, table string) (gtid
if _, err := conn.ExecuteFetch("set transaction isolation level repeatable read", 1, false); err != nil {
return "", err
}
if _, err := conn.ExecuteFetch("start transaction with consistent snapshot", 1, false); err != nil {
if _, err := conn.ExecuteFetch("start transaction with consistent snapshot, read only", 1, false); err != nil {
return "", err
}
if _, err := conn.ExecuteFetch("set @@session.time_zone = '+00:00'", 1, false); err != nil {
Expand All @@ -152,7 +152,7 @@ func (conn *snapshotConn) startSnapshotWithConsistentGTID(ctx context.Context) (
if _, err := conn.ExecuteFetch("set transaction isolation level repeatable read", 1, false); err != nil {
return "", err
}
result, err := conn.ExecuteFetch("start transaction with consistent snapshot", 1, false)
result, err := conn.ExecuteFetch("start transaction with consistent snapshot, read only", 1, false)
if err != nil {
return "", err
}
Expand Down Expand Up @@ -290,7 +290,7 @@ func (conn *snapshotConn) startSnapshotAllTables(ctx context.Context) (gtid stri
if _, err := conn.ExecuteFetch("set transaction isolation level repeatable read", 1, false); err != nil {
return "", err
}
if _, err := conn.ExecuteFetch("start transaction with consistent snapshot", 1, false); err != nil {
if _, err := conn.ExecuteFetch("start transaction with consistent snapshot, read only", 1, false); err != nil {
return "", err
}
if _, err := conn.ExecuteFetch("set @@session.time_zone = '+00:00'", 1, false); err != nil {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func TestStartSnapshot(t *testing.T) {
Rows: [][]sqltypes.Value{
{sqltypes.NewInt32(1), sqltypes.NewVarBinary("aaa")},
},
StatusFlags: sqltypes.ServerStatusNoIndexUsed | sqltypes.ServerStatusAutocommit | sqltypes.ServerStatusInTrans,
StatusFlags: sqltypes.ServerStatusInTransReadonly | sqltypes.ServerStatusNoIndexUsed | sqltypes.ServerStatusAutocommit | sqltypes.ServerStatusInTrans,
}
qr, err := conn.ExecuteFetch("select * from t1", 10, false)
require.NoError(t, err)
Expand Down

0 comments on commit 680d05f

Please sign in to comment.