Commit 4669c02
authored
fix: retry non-idempotent long-running RPCs (#141)
RPCs returning a long-running operation, such as CreateDatabase, CreateBackup and RestoreDatabase, are non-idempotent and cannot be retried automatically by gax. This means that these RPCs sometimes fail with transient errors, such as UNAVAILABLE or DEADLINE_EXCEEDED. This change introduces automatic retries of these RPCs using the following logic:
1. Execute the RPC and wait for the operation to be returned.
2. If a transient error occurs while waiting for the operation, the
client library queries the backend for the corresponding operation.
If the operation is found, the resumes the tracking of the existing
operation and returns that to the user.
3. If no corresponding operation is found in step 2, the client library
retries the RPC from step 1.
Fixes GoogleCloudPlatform/java-docs-samples#25711 parent c8be7b5 commit 4669c02
File tree
7 files changed
+1001
-224
lines changed- google-cloud-spanner/src
- main/java/com/google/cloud/spanner
- spi/v1
- test/java/com/google/cloud/spanner
- it
7 files changed
+1001
-224
lines changedLines changed: 4 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| 24 | + | |
24 | 25 | | |
25 | 26 | | |
26 | 27 | | |
| |||
291 | 292 | | |
292 | 293 | | |
293 | 294 | | |
294 | | - | |
| 295 | + | |
| 296 | + | |
295 | 297 | | |
296 | 298 | | |
297 | 299 | | |
| |||
581 | 583 | | |
582 | 584 | | |
583 | 585 | | |
| 586 | + | |
584 | 587 | | |
585 | 588 | | |
586 | 589 | | |
| |||
0 commit comments