deniskuzZ commented on code in PR #4091: URL: https://github.com/apache/hive/pull/4091#discussion_r1161633548
########## standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/txn/CompactionTxnHandler.java: ########## @@ -162,31 +162,33 @@ public Set<CompactionInfo> findPotentialCompactions(int abortedThreshold, } rs.close(); - // Check for aborted txns: number of aborted txns past threshold and age of aborted txns - // past time threshold - boolean checkAbortedTimeThreshold = abortedTimeThreshold >= 0; - String sCheckAborted = "SELECT \"TC_DATABASE\", \"TC_TABLE\", \"TC_PARTITION\", " + - "MIN(\"TXN_STARTED\"), COUNT(*) FROM \"TXNS\", \"TXN_COMPONENTS\" " + - " WHERE \"TXN_ID\" = \"TC_TXNID\" AND \"TXN_STATE\" = " + TxnStatus.ABORTED + " " + - "GROUP BY \"TC_DATABASE\", \"TC_TABLE\", \"TC_PARTITION\" " + - (checkAbortedTimeThreshold ? "" : " HAVING COUNT(*) > " + abortedThreshold); - - LOG.debug("Going to execute query <{}>", sCheckAborted); - rs = stmt.executeQuery(sCheckAborted); - long systemTime = System.currentTimeMillis(); - while (rs.next()) { - boolean pastTimeThreshold = - checkAbortedTimeThreshold && rs.getLong(4) + abortedTimeThreshold < systemTime; - int numAbortedTxns = rs.getInt(5); - if (numAbortedTxns > abortedThreshold || pastTimeThreshold) { - CompactionInfo info = new CompactionInfo(); - info.dbname = rs.getString(1); - info.tableName = rs.getString(2); - info.partName = rs.getString(3); - info.tooManyAborts = numAbortedTxns > abortedThreshold; - info.hasOldAbort = pastTimeThreshold; - LOG.debug("Found potential compaction: {}", info); - response.add(info); + if (!MetastoreConf.getBoolVar(conf, ConfVars.COMPACTOR_CLEAN_ABORTS_USING_CLEANER)) { Review Comment: no need for that, leads to code duplication ########## standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/txn/CompactionTxnHandler.java: ########## @@ -464,6 +466,54 @@ public List<CompactionInfo> findReadyToClean(long minOpenTxnWaterMark, long rete } } + @Override + @RetrySemantics.ReadOnly + public List<AcidTxnInfo> findReadyToCleanForAborts(long abortedTimeThreshold, int abortedThreshold) throws MetaException { Review Comment: rename `findReadyToCleanAborts` -- 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: gitbox-unsubscr...@hive.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: gitbox-unsubscr...@hive.apache.org For additional commands, e-mail: gitbox-h...@hive.apache.org