Skip to content

Commit

Permalink
Merge #55983
Browse files Browse the repository at this point in the history
55983: Revert "tpcc: use multiple column families to avoid contention" r=nvanbenschoten a=nvanbenschoten

This reverts commit 6b11918.

Fixes #55954.
Fixes #55953.
Fixes #55952.
Fixes #55951.
Fixes #55949.

In #30624, we split various column families up in the TPC-C workload. This
had the unintended consequence of breaking CDC roachtests, because CDC
does not support multiple column families per row:
```
CHANGEFEEDs are currently supported on tables with exactly 1 column family: warehouse has 2
```

This PR reverts that commit. I intend to come back to this and introduce
a `--families` flag to TPC-C (like we have to YCSB) that can be used to
selectively toggle column families on or off. However, I'll do this
after #51897 lands, because it's going to be more effort than it's worth
to conditionally set this flag based on whether the version of workload
used in the test supports it or not.

Co-authored-by: Nathan VanBenschoten <nvanbenschoten@gmail.com>
  • Loading branch information
craig[bot] and nvanbenschoten committed Oct 26, 2020
2 parents 889deed + 04cca34 commit a2db135
Show file tree
Hide file tree
Showing 6 changed files with 243 additions and 263 deletions.
34 changes: 17 additions & 17 deletions pkg/sql/opt/memo/testdata/stats_quality/tpcc
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@ SELECT w_tax FROM warehouse WHERE w_id = 1
----
project
├── save-table-name: new_order_01_project_1
├── columns: w_tax:8(decimal!null)
├── columns: w_tax:8(decimal)
├── cardinality: [0 - 1]
├── stats: [rows=1, distinct(8)=1, null(8)=0]
├── key: ()
├── fd: ()-->(8)
└── scan warehouse
├── save-table-name: new_order_01_scan_2
├── columns: w_id:1(int!null) w_tax:8(decimal!null)
├── columns: w_id:1(int!null) w_tax:8(decimal)
├── constraint: /1: [/1 - /1]
├── cardinality: [0 - 1]
├── stats: [rows=1, distinct(1)=1, null(1)=0, distinct(8)=1, null(8)=0]
Expand All @@ -54,14 +54,14 @@ WHERE c_w_id = 1 AND c_d_id = 1 AND c_id = 50
----
project
├── save-table-name: new_order_02_project_1
├── columns: c_discount:16(decimal!null) c_last:6(varchar!null) c_credit:14(char!null)
├── columns: c_discount:16(decimal) c_last:6(varchar) c_credit:14(char)
├── cardinality: [0 - 1]
├── stats: [rows=1, distinct(6)=0.999501832, null(6)=0, distinct(14)=0.786939691, null(14)=0, distinct(16)=0.999901673, null(16)=0]
├── key: ()
├── fd: ()-->(6,14,16)
└── scan customer
├── save-table-name: new_order_02_scan_2
├── columns: c_id:1(int!null) c_d_id:2(int!null) c_w_id:3(int!null) c_last:6(varchar!null) c_credit:14(char!null) c_discount:16(decimal!null)
├── columns: c_id:1(int!null) c_d_id:2(int!null) c_w_id:3(int!null) c_last:6(varchar) c_credit:14(char) c_discount:16(decimal)
├── constraint: /3/2/1: [/1/1/50 - /1/1/50]
├── cardinality: [0 - 1]
├── stats: [rows=1, distinct(1)=1, null(1)=0, distinct(2)=1, null(2)=0, distinct(3)=1, null(3)=0, distinct(6)=0.999501832, null(6)=0, distinct(14)=0.786939691, null(14)=0, distinct(16)=0.999901673, null(16)=0, distinct(1-3)=1, null(1-3)=0]
Expand Down Expand Up @@ -202,14 +202,14 @@ ORDER BY c_first ASC
----
project
├── save-table-name: payment_01_project_1
├── columns: c_id:1(int!null) [hidden: c_first:4(varchar!null)]
├── columns: c_id:1(int!null) [hidden: c_first:4(varchar)]
├── stats: [rows=2.05079862, distinct(1)=2.05010459, null(1)=0, distinct(4)=2.0470416, null(4)=0]
├── key: (1)
├── fd: (1)-->(4)
├── ordering: +4
└── scan customer@customer_idx
├── save-table-name: payment_01_scan_2
├── columns: c_id:1(int!null) c_d_id:2(int!null) c_w_id:3(int!null) c_first:4(varchar!null) c_last:6(varchar!null)
├── columns: c_id:1(int!null) c_d_id:2(int!null) c_w_id:3(int!null) c_first:4(varchar) c_last:6(varchar!null)
├── constraint: /3/2/6/4/1: [/1/1/'ANTIABLEABLE' - /1/1/'ANTIABLEABLE']
├── stats: [rows=2.05079862, distinct(1)=2.05010459, null(1)=0, distinct(2)=1, null(2)=0, distinct(3)=1, null(3)=0, distinct(4)=2.0470416, null(4)=0, distinct(6)=1, null(6)=0, distinct(2,3,6)=1, null(2,3,6)=0]
│ histogram(2)= 0 2.0508
Expand Down Expand Up @@ -256,14 +256,14 @@ WHERE c_w_id = 1 AND c_d_id = 1 AND c_id = 50
----
project
├── save-table-name: order_status_01_project_1
├── columns: c_balance:17(decimal!null) c_first:4(varchar!null) c_middle:5(char!null) c_last:6(varchar!null)
├── columns: c_balance:17(decimal) c_first:4(varchar) c_middle:5(char) c_last:6(varchar)
├── cardinality: [0 - 1]
├── stats: [rows=1, distinct(4)=0.999106141, null(4)=0, distinct(5)=0.632121172, null(5)=0, distinct(6)=0.999501832, null(6)=0, distinct(17)=0.632121172, null(17)=0]
├── key: ()
├── fd: ()-->(4-6,17)
└── scan customer
├── save-table-name: order_status_01_scan_2
├── columns: c_id:1(int!null) c_d_id:2(int!null) c_w_id:3(int!null) c_first:4(varchar!null) c_middle:5(char!null) c_last:6(varchar!null) c_balance:17(decimal!null)
├── columns: c_id:1(int!null) c_d_id:2(int!null) c_w_id:3(int!null) c_first:4(varchar) c_middle:5(char) c_last:6(varchar) c_balance:17(decimal)
├── constraint: /3/2/1: [/1/1/50 - /1/1/50]
├── cardinality: [0 - 1]
├── stats: [rows=1, distinct(1)=1, null(1)=0, distinct(2)=1, null(2)=0, distinct(3)=1, null(3)=0, distinct(4)=0.999106141, null(4)=0, distinct(5)=0.632121172, null(5)=0, distinct(6)=0.999501832, null(6)=0, distinct(17)=0.632121172, null(17)=0, distinct(1-3)=1, null(1-3)=0]
Expand Down Expand Up @@ -300,14 +300,14 @@ ORDER BY c_first ASC
----
project
├── save-table-name: order_status_02_project_1
├── columns: c_id:1(int!null) c_balance:17(decimal!null) c_first:4(varchar!null) c_middle:5(char!null)
├── columns: c_id:1(int!null) c_balance:17(decimal) c_first:4(varchar) c_middle:5(char)
├── stats: [rows=2.12233702, distinct(1)=2.12159373, null(1)=0, distinct(4)=2.11831349, null(4)=0, distinct(5)=0.880249459, null(5)=0, distinct(17)=0.880249459, null(17)=0]
├── key: (1)
├── fd: (1)-->(4,5,17)
├── ordering: +4
└── index-join customer
├── save-table-name: order_status_02_index_join_2
├── columns: c_id:1(int!null) c_d_id:2(int!null) c_w_id:3(int!null) c_first:4(varchar!null) c_middle:5(char!null) c_last:6(varchar!null) c_balance:17(decimal!null)
├── columns: c_id:1(int!null) c_d_id:2(int!null) c_w_id:3(int!null) c_first:4(varchar) c_middle:5(char) c_last:6(varchar!null) c_balance:17(decimal)
├── stats: [rows=2.12233702, distinct(1)=2.12159373, null(1)=0, distinct(2)=1, null(2)=0, distinct(3)=1, null(3)=0, distinct(4)=2.11831349, null(4)=0, distinct(5)=0.880249459, null(5)=0, distinct(6)=1, null(6)=0, distinct(17)=0.880249459, null(17)=0, distinct(2,3,6)=1, null(2,3,6)=0]
│ histogram(2)= 0 2.1223
│ <---- 2 --
Expand All @@ -320,7 +320,7 @@ project
├── ordering: +4 opt(2,3,6) [actual: +4]
└── scan customer@customer_idx
├── save-table-name: order_status_02_scan_3
├── columns: c_id:1(int!null) c_d_id:2(int!null) c_w_id:3(int!null) c_first:4(varchar!null) c_last:6(varchar!null)
├── columns: c_id:1(int!null) c_d_id:2(int!null) c_w_id:3(int!null) c_first:4(varchar) c_last:6(varchar!null)
├── constraint: /3/2/6/4/1: [/2/2/'ANTIBARESE' - /2/2/'ANTIBARESE']
├── stats: [rows=2.12233702, distinct(1)=2.12159373, null(1)=0, distinct(2)=1, null(2)=0, distinct(3)=1, null(3)=0, distinct(4)=2.11831349, null(4)=0, distinct(6)=1, null(6)=0, distinct(2,3,6)=1, null(2,3,6)=0]
│ histogram(1)= 0 0.00042447 0.0097628 0.00084893 0.010399 0.00084893 0.010399 0.00021223 0.009975 0.00084893 0.009975 0.0010612 0.010187 0.0010612 0.009975 0.0006367 0.010187 0.0012734 0.0097628 0.00084893 0.0097628 0.00084893 0.010399 0.0006367 0.010399 0.00042447 0.010187 0.0012734 0.010187 0.00084893 0.010399 0.0016979 0.010399 0.00084893 0.010399 0.0006367 0.009975 0.0006367 0.010187 0.00042447 0.010187 0.00084893 0.010399 0.0006367 0.010399 0.0012734 0.010399 0.00021223 0.009975 0.0006367 0.010187 0.0006367 0.010187 0.00084893 0.010399 0.00084893 0.0093383 0.0019101 0.0089138 0.0016979 0.010187 0.0014856 0.010187 0.0019101 0.0089138 0.0014856 0.009975 0.0010612 0.009975 0.0006367 0.0097628 0.0010612 0.0089138 0.0014856 0.010187 0.0006367 0.0097628 0.0006367 0.0097628 0.0010612 0.0097628 0.0006367 0.0097628 0.0006367 0.010187 0.00084893 0.010187 0.00042447 0.010187 0.00042447 0.009975 0.0006367 0.009975 0.00084893 0.009975 0.0010612 0.0097628 0.0012734 0.010187 0.0014856 0.010187 0.00021223 0.010187 0.0010612 0.0095505 0.0010612 0.0093383 0.0016979 0.0097628 0.0010612 0.010187 0.0006367 0.0095505 0.00084893 0.010187 0.00042447 0.0089138 0.0014856 0.010187 0.0010612 0.0097628 0.0010612 0.0095505 0.0010612 0.010187 0.0012734 0.0095505 0.00084893 0.0095505 0.00084893 0.009975 0.00084893 0.010187 0.0010612 0.009975 0.0010612 0.009975 0.0006367 0.009975 0.00084893 0.010187 0.0006367 0.0097628 0.0006367 0.009975 0.0006367 0.0093383 0.0014856 0.0095505 0.00084893 0.0097628 0.0006367 0.010187 0.0006367 0.010187 0.0006367 0.010187 0.00042447 0.0093383 0.0014856 0.010187 0.00042447 0.0097628 0.0014856 0.009975 0.0006367 0.0095505 0.0014856 0.010187 0.0012734 0.009975 0.00084893 0.009975 0.00084893 0.0097628 0.0010612 0.0097628 0.00084893 0.009975 0.0006367 0.010187 0.00084893 0.010187 0.00021223 0.010187 0.00021223 0.010187 0.0006367 0.009975 0.0010612 0.0095505 0.0010612 0.009126 0.0012734 0.0093383 0.0016979 0.0097628 0.0006367 0.0097628 0.0006367 0.009975 0.00042447 0.010187 0.00021223 0.009975 0.00084893 0.0097628 0.0016979 0.0095505 0.0012734 0.009975 0.00084893 0.009975 0.00042447 0.0097628 0.0012734 0.0095505 0.00084893 0.0093383 0.0010612 0.0097628 0.0006367 0.010187 0.00042447 0.0097628 0.0010612 0.009975 0.00084893 0.0097628 0.0006367 0.010187 0.00042447 0.0095505 0.00084893 0.010187 0.0006367 0.0093383 0.0010612 0.010187 0.0006367 0.0089138 0.0014856 0.010187 0.00084893 0.010187 0.0012734 0.009975 0.00042447 0.009126 0.0016979 0.010187 0.00042447 0.010187 0.0012734 0.0097628 0.0006367 0.009975 0.0006367 0.009975 0.00021223 0.0095505 0.0006367 0.009126 0.0014856 0.009975 0.00021223 0.0097628 0.0010612 0.009975 0.0006367 0.0093383 0.00084893 0.0097628 0.00084893 0.0093383 0.00084893 0.0097628 0.0012734 0.009975 0.00042447 0.009975 0.0010612 0.0087016 0.0019101 0.0087016 0.0023346 0.009126 0.0010612 0.0097628 0.00042447 0.009975 0.00084893 0.009975 0.00021223 0.0097628 0.0010612 0.0093383 0.00084893 0.0093383 0.00084893 0.0093383 0.0010612 0.009975 0.0006367 0.0097628 0.0006367 0.0097628 0.00042447 0.0097628 0.0014856 0.0095505 0.0006367 0.0097628 0.0006367 0.0097628 0.0006367 0.009126 0.0010612 0.0097628 0.00084893 0.0095505 0.0010612 0.0097628 0.0006367 0.009975 0.0006367 0.009975 0.00084893 0.009126 0.0012734 0.0095505 0.00084893 0.0095505 0.0010612 0.009126 0.0010612 0.0095505 0.0010612 0.0095505 0.0014856 0.009975 0.0014856 0.0095505 0.0006367 0.0097628 0.0014856 0.0097628 0.0010612 0.0093383 0.0006367 0.0095505 0.0006367 0.0097628 0.0006367 0.0097628 0.0006367 0.0087016 0.0012734 0.0095505 0.0014856 0.0097628 0.00021223 0.0089138 0.0014856 0.0095505 0.0010612 0.0087016 0.0012734 0.0097628 0.00084893 0.0095505 0.0012734 0.009126 0.0012734 0.0089138 0.00084893 0.0095505 0.00021223 0.0095505 0.0006367 0.0095505 0.00042447 0.0093383 0.0010612 0.0093383 0.00084893 0.0089138 0.0010612 0.0093383 0.00042447 0.0087016 0.0010612 0.0082771 0.0016979 0.0089138 0.0012734 0.0089138 0.00042447 0.0087016 0.00084893
Expand Down Expand Up @@ -567,14 +567,14 @@ WHERE d_w_id = 4 AND d_id = 9
----
project
├── save-table-name: stock_level_01_project_1
├── columns: d_next_o_id:11(int!null)
├── columns: d_next_o_id:11(int)
├── cardinality: [0 - 1]
├── stats: [rows=1, distinct(11)=0.633967659, null(11)=0]
├── key: ()
├── fd: ()-->(11)
└── scan district
├── save-table-name: stock_level_01_scan_2
├── columns: d_id:1(int!null) d_w_id:2(int!null) d_next_o_id:11(int!null)
├── columns: d_id:1(int!null) d_w_id:2(int!null) d_next_o_id:11(int)
├── constraint: /2/1: [/4/9 - /4/9]
├── cardinality: [0 - 1]
├── stats: [rows=1, distinct(1)=1, null(1)=0, distinct(2)=1, null(2)=0, distinct(11)=0.633967659, null(11)=0, distinct(1,2)=1, null(1,2)=0]
Expand Down Expand Up @@ -729,7 +729,7 @@ scalar-group-by
│ ├── fd: (1)-->(9), (12)-->(23), (1)==(12), (12)==(1)
│ ├── scan warehouse
│ │ ├── save-table-name: consistency_01_scan_3
│ │ ├── columns: w_id:1(int!null) w_ytd:9(decimal!null)
│ │ ├── columns: w_id:1(int!null) w_ytd:9(decimal)
│ │ ├── stats: [rows=10, distinct(1)=10, null(1)=0, distinct(9)=1, null(9)=0]
│ │ │ histogram(1)= 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
│ │ │ <--- 0 --- 1 --- 2 --- 3 --- 4 --- 5 --- 6 --- 7 --- 8 --- 9
Expand All @@ -740,15 +740,15 @@ scalar-group-by
│ │ └── ordering: +1
│ ├── group-by
│ │ ├── save-table-name: consistency_01_group_by_4
│ │ ├── columns: d_w_id:12(int!null) sum:23(decimal!null)
│ │ ├── columns: d_w_id:12(int!null) sum:23(decimal)
│ │ ├── grouping columns: d_w_id:12(int!null)
│ │ ├── stats: [rows=10, distinct(12)=10, null(12)=0, distinct(23)=10, null(23)=0]
│ │ ├── key: (12)
│ │ ├── fd: (12)-->(23)
│ │ ├── ordering: +12
│ │ ├── scan district
│ │ │ ├── save-table-name: consistency_01_scan_5
│ │ │ ├── columns: d_w_id:12(int!null) d_ytd:20(decimal!null)
│ │ │ ├── columns: d_w_id:12(int!null) d_ytd:20(decimal)
│ │ │ ├── stats: [rows=100, distinct(12)=10, null(12)=0, distinct(20)=1, null(20)=0]
│ │ │ │ histogram(12)= 0 10 0 10 0 10 0 10 0 10 0 10 0 10 0 10 0 10 0 10
│ │ │ │ <--- 0 --- 1 --- 2 --- 3 --- 4 --- 5 --- 6 --- 7 --- 8 --- 9
Expand Down Expand Up @@ -820,7 +820,7 @@ ORDER BY d_w_id, d_id
----
scan district
├── save-table-name: consistency_02_scan_1
├── columns: d_next_o_id:11(int!null) [hidden: d_id:1(int!null) d_w_id:2(int!null)]
├── columns: d_next_o_id:11(int) [hidden: d_id:1(int!null) d_w_id:2(int!null)]
├── stats: [rows=100, distinct(1)=10, null(1)=0, distinct(2)=10, null(2)=0, distinct(11)=1, null(11)=0]
│ histogram(1)= 0 10 0 10 0 10 0 10 0 10 0 10 0 10 0 10 0 10 0 10
│ <--- 1 --- 2 --- 3 --- 4 --- 5 --- 6 --- 7 --- 8 --- 9 --- 10
Expand Down
96 changes: 43 additions & 53 deletions pkg/sql/opt/testutils/opttester/testfixtures/tpcc_schema
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
exec-ddl
CREATE TABLE warehouse
(
w_id integer not null primary key,
w_name varchar(10) not null,
w_street_1 varchar(20) not null,
w_street_2 varchar(20) not null,
w_city varchar(20) not null,
w_state char(2) not null,
w_zip char(9) not null,
w_tax decimal(4,4) not null,
w_ytd decimal(12,2) not null,
family f1 (w_id, w_name, w_street_1, w_street_2, w_city, w_state, w_zip, w_ytd),
family f2 (w_tax)
w_id integer not null primary key,
w_name varchar(10),
w_street_1 varchar(20),
w_street_2 varchar(20),
w_city varchar(20),
w_state char(2),
w_zip char(9),
w_tax decimal(4,4),
w_ytd decimal(12,2)
)
----

Expand All @@ -20,55 +18,47 @@ CREATE TABLE district
(
d_id integer not null,
d_w_id integer not null,
d_name varchar(10) not null,
d_street_1 varchar(20) not null,
d_street_2 varchar(20) not null,
d_city varchar(20) not null,
d_state char(2) not null,
d_zip char(9) not null,
d_tax decimal(4,4) not null,
d_ytd decimal(12,2) not null,
d_next_o_id integer not null,
primary key (d_w_id, d_id),
foreign key (d_w_id) references warehouse (w_id),
family static (d_w_id, d_id, d_name, d_street_1, d_street_2, d_city, d_state, d_zip),
family dynamic_1 (d_ytd),
family dynamic_2 (d_next_o_id, d_tax)
d_name varchar(10),
d_street_1 varchar(20),
d_street_2 varchar(20),
d_city varchar(20),
d_state char(2),
d_zip char(9),
d_tax decimal(4,4),
d_ytd decimal(12,2),
d_next_o_id integer,
primary key (d_w_id, d_id),
foreign key (d_w_id) references warehouse (w_id)
) interleave in parent warehouse (d_w_id)
----

exec-ddl
CREATE TABLE customer
(
c_id integer not null,
c_d_id integer not null,
c_w_id integer not null,
c_first varchar(16) not null,
c_middle char(2) not null,
c_last varchar(16) not null,
c_street_1 varchar(20) not null,
c_street_2 varchar(20) not null,
c_city varchar(20) not null,
c_state char(2) not null,
c_zip char(9) not null,
c_phone char(16) not null,
c_since timestamp not null,
c_credit char(2) not null,
c_credit_lim decimal(12,2) not null,
c_discount decimal(4,4) not null,
c_balance decimal(12,2) not null,
c_ytd_payment decimal(12,2) not null,
c_payment_cnt integer not null,
c_delivery_cnt integer not null,
c_data varchar(500) not null,
primary key (c_w_id, c_d_id, c_id),
c_id integer not null,
c_d_id integer not null,
c_w_id integer not null,
c_first varchar(16),
c_middle char(2),
c_last varchar(16),
c_street_1 varchar(20),
c_street_2 varchar(20),
c_city varchar(20),
c_state char(2),
c_zip char(9),
c_phone char(16),
c_since timestamp,
c_credit char(2),
c_credit_lim decimal(12,2),
c_discount decimal(4,4),
c_balance decimal(12,2),
c_ytd_payment decimal(12,2),
c_payment_cnt integer,
c_delivery_cnt integer,
c_data varchar(500),
primary key (c_w_id, c_d_id, c_id),
index customer_idx (c_w_id, c_d_id, c_last, c_first),
foreign key (c_w_id, c_d_id) references district (d_w_id, d_id),
family static (
c_id, c_d_id, c_w_id, c_first, c_middle, c_last, c_street_1, c_street_2,
c_city, c_state, c_zip, c_phone, c_since, c_credit, c_credit_lim, c_discount
),
family dynamic (c_balance, c_ytd_payment, c_payment_cnt, c_data, c_delivery_cnt)
foreign key (c_w_id, c_d_id) references district (d_w_id, d_id)
) interleave in parent district (c_w_id, c_d_id)
----

Expand Down
Loading

0 comments on commit a2db135

Please sign in to comment.