Skip to content

Commit f84231f

Browse files
committed
Get batch arg, when looking for EndTransaction, just look at the last entry
1 parent fa11dae commit f84231f

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

roachpb/batch.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,13 @@ func (ba *BatchRequest) IsRange() bool {
6262

6363
// GetArg returns the first request of the given type, if possible.
6464
func (ba *BatchRequest) GetArg(method Method) (Request, bool) {
65-
// TODO(tschottdorf): when looking for EndTransaction, just look at the
66-
// last entry.
65+
// when looking for EndTransaction, just look at the last entry.
66+
if length := len(ba.Requests); length > 0 && method == EndTransaction {
67+
if req := ba.Requests[length-1].GetInner(); req.Method() == EndTransaction {
68+
return req, true
69+
}
70+
}
71+
6772
for _, arg := range ba.Requests {
6873
if req := arg.GetInner(); req.Method() == method {
6974
return req, true

0 commit comments

Comments
 (0)