-
Notifications
You must be signed in to change notification settings - Fork 48
/
stress.go
542 lines (476 loc) · 18.6 KB
/
stress.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
// Copyright 2017 CoreOS, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package dbtester
import (
"fmt"
"math"
"os"
"sort"
"sync"
"time"
"github.com/etcd-io/dbtester/dbtesterpb"
"github.com/coreos/etcd/clientv3"
"github.com/coreos/etcd/pkg/report"
consulapi "github.com/hashicorp/consul/api"
"go.uber.org/zap"
"golang.org/x/net/context"
"golang.org/x/time/rate"
)
type values struct {
bytes [][]byte
strings []string
sampleSize int
}
func newValues(gcfg dbtesterpb.ConfigClientMachineAgentControl) (v values, rerr error) {
v.bytes = [][]byte{randBytes(gcfg.ConfigClientMachineBenchmarkOptions.ValueSizeBytes)}
v.strings = []string{string(v.bytes[0])}
v.sampleSize = 1
return
}
// Stress stresses the database.
func (cfg *Config) Stress(databaseID string) error {
gcfg, ok := cfg.DatabaseIDToConfigClientMachineAgentControl[databaseID]
if !ok {
return fmt.Errorf("%q does not exist", databaseID)
}
vals, err := newValues(gcfg)
if err != nil {
return err
}
switch gcfg.ConfigClientMachineBenchmarkOptions.Type {
case "write":
cfg.lg.Info("write generateReport is started...")
// fixed number of client numbers
if len(gcfg.ConfigClientMachineBenchmarkOptions.ConnectionClientNumbers) == 0 {
h, done := newWriteHandlers(cfg.lg, gcfg)
reqGen := func(inflightReqs chan<- request) { generateWrites(gcfg, 0, vals, inflightReqs) }
cfg.generateReport(gcfg, h, done, reqGen)
} else {
// variable client numbers
rs := assignRequest(gcfg.ConfigClientMachineBenchmarkOptions.ConnectionClientNumbers, gcfg.ConfigClientMachineBenchmarkOptions.RequestNumber)
var stats []report.Stats
reqCompleted := int64(0)
for i := 0; i < len(rs); i++ {
copied := gcfg
copied.ConfigClientMachineBenchmarkOptions.ConnectionNumber = gcfg.ConfigClientMachineBenchmarkOptions.ConnectionClientNumbers[i]
copied.ConfigClientMachineBenchmarkOptions.ClientNumber = gcfg.ConfigClientMachineBenchmarkOptions.ConnectionClientNumbers[i]
copied.ConfigClientMachineBenchmarkOptions.RequestNumber = rs[i]
ncfg := *cfg
ncfg.DatabaseIDToConfigClientMachineAgentControl[databaseID] = copied
go func() {
cfg.lg.Sugar().Infof("signaling agent with client number %d", copied.ConfigClientMachineBenchmarkOptions.ClientNumber)
if _, err := (&ncfg).BroadcaseRequest(databaseID, dbtesterpb.Operation_Heartbeat); err != nil {
panic(err)
}
}()
h, done := newWriteHandlers(cfg.lg, copied)
reqGen := func(inflightReqs chan<- request) { generateWrites(copied, reqCompleted, vals, inflightReqs) }
b := newBenchmark(copied.ConfigClientMachineBenchmarkOptions.RequestNumber, copied.ConfigClientMachineBenchmarkOptions.ClientNumber, h, done, reqGen)
// wait until rs[i] requests are finished
// do not end reports yet
b.startRequests()
b.waitRequestsEnd()
cfg.lg.Info("finishing reports...")
now := time.Now()
b.finishReports()
cfg.lg.Sugar().Infof("finished reports... took %v", time.Since(now))
reqCompleted += rs[i]
stats = append(stats, b.stats)
}
cfg.lg.Info("combining all reports")
combined := report.Stats{ErrorDist: make(map[string]int)}
combinedClientNumber := make([]int64, 0, gcfg.ConfigClientMachineBenchmarkOptions.RequestNumber)
for i, st := range stats {
combined.AvgTotal += st.AvgTotal
combined.Total += st.Total
combined.Lats = append(combined.Lats, st.Lats...)
combined.TimeSeries = append(combined.TimeSeries, st.TimeSeries...)
//
// Need to handle duplicate unix second timestamps when two ranges are merged.
// This can happen when the following run happens within the same unix timesecond,
// since finishing up the previous report and restarting the next range of requests
// with different number of clients takes only 100+/- ms.
//
// For instance, we have the following raw data:
//
// unix-second, client-number, throughput
// 1486389257, 700, 30335 === ending of previous combined.TimeSeries
// 1486389258, "700", 23188 === ending of previous combined.TimeSeries
// 1486389258, 1000, 5739 === beginning of current st.TimeSeries
//
// So now we have two duplicate unix time seconds.
// This will be handled in aggregating by keys.
//
clientN := gcfg.ConfigClientMachineBenchmarkOptions.ConnectionClientNumbers[i]
clientNs := make([]int64, len(st.TimeSeries))
for i := range st.TimeSeries {
clientNs[i] = clientN
}
combinedClientNumber = append(combinedClientNumber, clientNs...)
for k, v := range st.ErrorDist {
if _, ok := combined.ErrorDist[k]; !ok {
combined.ErrorDist[k] = v
} else {
combined.ErrorDist[k] += v
}
}
}
if len(combined.TimeSeries) != len(combinedClientNumber) {
return fmt.Errorf("len(combined.TimeSeries) %d != len(combinedClientNumber) %d", len(combined.TimeSeries), len(combinedClientNumber))
}
combined.Average = combined.AvgTotal / float64(len(combined.Lats))
combined.RPS = float64(len(combined.Lats)) / combined.Total.Seconds()
cfg.lg.Sugar().Infof("got total %d data points and total %f seconds (RPS %f)", len(combined.Lats), combined.Total.Seconds(), combined.RPS)
for i := range combined.Lats {
dev := combined.Lats[i] - combined.Average
combined.Stddev += dev * dev
}
combined.Stddev = math.Sqrt(combined.Stddev / float64(len(combined.Lats)))
sort.Float64s(combined.Lats)
if len(combined.Lats) > 0 {
combined.Fastest = combined.Lats[0]
combined.Slowest = combined.Lats[len(combined.Lats)-1]
}
cfg.lg.Info("combined all reports")
printStats(combined)
cfg.saveAllStats(gcfg, combined, combinedClientNumber)
}
cfg.lg.Info("write generateReport is finished...")
cfg.lg.Info("checking total keys on", zap.Strings("endpoints", gcfg.DatabaseEndpoints))
var totalKeysFunc func(*zap.Logger, []string) map[string]int64
switch gcfg.DatabaseID {
case "etcd__other", "etcd__tip", "etcd__v3_2", "etcd__v3_3":
totalKeysFunc = getTotalKeysEtcdv3
case "zookeeper__r3_5_3_beta", "zetcd__beta":
totalKeysFunc = getTotalKeysZk
case "consul__v1_0_2", "cetcd__beta":
totalKeysFunc = getTotalKeysConsul
default:
cfg.lg.Fatal("unknown database ID", zap.String("database", gcfg.DatabaseID))
}
for k, v := range totalKeysFunc(cfg.lg, gcfg.DatabaseEndpoints) {
cfg.lg.Sugar().Infof("expected write total results [expected_total: %d | database: %q | endpoint: %q | number_of_keys: %d]",
gcfg.ConfigClientMachineBenchmarkOptions.RequestNumber, gcfg.DatabaseID, k, v)
}
case "read":
key, value := sameKey(gcfg.ConfigClientMachineBenchmarkOptions.KeySizeBytes), vals.strings[0]
switch gcfg.DatabaseID {
case "etcd__other", "etcd__tip", "etcd__v3_2", "etcd__v3_3":
cfg.lg.Sugar().Infof("write started [request: PUT | key: %q | database: %q]", key, gcfg.DatabaseID)
var err error
for i := 0; i < 7; i++ {
clients := mustCreateClientsEtcdv3(gcfg.DatabaseEndpoints, etcdv3ClientCfg{
totalConns: 1,
totalClients: 1,
})
_, err = clients[0].Do(context.Background(), clientv3.OpPut(key, value))
if err != nil {
continue
}
cfg.lg.Sugar().Infof("write done [request: PUT | key: %q | database: %q]", key, gcfg.DatabaseID)
break
}
if err != nil {
cfg.lg.Sugar().Fatalf("write error [request: PUT | key: %q | database: %q]", key, gcfg.DatabaseID)
os.Exit(1)
}
case "zookeeper__r3_5_3_beta", "zetcd__beta":
cfg.lg.Sugar().Infof("write started [request: PUT | key: %q | database: %q]", key, gcfg.DatabaseID)
var err error
for i := 0; i < 7; i++ {
conns := mustCreateConnsZk(gcfg.DatabaseEndpoints, gcfg.ConfigClientMachineBenchmarkOptions.ConnectionNumber)
_, err = conns[0].Create("/"+key, vals.bytes[0], zkCreateFlags, zkCreateACL)
if err != nil {
continue
}
for j := range conns {
conns[j].Close()
}
cfg.lg.Sugar().Infof("write done [request: PUT | key: %q | database: %q]", key, gcfg.DatabaseID)
break
}
if err != nil {
cfg.lg.Sugar().Fatalf("write error [request: PUT | key: %q | database: %q]", key, gcfg.DatabaseID)
os.Exit(1)
}
case "consul__v1_0_2", "cetcd__beta":
cfg.lg.Sugar().Infof("write started [request: PUT | key: %q | database: %q]", key, gcfg.DatabaseID)
var err error
for i := 0; i < 7; i++ {
clients := mustCreateConnsConsul(gcfg.DatabaseEndpoints, gcfg.ConfigClientMachineBenchmarkOptions.ConnectionNumber)
_, err = clients[0].Put(&consulapi.KVPair{Key: key, Value: vals.bytes[0]}, nil)
if err != nil {
continue
}
cfg.lg.Sugar().Infof("write done [request: PUT | key: %q | database: %q]", key, gcfg.DatabaseID)
break
}
if err != nil {
cfg.lg.Sugar().Fatalf("write done [request: PUT | key: %q | database: %q]", key, gcfg.DatabaseID)
os.Exit(1)
}
default:
panic(fmt.Sprintf("%q is unknown database ID", gcfg.DatabaseID))
}
h, done := newReadHandlers(gcfg)
reqGen := func(inflightReqs chan<- request) { generateReads(gcfg, key, inflightReqs) }
cfg.generateReport(gcfg, h, done, reqGen)
cfg.lg.Info("read generateReport is finished...")
case "read-oneshot":
key, value := sameKey(gcfg.ConfigClientMachineBenchmarkOptions.KeySizeBytes), vals.strings[0]
cfg.lg.Sugar().Infof("writing key for read-oneshot [key: %q | database: %q]", key, gcfg.DatabaseID)
var err error
switch gcfg.DatabaseID {
case "etcd__other", "etcd__tip", "etcd__v3_2", "etcd__v3_3":
clients := mustCreateClientsEtcdv3(gcfg.DatabaseEndpoints, etcdv3ClientCfg{
totalConns: 1,
totalClients: 1,
})
_, err = clients[0].Do(context.Background(), clientv3.OpPut(key, value))
clients[0].Close()
case "zookeeper__r3_5_3_beta", "zetcd__beta":
conns := mustCreateConnsZk(gcfg.DatabaseEndpoints, 1)
_, err = conns[0].Create("/"+key, vals.bytes[0], zkCreateFlags, zkCreateACL)
conns[0].Close()
case "consul__v1_0_2", "cetcd__beta":
clients := mustCreateConnsConsul(gcfg.DatabaseEndpoints, 1)
_, err = clients[0].Put(&consulapi.KVPair{Key: key, Value: vals.bytes[0]}, nil)
default:
panic(fmt.Sprintf("%q is unknown database ID", gcfg.DatabaseID))
}
if err != nil {
cfg.lg.Sugar().Fatalf("write error on read-oneshot (%v)", err)
os.Exit(1)
}
h := newReadOneshotHandlers(cfg.lg, gcfg)
reqGen := func(inflightReqs chan<- request) { generateReads(gcfg, key, inflightReqs) }
cfg.generateReport(gcfg, h, nil, reqGen)
cfg.lg.Info("read-oneshot generateReport is finished...")
}
return nil
}
func newReadHandlers(gcfg dbtesterpb.ConfigClientMachineAgentControl) (rhs []ReqHandler, done func()) {
rhs = make([]ReqHandler, gcfg.ConfigClientMachineBenchmarkOptions.ClientNumber)
switch gcfg.DatabaseID {
case "etcd__other", "etcd__tip", "etcd__v3_2", "etcd__v3_3":
clients := mustCreateClientsEtcdv3(gcfg.DatabaseEndpoints, etcdv3ClientCfg{
totalConns: gcfg.ConfigClientMachineBenchmarkOptions.ConnectionNumber,
totalClients: gcfg.ConfigClientMachineBenchmarkOptions.ClientNumber,
})
for i := range clients {
rhs[i] = newGetEtcd3(clients[i].KV)
}
done = func() {
for i := range clients {
clients[i].Close()
}
}
case "zookeeper__r3_5_3_beta", "zetcd__beta":
conns := mustCreateConnsZk(gcfg.DatabaseEndpoints, gcfg.ConfigClientMachineBenchmarkOptions.ConnectionNumber)
for i := range conns {
rhs[i] = newGetZK(conns[i])
}
done = func() {
for i := range conns {
conns[i].Close()
}
}
case "consul__v1_0_2", "cetcd__beta":
conns := mustCreateConnsConsul(gcfg.DatabaseEndpoints, gcfg.ConfigClientMachineBenchmarkOptions.ConnectionNumber)
for i := range conns {
rhs[i] = newGetConsul(conns[i])
}
default:
panic(fmt.Sprintf("%q is unknown database ID", gcfg.DatabaseID))
}
return rhs, done
}
func newWriteHandlers(lg *zap.Logger, gcfg dbtesterpb.ConfigClientMachineAgentControl) (rhs []ReqHandler, done func()) {
rhs = make([]ReqHandler, gcfg.ConfigClientMachineBenchmarkOptions.ClientNumber)
switch gcfg.DatabaseID {
case "etcd__other", "etcd__tip", "etcd__v3_2", "etcd__v3_3":
etcdClients := mustCreateClientsEtcdv3(gcfg.DatabaseEndpoints, etcdv3ClientCfg{
totalConns: gcfg.ConfigClientMachineBenchmarkOptions.ConnectionNumber,
totalClients: gcfg.ConfigClientMachineBenchmarkOptions.ClientNumber,
})
for i := range etcdClients {
rhs[i] = newPutEtcd3(etcdClients[i])
}
done = func() {
// this "done" function may decrease throughput at the end
for i := range etcdClients {
go func(idx int) {
etcdClients[idx].Close()
}(i)
}
}
case "zookeeper__r3_5_3_beta", "zetcd__beta":
if gcfg.ConfigClientMachineBenchmarkOptions.SameKey {
key := sameKey(gcfg.ConfigClientMachineBenchmarkOptions.KeySizeBytes)
valueBts := randBytes(gcfg.ConfigClientMachineBenchmarkOptions.ValueSizeBytes)
lg.Sugar().Infof("write started [request: PUT | key: %q | database: %q]", key, gcfg.DatabaseID)
var err error
for i := 0; i < 7; i++ {
conns := mustCreateConnsZk(gcfg.DatabaseEndpoints, gcfg.ConfigClientMachineBenchmarkOptions.ConnectionNumber)
_, err = conns[0].Create("/"+key, valueBts, zkCreateFlags, zkCreateACL)
if err != nil {
continue
}
for j := range conns {
conns[j].Close()
}
lg.Sugar().Infof("write done [request: PUT | key: %q | database: %q]", key, gcfg.DatabaseID)
break
}
if err != nil {
lg.Sugar().Fatalf("write error [request: PUT | key: %q | database: %q]", key, gcfg.DatabaseID)
os.Exit(1)
}
}
conns := mustCreateConnsZk(gcfg.DatabaseEndpoints, gcfg.ConfigClientMachineBenchmarkOptions.ConnectionNumber)
for i := range conns {
if gcfg.ConfigClientMachineBenchmarkOptions.SameKey {
rhs[i] = newPutOverwriteZK(conns[i])
} else {
rhs[i] = newPutCreateZK(conns[i])
}
}
done = func() {
for i := range conns {
go func(idx int) {
conns[idx].Close()
}(i)
}
}
case "consul__v1_0_2", "cetcd__beta":
conns := mustCreateConnsConsul(gcfg.DatabaseEndpoints, gcfg.ConfigClientMachineBenchmarkOptions.ConnectionNumber)
for i := range conns {
rhs[i] = newPutConsul(conns[i])
}
default:
lg.Sugar().Fatalf("%q is unknown database ID", gcfg.DatabaseID)
}
for k := range rhs {
if rhs[k] == nil {
lg.Sugar().Fatalf("%d-th write handler is nil (out of %d)", k, len(rhs))
}
}
return
}
func newReadOneshotHandlers(lg *zap.Logger, gcfg dbtesterpb.ConfigClientMachineAgentControl) []ReqHandler {
rhs := make([]ReqHandler, gcfg.ConfigClientMachineBenchmarkOptions.ClientNumber)
switch gcfg.DatabaseID {
case "etcd__other", "etcd__tip", "etcd__v3_2", "etcd__v3_3":
for i := range rhs {
rhs[i] = func(ctx context.Context, req *request) error {
conns := mustCreateClientsEtcdv3(gcfg.DatabaseEndpoints, etcdv3ClientCfg{
totalConns: 1,
totalClients: 1,
})
defer conns[0].Close()
return newGetEtcd3(conns[0])(ctx, req)
}
}
case "zookeeper__r3_5_3_beta", "zetcd__beta":
for i := range rhs {
rhs[i] = func(ctx context.Context, req *request) error {
conns := mustCreateConnsZk(gcfg.DatabaseEndpoints, gcfg.ConfigClientMachineBenchmarkOptions.ConnectionNumber)
defer conns[0].Close()
return newGetZK(conns[0])(ctx, req)
}
}
case "consul__v1_0_2", "cetcd__beta":
for i := range rhs {
rhs[i] = func(ctx context.Context, req *request) error {
conns := mustCreateConnsConsul(gcfg.DatabaseEndpoints, 1)
return newGetConsul(conns[0])(ctx, req)
}
}
default:
lg.Sugar().Fatalf("%q is unknown database ID", gcfg.DatabaseID)
}
return rhs
}
func generateReads(gcfg dbtesterpb.ConfigClientMachineAgentControl, key string, inflightReqs chan<- request) {
defer close(inflightReqs)
var rateLimiter *rate.Limiter
if gcfg.ConfigClientMachineBenchmarkOptions.RateLimitRequestsPerSecond > 0 {
rateLimiter = rate.NewLimiter(
rate.Limit(gcfg.ConfigClientMachineBenchmarkOptions.RateLimitRequestsPerSecond),
int(gcfg.ConfigClientMachineBenchmarkOptions.RateLimitRequestsPerSecond),
)
}
for i := int64(0); i < gcfg.ConfigClientMachineBenchmarkOptions.RequestNumber; i++ {
if rateLimiter != nil {
rateLimiter.Wait(context.TODO())
}
switch gcfg.DatabaseID {
case "etcd__other", "etcd__tip", "etcd__v3_2", "etcd__v3_3":
opts := []clientv3.OpOption{clientv3.WithRange("")}
if gcfg.ConfigClientMachineBenchmarkOptions.StaleRead {
opts = append(opts, clientv3.WithSerializable())
}
inflightReqs <- request{etcdv3Op: clientv3.OpGet(key, opts...)}
case "zookeeper__r3_5_3_beta", "zetcd__beta":
op := zkOp{key: key}
if gcfg.ConfigClientMachineBenchmarkOptions.StaleRead {
op.staleRead = true
}
inflightReqs <- request{zkOp: op}
case "consul__v1_0_2", "cetcd__beta":
op := consulOp{key: key}
if gcfg.ConfigClientMachineBenchmarkOptions.StaleRead {
op.staleRead = true
}
inflightReqs <- request{consulOp: op}
default:
panic(fmt.Sprintf("%q is unknown database ID", gcfg.DatabaseID))
}
}
}
func generateWrites(gcfg dbtesterpb.ConfigClientMachineAgentControl, startIdx int64, vals values, inflightReqs chan<- request) {
var rateLimiter *rate.Limiter
if gcfg.ConfigClientMachineBenchmarkOptions.RateLimitRequestsPerSecond > 0 {
rateLimiter = rate.NewLimiter(
rate.Limit(gcfg.ConfigClientMachineBenchmarkOptions.RateLimitRequestsPerSecond),
int(gcfg.ConfigClientMachineBenchmarkOptions.RateLimitRequestsPerSecond),
)
}
var wg sync.WaitGroup
defer func() {
close(inflightReqs)
wg.Wait()
}()
for i := int64(0); i < gcfg.ConfigClientMachineBenchmarkOptions.RequestNumber; i++ {
k := sequentialKey(gcfg.ConfigClientMachineBenchmarkOptions.KeySizeBytes, i+startIdx)
if gcfg.ConfigClientMachineBenchmarkOptions.SameKey {
k = sameKey(gcfg.ConfigClientMachineBenchmarkOptions.KeySizeBytes)
}
v := vals.bytes[i%int64(vals.sampleSize)]
vs := vals.strings[i%int64(vals.sampleSize)]
if rateLimiter != nil {
rateLimiter.Wait(context.TODO())
}
switch gcfg.DatabaseID {
case "etcd__other", "etcd__tip", "etcd__v3_2", "etcd__v3_3":
inflightReqs <- request{etcdv3Op: clientv3.OpPut(k, vs)}
case "zookeeper__r3_5_3_beta", "zetcd__beta":
inflightReqs <- request{zkOp: zkOp{key: "/" + k, value: v}}
case "consul__v1_0_2", "cetcd__beta":
inflightReqs <- request{consulOp: consulOp{key: k, value: v}}
default:
panic(fmt.Sprintf("%q is unknown database ID", gcfg.DatabaseID))
}
}
}