cherry pick from #40194
This commit is contained in:
@ -1786,7 +1786,7 @@ public class RestoreJob extends AbstractJob {
|
||||
|
||||
// set all restored partition version and version hash
|
||||
// set all tables' state to NORMAL
|
||||
setTableStateToNormal(db, true, isReplay);
|
||||
setTableStateToNormalAndUpdateProperties(db, true, isReplay);
|
||||
for (long tblId : restoredVersionInfo.rowKeySet()) {
|
||||
Table tbl = db.getTableNullable(tblId);
|
||||
if (tbl == null) {
|
||||
@ -2030,7 +2030,7 @@ public class RestoreJob extends AbstractJob {
|
||||
Database db = env.getInternalCatalog().getDbNullable(dbId);
|
||||
if (db != null) {
|
||||
// rollback table's state to NORMAL
|
||||
setTableStateToNormal(db, false, isReplay);
|
||||
setTableStateToNormalAndUpdateProperties(db, false, isReplay);
|
||||
|
||||
// remove restored tbls
|
||||
for (Table restoreTbl : restoredTbls) {
|
||||
@ -2110,7 +2110,7 @@ public class RestoreJob extends AbstractJob {
|
||||
LOG.info("finished to cancel restore job. is replay: {}. {}", isReplay, this);
|
||||
}
|
||||
|
||||
private void setTableStateToNormal(Database db, boolean committed, boolean isReplay) {
|
||||
private void setTableStateToNormalAndUpdateProperties(Database db, boolean committed, boolean isReplay) {
|
||||
for (String tableName : jobInfo.backupOlapTableObjects.keySet()) {
|
||||
Table tbl = db.getTableNullable(jobInfo.getAliasByOriginNameIfSet(tableName));
|
||||
if (tbl == null) {
|
||||
@ -2153,6 +2153,9 @@ public class RestoreJob extends AbstractJob {
|
||||
DynamicPartitionScheduler.LAST_UPDATE_TIME, TimeUtils.getCurrentFormatTime());
|
||||
}
|
||||
}
|
||||
if (committed && isBeingSynced) {
|
||||
olapTbl.setBeingSyncedProperties();
|
||||
}
|
||||
} finally {
|
||||
tbl.writeUnlock();
|
||||
}
|
||||
|
||||
@ -590,17 +590,26 @@ public class OlapTable extends Table implements MTMVRelatedTableIf {
|
||||
tableProperty.resetPropertiesForRestore(reserveDynamicPartitionEnable, reserveReplica, replicaAlloc);
|
||||
}
|
||||
if (isBeingSynced) {
|
||||
TableProperty tableProperty = getOrCreatTableProperty();
|
||||
tableProperty.setIsBeingSynced();
|
||||
tableProperty.removeInvalidProperties();
|
||||
if (isAutoBucket()) {
|
||||
markAutoBucket();
|
||||
}
|
||||
setBeingSyncedProperties();
|
||||
}
|
||||
// remove colocate property.
|
||||
setColocateGroup(null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the related properties when is_being_synced properties is true.
|
||||
*
|
||||
* Some properties, like storage_policy, colocate_with, are not supported by the ccr syncer.
|
||||
*/
|
||||
public void setBeingSyncedProperties() {
|
||||
TableProperty tableProperty = getOrCreatTableProperty();
|
||||
tableProperty.setIsBeingSynced();
|
||||
tableProperty.removeInvalidProperties();
|
||||
if (isAutoBucket()) {
|
||||
markAutoBucket();
|
||||
}
|
||||
}
|
||||
|
||||
public void resetVersionForRestore() {
|
||||
for (Partition partition : idToPartition.values()) {
|
||||
partition.setNextVersion(partition.getVisibleVersion() + 1);
|
||||
|
||||
Reference in New Issue
Block a user