Skip to content

[Enhancement] add support for restore to ccr #303

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 358 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
358 commits
Select commit Hold shift + click to select a range
0c9303e
Fix case db_sync by send TEST_* query to target (#52)
w41ter Mar 22, 2024
27e3769
Fix case db_sync by send TEST_* query to target (#55)
w41ter Apr 7, 2024
483833d
fix sync db error when table name is keyword (#53)
lsy3993 Apr 7, 2024
b9b9645
add option to start pprof server (#51)
lsy3993 Apr 8, 2024
9b90f28
skip view when set binlog.enable (#50)
lsy3993 Apr 8, 2024
4e93f0f
Make the constants configurable (#49)
ButterBright Apr 8, 2024
daf36c8
fix start helper parameter (#57)
lsy3993 Apr 15, 2024
19ea40f
Add golang workflows
w41ter Apr 16, 2024
98dd622
Drop the table if restore is cancelled by signature not matched (#58)
w41ter Apr 16, 2024
b664229
Update changelog after 2.0.3.8
w41ter Apr 16, 2024
7b79d5b
Fix bloomfilter index case by wait add index finish (#56)
w41ter Apr 10, 2024
1753338
Fix materialized view
w41ter Apr 10, 2024
40904a6
fix table key word (#60)
lsy3993 Apr 17, 2024
420c7e1
fix syntax of auto partition in db sync test (#61)
lsy3993 Apr 22, 2024
b4f8b38
Add tarball target
w41ter Apr 23, 2024
fde26c0
Release 2.0.3.9
w41ter Apr 23, 2024
74262cd
Add LICENSE (#63)
w41ter Apr 24, 2024
a661efc
Save key time point for ccr job progress (#64)
w41ter Apr 26, 2024
3e18d2c
Fix keyword name in ADD PARTITION (#65)
w41ter Apr 26, 2024
510fc4e
Fix drop table with keyword (#67)
w41ter Apr 28, 2024
5662c81
Fix drop table keyword name if table schema conflicts (#68)
w41ter Apr 28, 2024
852a5a2
Fix test keyword name test (#69)
w41ter Apr 28, 2024
0fc2e5a
create a handler to view job details (#66)
lsy3993 Apr 28, 2024
e4e6559
Fix test inverted index (#70)
w41ter Apr 28, 2024
211ba02
Fix keyword name in job.go (#71)
w41ter Apr 28, 2024
dea2407
create a handler can get job progress (#72)
lsy3993 Apr 29, 2024
ea69bb7
Avoid restart full sync when network interrupt or process crash (#75)
w41ter May 10, 2024
a4c3ce9
Update CHANGELOG for 2.1.3
w41ter May 10, 2024
0411b34
Add platform as tarball suffix
w41ter May 9, 2024
dfce7d3
Add drop partition usercase
w41ter May 11, 2024
32f1d78
add more desc about operations (#78)
lsy3993 May 14, 2024
39d9f8d
Add postgresql as meta db (#77)
lsy3993 May 15, 2024
a67562f
Fix job progress key time point (#80)
w41ter May 22, 2024
44f2e27
Fix request redirection (#81)
lsy3993 May 22, 2024
e5e798f
Fix could not found partition id after drop partition (#82)
w41ter May 22, 2024
582dd5b
add ccr variant case (#83)
XueYuhai May 23, 2024
a7a12b3
add mtmv case (#84)
lsy3993 May 23, 2024
d8fb587
Move sql related operations into Specer (#85)
w41ter May 24, 2024
884c455
Fix binlog lost (#86)
w41ter May 24, 2024
dc2ab91
Fix add partition sql and add adding partition tests (#88)
w41ter May 27, 2024
8f0fc94
Add adding partition test (#89)
w41ter May 27, 2024
0596437
remove mtmv case (#90)
lsy3993 May 28, 2024
bcf5f86
add acid case (#87)
lsy3993 May 28, 2024
3c6d538
Save prev commit seq if progress is done (#91)
w41ter May 28, 2024
fc78926
Correct add list partition sql (#92)
w41ter May 28, 2024
3a559fa
fix acid case (#93)
lsy3993 May 29, 2024
00af580
Change default connect & rpc timeout to 10s,30s (#94)
w41ter May 29, 2024
fc4ad23
add connect and rpc timeout in start (#95)
lsy3993 May 29, 2024
f9d08d2
remove acid table test (#96)
lsy3993 May 29, 2024
ad24a53
Filter temp partition upserts and add insert overwrite case (#97)
w41ter May 30, 2024
a5d1e9c
Fix add partition case (#98)
w41ter May 30, 2024
ac1b294
Fix add partition sql (#99)
w41ter May 30, 2024
fb3b790
Fix insert overwrite cases (#101)
w41ter Jun 3, 2024
61d6de3
fix create/drop view bug (#100)
lsy3993 Jun 3, 2024
290069a
Remove useless CreateTable (#102)
w41ter Jun 3, 2024
d583e07
Log snapshot meta size (#103)
w41ter Jun 4, 2024
34c3bd2
Check backup/restore state for test insert overwrite case (#105)
w41ter Jun 6, 2024
5f958af
Update CHANGELOG.md (#110)
w41ter Jun 12, 2024
f4635e1
add view and mv case (#104)
lsy3993 Jun 12, 2024
859c5ba
filter dropped table when restore (#115)
lsy3993 Jun 14, 2024
7356824
fix view case (#116)
lsy3993 Jun 18, 2024
8b7449a
Fix add partition case by check the partition item (#118)
w41ter Jul 5, 2024
f801ce9
Filter dropped partitions instead of fullsync (#117)
w41ter Jul 5, 2024
1459383
Make AddPartition record compatibile with alternative json name (#121)
w41ter Jul 15, 2024
caa48f3
Refactor suites layout (#122)
w41ter Jul 16, 2024
9302591
get jobs from GetAllData (#120)
lsy3993 Jul 16, 2024
abfb6e9
Filter dropped tables (#123)
w41ter Jul 18, 2024
730237f
Update CHANGELOG.md
w41ter Jul 30, 2024
3081c2c
Check job state before update progress (#124)
w41ter Aug 1, 2024
7e316dc
Support partial snapshot to reduce fullsync overhead (#125)
w41ter Aug 5, 2024
fc46820
fix no lag when get_lag successed (#126)
lsy3993 Aug 7, 2024
1f87be0
Fix replace partial partition test case assert content (#127)
w41ter Aug 7, 2024
c3d5310
Fix cases (#129)
w41ter Aug 9, 2024
3ab568e
Restore snapshot with clean_restore during fullsync (#128)
w41ter Aug 14, 2024
1d1c3cf
use full argument (#130)
lsy3993 Aug 15, 2024
38bc863
Fix incorrect table mapping for dropped tables (#132)
w41ter Aug 19, 2024
dc23b3b
Improve binlog logs (#133)
w41ter Aug 19, 2024
9ed2a6a
Fix downstream db in suites (#134)
w41ter Aug 20, 2024
13ff5d6
Improve ci action (#135)
w41ter Aug 20, 2024
970396b
SHOW RESTORE RESULT
w41ter Aug 22, 2024
5745199
Allow create ccr job even if the target table alrady exists (#136)
w41ter Aug 22, 2024
e560ad6
Move table to recycle bin if the signature is not matched (#137)
w41ter Aug 22, 2024
e233730
Update CHANGELOG.md
w41ter Aug 28, 2024
8db51f3
Add schema change detail cases (#143)
w41ter Aug 29, 2024
b3dc980
Add partial sync table name check (#144)
w41ter Aug 29, 2024
45ae400
Make clearing meta cache clearer (#145)
w41ter Aug 30, 2024
142f94b
Support partial sync with table alias (#148)
w41ter Sep 2, 2024
568c299
Fix job progress test (#150)
w41ter Sep 5, 2024
4cb9481
Add allow_table_exists test (#146)
w41ter Sep 5, 2024
55491a5
Fix creating view and getting views related to specific table (#149)
smallx Sep 5, 2024
4618de6
Support partial sync during schema change (#151)
w41ter Sep 9, 2024
f75dbc0
Support rename operator (#147)
lsy3993 Sep 9, 2024
d9dbcc3
Drop view if the schema is not matched (#152)
w41ter Sep 9, 2024
9abad4c
Disable clean tables & partitions by default (#153)
w41ter Sep 9, 2024
23027cc
Fix test_add_partition case (#154)
w41ter Sep 9, 2024
fa6d54e
Skip variant test in doris 2.0 (#155)
w41ter Sep 9, 2024
bd3e043
Skip inverted index with unique mor value (#156)
w41ter Sep 9, 2024
410f7f3
Skip some cases doris 2.0 not supported yet (#157)
w41ter Sep 9, 2024
8f29331
Skip db sync rename table in 2.0/2.1 (#158)
w41ter Sep 9, 2024
1f5acc0
Make schema change cases compatible with 2.0 (#159)
w41ter Sep 9, 2024
8e15f6c
Skip AUTO PARTITION in doris 2.0 (#160)
w41ter Sep 9, 2024
d52207b
Allow table exists not support 2.1
w41ter Sep 9, 2024
758c8ee
Delete sync job before test keyword name
w41ter Sep 9, 2024
f3ebc2b
2.0 not support INSERT OVERWRITE yet
w41ter Sep 9, 2024
83534df
2.0 default value has \"\"
w41ter Sep 9, 2024
69a5fcd
Fix view already exists
w41ter Sep 9, 2024
39b35e8
Delete job first for db sync suites
w41ter Sep 9, 2024
f47fb3a
Fix test keyword name
w41ter Sep 9, 2024
77255ac
Fix view and mv test
w41ter Sep 9, 2024
65dc10a
Disable clean tables & partitions by default (#161)
w41ter Sep 10, 2024
baf8c03
Fix view and mv test
w41ter Sep 10, 2024
955aba3
Handle table not found error during begin txn (#162)
w41ter Sep 11, 2024
8bc7df6
Clear the staled table mapping if dest table is not found (#163)
w41ter Sep 11, 2024
0d12c8d
Rollback job progress when table is not found (#164)
w41ter Sep 11, 2024
509f2b6
Sync thrift with doris master (#165)
w41ter Sep 11, 2024
f0302d0
Add feature atomic restore (#166)
w41ter Sep 11, 2024
a0caa7d
Add force_fullsync http API (#167)
w41ter Sep 12, 2024
8c6fffa
Disable test sync view twice in 2.0/2.1
w41ter Sep 12, 2024
4f2a5a7
Support drop view (#169)
w41ter Sep 14, 2024
426605d
Drop view if it exists before creating table (#170)
w41ter Sep 14, 2024
9472dd4
Fix create table failed message (#171)
w41ter Sep 14, 2024
334ab55
Update CHANGELOG.md
w41ter Sep 14, 2024
749afb3
Simplify regression suites (#172)
w41ter Sep 19, 2024
afef42a
Fix partial snapshot table alias in db sync mode (#173)
w41ter Sep 19, 2024
abaf6c8
Add db replace partition test (#174)
w41ter Sep 19, 2024
334dfe4
Add http api /features to list the feature flags (#175)
w41ter Sep 19, 2024
c7ee793
Fix error when hyphen in table name (#168)
lsy3993 Sep 20, 2024
bd770a7
Fix table alias when handle lightning schema change (#176)
w41ter Sep 20, 2024
605ee9c
Support rename column (#139)
smallx Sep 20, 2024
6907e1c
Add table sync alias case (#177)
w41ter Sep 20, 2024
093c949
Refresh dest table id after partial sync (#178)
w41ter Sep 24, 2024
da78418
Support table alias instead of drop during fullsync (#179)
w41ter Sep 24, 2024
5598acd
Compatible REPLACE_IF_NOT_NULL default value (#180)
w41ter Sep 24, 2024
2b91cda
Add mem/goroutine/jobs monitor (#181)
w41ter Sep 24, 2024
5d5ec61
Log timestamp add milliseconds (#182)
w41ter Sep 24, 2024
50cf547
Fix nil pointer of job.progress (#183)
w41ter Sep 24, 2024
5a69d8f
Filter dropped indexes to avoid META NOT FOUND (#185)
w41ter Sep 25, 2024
ce1ce36
Fix partial sync with incremental data (#186)
w41ter Sep 25, 2024
0b37675
Filter shadow indexes upsert (#187)
w41ter Sep 26, 2024
66ae58d
Update CHANGELOG.md
w41ter Sep 26, 2024
9a9366d
Fix test_column_ops and row_storage case
w41ter Sep 26, 2024
294de2e
Fix test_column_ops test
w41ter Sep 26, 2024
5738a1b
Fix create dropped view (#188)
w41ter Sep 27, 2024
884dda2
Remove useless log
w41ter Sep 27, 2024
754ed09
Update CHANGELOG.md
w41ter Sep 30, 2024
8188433
Enable features
w41ter Sep 30, 2024
36581a8
Fix test_filter_dropped_indexes.groovy
w41ter Sep 30, 2024
1dc1e73
Add db sync truncate table case (#190)
w41ter Oct 9, 2024
ad437ee
Filter the committed binlogs (#191)
w41ter Oct 10, 2024
6eb9b76
Fix test_truncate_table and test_db_sync_signature_not_matched (#192)
w41ter Oct 11, 2024
8b0df43
fix test_db_sync_signature_not_matched (#193)
w41ter Oct 11, 2024
c9fd786
Reduce suites name size (#194)
w41ter Oct 11, 2024
18ff4fe
Limit Backend ingesting concurrency (#195)
w41ter Oct 12, 2024
cc411f7
Add mysql max allowed packet flag (#196)
w41ter Oct 21, 2024
b2859fe
Support modify comment (#140)
smallx Oct 21, 2024
2c6bb5e
Cancel running backup/restore jobs before fullsync (#197)
w41ter Oct 23, 2024
69ac677
Avoid lock job when get job status (#198)
w41ter Oct 23, 2024
2defd4a
Add cancel_conflict_backup_restore_job flag (#199)
w41ter Oct 24, 2024
6062cb7
Cancel restore job only when feature flag open (#200)
w41ter Oct 25, 2024
bffb4b1
Avoid blocking job in full/partial sync (#201)
w41ter Oct 25, 2024
ab3ad19
skip external table when set binlog enable
lsy3993 Oct 28, 2024
2590d49
spell error
lsy3993 Oct 28, 2024
d2d6b6f
Skip unsupported tables during fullsync
w41ter Oct 28, 2024
ff9ee9a
Avoid persisting snapshot job info and meta in job progress (#204)
w41ter Oct 29, 2024
36b71b0
Build table mapping from snapshot job info (#205)
w41ter Oct 30, 2024
0ac7589
Fix fullsync with alias (#207)
w41ter Oct 30, 2024
f660368
Handle the binlogs wrapped in barrier log (#208)
w41ter Oct 31, 2024
d85c59a
Support rename table in 2.0/2.1 (#209)
w41ter Oct 31, 2024
3534ef6
Support rename column in 2.0/2.1 (#210)
w41ter Oct 31, 2024
4188555
Fix infinite loop when backup/restore job failed (#206)
w41ter Oct 31, 2024
c5e99d3
Avoid logging empty db error, wait instead (#211)
w41ter Nov 1, 2024
b8bfa89
Fix add partition with keyword name (#212)
w41ter Nov 1, 2024
b9fdf5b
Skip modify partitions binlog (#213)
w41ter Nov 1, 2024
503dbb7
Fix column ops suite
w41ter Nov 1, 2024
25aec97
Skip tmp partition dropping (#214)
w41ter Nov 1, 2024
33aac76
Remove readOnly option for mysql (#215)
w41ter Nov 4, 2024
00ab124
Reuse the backup/restore task issued by the job itself (#218)
w41ter Nov 6, 2024
f9cca64
Reorg db/table sync suites (#219)
w41ter Nov 6, 2024
290fcc6
Fix test_ts_table_modify_comment case (#222)
w41ter Nov 8, 2024
7f03831
Support compressed snapshot to avoid thrift max message size limitati…
w41ter Nov 11, 2024
d13e2fd
Enable feature_reuse_running_backup_restore_job by default (#224)
w41ter Nov 11, 2024
cde0136
Fix reusing wrong backup/restore job (#226)
w41ter Nov 11, 2024
71239c4
Fix suites (#227)
w41ter Nov 11, 2024
5b934df
Add test for ccr sync rename partition name (#221)
wyxxxcat Nov 12, 2024
322c6a5
[test] Add test for db/tbl sync rename table column(#225)
wyxxxcat Nov 12, 2024
6c1e8b7
Support snapshot expiration (#229)
w41ter Nov 12, 2024
683a210
Fix drop partition with keyword name (#231)
w41ter Nov 12, 2024
2c81c97
Correct use of target_sql (#230)
wyxxxcat Nov 12, 2024
c4bcffd
Fix helper.is_version_supported (#233)
w41ter Nov 13, 2024
94bac01
Avoid using index name to build base index mapping (#235)
w41ter Nov 14, 2024
be2e37a
Add flag to skip rollup binlogs (#236)
w41ter Nov 14, 2024
5a685d3
Fix parallel creating table and fullsync (#237)
w41ter Nov 18, 2024
3dda2ab
Revert "Fix drop partition with keyword name (#231)" (#238)
w41ter Nov 18, 2024
89e2df1
Fix wrong table name dependencies (#239)
w41ter Nov 18, 2024
2c21118
Fix unknown table/partitions in partial snapshot (#240)
w41ter Nov 18, 2024
06a8abb
Skip overwritten tables in partial snapshot (#241)
w41ter Nov 18, 2024
6cc4e2c
Fix wrong test for rename partition (#243)
wyxxxcat Nov 19, 2024
ddae75b
add tests for schema change
wyxxxcat Nov 19, 2024
f738007
Support replace table binlog (#245)
w41ter Nov 19, 2024
2611de7
Check connection error (#247)
w41ter Nov 19, 2024
09b3eea
Filter the drop missing table binlog (#248)
w41ter Nov 19, 2024
bc5ab9f
Support drop view (#138)
smallx Nov 21, 2024
aea0eef
Fix partially committed replace table binlog (#249)
w41ter Nov 21, 2024
3ec9ff2
Support Modify ViewDef binlog (#184)
xiaoming12306 Nov 22, 2024
5c6dff8
Support inverted index binlog (#252)
w41ter Nov 22, 2024
c7d79d1
Add drop view test (#253)
w41ter Nov 22, 2024
9a63f6a
Fix test_cds_tbl_alter_replace (#254)
w41ter Nov 22, 2024
ebf6915
Fix partition dropped in partial snapshot (#255)
w41ter Nov 22, 2024
924e447
Add ts/ds test for tbl model (#244)
wyxxxcat Nov 22, 2024
1c6ed8b
Add ts/ds test for properties partition and bucket (#246)
wyxxxcat Nov 22, 2024
d10a486
Organize index related suites (#256)
w41ter Nov 25, 2024
7fe3be2
Add and drop [ng]bloom filter suites (#257)
w41ter Nov 26, 2024
c49e8e3
Add bloom filter fpp suites (#258)
w41ter Nov 26, 2024
2a4d0c6
Add ts/ds test for table properties (#251)
wyxxxcat Nov 26, 2024
7ee90cc
Support txn insert when table sync (#234)
lsy3993 Nov 26, 2024
36de25a
Add flag to controll txn insert (#259)
w41ter Nov 26, 2024
5554fb3
Fix problem caused by database name too long for test (#260)
wyxxxcat Nov 26, 2024
281cc8c
fix format (#261)
w41ter Nov 26, 2024
ec4aa48
Fix create table if table already exists (#262)
w41ter Nov 27, 2024
c450643
Add docs for ccr regression test (#266)
wyxxxcat Nov 27, 2024
54c405a
Refactor partial snapshot with replace/rename (#267)
w41ter Nov 27, 2024
f1ccabe
Fix incorrect test (#265)
wyxxxcat Nov 27, 2024
57efa0b
Support rename partition/rollup (#268)
w41ter Nov 27, 2024
367b64a
Support add/drop rollup binlogs (#269)
w41ter Nov 27, 2024
300ffae
Fix modify view info/modify comment binlog in barrier log (#270)
w41ter Nov 27, 2024
1f831f0
Add rollup schema change cases (#272)
w41ter Nov 28, 2024
5b0725a
Fix alter view def (#273)
w41ter Nov 28, 2024
4051aa0
[improve] API job_progress shouldn't returns the data field of job pr…
wyxxxcat Nov 28, 2024
37b2cf2
Supplement table property compaction_policy test (#274)
wyxxxcat Nov 28, 2024
a507507
Fix restore with view (#275)
w41ter Nov 28, 2024
904ec71
fix test_ds_mv_basic/test_ds_view_basic (#276)
w41ter Nov 28, 2024
641035b
Fix test_ds_view_basic (#277)
w41ter Nov 28, 2024
3187cbd
Support replace table in table sync (#279)
w41ter Nov 29, 2024
c276db3
Update CHANGELOG.md (#281)
w41ter Nov 29, 2024
98db57a
Retry handle upsert binlog, to fix meta error (#282)
w41ter Nov 29, 2024
ffa995a
Fix wrong infinity partition key in create table sql (#285)
w41ter Dec 2, 2024
7efc7ab
Support create table with agg_state (#286)
w41ter Dec 2, 2024
1638bac
Fix test_ds_tbl_res_agg_state (#287)
w41ter Dec 3, 2024
4d72f8c
Support private IP and public IP (#288)
w41ter Dec 3, 2024
4a1ea02
Update operations.md (#289)
w41ter Dec 3, 2024
a910cf5
Add alter table property for ds/ts test (#264)
wyxxxcat Dec 4, 2024
49a8ca4
Fix spelling mistake (#291)
lsy3993 Dec 5, 2024
1d97afe
Add db incremental sync test for table property (#280)
wyxxxcat Dec 5, 2024
7d49241
Support add/drop multi inverted indexes (#296)
w41ter Dec 6, 2024
a56d056
Fix fullsync commit seq with views (#297)
w41ter Dec 6, 2024
c6f99a1
[TEST] fix error test for ccr (#300)
wyxxxcat Dec 11, 2024
97de4e3
Fix be rpc leaks in rpc factory (#299)
w41ter Dec 11, 2024
a110d63
[feat](binlog) Add Support recover binlog (#284)
Vallishp Dec 11, 2024
8955600
Fix format (#302)
w41ter Dec 11, 2024
b18ce73
[Enhancement] add support for restore to ccr
Vallishp Dec 8, 2024
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
Prev Previous commit
[Enhancement] add support for restore to ccr
  • Loading branch information
Vallishp committed Jan 11, 2025
commit b18ce73bf010da5672817c255c60addc4818d5ec
48 changes: 48 additions & 0 deletions pkg/ccr/job.go
Original file line number Diff line number Diff line change
Expand Up @@ -2609,6 +2609,46 @@ func (j *Job) handleRecoverInfoRecord(commitSeq int64, recoverInfo *record.Recov
return j.newPartialSnapshot(recoverInfo.TableId, recoverInfo.TableName, nil, true)
}

func (j *Job) handleRestoreInfo(binlog *festruct.TBinlog) error {
log.Infof("handle restore info binlog, prevCommitSeq: %d, commitSeq: %d",
j.progress.PrevCommitSeq, j.progress.CommitSeq)

data := binlog.GetData()
restoreInfo, err := record.NewRestoreInfoFromJson(data)
if err != nil {
return err
}
return j.handleRestoreInfoRecord(binlog.GetCommitSeq(), restoreInfo)
}

func (j *Job) handleRestoreInfoRecord(commitSeq int64, restoreInfo *record.RestoreInfo) error {
if len(restoreInfo.TableInfo) != 1 {
// for both table and db sync take a full snapshot.
log.Warnf("Lets do new snapshot")
return j.newSnapshot(commitSeq)
}

if len(restoreInfo.TableInfo) == 1 {
for tableId, tableName := range restoreInfo.TableInfo {
switch j.SyncType {
case TableSync:
log.Warnf("full snapshot, table:%d and name:%s",
tableId, tableName)
return j.newSnapshot(commitSeq)
case DBSync:
log.Warnf("new partial snapshot, table:%d and name:%s",
tableId, tableName)
replace := true // replace the old data to avoid blocking reading
return j.newPartialSnapshot(tableId, tableName, nil, replace)
default:
break
}
}
}
//This is unreachable.
return nil
}

func (j *Job) handleBarrier(binlog *festruct.TBinlog) error {
data := binlog.GetData()
barrierLog, err := record.NewBarrierLogFromJson(data)
Expand Down Expand Up @@ -2693,6 +2733,12 @@ func (j *Job) handleBarrier(binlog *festruct.TBinlog) error {
return err
}
return j.handleRecoverInfoRecord(commitSeq, recoverInfo)
case festruct.TBinlogType_RESTORE_INFO:
restoreInfo, err := record.NewRestoreInfoFromJson(barrierLog.Binlog)
if err != nil {
return err
}
return j.handleRestoreInfoRecord(commitSeq, restoreInfo)
case festruct.TBinlogType_BARRIER:
log.Info("handle barrier binlog, ignore it")
default:
Expand Down Expand Up @@ -2807,6 +2853,8 @@ func (j *Job) handleBinlog(binlog *festruct.TBinlog) error {
return j.handleDropRollup(binlog)
case festruct.TBinlogType_RECOVER_INFO:
return j.handleRecoverInfo(binlog)
case festruct.TBinlogType_RESTORE_INFO:
return j.handleRestoreInfo(binlog)
default:
return xerror.Errorf(xerror.Normal, "unknown binlog type: %v", binlog.GetType())
}
Expand Down
26 changes: 26 additions & 0 deletions pkg/ccr/record/restore_info.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package record

import (
"encoding/json"

"github.com/selectdb/ccr_syncer/pkg/xerror"
)

type RestoreInfo struct {
DbId int64 `json:"dbId"`
DbName string `json:"dbName"`
TableInfo map[int64]string `json:"tableInfo"`
}

func NewRestoreInfoFromJson(data string) (*RestoreInfo, error) {
var restoreInfo RestoreInfo
err := json.Unmarshal([]byte(data), &restoreInfo)
if err != nil {
return nil, xerror.Wrap(err, xerror.Normal, "unmarshal create table error")
}

if restoreInfo.DbId == 0 {
return nil, xerror.Errorf(xerror.Normal, "db id not found")
}
return &restoreInfo, nil
}
12 changes: 6 additions & 6 deletions pkg/rpc/kitex_gen/frontendservice/FrontendService.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions pkg/rpc/thrift/FrontendService.thrift
Original file line number Diff line number Diff line change
Expand Up @@ -1198,6 +1198,7 @@ enum TBinlogType {
RENAME_PARTITION = 22,
DROP_ROLLUP = 23,
RECOVER_INFO = 24,
RESTORE_INFO = 25,
// Keep some IDs for allocation so that when new binlog types are added in the
// future, the changes can be picked back to the old versions without breaking
// compatibility.
Expand All @@ -1213,8 +1214,7 @@ enum TBinlogType {
// MODIFY_XXX = 17,
// MIN_UNKNOWN = 18,
// UNKNOWN_3 = 19,
MIN_UNKNOWN = 25,
UNKNOWN_10 = 26,
MIN_UNKNOWN = 26,
UNKNOWN_11 = 27,
UNKNOWN_12 = 28,
UNKNOWN_13 = 29,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
-- This file is automatically generated. You should know what you did if you want to edit this
-- !sql_source_content --
0 0
0 1
0 2
0 3
0 4
0 5
0 6
0 7
0 8
0 9

-- !target_sql_content --
0 0
0 1
0 2
0 3
0 4
0 5
0 6
0 7
0 8
0 9

Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
-- This file is automatically generated. You should know what you did if you want to edit this
-- !sql_source_content_backup --
0 0
0 1
0 2

-- !target_sql_content_backup --
0 0
0 1
0 2

-- !sql_source_content_new --
0 0
0 1
0 2
9 0
9 1
9 2

-- !target_sql_content_new --
0 0
0 1
0 2
9 0
9 1
9 2

-- !sql_source_content_restore --
0 0
0 1
0 2

-- !target_sql_content_restore --
0 0
0 1
0 2

Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
-- This file is automatically generated. You should know what you did if you want to edit this
-- !sql_source_content --
0 0
0 1
0 2
0 3
0 4
0 5
0 6
0 7
0 8
0 9

-- !target_sql_content --
0 0
0 1
0 2
0 3
0 4
0 5
0 6
0 7
0 8
0 9

-- !sql_source_content --
0 0
0 1
0 2
0 3
0 4
0 5
0 6
0 7
0 8
0 9

-- !target_sql_content --
0 0
0 1
0 2
0 3
0 4
0 5
0 6
0 7
0 8
0 9

69 changes: 69 additions & 0 deletions regression-test/data/table_sync/restore/test_tbl_restore.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
-- This file is automatically generated. You should know what you did if you want to edit this
-- !sql_source_content --
0 0
0 1
0 2
0 3
0 4
0 5
0 6
0 7
0 8
0 9
1 0
1 1
1 2
1 3
1 4
1 5
1 6
1 7
1 8
1 9

-- !target_sql_content --
0 0
0 1
0 2
0 3
0 4
0 5
0 6
0 7
0 8
0 9
1 0
1 1
1 2
1 3
1 4
1 5
1 6
1 7
1 8
1 9

-- !sql_source_content --
0 0
0 1
0 2
0 3
0 4
0 5
0 6
0 7
0 8
0 9

-- !target_sql_content --
0 0
0 1
0 2
0 3
0 4
0 5
0 6
0 7
0 8
0 9

Loading