Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,14 @@ Config your database and Databend connection in `config/conf.json`:
"sourcePort": 3306,
"sourceUser": "root",
"sourcePass": "123456",
"sourceDbTables": ["mydb.*@table.*"],
"sourceQuery": "select * from mydb.my_table",
"sourceWhereCondition": "id < 100",
"sourceDbTables": ["mydb.*@test_table.*"],
"sourceWhereCondition": "id > 0",
"sourceSplitKey": "id",
"databendDSN": "http://username:password@host:port",
"databendTable": "testSync.my_table",
"batchSize": 20000,
"databendTable": "mydb.test_table3",
"batchSize": 40000,
"batchMaxInterval": 30,
"workers": 1,
"maxThread": 5,
"copyPurge": true,
"copyForce": false,
"disableVariantCheck": true,
Expand Down
23 changes: 11 additions & 12 deletions config/conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,17 @@
"sourcePort": 3306,
"sourceUser": "root",
"sourcePass": "123456",
"sourceDB": "mydb",
"sourceTable": "my_table2",
"sourceQuery": "select * from mydb.my_table2",
"sourceWhereCondition": "t1 >= '2024-06-01' and t1 < '2024-07-01'",
"sourceSplitKey": "",
"sourceSplitTimeKey": "t1",
"timeSplitUnit": "minute",
"databendDSN": "https://cloudapp:password@tn3ftqihs--medium-p8at.gw.aws-us-east-2.default.databend.com:443",
"databendTable": "testSync.my_table2",
"batchSize": 2,
"batchMaxInterval": 30,
"sourceDbTables": ["mydb.*@test_table.*"],
"sourceWhereCondition": "id > 0",
"sourceSplitKey": "id",
"databendDSN": "https://user:password@host:8000",
"databendTable": "mydb.test_table3",
"batchSize": 40000,
"batchMaxInterval": 3,
"copyPurge": true,
"copyForce": false,
"disableVariantCheck": true,
"userStage": "~",
"deleteAfterSync": false,
"maxThread": 10
"maxThread": 5
}
3 changes: 3 additions & 0 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,9 @@ func preCheckConfig(cfg *Config) {
if cfg.UserStage == "" {
cfg.UserStage = "~"
}
if cfg.MaxThread == 0 {
cfg.MaxThread = 1
}
if cfg.SourceSplitKey != "" && cfg.SourceSplitTimeKey != "" {
panic("cannot set both sourceSplitKey and sourceSplitTimeKey")
}
Expand Down
4 changes: 1 addition & 3 deletions source/mysql.go
Original file line number Diff line number Diff line change
Expand Up @@ -289,11 +289,9 @@ func (s *MysqlSource) GetDatabasesAccordingToSourceDbRegex(sourceDatabasePattern
return nil, err
}
if match {
fmt.Println("match db: ", database)
databases = append(databases, database)
} else {
fmt.Println("not match db: ", database)
}

}
return databases, nil
}
Expand Down
3 changes: 0 additions & 3 deletions source/sql_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -416,10 +416,7 @@ func (s *SQLServerSource) GetDatabasesAccordingToSourceDbRegex(sourceDatabasePat
}

if match {
fmt.Println("match db:", database)
databases = append(databases, database)
} else {
fmt.Println("not match db:", database)
}
}

Expand Down