forked from cockroachdb/cockroach
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
util/retry: always run at least one iteration
This commit updates the Retry utility to always guarantee at least a single iteration of the retry loop. This fixes a previously-buggy pattern that we have throughout the codebase where we would assume that a retry loop would be executed at least once. With this false understanding, we would try to return the error found in the last iteration of the retry loop. This could cause us to return no error at all if the loop never ran, which would trick upper levels into thinking the retry loop had succeeded. One instance of this bug was fixed in cockroachdb#43789. Here are five other instances of the pattern that I believe are currently susceptible to the bug: - https://github.com/cockroachdb/cockroach/blob/d0c79625eda85d3aa38afad5b0254d419a9bc4cd/pkg/ccl/changefeedccl/changefeed_stmt.go#L568 - https://github.com/cockroachdb/cockroach/blob/d0c79625eda85d3aa38afad5b0254d419a9bc4cd/pkg/ccl/workloadccl/fixture.go#L136 - https://github.com/cockroachdb/cockroach/blob/d0c79625eda85d3aa38afad5b0254d419a9bc4cd/pkg/kv/kvserver/replica_command.go#L529 - https://github.com/cockroachdb/cockroach/blob/d0c79625eda85d3aa38afad5b0254d419a9bc4cd/pkg/sql/schema_changer.go#L1701 - https://github.com/cockroachdb/cockroach/blob/d0c79625eda85d3aa38afad5b0254d419a9bc4cd/pkg/sqlmigrations/migrations.go#L580 And a sixth was almost introduced in cockroachdb#51227.
- Loading branch information
1 parent
cff2542
commit ff7dc82
Showing
6 changed files
with
51 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters