[fix](meta) remove default_cluster prefix in recover db log (#30350)

This commit is contained in:
Mingyu Chen
2024-01-25 14:30:53 +08:00
committed by yiguolei
parent 9174ac921b
commit e8a20d8899
3 changed files with 11 additions and 7 deletions

View File

@ -216,7 +216,8 @@ public class Database extends MetaObject implements Writable, DatabaseIf<Table>
public void setNameWithLock(String newName) {
writeLock();
try {
this.fullQualifiedName = newName;
// ClusterNamespace.getNameFromFullName should be removed in 3.0
this.fullQualifiedName = ClusterNamespace.getNameFromFullName(newName);
for (Table table : idToTable.values()) {
table.setQualifiedDbName(fullQualifiedName);
}

View File

@ -649,7 +649,7 @@ public class InternalCatalog implements CatalogIf<Database> {
String tableName = recoverStmt.getTableName();
String newTableName = recoverStmt.getNewTableName();
Database db = (Database) getDbOrDdlException(dbName);
Database db = getDbOrDdlException(dbName);
db.writeLockOrDdlException();
try {
if (Strings.isNullOrEmpty(newTableName)) {
@ -698,10 +698,6 @@ public class InternalCatalog implements CatalogIf<Database> {
}
}
public void replayEraseDatabase(long dbId) throws DdlException {
Env.getCurrentRecycleBin().replayEraseDatabase(dbId);
}
public void replayRecoverDatabase(RecoverInfo info) {
long dbId = info.getDbId();
String newDbName = info.getNewDbName();

View File

@ -18,9 +18,11 @@
package org.apache.doris.persist;
import org.apache.doris.catalog.Env;
import org.apache.doris.cluster.ClusterNamespace;
import org.apache.doris.common.FeMetaVersion;
import org.apache.doris.common.io.Text;
import org.apache.doris.common.io.Writable;
import org.apache.doris.persist.gson.GsonPostProcessable;
import org.apache.doris.persist.gson.GsonUtils;
import com.google.gson.annotations.SerializedName;
@ -29,7 +31,7 @@ import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;
public class RecoverInfo implements Writable {
public class RecoverInfo implements Writable, GsonPostProcessable {
@SerializedName(value = "dbId")
private long dbId;
@SerializedName(value = "newDbName")
@ -102,4 +104,9 @@ public class RecoverInfo implements Writable {
tableId = in.readLong();
partitionId = in.readLong();
}
@Override
public void gsonPostProcess() throws IOException {
newDbName = ClusterNamespace.getNameFromFullName(newDbName);
}
}