deniskuzZ commented on a change in pull request #2772:
URL: https://github.com/apache/hive/pull/2772#discussion_r760255174



##########
File path: 
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/AcidEventListener.java
##########
@@ -60,9 +65,30 @@ public void onDropDatabase (DropDatabaseEvent dbEvent) 
throws MetaException {
 
   @Override
   public void onDropTable(DropTableEvent tableEvent)  throws MetaException {
-    if (TxnUtils.isTransactionalTable(tableEvent.getTable())) {
+    Table table = tableEvent.getTable();
+    
+    if (TxnUtils.isTransactionalTable(table)) {
       txnHandler = getTxnHandler();
-      txnHandler.cleanupRecords(HiveObjectType.TABLE, null, 
tableEvent.getTable(), null);
+      txnHandler.cleanupRecords(HiveObjectType.TABLE, null, table, null, 
!tableEvent.getDeleteData());
+      
+      if (!tableEvent.getDeleteData()) {
+        long currentTxn = 
Optional.ofNullable(tableEvent.getEnvironmentContext())
+          .map(EnvironmentContext::getProperties)
+          .map(prop -> prop.get("txnId"))
+          .map(Long::parseLong)
+          .orElse(0L);
+
+        if (currentTxn > 0) {
+          CompactionRequest rqst = new CompactionRequest(table.getDbName(), 
table.getTableName(), CompactionType.MAJOR);
+          rqst.putToProperties("location", table.getSd().getLocation());

Review comment:
       I didn't want to change the compaction queue schema + it kinda fits the 
definition of CQ_TBLPROPERTIES column




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to