From 73f1a840970cf9e55f5c9369e085a12027266098 Mon Sep 17 00:00:00 2001 From: Harshit Gangal Date: Wed, 4 Sep 2024 22:19:28 +0530 Subject: [PATCH] use original context for mm shard conclude and add command test Signed-off-by: Harshit Gangal --- go/test/endtoend/tabletmanager/commands_test.go | 10 ++++++++-- go/vt/vtctl/grpcvtctldserver/server.go | 2 +- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/go/test/endtoend/tabletmanager/commands_test.go b/go/test/endtoend/tabletmanager/commands_test.go index 911e097a17c..55126cb22e8 100644 --- a/go/test/endtoend/tabletmanager/commands_test.go +++ b/go/test/endtoend/tabletmanager/commands_test.go @@ -81,8 +81,14 @@ func TestTabletCommands(t *testing.T) { require.NoError(t, err) }) t.Run("ConcludeTransaction", func(t *testing.T) { - _, err := clusterInstance.VtctldClientProcess.ExecuteCommandWithOutput("ConcludeTransaction", "ks:-80:1234", "ks/80-") - require.NoError(t, err) + output, err := clusterInstance.VtctldClientProcess.ExecuteCommandWithOutput("ConcludeTransaction", "ks:0:1234") + assert.NoError(t, err) + assert.Contains(t, output, "Successfully concluded the distributed transaction") + }) + t.Run("ConcludeTransaction with participants", func(t *testing.T) { + output, err := clusterInstance.VtctldClientProcess.ExecuteCommandWithOutput("ConcludeTransaction", "ks:0:1234", "ks/0") + assert.NoError(t, err) + assert.Contains(t, output, "Successfully concluded the distributed transaction") }) // check Ping / RefreshState / RefreshStateByShard err = clusterInstance.VtctldClientProcess.ExecuteCommand("PingTablet", primaryTablet.Alias) diff --git a/go/vt/vtctl/grpcvtctldserver/server.go b/go/vt/vtctl/grpcvtctldserver/server.go index 299aaf174db..ffb4865f3c7 100644 --- a/go/vt/vtctl/grpcvtctldserver/server.go +++ b/go/vt/vtctl/grpcvtctldserver/server.go @@ -2468,7 +2468,7 @@ func (s *VtctldServer) ConcludeTransaction(ctx context.Context, req *vtctldatapb return nil, err } - if err = s.tmc.ConcludeTransaction(newCtx, primary.Tablet, req.Dtid, true); err != nil { + if err = s.tmc.ConcludeTransaction(ctx, primary.Tablet, req.Dtid, true); err != nil { return nil, err }