veghlaci05 commented on code in PR #3803:
URL: https://github.com/apache/hive/pull/3803#discussion_r1031563926
##########
ql/src/java/org/apache/hadoop/hive/ql/txn/compactor/CompactorThread.java:
##########
@@ -219,4 +226,17 @@ protected LockRequest createLockRequest(CompactionInfo ci,
long txnId, LockType
!conf.getBoolVar(HiveConf.ConfVars.TXN_WRITE_X_LOCK));
return requestBuilder.build();
}
+
+ protected void doPostLoopActions(long elapsedTime, CompactorThreadType type)
throws InterruptedException {
+ if (elapsedTime < checkInterval && !stop.get()) {
+ Thread.sleep(checkInterval - elapsedTime);
+ }
+
+ if(elapsedTime < MAX_WARN_LOG_TIME){
+ LOG.debug(type.name() + " loop took " + elapsedTime/1000 + " seconds to
finish.");
+ } else {
+ LOG.warn("Possible "+ type.name() +" slowdown, loop took "+
elapsedTime/1000 + " seconds to finish.");
Review Comment:
nit: spaces around + operator
##########
ql/src/java/org/apache/hadoop/hive/ql/txn/compactor/CompactorThread.java:
##########
@@ -61,6 +61,13 @@ public abstract class CompactorThread extends Thread
implements Configurable {
protected String hostName;
protected String runtimeVersion;
+ //Time threshold for compactor thread log
+ //In milliseconds:
+ protected Integer MAX_WARN_LOG_TIME = 1200000; //20 min
+
+ protected long checkInterval;
+
+ public enum CompactorThreadType {INITIATOR, WORKER, CLEANER}
Review Comment:
What about introducing an abstract CompactorThreadType getThreadType()
method, implement in Cleaner, Worker, Initiator, and use it in
doPostLoopActions()? This way CompactorThreadType type parameter would no
longer necessary. However, I don't have a strong preference over this, the
current approach is also fine.
--
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]