@ -609,8 +609,8 @@ public class BackupJob extends AbstractJob {
|
||||
}
|
||||
}
|
||||
|
||||
LOG.info("snapshot for partition {}, version: {}",
|
||||
partition.getId(), visibleVersion);
|
||||
LOG.info("snapshot for partition {}, version: {}, job: {}",
|
||||
partition.getId(), visibleVersion, label);
|
||||
}
|
||||
return Status.OK;
|
||||
}
|
||||
|
||||
@ -744,7 +744,8 @@ public class RestoreJob extends AbstractJob {
|
||||
}
|
||||
|
||||
// reset all ids in this table
|
||||
Status st = remoteOlapTbl.resetIdsForRestore(env, db, replicaAlloc, reserveReplica);
|
||||
String srcDbName = jobInfo.dbName;
|
||||
Status st = remoteOlapTbl.resetIdsForRestore(env, db, replicaAlloc, reserveReplica, srcDbName);
|
||||
if (!st.ok()) {
|
||||
status = st;
|
||||
return;
|
||||
|
||||
@ -122,8 +122,15 @@ public class MaterializedIndexMeta implements Writable, GsonPostProcessable {
|
||||
return indexId;
|
||||
}
|
||||
|
||||
public void resetIndexIdForRestore(long id) {
|
||||
public void resetIndexIdForRestore(long id, String srcDbName, String dbName) {
|
||||
indexId = id;
|
||||
|
||||
// the source db name is not setted in old BackupMeta, keep compatible with the old one.
|
||||
// See InitMaterializationContextHook.java:createSyncMvContexts for details.
|
||||
if (defineStmt != null && srcDbName != null) {
|
||||
String newStmt = defineStmt.originStmt.replaceAll(srcDbName, dbName);
|
||||
defineStmt = new OriginStatement(newStmt, defineStmt.idx);
|
||||
}
|
||||
}
|
||||
|
||||
public KeysType getKeysType() {
|
||||
|
||||
@ -578,7 +578,7 @@ public class OlapTable extends Table implements MTMVRelatedTableIf {
|
||||
}
|
||||
|
||||
public Status resetIdsForRestore(Env env, Database db, ReplicaAllocation restoreReplicaAlloc,
|
||||
boolean reserveReplica) {
|
||||
boolean reserveReplica, String srcDbName) {
|
||||
// ATTN: The meta of the restore may come from different clusters, so the
|
||||
// original ID in the meta may conflict with the ID of the new cluster. For
|
||||
// example, if a newly allocated ID happens to be the same as an original ID,
|
||||
@ -604,7 +604,7 @@ public class OlapTable extends Table implements MTMVRelatedTableIf {
|
||||
baseIndexId = newIdxId;
|
||||
}
|
||||
MaterializedIndexMeta indexMeta = origIdxIdToMeta.get(entry.getKey());
|
||||
indexMeta.resetIndexIdForRestore(newIdxId);
|
||||
indexMeta.resetIndexIdForRestore(newIdxId, srcDbName, db.getFullName());
|
||||
indexIdToMeta.put(newIdxId, indexMeta);
|
||||
indexNameToId.put(entry.getValue(), newIdxId);
|
||||
}
|
||||
@ -1603,7 +1603,7 @@ public class OlapTable extends Table implements MTMVRelatedTableIf {
|
||||
LOG.warn("HACK: the index id {} in materialized index meta of {} is not equals"
|
||||
+ " to the index saved in table {} ({}), reset it to {}",
|
||||
indexMeta.getIndexId(), indexName, name, id, indexId);
|
||||
indexMeta.resetIndexIdForRestore(indexId);
|
||||
indexMeta.resetIndexIdForRestore(indexId, null, null);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user