SourabhBadhya commented on code in PR #4313:
URL: https://github.com/apache/hive/pull/4313#discussion_r1196641377
##########
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/txn/CompactionTxnHandler.java:
##########
@@ -1562,16 +1620,46 @@ public void markRefused(CompactionInfo info) throws
MetaException {
@Override
@RetrySemantics.CannotRetry
- public void setCleanerRetryRetentionTimeOnError(CompactionInfo info) throws
MetaException {
+ public void setCleanerRetryRetentionTimeOnError(CompactionInfo info, boolean
isAbort) throws MetaException {
try {
try (Connection dbConn =
getDbConn(Connection.TRANSACTION_READ_COMMITTED, connPoolCompaction)) {
- try (PreparedStatement stmt = dbConn.prepareStatement("UPDATE
\"COMPACTION_QUEUE\" " +
- "SET \"CQ_RETRY_RETENTION\" = ?, \"CQ_ERROR_MESSAGE\"= ? WHERE
\"CQ_ID\" = ?")) {
+ String query;
+ if (isAbort) {
+ // Check whether we need to do an insert to the TXN_CLEANUP_QUEUE or
an update to TXN_CLEANUP_QUEUE.
+ if (!info.hasOldAbort) {
+ if (info.partName != null) {
+ query = "INSERT INTO \"TXN_CLEANUP_QUEUE\"
(\"TCQ_RETRY_RETENTION\", \"TCQ_ERROR_MESSAGE\", " +
+ "\"TCQ_DATABASE\", \"TCQ_TABLE\", \"TCQ_PARTITION\",
\"TCQ_RETRY_TIME\") VALUES (?, ?, ?, ?, ?, " + getEpochFn(dbProduct) + ")";
+ } else {
+ query = "INSERT INTO \"TXN_CLEANUP_QUEUE\"
(\"TCQ_RETRY_RETENTION\", \"TCQ_ERROR_MESSAGE\", " +
+ "\"TCQ_DATABASE\", \"TCQ_TABLE\", \"TCQ_RETRY_TIME\")
VALUES (?, ?, ?, ?, " + getEpochFn(dbProduct) + ")";
+ }
+ } else {
+ query = "UPDATE \"TXN_CLEANUP_QUEUE\" SET \"TCQ_RETRY_RETENTION\"
= ?, \"TCQ_ERROR_MESSAGE\" = ? " +
+ "WHERE \"TCQ_DATABASE\" = ? AND \"TCQ_TABLE\" = ? AND
\"TCQ_PARTITION\" " + (info.partName != null ? "= ?" : "IS NULL");
Review Comment:
Implemented. Done.
##########
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/txn/CompactionTxnHandler.java:
##########
@@ -772,6 +804,32 @@ private void removeTxnComponents(Connection dbConn,
CompactionInfo info) throws
}
}
+ private void removeRetryQueueEntries(Connection dbConn, CompactionInfo info)
throws MetaException, RetryException {
+ PreparedStatement pStmt = null;
+ String query = "DELETE FROM \"TXN_CLEANUP_QUEUE\" WHERE \"TCQ_DATABASE\" =
? " +
+ "AND \"TCQ_TABLE\" = ? AND \"TCQ_PARTITION\" " + (info.partName !=
null ? "= ?" : "IS NULL");
Review Comment:
Implemented. 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]