Skip to content

Commit 165e246

Browse files
committed
Remove lock hint in assignEntries - let Spanner figure it out.
1 parent 06081f1 commit 165e246

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

storage/gcp/gcp.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -725,7 +725,7 @@ func (s *spannerCoordinator) assignEntries(ctx context.Context, entries []*tesse
725725

726726
_, err := s.dbPool.ReadWriteTransaction(ctx, func(ctx context.Context, txn *spanner.ReadWriteTransaction) error {
727727
// First we need to grab the next available sequence number from the SeqCoord table.
728-
row, err := txn.ReadRowWithOptions(ctx, "SeqCoord", spanner.Key{0}, []string{"id", "next"}, &spanner.ReadOptions{LockHint: spannerpb.ReadRequest_LOCK_HINT_EXCLUSIVE})
728+
row, err := txn.ReadRow(ctx, "SeqCoord", spanner.Key{0}, []string{"id", "next"})
729729
if err != nil {
730730
return fmt.Errorf("failed to read SeqCoord: %w", err)
731731
}
@@ -762,7 +762,8 @@ func (s *spannerCoordinator) assignEntries(ctx context.Context, entries []*tesse
762762

763763
// TODO(al): think about whether aligning bundles to tile boundaries would be a good idea or not.
764764
m := []*spanner.Mutation{
765-
// Insert our newly sequenced batch of entries into Seq,
765+
// Insert our newly sequenced batch of entries into Seq, this will cause the TX to abort if
766+
// someone else has put a batch there.
766767
spanner.Insert("Seq", []string{"id", "seq", "v"}, []any{0, int64(next), data}),
767768
// and update the next-available sequence number row in SeqCoord.
768769
spanner.Update("SeqCoord", []string{"id", "next"}, []any{0, int64(next) + int64(num)}),

0 commit comments

Comments
 (0)