Skip to content

Commit

Permalink
workload/tpcc: disable check 3.3.2.11 after workload
Browse files Browse the repository at this point in the history
Fixes cockroachdb#99619.
Fixes cockroachdb#99594.
Fixes cockroachdb#99603.
Fixes cockroachdb#99604.

This commit disables TPC-C's consistency check 3.3.2.11 after the
workload has run. The check asserts a relationship between the number of
rows in the "order" table and rows in the "new_order" table. Rows are
inserted into these tables transactional by the NewOrder transaction.
However, only rows in the "new_order" table are deleted by the Delivery
transaction. Consequently, the consistency condition will fail after the
first Delivery transaction is run by the workload.

See cockroachdb#99542 (comment)
for more details.

Release note: None
  • Loading branch information
nvanbenschoten committed Mar 27, 2023
1 parent 20e41ff commit 70b1be2
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 13 deletions.
36 changes: 23 additions & 13 deletions pkg/workload/tpcc/checks.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,25 +22,35 @@ type Check struct {
// If asOfSystemTime is non-empty it will be used to perform the check as
// a historical query using the provided value as the argument to the
// AS OF SYSTEM TIME clause.
Fn func(db *gosql.DB, asOfSystemTime string) error
Fn func(db *gosql.DB, asOfSystemTime string) error
// If true, the check is "expensive" and may take a long time to run.
Expensive bool
// If true, the check is only valid immediately after loading the dataset.
// The check may fail if run after the workload.
LoadOnly bool
}

// AllChecks returns a slice of all of the checks.
func AllChecks() []Check {
return []Check{
{"3.3.2.1", check3321, false},
{"3.3.2.2", check3322, false},
{"3.3.2.3", check3323, false},
{"3.3.2.4", check3324, false},
{"3.3.2.5", check3325, false},
{"3.3.2.6", check3326, true},
{"3.3.2.7", check3327, false},
{"3.3.2.8", check3328, false},
{"3.3.2.9", check3329, false},
{"3.3.2.10", check33210, true},
{"3.3.2.11", check33211, false},
{"3.3.2.12", check33212, true},
{"3.3.2.1", check3321, false, false},
{"3.3.2.2", check3322, false, false},
{"3.3.2.3", check3323, false, false},
{"3.3.2.4", check3324, false, false},
{"3.3.2.5", check3325, false, false},
{"3.3.2.6", check3326, true, false},
{"3.3.2.7", check3327, false, false},
{"3.3.2.8", check3328, false, false},
{"3.3.2.9", check3329, false, false},
{"3.3.2.10", check33210, true, false},
// 3.3.2.11 is LoadOnly. It asserts a relationship between the number of
// rows in the "order" table and rows in the "new_order" table. Rows are
// inserted into these tables transactional by the NewOrder transaction.
// However, only rows in the "new_order" table are deleted by the Delivery
// transaction. Consequently, the consistency condition will fail after the
// first Delivery transaction is run by the workload.
{"3.3.2.11", check33211, false, true},
{"3.3.2.12", check33212, true, false},
}
}

Expand Down
4 changes: 4 additions & 0 deletions pkg/workload/tpcc/tpcc.go
Original file line number Diff line number Diff line change
Expand Up @@ -513,6 +513,10 @@ func (w *tpcc) Hooks() workload.Hooks {
if !w.expensiveChecks && check.Expensive {
continue
}
if check.LoadOnly {
// TODO(nvanbenschoten): support load-only checks.
continue
}
start := timeutil.Now()
err := check.Fn(db, "" /* asOfSystemTime */)
log.Infof(ctx, `check %s took %s`, check.Name, timeutil.Since(start))
Expand Down
4 changes: 4 additions & 0 deletions pkg/workload/tpccchecks/checks_generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ foreground TPC-C workload`,
" AS OF SYSTEM TIME CLAUSE for all checks.")
checkNames := func() (checkNames []string) {
for _, c := range tpcc.AllChecks() {
if c.LoadOnly {
// TODO(nvanbenschoten): support load-only checks.
continue
}
checkNames = append(checkNames, c.Name)
}
return checkNames
Expand Down

0 comments on commit 70b1be2

Please sign in to comment.