Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(bigtable): Mutate groups even after first error #11434

Merged
Prev Previous commit
Next Next commit
fix tests
  • Loading branch information
bhshkh committed Jan 15, 2025

Verified

This commit was signed with the committer’s verified signature.
ignatiusmb Ignatius Bagus
commit b44cbd00e070596085e0dcbd4f39e34e0c18b9ed
12 changes: 7 additions & 5 deletions bigtable/bigtable.go
Original file line number Diff line number Diff line change
@@ -1348,6 +1348,11 @@ func (t *Table) doApplyBulk(ctx context.Context, entryErrs []*entryErr, headerMD
}
}

var topLevelErr error
defer func() {
populateTopLevelError(entryErrs, topLevelErr)
}()

entries := make([]*btpb.MutateRowsRequest_Entry, len(entryErrs))
for i, entryErr := range entryErrs {
entries[i] = entryErr.Entry
@@ -1364,8 +1369,7 @@ func (t *Table) doApplyBulk(ctx context.Context, entryErrs []*entryErr, headerMD

stream, err := t.c.client.MutateRows(ctx, req)
if err != nil {
_, topLevelErr := convertToGrpcStatusErr(err)
populateTopLevelError(entryErrs, topLevelErr)
_, topLevelErr = convertToGrpcStatusErr(err)
return err
}

@@ -1380,12 +1384,10 @@ func (t *Table) doApplyBulk(ctx context.Context, entryErrs []*entryErr, headerMD
}
if err != nil {
*trailerMD = stream.Trailer()
_, topLevelErr := convertToGrpcStatusErr(err)
populateTopLevelError(entryErrs, topLevelErr)
_, topLevelErr = convertToGrpcStatusErr(err)
return err
}

populateTopLevelError(entryErrs, nil)
for _, entry := range res.Entries {
s := entry.Status
if s.Code == int32(codes.OK) {
4 changes: 2 additions & 2 deletions bigtable/retry_test.go
Original file line number Diff line number Diff line change
@@ -354,8 +354,8 @@ func TestRetryApplyBulk_IndividualErrorsAndDeadlineExceeded(t *testing.T) {
if !equalErrs(wantErr, err) {
t.Fatalf("deadline exceeded error: got: %v, want: %v", err, wantErr)
}
if errors == nil {
t.Errorf("deadline exceeded errors: got: %v, want: %v", err, []error{wantErr})
if errors != nil {
t.Errorf("deadline exceeded errors: got: %v, want: nil", err)
}
}

Loading