forked from databendlabs/databend
-
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.
refactor: optimize
SchemaApi::create_table()
(databendlabs#14341)
* refactor: optimize `SchemaApi::create_table()` In this commit, when `create_table()` encounters a transaction conflict, it re-fetch the latest state for next retry at once in the transaction response. This way, in each retry loop, it saves a few RPC call for fetching the states. There is only one RPC in each loop, which is sending the transaction. Because the state is fetched at once when transaction conflict, backoff sleep time is removed between each retry, because sleeping just increases the chance that the fetched state becoming stale. Implementation of this refactor includes: - Fetch required state before retry-loop. - In each loop, validate the state and then send transaction with assertions and operations, just as before. - If it conflicts, the latest state is returned at once for next retry. Other changes: - Add two small backoff 2ms and 5ms - Fix: databendlabs#14340 * refactor: use mget to fetch state before create_table * chore: remove unused get_raw_key_value --------- Co-authored-by: Bohu <[email protected]>
- Loading branch information
1 parent
a08e185
commit b59d6b6
Showing
12 changed files
with
365 additions
and
122 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Large diffs are not rendered by default.
Oops, something went wrong.
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
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