Skip to content

Commit d22ddcc

Browse files
Zohaib Sibte Hassanclaude
andcommitted
Fix: Forward handler missing InTransaction and CommittedTxnId
1. handleBegin now returns InTransaction: true so replica knows transaction started after BEGIN. 2. handleDatabaseOp now returns CommittedTxnId so replica can wait for CREATE/DROP DATABASE replication before returning to client. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 80696ee commit d22ddcc

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

grpc/forward_handler.go

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -150,13 +150,16 @@ func (h *ForwardHandler) handleDatabaseOp(_ context.Context, req *ForwardQueryRe
150150
}
151151

152152
var rowsAffected int64
153+
var committedTxnId uint64
153154
if rs != nil {
154155
rowsAffected = rs.RowsAffected
156+
committedTxnId = rs.CommittedTxnId
155157
}
156158

157159
return &ForwardQueryResponse{
158-
Success: true,
159-
RowsAffected: rowsAffected,
160+
Success: true,
161+
RowsAffected: rowsAffected,
162+
CommittedTxnId: committedTxnId,
160163
}, nil
161164
}
162165

@@ -185,7 +188,8 @@ func (h *ForwardHandler) handleBegin(_ context.Context, session *ForwardSession,
185188
Msg("BEGIN transaction on leader")
186189

187190
return &ForwardQueryResponse{
188-
Success: true,
191+
Success: true,
192+
InTransaction: true,
189193
}, nil
190194
}
191195

0 commit comments

Comments
 (0)