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.
workload/tpcc: add SELECT FOR UPDATE locking for Read Committed
Informs cockroachdb#100176. This commit adds SELECT FOR UPDATE locking in two places to ensure that the workload avoids anomalies when run under Read Committed isolation. The first of these is in the NewOrder transaction, when querying the "stock" table in preparation for updating quantities and order counts for the items in an order. There are no consistency checks which fail without this, but the locking is present in benchbase (https://github.com/cmu-db/benchbase/blob/546afa60dae4f8a6b00b84b77c77ff7684e494ad/src/main/java/com/oltpbenchmark/benchmarks/tpcc/procedures/NewOrder.java#L88) and makes sense to do. The second of these is in the Delivery transaction, when querying the "new_order" table to select an order to deliver. The order selected is processed by the transaction, including updating counters in the corresponding "customer" row, so it's important to have full isolation. Without this, consistency checks `3.3.2.10` and `3.3.2.12` (`workload check tpcc --expensive-checks`) do fail, presumably because a customer's row is updated twice for a single order. This use of SELECT FOR UPDATE in the Delivery transaction is an alternative to a patch like 36709df, which would probably be more efficient than the approach we have here, but would not exercise the database in an interesting way. We opt to use SELECT FOR UPDATE. Release note: None
- Loading branch information
1 parent
87dce3f
commit 3cdee20
Showing
8 changed files
with
34 additions
and
3 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
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