Skip to content

Commit

Permalink
[improvement](statistics)Drop table stats in unprotectDropTable so th…
Browse files Browse the repository at this point in the history
…at dropDB could call it as well. (apache#39685)

Drop table stats in unprotectDropTable so that dropDB could call it as
well.
  • Loading branch information
Jibing-Li committed Oct 14, 2024
1 parent ff52e73 commit f540b1c
Showing 1 changed file with 1 addition and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -972,9 +972,6 @@ private void dropTableInternal(Database db, Table table, boolean forceDrop,

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, forceDrop, recycleTime);
Env.getCurrentEnv().getEditLog().logDropTable(info);
Env.getCurrentEnv().getMtmvService().dropTable(table);
Expand Down Expand Up @@ -1004,7 +1001,7 @@ public boolean unprotectDropTable(Database db, Table table, boolean isForceDrop,
if (table.getType() == TableType.MATERIALIZED_VIEW) {
Env.getCurrentEnv().getMtmvService().deregisterMTMV((MTMV) table);
}

Env.getCurrentEnv().getAnalysisManager().removeTableStats(table.getId());
db.unregisterTable(table.getName());
StopWatch watch = StopWatch.createStarted();
Env.getCurrentRecycleBin().recycleTable(db.getId(), table, isReplay, isForceDrop, recycleTime);
Expand All @@ -1022,7 +1019,6 @@ private void dropTable(Database db, long tableId, boolean isForceDrop, boolean i
try {
unprotectDropTable(db, table, isForceDrop, isReplay, recycleTime);
Env.getCurrentEnv().getQueryStats().clear(Env.getCurrentInternalCatalog().getId(), db.getId(), tableId);
Env.getCurrentEnv().getAnalysisManager().removeTableStats(table.getId());
} finally {
table.writeUnlock();
db.writeUnlock();
Expand Down

0 comments on commit f540b1c

Please sign in to comment.