deniskuzZ commented on code in PR #4313:
URL: https://github.com/apache/hive/pull/4313#discussion_r1217869629
##########
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/txn/CompactionTxnHandler.java:
##########
@@ -1240,6 +1298,73 @@ private static boolean timedOut(CompactionInfo ci,
RetentionCounters rc, long pa
&& (rc.hasSucceededMajorCompaction ||
(rc.hasSucceededMinorCompaction && ci.type == CompactionType.MINOR));
}
+ private void removeAbortRetryEntries(Connection dbConn, CompactionInfo info)
throws MetaException, RetryException {
+ LOG.debug("Going to execute update <{}>",
DELETE_ABORT_RETRY_ENTRIES_FROM_COMPACTION_QUEUE);
+ try (PreparedStatement pStmt =
dbConn.prepareStatement(DELETE_ABORT_RETRY_ENTRIES_FROM_COMPACTION_QUEUE)) {
+ pStmt.setString(1, info.dbname);
+ pStmt.setString(2, info.tableName);
+ if (info.partName != null) {
+ pStmt.setString(3, info.partName);
+ } else {
+ // Since the type of 'CQ_PARTITION' column is varchar.
+ // Hence, setting null for VARCHAR type.
+ pStmt.setNull(3, Types.VARCHAR);
+ }
+ int rc = pStmt.executeUpdate();
+ LOG.debug("Removed {} records in COMPACTION_QUEUE", rc);
+ } catch (SQLException e) {
+ LOG.error("Unable to delete abort retry entries from COMPACTION_QUEUE
due to {}", e.getMessage());
+ LOG.debug("Going to rollback");
+ rollbackDBConn(dbConn);
+ checkRetryable(e, "removeAbortRetryEntries(" + info + ")");
+ throw new MetaException(DB_FAILED_TO_CONNECT + e.getMessage());
+ }
+ }
+
+ private void setAbortRetryRetentionTimeOnError(Connection dbConn,
AbortTxnRequestInfo info) throws MetaException, RetryException {
Review Comment:
check `Txnhandler.compact`
````
TxnStore.MutexAPI.LockHandle handle = null;
try {
lockInternal();
/**
* MUTEX_KEY.CompactionScheduler lock ensures that there is only 1
entry in
* Initiated/Working state for any resource. This ensures that we
don't run concurrent
* compactions for any resource.
*/
handle =
getMutexAPI().acquireLock(MUTEX_KEY.CompactionScheduler.name());
try (Connection dbConn =
getDbConn(Connection.TRANSACTION_READ_COMMITTED)) {
try (Statement stmt = dbConn.createStatement()) {
long id = generateCompactionQueueId(stmt);
.....
.....
````
--
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]