Skip to content

Commit

Permalink
use original context for mm shard conclude and add command test
Browse files Browse the repository at this point in the history
Signed-off-by: Harshit Gangal <harshit@planetscale.com>
  • Loading branch information
harshit-gangal committed Sep 4, 2024
1 parent b03c109 commit 73f1a84
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
10 changes: 8 additions & 2 deletions go/test/endtoend/tabletmanager/commands_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion go/vt/vtctl/grpcvtctldserver/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down

0 comments on commit 73f1a84

Please sign in to comment.