@@ -28,6 +28,10 @@ import (
28
28
"go.opencensus.io/tag"
29
29
)
30
30
31
+ const (
32
+ DefaultInsertConcurrency = 4
33
+ )
34
+
31
35
var runCmd = & cli.Command {
32
36
Name : "run" ,
33
37
Subcommands : []* cli.Command {
@@ -104,6 +108,11 @@ var yugabyteCmd = &cli.Command{
104
108
Usage : "postgres connect string eg 'postgresql://postgres:postgres@localhost'" ,
105
109
Required : true ,
106
110
},
111
+ & cli.IntFlag {
112
+ Name : "insert-concurrency" ,
113
+ Usage : "the number of concurrent tasks that each add index operation is split into" ,
114
+ Value : DefaultInsertConcurrency ,
115
+ },
107
116
& cli.IntFlag {
108
117
Name : "CQLTimeout" ,
109
118
Usage : "client timeout value in seconds for CQL queries" ,
@@ -115,9 +124,10 @@ var yugabyteCmd = &cli.Command{
115
124
Action : func (cctx * cli.Context ) error {
116
125
// Create a yugabyte data service
117
126
settings := yugabyte.DBSettings {
118
- Hosts : cctx .StringSlice ("hosts" ),
119
- ConnectString : cctx .String ("connect-string" ),
120
- CQLTimeout : cctx .Int ("CQLTimeout" ),
127
+ Hosts : cctx .StringSlice ("hosts" ),
128
+ ConnectString : cctx .String ("connect-string" ),
129
+ CQLTimeout : cctx .Int ("CQLTimeout" ),
130
+ InsertConcurrency : cctx .Int ("insert-concurrency" ),
121
131
}
122
132
123
133
// One of the migrations requires a miner address. But we don't want to
@@ -223,6 +233,11 @@ var yugabyteMigrateCmd = &cli.Command{
223
233
Name : "miner-address" ,
224
234
Usage : "default miner address eg f1234" ,
225
235
},
236
+ & cli.IntFlag {
237
+ Name : "insert-concurrency" ,
238
+ Usage : "the number of concurrent tasks that each add index operation is split into" ,
239
+ Value : DefaultInsertConcurrency ,
240
+ },
226
241
& cli.IntFlag {
227
242
Name : "CQLTimeout" ,
228
243
Usage : "client timeout value in seconds for CQL queries" ,
@@ -236,9 +251,10 @@ var yugabyteMigrateCmd = &cli.Command{
236
251
237
252
// Create a yugabyte data service
238
253
settings := yugabyte.DBSettings {
239
- Hosts : cctx .StringSlice ("hosts" ),
240
- ConnectString : cctx .String ("connect-string" ),
241
- CQLTimeout : cctx .Int ("CQLTimeout" ),
254
+ Hosts : cctx .StringSlice ("hosts" ),
255
+ ConnectString : cctx .String ("connect-string" ),
256
+ CQLTimeout : cctx .Int ("CQLTimeout" ),
257
+ InsertConcurrency : cctx .Int ("insert-concurrency" ),
242
258
}
243
259
244
260
maddr := migrations .DisabledMinerAddr
@@ -280,6 +296,11 @@ var yugabyteAddIndexCmd = &cli.Command{
280
296
Usage : "filename must be same as pieceCID" ,
281
297
Required : true ,
282
298
},
299
+ & cli.IntFlag {
300
+ Name : "insert-concurrency" ,
301
+ Usage : "the number of concurrent tasks that each add index operation is split into" ,
302
+ Value : DefaultInsertConcurrency ,
303
+ },
283
304
& cli.IntFlag {
284
305
Name : "CQLTimeout" ,
285
306
Usage : "client timeout value in seconds for CQL queries" ,
@@ -292,9 +313,10 @@ var yugabyteAddIndexCmd = &cli.Command{
292
313
293
314
// Create a yugabyte data service
294
315
settings := yugabyte.DBSettings {
295
- Hosts : cctx .StringSlice ("hosts" ),
296
- ConnectString : cctx .String ("connect-string" ),
297
- CQLTimeout : cctx .Int ("CQLTimeout" ),
316
+ Hosts : cctx .StringSlice ("hosts" ),
317
+ ConnectString : cctx .String ("connect-string" ),
318
+ CQLTimeout : cctx .Int ("CQLTimeout" ),
319
+ InsertConcurrency : cctx .Int ("insert-concurrency" ),
298
320
}
299
321
300
322
migrator := yugabyte .NewMigrator (settings , migrations .DisabledMinerAddr )
0 commit comments