@@ -224,6 +224,9 @@ public enum RestoreJobState {
224224 @ SerializedName ("prop" )
225225 private Map <String , String > properties = Maps .newHashMap ();
226226
227+ @ SerializedName ("resbinlog" )
228+ private RestoreBinlogInfo restoreBinlogInfo = null ; // only set in FinishedCase.
229+
227230 private MarkedCountDownLatch <Long , Long > createReplicaTasksLatch = null ;
228231
229232 public RestoreJob () {
@@ -424,6 +427,10 @@ public boolean isFinished() {
424427 return state == RestoreJobState .FINISHED ;
425428 }
426429
430+ public RestoreBinlogInfo getRestoreBinlogInfo () {
431+ return restoreBinlogInfo ;
432+ }
433+
427434 @ Override
428435 public synchronized Status updateRepo (Repository repo ) {
429436 this .repo = repo ;
@@ -2097,6 +2104,7 @@ private Status allTabletCommitted(boolean isReplay) {
20972104 return new Status (ErrCode .NOT_FOUND , "database " + dbId + " does not exist" );
20982105 }
20992106
2107+ restoreBinlogInfo = new RestoreBinlogInfo (dbId , db .getName ());
21002108 // replace the origin tables in atomic.
21012109 if (isAtomicRestore ) {
21022110 Status st = atomicReplaceOlapTables (db , isReplay );
@@ -2113,6 +2121,9 @@ private Status allTabletCommitted(boolean isReplay) {
21132121 if (tbl == null ) {
21142122 continue ;
21152123 }
2124+ //just restore existing table, then version will change.
2125+ // so we need to write bin log for those tables also.
2126+ restoreBinlogInfo .addTableInfo (tbl .getId (), tbl .getName ());
21162127 OlapTable olapTbl = (OlapTable ) tbl ;
21172128 if (!tbl .writeLockIfExist ()) {
21182129 continue ;
@@ -2158,6 +2169,7 @@ private Status allTabletCommitted(boolean isReplay) {
21582169 }
21592170
21602171 if (!isReplay ) {
2172+ restoredTbls .stream ().forEach (tbl -> restoreBinlogInfo .addTableInfo (tbl .getId (), tbl .getName ()));
21612173 restoredPartitions .clear ();
21622174 restoredTbls .clear ();
21632175 restoredResources .clear ();
@@ -2173,9 +2185,9 @@ private Status allTabletCommitted(boolean isReplay) {
21732185 state = RestoreJobState .FINISHED ;
21742186
21752187 env .getEditLog ().logRestoreJob (this );
2176-
21772188 // Only send release snapshot tasks after the job is finished.
21782189 releaseSnapshots (savedSnapshotInfos );
2190+ restoreBinlogInfo = null ;
21792191 }
21802192
21812193 LOG .info ("job is finished. is replay: {}. {}" , isReplay , this );
0 commit comments