Skip to content

Commit 654a172

Browse files
authored
drainer/*: use enable-** in 4.0 (pingcap#785)
1 parent cd006ab commit 654a172

File tree

10 files changed

+10
-23
lines changed

10 files changed

+10
-23
lines changed

cmd/drainer/drainer.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ txn-batch = 20
4343
# to get higher throughput by higher concurrent write to the downstream
4444
worker-count = 16
4545

46-
disable-dispatch = false
46+
enable-dispatch = true
4747

4848
# safe mode will split update to delete and insert
4949
safe-mode = false

drainer/config.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,9 @@ type SyncerConfig struct {
7070
DoTables []filter.TableName `toml:"replicate-do-table" json:"replicate-do-table"`
7171
DoDBs []string `toml:"replicate-do-db" json:"replicate-do-db"`
7272
DestDBType string `toml:"db-type" json:"db-type"`
73-
DisableDispatch bool `toml:"disable-dispatch" json:"disable-dispatch"`
73+
EnableDispatch bool `toml:"enable-dispatch" json:"enable-dispatch"`
7474
SafeMode bool `toml:"safe-mode" json:"safe-mode"`
75-
DisableCausality bool `toml:"disable-detect" json:"disable-detect"`
75+
EnableCausality bool `toml:"enable-detect" json:"enable-detect"`
7676
}
7777

7878
// Config holds the configuration of drainer
@@ -129,9 +129,9 @@ func NewConfig() *Config {
129129
fs.StringVar(&cfg.SyncerCfg.IgnoreSchemas, "ignore-schemas", "INFORMATION_SCHEMA,PERFORMANCE_SCHEMA,mysql", "disable sync those schemas")
130130
fs.IntVar(&cfg.SyncerCfg.WorkerCount, "c", 16, "parallel worker count")
131131
fs.StringVar(&cfg.SyncerCfg.DestDBType, "dest-db-type", "mysql", "target db type: mysql or tidb or file or kafka; see syncer section in conf/drainer.toml")
132-
fs.BoolVar(&cfg.SyncerCfg.DisableDispatch, "disable-dispatch", false, "disable dispatching sqls that in one same binlog; if set true, work-count and txn-batch would be useless")
132+
fs.BoolVar(&cfg.SyncerCfg.EnableDispatch, "enable-dispatch", true, "enable dispatching sqls that in one same binlog; if set true, work-count and txn-batch would be useless")
133133
fs.BoolVar(&cfg.SyncerCfg.SafeMode, "safe-mode", false, "enable safe mode to make syncer reentrant")
134-
fs.BoolVar(&cfg.SyncerCfg.DisableCausality, "disable-detect", false, "disable detect causality")
134+
fs.BoolVar(&cfg.SyncerCfg.EnableCausality, "enable-detect", false, "enable detect causality")
135135
fs.IntVar(&maxBinlogItemCount, "cache-binlog-count", defaultBinlogItemCount, "blurry count of binlogs in cache, limit cache size")
136136
fs.IntVar(&cfg.SyncedCheckTime, "synced-check-time", defaultSyncedCheckTime, "if we can't detect new binlog after many minute, we think the all binlog is all synced")
137137
fs.StringVar(new(string), "log-rotate", "", "DEPRECATED")
@@ -205,9 +205,9 @@ func (cfg *Config) Parse(args []string) error {
205205

206206
func (c *SyncerConfig) adjustWorkCount() {
207207
if c.DestDBType == "file" || c.DestDBType == "kafka" {
208-
c.DisableDispatch = true
208+
c.EnableDispatch = false
209209
c.WorkerCount = 1
210-
} else if c.DisableDispatch {
210+
} else if !c.EnableDispatch {
211211
c.WorkerCount = 1
212212
}
213213
}

drainer/config_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,13 +104,13 @@ func (t *testDrainerSuite) TestAdjustConfig(c *C) {
104104
cfg := NewConfig()
105105
cfg.SyncerCfg.DestDBType = "pb"
106106
cfg.SyncerCfg.WorkerCount = 10
107-
cfg.SyncerCfg.DisableDispatch = false
107+
cfg.SyncerCfg.EnableDispatch = true
108108

109109
err := cfg.adjustConfig()
110110
c.Assert(err, IsNil)
111111
c.Assert(cfg.SyncerCfg.DestDBType, Equals, "file")
112112
c.Assert(cfg.SyncerCfg.WorkerCount, Equals, 1)
113-
c.Assert(cfg.SyncerCfg.DisableDispatch, IsTrue)
113+
c.Assert(cfg.SyncerCfg.EnableDispatch, IsFalse)
114114

115115
cfg = NewConfig()
116116
err = cfg.adjustConfig()

tests/binlog/drainer.toml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,6 @@ txn-batch = 200
3333
# work count to execute binlogs
3434
worker-count = 20
3535

36-
disable-dispatch = false
37-
3836
# safe mode will split update to delete and insert
3937
safe-mode = false
4038

tests/filter/drainer.toml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@ txn-batch = 1
2222
# work count to execute binlogs
2323
worker-count = 1
2424

25-
disable-dispatch = false
26-
2725
# safe mode will split update to delete and insert
2826
safe-mode = false
2927

tests/gencol/drainer.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ pd-urls = 'http://127.0.0.1:2379'
66
ignore-schemas = 'INFORMATION_SCHEMA,PERFORMANCE_SCHEMA,mysql'
77
txn-batch = 1
88
worker-count = 1
9-
disable-dispatch = false
109
safe-mode = false
1110
db-type = 'mysql'
1211
replicate-do-db = ['gencol']

tests/kafka/drainer.toml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@ txn-batch = 1
1616
# work count to execute binlogs
1717
worker-count = 1
1818

19-
disable-dispatch = false
20-
2119
# safe mode will split update to delete and insert
2220
safe-mode = false
2321

tests/reparo/drainer.toml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,6 @@ txn-batch = 200
2525
# work count to execute binlogs
2626
worker-count = 20
2727

28-
disable-dispatch = false
29-
3028
# safe mode will split update to delete and insert
3129
safe-mode = false
3230

tests/restart/drainer.toml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,6 @@ txn-batch = 200
2525
# work count to execute binlogs
2626
worker-count = 20
2727

28-
disable-dispatch = false
29-
3028
# safe mode will split update to delete and insert
3129
safe-mode = false
3230

tests/status/drainer.toml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,6 @@ txn-batch = 1
2525
# work count to execute binlogs
2626
worker-count = 1
2727

28-
disable-dispatch = false
29-
3028
# safe mode will split update to delete and insert
3129
safe-mode = false
3230

@@ -36,4 +34,4 @@ db-type = "file"
3634

3735
#[syncer.to]
3836
#dir = "/data/data.drainer"
39-
#compression = "gzip"
37+
#compression = "gzip"

0 commit comments

Comments
 (0)