Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Manan Gupta <35839558+GuptaManan100@users.noreply.github.com>
Signed-off-by: Olga Shestopalova <olgash@mit.edu>
  • Loading branch information
olyazavr and GuptaManan100 authored Sep 29, 2023
1 parent c8576ca commit a036088
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion go/vt/vtgate/executor_framework_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ func createExecutorEnvWithPrimaryReplicaConn(t testing.TB, ctx context.Context,
replica = hc.AddTestTablet(cell, "0-replica", 1, KsTestUnsharded, "0", topodatapb.TabletType_REPLICA, true, 1, nil)

queryLogger := streamlog.New[*logstats.LogStats]("VTGate", queryLogBufferSize)
executor = NewExecutor(context.Background(), serv, cell, resolver, false, false, testBufferSize, DefaultPlanCache(), nil, false, querypb.ExecuteOptions_Gen4, warmingReadsPercent)
executor = NewExecutor(ctx, serv, cell, resolver, false, false, testBufferSize, DefaultPlanCache(), nil, false, querypb.ExecuteOptions_Gen4, warmingReadsPercent)
executor.SetQueryLogger(queryLogger)

t.Cleanup(func() {
Expand Down
12 changes: 6 additions & 6 deletions go/vt/vtgate/executor_select_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4152,13 +4152,13 @@ func TestSelectView(t *testing.T) {
}

func TestWarmingReads(t *testing.T) {
ctx := context.Background()
ctx := utils.LeakCheckContext(t)
executor, primary, replica := createExecutorEnvWithPrimaryReplicaConn(t, ctx, 100)

executor.normalize = true
session := NewSafeSession(&vtgatepb.Session{TargetString: KsTestUnsharded})

_, err := executor.Execute(ctx, nil, "TestSelect", session, "select age, city from user", map[string]*querypb.BindVariable{})
_, err := executor.Execute(ctx, nil, "TestWarmingReads", session, "select age, city from user", map[string]*querypb.BindVariable{})
time.Sleep(10 * time.Millisecond)
require.NoError(t, err)
wantQueries := []*querypb.BoundQuery{
Expand All @@ -4173,7 +4173,7 @@ func TestWarmingReads(t *testing.T) {
utils.MustMatch(t, wantQueriesReplica, replica.Queries)
replica.Queries = nil

_, err = executor.Execute(ctx, nil, "TestSelect", session, "select age, city from user /* already has a comment */ ", map[string]*querypb.BindVariable{})
_, err = executor.Execute(ctx, nil, "TestWarmingReads", session, "select age, city from user /* already has a comment */ ", map[string]*querypb.BindVariable{})
time.Sleep(10 * time.Millisecond)
require.NoError(t, err)
wantQueries = []*querypb.BoundQuery{
Expand All @@ -4193,19 +4193,19 @@ func TestWarmingReads(t *testing.T) {
require.NoError(t, err)
require.Nil(t, replica.Queries)

_, err = executor.Execute(ctx, nil, "TestSelect", session, "update user set age=5 where city='Boston'", map[string]*querypb.BindVariable{})
_, err = executor.Execute(ctx, nil, "TestWarmingReads", session, "update user set age=5 where city='Boston'", map[string]*querypb.BindVariable{})
time.Sleep(10 * time.Millisecond)
require.NoError(t, err)
require.Nil(t, replica.Queries)

_, err = executor.Execute(ctx, nil, "TestSelect", session, "delete from user where city='Boston'", map[string]*querypb.BindVariable{})
_, err = executor.Execute(ctx, nil, "TestWarmingReads", session, "delete from user where city='Boston'", map[string]*querypb.BindVariable{})
time.Sleep(10 * time.Millisecond)
require.NoError(t, err)
require.Nil(t, replica.Queries)
primary.Queries = nil

executor, primary, replica = createExecutorEnvWithPrimaryReplicaConn(t, ctx, 0)
_, err = executor.Execute(ctx, nil, "TestSelect", session, "select age, city from user", map[string]*querypb.BindVariable{})
_, err = executor.Execute(ctx, nil, "TestWarmingReads", session, "select age, city from user", map[string]*querypb.BindVariable{})
time.Sleep(10 * time.Millisecond)
require.NoError(t, err)
wantQueries = []*querypb.BoundQuery{
Expand Down

0 comments on commit a036088

Please sign in to comment.