Skip to content

Commit 49a7015

Browse files
authored
Merge pull request #67 from databendcloud/fix/remove-print
fix: some bug fix
2 parents 007667d + fbe58ae commit 49a7015

File tree

5 files changed

+20
-24
lines changed

5 files changed

+20
-24
lines changed

README.md

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,14 @@ Config your database and Databend connection in `config/conf.json`:
2525
"sourcePort": 3306,
2626
"sourceUser": "root",
2727
"sourcePass": "123456",
28-
"sourceDbTables": ["mydb.*@table.*"],
29-
"sourceQuery": "select * from mydb.my_table",
30-
"sourceWhereCondition": "id < 100",
28+
"sourceDbTables": ["mydb.*@test_table.*"],
29+
"sourceWhereCondition": "id > 0",
3130
"sourceSplitKey": "id",
3231
"databendDSN": "http://username:password@host:port",
33-
"databendTable": "testSync.my_table",
34-
"batchSize": 20000,
32+
"databendTable": "mydb.test_table3",
33+
"batchSize": 40000,
3534
"batchMaxInterval": 30,
36-
"workers": 1,
35+
"maxThread": 5,
3736
"copyPurge": true,
3837
"copyForce": false,
3938
"disableVariantCheck": true,

config/conf.json

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,17 @@
33
"sourcePort": 3306,
44
"sourceUser": "root",
55
"sourcePass": "123456",
6-
"sourceDB": "mydb",
7-
"sourceTable": "my_table2",
8-
"sourceQuery": "select * from mydb.my_table2",
9-
"sourceWhereCondition": "t1 >= '2024-06-01' and t1 < '2024-07-01'",
10-
"sourceSplitKey": "",
11-
"sourceSplitTimeKey": "t1",
12-
"timeSplitUnit": "minute",
13-
"databendDSN": "https://cloudapp:password@tn3ftqihs--medium-p8at.gw.aws-us-east-2.default.databend.com:443",
14-
"databendTable": "testSync.my_table2",
15-
"batchSize": 2,
16-
"batchMaxInterval": 30,
6+
"sourceDbTables": ["mydb.*@test_table.*"],
7+
"sourceWhereCondition": "id > 0",
8+
"sourceSplitKey": "id",
9+
"databendDSN": "https://user:password@host:8000",
10+
"databendTable": "mydb.test_table3",
11+
"batchSize": 40000,
12+
"batchMaxInterval": 3,
13+
"copyPurge": true,
14+
"copyForce": false,
15+
"disableVariantCheck": true,
1716
"userStage": "~",
1817
"deleteAfterSync": false,
19-
"maxThread": 10
18+
"maxThread": 5
2019
}

config/config.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,9 @@ func preCheckConfig(cfg *Config) {
9191
if cfg.UserStage == "" {
9292
cfg.UserStage = "~"
9393
}
94+
if cfg.MaxThread == 0 {
95+
cfg.MaxThread = 1
96+
}
9497
if cfg.SourceSplitKey != "" && cfg.SourceSplitTimeKey != "" {
9598
panic("cannot set both sourceSplitKey and sourceSplitTimeKey")
9699
}

source/mysql.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -289,11 +289,9 @@ func (s *MysqlSource) GetDatabasesAccordingToSourceDbRegex(sourceDatabasePattern
289289
return nil, err
290290
}
291291
if match {
292-
fmt.Println("match db: ", database)
293292
databases = append(databases, database)
294-
} else {
295-
fmt.Println("not match db: ", database)
296293
}
294+
297295
}
298296
return databases, nil
299297
}

source/sql_server.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -416,10 +416,7 @@ func (s *SQLServerSource) GetDatabasesAccordingToSourceDbRegex(sourceDatabasePat
416416
}
417417

418418
if match {
419-
fmt.Println("match db:", database)
420419
databases = append(databases, database)
421-
} else {
422-
fmt.Println("not match db:", database)
423420
}
424421
}
425422

0 commit comments

Comments
 (0)