Skip to content

Commit aa3990c

Browse files
committed
HIVE-29587: Cleanup acid table dir after async drop
1 parent 24b4de6 commit aa3990c

16 files changed

Lines changed: 48 additions & 29 deletions

File tree

ql/src/java/org/apache/hadoop/hive/ql/txn/compactor/handler/CompactionCleaner.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ private void cleanUsingLocation(CompactionInfo ci, String path, boolean requires
198198
deleted = fsRemover.clean(getCleaningRequestBasedOnLocation(ci, path));
199199
}
200200
if (!deleted.isEmpty()) {
201-
txnHandler.markCleaned(ci.asSoftDeleted());
201+
txnHandler.markCleaned(ci);
202202
} else {
203203
txnHandler.clearCleanerStart(ci);
204204
}

standalone-metastore/metastore-common/src/gen/thrift/gen-cpp/hive_metastore_types.cpp

Lines changed: 5 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

standalone-metastore/metastore-common/src/gen/thrift/gen-cpp/hive_metastore_types.h

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

standalone-metastore/metastore-common/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/CompactionType.java

Lines changed: 4 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

standalone-metastore/metastore-common/src/gen/thrift/gen-php/metastore/CompactionType.php

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

standalone-metastore/metastore-common/src/gen/thrift/gen-py/hive_metastore/ttypes.py

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

standalone-metastore/metastore-common/src/gen/thrift/gen-rb/hive_metastore_types.rb

Lines changed: 3 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

standalone-metastore/metastore-common/src/main/thrift/hive_metastore.thrift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,7 @@ enum CompactionType {
220220
REBALANCE = 3,
221221
ABORT_TXN_CLEANUP = 4,
222222
SMART_OPTIMIZE = 5,
223+
DEFERRED_CLEANUP = 6,
223224
}
224225

225226
enum GrantRevokeType {

standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/AcidEventListener.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,8 @@ public void onDropTable(DropTableEvent tableEvent) throws MetaException {
8888

8989
if (currentTxn > 0) {
9090
try {
91-
CompactionRequest rqst = new CompactionRequest(table.getDbName(), table.getTableName(), CompactionType.MAJOR);
91+
CompactionRequest rqst = new CompactionRequest(table.getDbName(), table.getTableName(),
92+
CompactionType.DEFERRED_CLEANUP);
9293
rqst.setRunas(TxnUtils.findUserToRunAs(table.getSd().getLocation(), table, conf));
9394
rqst.putToProperties("location", table.getSd().getLocation());
9495
rqst.putToProperties("ifPurge", Boolean.toString(isMustPurge(tableEvent.getEnvironmentContext(), table)));

standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/handler/DropDatabaseHandler.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
import java.util.concurrent.atomic.AtomicReference;
2929

3030
import org.apache.hadoop.fs.Path;
31-
import org.apache.hadoop.hive.common.repl.ReplConst;
3231
import org.apache.hadoop.hive.metastore.Batchable;
3332
import org.apache.hadoop.hive.metastore.HMSHandler;
3433
import org.apache.hadoop.hive.metastore.IHMSHandler;
@@ -137,9 +136,6 @@ public DropDatabaseResult execute() throws TException, IOException {
137136
if (isSoftDelete) {
138137
context = new EnvironmentContext();
139138
context.putToProperties(hive_metastoreConstants.TXN_ID, String.valueOf(request.getTxnId()));
140-
if (ReplChangeManager.isSourceOfReplication(db)) {
141-
context.putToProperties(ReplConst.SOURCE_OF_REPLICATION, Boolean.TRUE.toString());
142-
}
143139
request.setDeleteManagedDir(false);
144140
}
145141
DropTableRequest dropRequest = new DropTableRequest(name, table.getTableName());

0 commit comments

Comments
 (0)