Skip to content

Commit

Permalink
Update main.go
Browse files Browse the repository at this point in the history
  • Loading branch information
wk989898 authored Mar 7, 2025
1 parent 56fa563 commit 13dfa9b
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions tests/integration_tests/multi_source/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,6 @@ func ignoreableError(err error) bool {
knownErrorList := []string{
"Error 1146", // table doesn't exist
"Error 1049", // database doesn't exist
"Error 1062", // Duplicate entr
}
for _, e := range knownErrorList {
if strings.HasPrefix(err.Error(), e) {
Expand All @@ -240,10 +239,11 @@ func dml(ctx context.Context, db *sql.DB, table string, id int) {
var i int
var insertSuccess int
var deleteSuccess int
insertSQL := fmt.Sprintf("insert into test.`%s`(id1, id2) values(?,?)", table)
insertSQL := fmt.Sprintf("insert into test.`%s`(id, id1, id2) values(?,?,?)", table)
deleteSQL := fmt.Sprintf("delete from test.`%s` where id1 = ? or id2 = ?", table)
k := 100000000
for i = 0; ; i++ {
_, err = db.Exec(insertSQL, i+id*100000000, i+id*100000000+1)
_, err = db.Exec(insertSQL, i+id*k, i+id*k, i+id*k+1)
if err == nil {
insertSuccess++
if insertSuccess%100 == 0 {
Expand All @@ -255,7 +255,7 @@ func dml(ctx context.Context, db *sql.DB, table string, id int) {
}

if i%2 == 0 {
result, err := db.Exec(deleteSQL, i+id*100000000, i+id*100000000+1)
result, err := db.Exec(deleteSQL, i+id*k, i+id*k+1)
if err == nil {
rows, _ := result.RowsAffected()
if rows != 0 {
Expand Down Expand Up @@ -411,6 +411,7 @@ const (
createTableSQL = `
create table if not exists test.%s
(
id int primary key,
id1 int unique key not null,
id2 int unique key not null,
v1 int default null
Expand Down

0 comments on commit 13dfa9b

Please sign in to comment.