[fix](fe) Fix drop table write too many times editlog (#29966)
This commit is contained in:
@ -903,11 +903,15 @@ public class InternalCatalog implements CatalogIf<Database> {
|
||||
} finally {
|
||||
table.writeUnlock();
|
||||
}
|
||||
DropInfo info = new DropInfo(db.getId(), table.getId(), tableName, -1L, stmt.isForceDrop(), recycleTime);
|
||||
Env.getCurrentEnv().getEditLog().logDropTable(info);
|
||||
|
||||
Env.getCurrentEnv().getQueryStats().clear(Env.getCurrentEnv().getCurrentCatalog().getId(),
|
||||
db.getId(), table.getId());
|
||||
|
||||
Env.getCurrentEnv().getAnalysisManager().removeTableStats(table.getId());
|
||||
|
||||
DropInfo info = new DropInfo(db.getId(), table.getId(), tableName, -1L, stmt.isForceDrop(), recycleTime);
|
||||
Env.getCurrentEnv().getEditLog().logDropTable(info);
|
||||
|
||||
Env.getCurrentEnv().getMtmvService().dropTable(table);
|
||||
} catch (UserException e) {
|
||||
throw new DdlException(e.getMessage(), e.getMysqlErrorCode());
|
||||
@ -944,6 +948,7 @@ public class InternalCatalog implements CatalogIf<Database> {
|
||||
unprotectDropTable(db, table, isForceDrop, true, recycleTime);
|
||||
Env.getCurrentEnv().getQueryStats().clear(Env.getCurrentInternalCatalog().getId(), db.getId(),
|
||||
tableId);
|
||||
Env.getCurrentEnv().getAnalysisManager().removeTableStats(table.getId());
|
||||
} finally {
|
||||
table.writeUnlock();
|
||||
db.writeUnlock();
|
||||
|
||||
@ -1135,7 +1135,9 @@ public class EditLog {
|
||||
break;
|
||||
}
|
||||
case OperationType.OP_DELETE_TABLE_STATS: {
|
||||
env.getAnalysisManager().replayTableStatsDeletion((TableStatsDeletionLog) journal.getData());
|
||||
long tableId = ((TableStatsDeletionLog) journal.getData()).id;
|
||||
LOG.info("replay delete table stat tableId: {}", tableId);
|
||||
Env.getCurrentEnv().getAnalysisManager().removeTableStats(tableId);
|
||||
break;
|
||||
}
|
||||
case OperationType.OP_ALTER_MTMV: {
|
||||
|
||||
@ -46,7 +46,6 @@ import org.apache.doris.common.util.Util;
|
||||
import org.apache.doris.datasource.CatalogIf;
|
||||
import org.apache.doris.mysql.privilege.PrivPredicate;
|
||||
import org.apache.doris.persist.AnalyzeDeletionLog;
|
||||
import org.apache.doris.persist.TableStatsDeletionLog;
|
||||
import org.apache.doris.persist.gson.GsonUtils;
|
||||
import org.apache.doris.qe.ConnectContext;
|
||||
import org.apache.doris.qe.ShowResultSet;
|
||||
@ -1015,17 +1014,8 @@ public class AnalysisManager implements Writable {
|
||||
}
|
||||
}
|
||||
|
||||
public void removeTableStats(long tblId) {
|
||||
if (!idToTblStats.containsKey(tblId)) {
|
||||
return;
|
||||
}
|
||||
TableStatsDeletionLog log = new TableStatsDeletionLog(tblId);
|
||||
Env.getCurrentEnv().getEditLog().logDeleteTableStats(log);
|
||||
replayTableStatsDeletion(log);
|
||||
}
|
||||
|
||||
public void replayTableStatsDeletion(TableStatsDeletionLog log) {
|
||||
idToTblStats.remove(log.id);
|
||||
public void removeTableStats(long tableId) {
|
||||
idToTblStats.remove(tableId);
|
||||
}
|
||||
|
||||
public ColStatsMeta findColStatsMeta(long tblId, String colName) {
|
||||
|
||||
Reference in New Issue
Block a user