-
Notifications
You must be signed in to change notification settings - Fork 279
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix handle empty startTs/endTs (#21060)
fix handle empty startTs/endTs Approved by: @daviszhen
- Loading branch information
Showing
3 changed files
with
64 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -404,6 +404,10 @@ func Test_handleCreateCdc(t *testing.T) { | |
fmt.Sprintf("%d", cdc2.DefaultMaxSqlLength), | ||
cdc2.SendSqlTimeout, | ||
cdc2.DefaultSendSqlTimeout, | ||
cdc2.StartTs, | ||
"2025-01-03 15:20:00", | ||
cdc2.EndTs, | ||
"2025-01-03 16:20:00", | ||
}, | ||
} | ||
|
||
|
@@ -449,6 +453,51 @@ func Test_handleCreateCdc(t *testing.T) { | |
} | ||
} | ||
|
||
func Test_doCreateCdc_invalidStartTs(t *testing.T) { | ||
ctrl := gomock.NewController(t) | ||
defer ctrl.Finish() | ||
|
||
ses := newTestSession(t, ctrl) | ||
defer ses.Close() | ||
|
||
pu := config.ParameterUnit{} | ||
pu.TaskService = &testTaskService{} | ||
setPu("", &pu) | ||
|
||
stubCheckPitr := gostub.Stub(&checkPitr, func(ctx context.Context, bh BackgroundExec, accName string, pts *cdc2.PatternTuples) error { | ||
return nil | ||
}) | ||
defer stubCheckPitr.Reset() | ||
|
||
create := &tree.CreateCDC{ | ||
IfNotExists: false, | ||
TaskName: "task1", | ||
SourceUri: "mysql://root:[email protected]:6001", | ||
SinkType: cdc2.MysqlSink, | ||
SinkUri: "mysql://root:[email protected]:3306", | ||
Tables: "db1.t1:db1.t1,db1.t2", | ||
Option: []string{ | ||
"Level", | ||
cdc2.TableLevel, | ||
"Account", | ||
sysAccountName, | ||
"Exclude", | ||
"db2.t3,db2.t4", | ||
cdc2.InitSnapshotSplitTxn, | ||
"false", | ||
cdc2.MaxSqlLength, | ||
fmt.Sprintf("%d", cdc2.DefaultMaxSqlLength), | ||
cdc2.SendSqlTimeout, | ||
cdc2.DefaultSendSqlTimeout, | ||
cdc2.StartTs, | ||
"123456", | ||
}, | ||
} | ||
|
||
err := doCreateCdc(context.Background(), ses, create) | ||
assert.Error(t, err) | ||
} | ||
|
||
type testTaskData struct { | ||
metadata task.TaskMetadata | ||
details *task.Details | ||
|