pvargacl commented on a change in pull request #1839:
URL: https://github.com/apache/hive/pull/1839#discussion_r553600334
##########
File path:
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/txn/CompactionTxnHandler.java
##########
@@ -1006,16 +1007,23 @@ public boolean checkFailedCompactions(CompactionInfo
ci) throws MetaException {
rs = pStmt.executeQuery();
int numFailed = 0;
int numTotal = 0;
+ long lastEnqueueTime = -1;
int failedThreshold = MetastoreConf.getIntVar(conf,
ConfVars.COMPACTOR_INITIATOR_FAILED_THRESHOLD);
while(rs.next() && ++numTotal <= failedThreshold) {
+ long enqueueTime = rs.getLong(2);
+ if (enqueueTime > lastEnqueueTime) {
+ lastEnqueueTime = enqueueTime;
+ }
if(rs.getString(1).charAt(0) == FAILED_STATE) {
numFailed++;
}
else {
numFailed--;
}
}
- return numFailed == failedThreshold;
+ // If the last attempt was too long ago, ignore the failed treshold
and try compaction again
+ long retryTime = MetastoreConf.getTimeVar(conf,
ConfVars.COMPACTOR_INITIATOR_FAILED_RETRY_TIME, TimeUnit.MILLISECONDS);
Review comment:
I don't really want to do that. The same is true for
COMPACTOR_INITIATOR_FAILED_THRESHOLD a few lines up, but I think this makes
this code more readable and more testable by its own. Besides this part is not
that time critical, since it is a background process.
----------------------------------------------------------------
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]