pvary commented on a change in pull request #1085:
URL: https://github.com/apache/hive/pull/1085#discussion_r439339985
##########
File path:
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/txn/TxnHandler.java
##########
@@ -5363,6 +5363,121 @@ private void acquireTxnLock(Statement stmt, boolean
shared) throws SQLException,
LOG.debug("TXN lock locked by {} in mode {}",
quoteString(TxnHandler.hostname), shared);
}
+
+ @Override
+ @RetrySemantics.Idempotent
+ public void requestCleanup(CompactionInfo ci) throws MetaException {
+ try {
+ Connection dbConn = null;
+ Statement stmt = null;
+ PreparedStatement pst = null;
+ 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());
+ dbConn = getDbConn(Connection.TRANSACTION_READ_COMMITTED);
+ stmt = dbConn.createStatement();
+
+ long id = generateCompactionQueueId(stmt);
+
+ List<String> params = new ArrayList<>();
+ StringBuilder sb = new StringBuilder("select cq_id, cq_state from
COMPACTION_QUEUE where").
+ append(" cq_state IN(").append(quoteChar(INITIATED_STATE)).
+ append(",").append(quoteChar(WORKING_STATE)).
+ append(") AND cq_database=?").
+ append(" AND cq_table=?").append(" AND ");
Review comment:
Meybe we should move this select out to a different method, since this
is the copy of the one used in compact().
Also I would add state cleaning as well. We do not want 2 cleaners running
parallel
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]