Skip to content

Commit 81d2c76

Browse files
authored
fix: remove potential infinite loop in administrative requests (#398)
The automatic retryer for non-idempotent administrative requests did not keep track of the nextPageToken correctly when querying the backend for running operations. This could cause an infinite loop if a resource (database/backup) with the same name had been created repeatedly on the same instance.
1 parent 52fc363 commit 81d2c76

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

google-cloud-spanner/src/main/java/com/google/cloud/spanner/spi/v1/GapicSpannerRpc.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -575,6 +575,7 @@ private Operation mostRecentOperation(
575575
Paginated<Operation> operations;
576576
do {
577577
operations = lister.listOperations(nextPageToken);
578+
nextPageToken = operations.getNextPageToken();
578579
for (Operation op : operations.getResults()) {
579580
Timestamp startTime = getStartTimeFunction.apply(op);
580581
if (res == null
@@ -590,7 +591,7 @@ private Operation mostRecentOperation(
590591
break;
591592
}
592593
}
593-
} while (operations.getNextPageToken() != null);
594+
} while (nextPageToken != null);
594595
return res;
595596
}
596597

0 commit comments

Comments
 (0)