From 16ffee39e2c18132e70bf25be864c11593b3e637 Mon Sep 17 00:00:00 2001 From: Nathan VanBenschoten Date: Wed, 28 Nov 2018 19:25:19 -0500 Subject: [PATCH] workload/ycsb: add flag to use column families This change adds a new `--families` flag to the ycsb workload. Now that #18168 is addressed, this significantly reduces the contention present in the workload by avoiding conflicts on updates to different columns in the same table. Release note: None --- pkg/workload/ycsb/ycsb.go | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/pkg/workload/ycsb/ycsb.go b/pkg/workload/ycsb/ycsb.go index 7fdbccc87b81..5c49e1bdfc30 100644 --- a/pkg/workload/ycsb/ycsb.go +++ b/pkg/workload/ycsb/ycsb.go @@ -51,6 +51,30 @@ const ( FIELD8 TEXT, FIELD9 TEXT )` + usertableSchemaRelationalWithFamilies = `( + ycsb_key VARCHAR(255) PRIMARY KEY NOT NULL, + FIELD0 TEXT, + FIELD1 TEXT, + FIELD2 TEXT, + FIELD3 TEXT, + FIELD4 TEXT, + FIELD5 TEXT, + FIELD6 TEXT, + FIELD7 TEXT, + FIELD8 TEXT, + FIELD9 TEXT, + FAMILY (ycsb_key), + FAMILY (FIELD0), + FAMILY (FIELD1), + FAMILY (FIELD2), + FAMILY (FIELD3), + FAMILY (FIELD4), + FAMILY (FIELD5), + FAMILY (FIELD6), + FAMILY (FIELD7), + FAMILY (FIELD8), + FAMILY (FIELD9) + )` usertableSchemaJSON = `( ycsb_key VARCHAR(255) PRIMARY KEY NOT NULL, FIELD JSONB @@ -64,6 +88,7 @@ type ycsb struct { seed int64 initialRows int json bool + families bool splits int workload string @@ -89,6 +114,7 @@ var ycsbMeta = workload.Meta{ g.flags.IntVar(&g.initialRows, `initial-rows`, 10000, `Initial number of rows to sequentially insert before beginning Zipfian workload`) g.flags.BoolVar(&g.json, `json`, false, `Use JSONB rather than relational data`) + g.flags.BoolVar(&g.families, `families`, true, `Place each column in its own column family`) g.flags.IntVar(&g.splits, `splits`, 0, `Number of splits to perform before starting normal operations`) g.flags.StringVar(&g.workload, `workload`, `B`, `Workload type. Choose from A-F.`) g.flags.StringVar(&g.distribution, `request-distribution`, `zipfian`, `Distribution for random number generator [zipfian, uniform].`) @@ -169,7 +195,11 @@ func (g *ycsb) Tables() []workload.Table { if g.json { usertable.Schema = usertableSchemaJSON } else { - usertable.Schema = usertableSchemaRelational + if g.families { + usertable.Schema = usertableSchemaRelationalWithFamilies + } else { + usertable.Schema = usertableSchemaRelational + } } return []workload.Table{usertable} }