Skip to content

Commit 26f3cfc

Browse files
Ryan BoozRobAtticusniksaBrian Rowejonatas
authored
Add multinode to master (timescale#168)
* Update Travis config to work for private repo We need to rename the checked out repo to be named the same as the public repo (tsbs) so that the imports match up correctly. This also adds testing for 1.12 and removes the codecov part since we don't have support for private repos there. * Add support for benchmarking clustered version of TimescaleDB * Add support for benchmarking clustered version of TimescaleDB Add replication factor for distributed hypertable Pass in replication_factor from bash script * Allow tsbs_load_timescaledb to use existing table This change correctly handles the createMeticsTable flag to skip the table creation commands in PostCreateDB, but still set up the internal structures needed by the rest of the test. If the flag is set, the PostCreateDB will also verify that the necessary table exists on the database, and will wait for up to a minute for the table to be created. This change also stops passing 0 values for numberPartions or replicationFactor when creating the table. For number_partitions, this enables the default behavior of 1 partition per data node. For replicationFactor, values greater than 1 aren't supported by the current code, so we simply call create_distributed_hypertable for all non-zero values. Also included in this change is a bit of clean-up for the multinode branch rebase. * Allow tsbs_load_timescaledb to partition on hostname This change adds a new option (partition-on-hostname) to the tsbs_load_timescaledb, and exposes it through the load_timescaledb.sh script. This is needed for efficiently running query tests with USE_TAGS=false, as the test will then access rows by hostname. This change also fixes the double-groupby class of queries to work properly with the USE_TAGS=false option. * Add port argument. Fix max_queries script * Fix flag var after rebasing Fix travis for Go 1.10.x * Add new query type that scans more data Add cpu-max-all-32-24 query type that scans metrics for 32 hosts during 24 hour interval. This query type is more sutable for multinode testing. * Reworking how distributed hypertables are created * Reworking parameters and creation code for TimescaleDB. It turns out that `create_hypertable` will create a distributed hypertable with a replication factor >= 1. Tried to leave options for testing various configurations of both regular and distributed hypertables. Still trying to figure out default values with Viper. * Can now set multiple kinds of tests with a few parameters. * Single-node, no partitions * single-node, partitions on tag table "name" column * multi-node, partition on tag table "name" column Co-authored-by: Jônatas Davi Paganini <[email protected]> * Adding YAML configuration samples for TimescaleDB * Fixing the OR logic in hostname where clauses * Fixed tests for query generation * Update TimescaleDB documentation for multi-node related configuration * Adding options for TimescaleDB input * Simply committing to kick off another build for checks. * Forcing build Co-authored-by: Rob Kiefer <[email protected]> Co-authored-by: niksa <[email protected]> Co-authored-by: Brian Rowe <[email protected]> Co-authored-by: Jônatas Davi Paganini <[email protected]>
1 parent d51fd44 commit 26f3cfc

28 files changed

+503
-76
lines changed

.travis.yml

-2
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,3 @@ jobs:
1616
install: skip
1717
script:
1818
- GO111MODULE=on go test -v -race -coverprofile=coverage.txt -covermode=atomic ./...
19-
after_success:
20-
- bash <(curl -s https://codecov.io/bash)

cmd/tsbs_generate_queries/databases/cassandra/devops.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,8 @@ func (d *Devops) GroupByTimeAndPrimaryTag(qi query.Query, numMetrics int) {
111111
// FROM cpu WHERE (hostname = '$HOSTNAME_1' OR ... OR hostname = '$HOSTNAME_N')
112112
// AND time >= '$HOUR_START' AND time < '$HOUR_END'
113113
// GROUP BY hour ORDER BY hour
114-
func (d *Devops) MaxAllCPU(qi query.Query, nHosts int) {
115-
interval := d.Interval.MustRandWindow(devops.MaxAllDuration)
114+
func (d *Devops) MaxAllCPU(qi query.Query, nHosts int, duration time.Duration) {
115+
interval := d.Interval.MustRandWindow(duration)
116116

117117
tagSet := d.getHostWhere(nHosts)
118118

cmd/tsbs_generate_queries/databases/clickhouse/devops.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,8 @@ const clickhouseTimeStringFormat = "2006-01-02 15:04:05"
8585
// Resultsets:
8686
// cpu-max-all-1
8787
// cpu-max-all-8
88-
func (d *Devops) MaxAllCPU(qi query.Query, nHosts int) {
89-
interval := d.Interval.MustRandWindow(devops.MaxAllDuration)
88+
func (d *Devops) MaxAllCPU(qi query.Query, nHosts int, duration time.Duration) {
89+
interval := d.Interval.MustRandWindow(duration)
9090
metrics := devops.GetAllCPUMetrics()
9191
selectClauses := d.getSelectClausesAggMetrics("max", metrics)
9292

cmd/tsbs_generate_queries/databases/clickhouse/devops_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ func TestMaxAllCPU(t *testing.T) {
154154

155155
testFunc := func(d *Devops, c testCase) query.Query {
156156
q := d.GenerateEmptyQuery()
157-
d.MaxAllCPU(q, c.input)
157+
d.MaxAllCPU(q, c.input, devops.MaxAllDuration)
158158
return q
159159
}
160160

cmd/tsbs_generate_queries/databases/influx/devops.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,8 @@ func (d *Devops) GroupByTimeAndPrimaryTag(qi query.Query, numMetrics int) {
104104
// FROM cpu WHERE (hostname = '$HOSTNAME_1' OR ... OR hostname = '$HOSTNAME_N')
105105
// AND time >= '$HOUR_START' AND time < '$HOUR_END'
106106
// GROUP BY hour ORDER BY hour
107-
func (d *Devops) MaxAllCPU(qi query.Query, nHosts int) {
108-
interval := d.Interval.MustRandWindow(devops.MaxAllDuration)
107+
func (d *Devops) MaxAllCPU(qi query.Query, nHosts int, duration time.Duration) {
108+
interval := d.Interval.MustRandWindow(duration)
109109
whereHosts := d.getHostWhereString(nHosts)
110110
selectClauses := d.getSelectClausesAggMetrics("max", devops.GetAllCPUMetrics())
111111

cmd/tsbs_generate_queries/databases/influx/devops_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ func TestMaxAllCPU(t *testing.T) {
269269

270270
testFunc := func(d *Devops, c testCase) query.Query {
271271
q := d.GenerateEmptyQuery()
272-
d.MaxAllCPU(q, c.input)
272+
d.MaxAllCPU(q, c.input, devops.MaxAllDuration)
273273
return q
274274
}
275275

cmd/tsbs_generate_queries/databases/mongo/devops.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -168,8 +168,8 @@ func (d *Devops) GroupByTime(qi query.Query, nHosts, numMetrics int, timeRange t
168168
// FROM cpu WHERE (hostname = '$HOSTNAME_1' OR ... OR hostname = '$HOSTNAME_N')
169169
// AND time >= '$HOUR_START' AND time < '$HOUR_END'
170170
// GROUP BY hour ORDER BY hour
171-
func (d *Devops) MaxAllCPU(qi query.Query, nHosts int) {
172-
interval := d.Interval.MustRandWindow(devops.MaxAllDuration)
171+
func (d *Devops) MaxAllCPU(qi query.Query, nHosts int, duration time.Duration) {
172+
interval := d.Interval.MustRandWindow(duration)
173173
hostnames, err := d.GetRandomHosts(nHosts)
174174
panicIfErr(err)
175175
docs := getTimeFilterDocs(interval)

cmd/tsbs_generate_queries/databases/siridb/devops.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,8 @@ func (d *Devops) GroupByTimeAndPrimaryTag(qi query.Query, numMetrics int) {
120120
// hosts and all `cpu` metrics are returned):
121121
//
122122
// select max(1h) from (`groupHost1` | ...) & `cpu` between 'time1' and 'time2'
123-
func (d *Devops) MaxAllCPU(qi query.Query, nHosts int) {
124-
interval := d.Interval.MustRandWindow(devops.MaxAllDuration)
123+
func (d *Devops) MaxAllCPU(qi query.Query, nHosts int, duration time.Duration) {
124+
interval := d.Interval.MustRandWindow(duration)
125125

126126
whereMetrics := "`cpu`"
127127
whereHosts := d.getHostWhereString(nHosts)

cmd/tsbs_generate_queries/databases/siridb/devops_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ func TestMaxAllCPU(t *testing.T) {
236236

237237
testFunc := func(d *Devops, c testCase) query.Query {
238238
q := d.GenerateEmptyQuery()
239-
d.MaxAllCPU(q, c.input)
239+
d.MaxAllCPU(q, c.input, devops.MaxAllDuration)
240240
return q
241241
}
242242

cmd/tsbs_generate_queries/databases/timescaledb/devops.go

+13-10
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,11 @@ func (d *Devops) getHostWhereWithHostnames(hostnames []string) string {
4646
return fmt.Sprintf("tags_id IN (SELECT id FROM tags WHERE hostname IN (%s))", strings.Join(hostnameClauses, ","))
4747
} else {
4848
for _, s := range hostnames {
49-
hostnameClauses = append(hostnameClauses, fmt.Sprintf("hostname = '%s'", s))
49+
hostnameClauses = append(hostnameClauses, fmt.Sprintf("'%s'", s))
5050
}
51-
combinedHostnameClause := strings.Join(hostnameClauses, " OR ")
52-
53-
return "(" + combinedHostnameClause + ")"
51+
// using the OR logic here is an anti-pattern for the query planner. Doing
52+
// the IN will get translated to an ANY query and do better
53+
return fmt.Sprintf("hostname IN (%s)", strings.Join(hostnameClauses, ","))
5454
}
5555
}
5656

@@ -83,7 +83,7 @@ func (d *Devops) getSelectClausesAggMetrics(agg string, metrics []string) []stri
8383
//
8484
// SELECT minute, max(metric1), ..., max(metricN)
8585
// FROM cpu
86-
// WHERE (hostname = '$HOSTNAME_1' OR ... OR hostname = '$HOSTNAME_N')
86+
// WHERE hostname IN ('$HOSTNAME_1',...,'$HOSTNAME_N')
8787
// AND time >= '$HOUR_START' AND time < '$HOUR_END'
8888
// GROUP BY minute ORDER BY minute ASC
8989
func (d *Devops) GroupByTime(qi query.Query, nHosts, numMetrics int, timeRange time.Duration) {
@@ -153,28 +153,31 @@ func (d *Devops) GroupByTimeAndPrimaryTag(qi query.Query, numMetrics int) {
153153

154154
hostnameField := "hostname"
155155
joinStr := ""
156+
partitionGrouping := hostnameField
156157
if d.UseJSON || d.UseTags {
157158
if d.UseJSON {
158159
hostnameField = "tags->>'hostname'"
159160
} else if d.UseTags {
160161
hostnameField = "tags.hostname"
161162
}
162163
joinStr = "JOIN tags ON cpu_avg.tags_id = tags.id"
164+
partitionGrouping = "tags_id"
163165
}
164166

165167
sql := fmt.Sprintf(`
166168
WITH cpu_avg AS (
167-
SELECT %s as hour, tags_id,
169+
SELECT %s as hour, %s,
168170
%s
169171
FROM cpu
170172
WHERE time >= '%s' AND time < '%s'
171-
GROUP BY hour, tags_id
173+
GROUP BY 1, 2
172174
)
173175
SELECT hour, %s, %s
174176
FROM cpu_avg
175177
%s
176178
ORDER BY hour, %s`,
177179
d.getTimeBucket(oneHour),
180+
partitionGrouping,
178181
strings.Join(selectClauses, ", "),
179182
interval.Start().Format(goTimeFmt),
180183
interval.End().Format(goTimeFmt),
@@ -189,11 +192,11 @@ func (d *Devops) GroupByTimeAndPrimaryTag(qi query.Query, numMetrics int) {
189192
// e.g. in pseudo-SQL:
190193
//
191194
// SELECT MAX(metric1), ..., MAX(metricN)
192-
// FROM cpu WHERE (hostname = '$HOSTNAME_1' OR ... OR hostname = '$HOSTNAME_N')
195+
// FROM cpu WHERE hostname IN ('$HOSTNAME_1',...,'$HOSTNAME_N')
193196
// AND time >= '$HOUR_START' AND time < '$HOUR_END'
194197
// GROUP BY hour ORDER BY hour
195-
func (d *Devops) MaxAllCPU(qi query.Query, nHosts int) {
196-
interval := d.Interval.MustRandWindow(devops.MaxAllDuration)
198+
func (d *Devops) MaxAllCPU(qi query.Query, nHosts int, duration time.Duration) {
199+
interval := d.Interval.MustRandWindow(duration)
197200

198201
metrics := devops.GetAllCPUMetrics()
199202
selectClauses := d.getSelectClausesAggMetrics("max", metrics)

cmd/tsbs_generate_queries/databases/timescaledb/devops_test.go

+15-16
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,14 @@ func TestDevopsGetHostWhereWithHostnames(t *testing.T) {
2525
hostnames: []string{"foo1"},
2626
useJSON: false,
2727
useTags: false,
28-
want: "(hostname = 'foo1')",
28+
want: "hostname IN ('foo1')",
2929
},
3030
{
3131
desc: "multi host - no json or tags",
3232
hostnames: []string{"foo1", "foo2"},
3333
useJSON: false,
3434
useTags: false,
35-
want: "(hostname = 'foo1' OR hostname = 'foo2')",
35+
want: "hostname IN ('foo1','foo2')",
3636
},
3737
{
3838
desc: "single host - w/ json",
@@ -88,15 +88,15 @@ func TestDevopsGetHostWhereString(t *testing.T) {
8888
}{
8989
{
9090
nHosts: 1,
91-
want: "(hostname = 'host_5')",
91+
want: "hostname IN ('host_5')",
9292
},
9393
{
9494
nHosts: 2,
95-
want: "(hostname = 'host_5' OR hostname = 'host_9')",
95+
want: "hostname IN ('host_5','host_9')",
9696
},
9797
{
9898
nHosts: 5,
99-
want: "(hostname = 'host_5' OR hostname = 'host_9' OR hostname = 'host_3' OR hostname = 'host_1' OR hostname = 'host_7')",
99+
want: "hostname IN ('host_5','host_9','host_3','host_1','host_7')",
100100
},
101101
}
102102

@@ -184,7 +184,7 @@ func TestDevopsGroupByTime(t *testing.T) {
184184
expectedSQLQuery := `SELECT time_bucket('60 seconds', time) AS minute,
185185
max(usage_user) as max_usage_user
186186
FROM cpu
187-
WHERE (hostname = 'host_9') AND time >= '1970-01-01 00:05:58.646325 +0000' AND time < '1970-01-01 00:05:59.646325 +0000'
187+
WHERE hostname IN ('host_9') AND time >= '1970-01-01 00:05:58.646325 +0000' AND time < '1970-01-01 00:05:59.646325 +0000'
188188
GROUP BY minute ORDER BY minute ASC`
189189

190190
rand.Seed(123) // Setting seed for testing purposes.
@@ -255,11 +255,11 @@ func TestGroupByTimeAndPrimaryTag(t *testing.T) {
255255
expectedHypertable: "cpu",
256256
expectedSQLQuery: `
257257
WITH cpu_avg AS (
258-
SELECT time_bucket('3600 seconds', time) as hour, tags_id,
258+
SELECT time_bucket('3600 seconds', time) as hour, hostname,
259259
avg(usage_user) as mean_usage_user
260260
FROM cpu
261261
WHERE time >= '1970-01-01 00:16:22.646325 +0000' AND time < '1970-01-01 12:16:22.646325 +0000'
262-
GROUP BY hour, tags_id
262+
GROUP BY 1, 2
263263
)
264264
SELECT hour, hostname, mean_usage_user
265265
FROM cpu_avg
@@ -278,7 +278,7 @@ func TestGroupByTimeAndPrimaryTag(t *testing.T) {
278278
avg(usage_user) as mean_usage_user
279279
FROM cpu
280280
WHERE time >= '1970-01-01 00:54:10.138978 +0000' AND time < '1970-01-01 12:54:10.138978 +0000'
281-
GROUP BY hour, tags_id
281+
GROUP BY 1, 2
282282
)
283283
SELECT hour, tags->>'hostname', mean_usage_user
284284
FROM cpu_avg
@@ -297,7 +297,7 @@ func TestGroupByTimeAndPrimaryTag(t *testing.T) {
297297
avg(usage_user) as mean_usage_user
298298
FROM cpu
299299
WHERE time >= '1970-01-01 00:47:30.894865 +0000' AND time < '1970-01-01 12:47:30.894865 +0000'
300-
GROUP BY hour, tags_id
300+
GROUP BY 1, 2
301301
)
302302
SELECT hour, tags.hostname, mean_usage_user
303303
FROM cpu_avg
@@ -317,7 +317,7 @@ func TestGroupByTimeAndPrimaryTag(t *testing.T) {
317317
avg(usage_user) as mean_usage_user
318318
FROM cpu
319319
WHERE time >= '1970-01-01 00:37:12.342805 +0000' AND time < '1970-01-01 12:37:12.342805 +0000'
320-
GROUP BY hour, tags_id
320+
GROUP BY 1, 2
321321
)
322322
SELECT hour, tags->>'hostname', mean_usage_user
323323
FROM cpu_avg
@@ -363,7 +363,7 @@ func TestMaxAllCPU(t *testing.T) {
363363
"max(usage_softirq) as max_usage_softirq, max(usage_steal) as max_usage_steal, max(usage_guest) as max_usage_guest, " +
364364
`max(usage_guest_nice) as max_usage_guest_nice
365365
FROM cpu
366-
WHERE (hostname = 'host_9') AND time >= '1970-01-01 00:16:22.646325 +0000' AND time < '1970-01-01 08:16:22.646325 +0000'
366+
WHERE hostname IN ('host_9') AND time >= '1970-01-01 00:16:22.646325 +0000' AND time < '1970-01-01 08:16:22.646325 +0000'
367367
GROUP BY hour ORDER BY hour`
368368
rand.Seed(123) // Setting seed for testing purposes.
369369
s := time.Unix(0, 0)
@@ -379,7 +379,7 @@ func TestMaxAllCPU(t *testing.T) {
379379
d := dq.(*Devops)
380380

381381
q := d.GenerateEmptyQuery()
382-
d.MaxAllCPU(q, 1)
382+
d.MaxAllCPU(q, 1, devops.MaxAllDuration)
383383
verifyQuery(t, q, expectedHumanLabel, expectedHumanDesc, expectedHypertable, expectedSQLQuery)
384384
}
385385

@@ -476,7 +476,7 @@ func TestHighCPUForHosts(t *testing.T) {
476476
expectedHumanDesc: "TimescaleDB CPU over threshold, 1 host(s): 1970-01-01T00:47:30Z",
477477
expectedHypertable: "cpu",
478478
expectedSQLQuery: "SELECT * FROM cpu WHERE usage_user > 90.0 and time >= '1970-01-01 00:47:30.894865 +0000'" +
479-
" AND time < '1970-01-01 12:47:30.894865 +0000' AND (hostname = 'host_9')",
479+
" AND time < '1970-01-01 12:47:30.894865 +0000' AND hostname IN ('host_9')",
480480
},
481481
{
482482
desc: "five hosts",
@@ -485,8 +485,7 @@ func TestHighCPUForHosts(t *testing.T) {
485485
expectedHumanDesc: "TimescaleDB CPU over threshold, 5 host(s): 1970-01-01T00:08:59Z",
486486
expectedHypertable: "cpu",
487487
expectedSQLQuery: "SELECT * FROM cpu WHERE usage_user > 90.0 and time >= '1970-01-01 00:08:59.080812 +0000'" +
488-
" AND time < '1970-01-01 12:08:59.080812 +0000' AND (hostname = 'host_5' OR hostname = 'host_9' " +
489-
"OR hostname = 'host_1' OR hostname = 'host_7' OR hostname = 'host_2')",
488+
" AND time < '1970-01-01 12:08:59.080812 +0000' AND hostname IN ('host_5','host_9','host_1','host_7','host_2')",
490489
},
491490
}
492491

cmd/tsbs_generate_queries/main.go

+4-2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import (
66
"fmt"
77
"github.com/timescale/tsbs/pkg/query/config"
88
"os"
9+
"time"
910

1011
"github.com/blagojts/viper"
1112
"github.com/spf13/pflag"
@@ -24,8 +25,9 @@ var useCaseMatrix = map[string]map[string]utils.QueryFillerMaker{
2425
devops.LabelSingleGroupby + "-5-1-1": devops.NewSingleGroupby(5, 1, 1),
2526
devops.LabelSingleGroupby + "-5-1-12": devops.NewSingleGroupby(5, 1, 12),
2627
devops.LabelSingleGroupby + "-5-8-1": devops.NewSingleGroupby(5, 8, 1),
27-
devops.LabelMaxAll + "-1": devops.NewMaxAllCPU(1),
28-
devops.LabelMaxAll + "-8": devops.NewMaxAllCPU(8),
28+
devops.LabelMaxAll + "-1": devops.NewMaxAllCPU(1, devops.MaxAllDuration),
29+
devops.LabelMaxAll + "-8": devops.NewMaxAllCPU(8, devops.MaxAllDuration),
30+
devops.LabelMaxAll + "-32-24": devops.NewMaxAllCPU(32, 24*time.Hour),
2931
devops.LabelDoubleGroupby + "-1": devops.NewGroupBy(1),
3032
devops.LabelDoubleGroupby + "-5": devops.NewGroupBy(5),
3133
devops.LabelDoubleGroupby + "-all": devops.NewGroupBy(devops.GetCPUMetricsLen()),

cmd/tsbs_generate_queries/uses/devops/common.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ type LastPointFiller interface {
107107

108108
// MaxAllFiller is a type that can fill in a max all CPU metrics query
109109
type MaxAllFiller interface {
110-
MaxAllCPU(query.Query, int)
110+
MaxAllCPU(query.Query, int, time.Duration)
111111
}
112112

113113
// GroupbyOrderbyLimitFiller is a type that can fill in a groupby-orderby-limit query
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,27 @@
11
package devops
22

33
import (
4+
"time"
5+
46
"github.com/timescale/tsbs/cmd/tsbs_generate_queries/uses/common"
57
"github.com/timescale/tsbs/cmd/tsbs_generate_queries/utils"
68
"github.com/timescale/tsbs/pkg/query"
79
)
810

911
// MaxAllCPU contains info for filling in a query.Query for "max all" queries
1012
type MaxAllCPU struct {
11-
core utils.QueryGenerator
12-
hosts int
13+
core utils.QueryGenerator
14+
hosts int
15+
duration time.Duration
1316
}
1417

1518
// NewMaxAllCPU produces a new function that produces a new AllMaxCPU
16-
func NewMaxAllCPU(hosts int) utils.QueryFillerMaker {
19+
func NewMaxAllCPU(hosts int, duration time.Duration) utils.QueryFillerMaker {
1720
return func(core utils.QueryGenerator) utils.QueryFiller {
1821
return &MaxAllCPU{
19-
core: core,
20-
hosts: hosts,
22+
core: core,
23+
hosts: hosts,
24+
duration: duration,
2125
}
2226
}
2327
}
@@ -28,6 +32,6 @@ func (d *MaxAllCPU) Fill(q query.Query) query.Query {
2832
if !ok {
2933
common.PanicUnimplementedQuery(d.core)
3034
}
31-
fc.MaxAllCPU(q, d.hosts)
35+
fc.MaxAllCPU(q, d.hosts, d.duration)
3236
return q
3337
}

cmd/tsbs_load_timescaledb/main.go

+14-1
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ func initProgramOptions() (*timescaledb.LoadingOptions, load.BenchmarkRunner, *l
3333
panic(fmt.Errorf("unable to decode config: %s", err))
3434
}
3535
opts := timescaledb.LoadingOptions{}
36+
viper.SetTypeByDefaultValue(true)
3637
opts.PostgresConnect = viper.GetString("postgres")
3738
opts.Host = viper.GetString("host")
3839
opts.Port = viper.GetString("port")
@@ -42,11 +43,22 @@ func initProgramOptions() (*timescaledb.LoadingOptions, load.BenchmarkRunner, *l
4243
opts.LogBatches = viper.GetBool("log-batches")
4344

4445
opts.UseHypertable = viper.GetBool("use-hypertable")
46+
opts.ChunkTime = viper.GetDuration("chunk-time")
47+
4548
opts.UseJSON = viper.GetBool("use-jsonb-tags")
49+
50+
// This must be set to 'true' if you are going to test
51+
// distributed hypertable queries and insert. Replication
52+
// factor must also be set to true for distributed hypertables
4653
opts.InTableTag = viper.GetBool("in-table-partition-tag")
4754

55+
// We currently use `create_hypertable` for all variations. When
56+
// `replication-factor`>=1, we automatically create a distributed
57+
// hypertable.
58+
opts.ReplicationFactor = viper.GetInt("replication-factor")
59+
// Currently ignored for distributed hypertables. We assume all
60+
// data nodes will be used based on the partition-column above
4861
opts.NumberPartitions = viper.GetInt("partitions")
49-
opts.ChunkTime = viper.GetDuration("chunk-time")
5062

5163
opts.TimeIndex = viper.GetBool("time-index")
5264
opts.TimePartitionIndex = viper.GetBool("time-partition-index")
@@ -59,6 +71,7 @@ func initProgramOptions() (*timescaledb.LoadingOptions, load.BenchmarkRunner, *l
5971
opts.CreateMetricsTable = viper.GetBool("create-metrics-table")
6072

6173
opts.ForceTextFormat = viper.GetBool("force-text-format")
74+
opts.UseInsert = viper.GetBool("use-insert")
6275

6376
loader := load.GetBenchmarkRunner(loaderConf)
6477
return &opts, loader, &loaderConf

0 commit comments

Comments
 (0)