SourabhBadhya commented on code in PR #4091:
URL: https://github.com/apache/hive/pull/4091#discussion_r1167991431
##########
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/txn/CompactionTxnHandler.java:
##########
@@ -702,6 +699,102 @@ public void markCleaned(CompactionInfo info) throws
MetaException {
}
}
+ @Override
+ public void markCleanedForAborts(AcidTxnInfo info) throws MetaException {
+ // Do cleanup of TXN_COMPONENTS table
+ LOG.debug("Running markCleanedForAborts with CompactionInfo: {}", info);
+ try {
+ Connection dbConn = null;
+ try {
+ dbConn = getDbConn(Connection.TRANSACTION_READ_COMMITTED,
connPoolCompaction);
+ markAbortCleaned(dbConn, info);
+ LOG.debug("Going to commit");
+ dbConn.commit();
+ } catch (SQLException e) {
+ LOG.error("Unable to delete from txn components due to {}",
e.getMessage());
+ LOG.debug("Going to rollback");
+ rollbackDBConn(dbConn);
+ checkRetryable(e, "markCleanedForAborts(" + info + ")");
+ throw new MetaException("Unable to connect to transaction database " +
+ e.getMessage());
+ } finally {
+ closeDbConn(dbConn);
+ }
+ } catch (RetryException e) {
+ markCleanedForAborts(info);
+ }
+ }
+
+ private void markAbortCleaned(Connection dbConn, AcidTxnInfo info) throws
MetaException, RetryException {
Review Comment:
Renamed. Done.
##########
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/txn/TxnStore.java:
##########
@@ -516,6 +516,19 @@ Set<CompactionInfo> findPotentialCompactions(int
abortedThreshold, long abortedT
@RetrySemantics.ReadOnly
List<CompactionInfo> findReadyToClean(long minOpenTxnWaterMark, long
retentionTime) throws MetaException;
+ /**
+ * Find the aborted entries in TXN_COMPONENTS which can be used to
+ * clean directories belonging to transactions in aborted state.
+ * @param abortedTimeThreshold Age of table/partition's oldest aborted
transaction involving a given table
+ * or partition that will trigger cleanup.
+ * @param abortedThreshold Number of aborted transactions involving a given
table or partition
+ * that will trigger cleanup.
+ * @return Information of potential abort items that needs to be cleaned.
+ * @throws MetaException
+ */
+ @RetrySemantics.ReadOnly
+ List<AcidTxnInfo> findReadyToCleanForAborts(long abortedTimeThreshold, int
abortedThreshold) throws MetaException;
Review Comment:
Renamed. Done.
##########
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/txn/TxnStore.java:
##########
@@ -541,6 +554,15 @@ Set<CompactionInfo> findPotentialCompactions(int
abortedThreshold, long abortedT
@RetrySemantics.CannotRetry
void markCleaned(CompactionInfo info) throws MetaException;
+ /**
+ * This will remove an aborted entries from TXN_COMPONENTS table after
+ * the aborted directories are removed from the filesystem.
+ * @param info info on the aborted directories cleanup that needs to be
removed
+ * @throws MetaException
+ */
+ @RetrySemantics.CannotRetry
+ void markCleanedForAborts(AcidTxnInfo info) throws MetaException;
Review Comment:
Removed the API. Extended `markCleaned` with a boolean `isAbortOnly` flag.
Done.
--
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]