From 70b1be2d8455e3a579d2c22e28dec2f1ff618354 Mon Sep 17 00:00:00 2001 From: Nathan VanBenschoten Date: Mon, 27 Mar 2023 10:45:49 -0400 Subject: [PATCH] workload/tpcc: disable check 3.3.2.11 after workload Fixes #99619. Fixes #99594. Fixes #99603. Fixes #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 https://github.com/cockroachdb/cockroach/pull/99542#issuecomment-1485227793 for more details. Release note: None --- pkg/workload/tpcc/checks.go | 36 +++++++++++++-------- pkg/workload/tpcc/tpcc.go | 4 +++ pkg/workload/tpccchecks/checks_generator.go | 4 +++ 3 files changed, 31 insertions(+), 13 deletions(-) diff --git a/pkg/workload/tpcc/checks.go b/pkg/workload/tpcc/checks.go index 0fdb7b13002e..875d39280e82 100644 --- a/pkg/workload/tpcc/checks.go +++ b/pkg/workload/tpcc/checks.go @@ -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}, } } diff --git a/pkg/workload/tpcc/tpcc.go b/pkg/workload/tpcc/tpcc.go index 3f82afee8eee..1c18f8ed9315 100644 --- a/pkg/workload/tpcc/tpcc.go +++ b/pkg/workload/tpcc/tpcc.go @@ -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)) diff --git a/pkg/workload/tpccchecks/checks_generator.go b/pkg/workload/tpccchecks/checks_generator.go index 8648683ae1c1..778d6fd00a5a 100644 --- a/pkg/workload/tpccchecks/checks_generator.go +++ b/pkg/workload/tpccchecks/checks_generator.go @@ -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