[
https://issues.apache.org/jira/browse/HIVE-24423?focusedWorklogId=517797&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-517797
]
ASF GitHub Bot logged work on HIVE-24423:
-----------------------------------------
Author: ASF GitHub Bot
Created on: 30/Nov/20 08:39
Start Date: 30/Nov/20 08:39
Worklog Time Spent: 10m
Work Description: miklosgergely commented on a change in pull request
#1703:
URL: https://github.com/apache/hive/pull/1703#discussion_r532424432
##########
File path:
hcatalog/server-extensions/src/main/java/org/apache/hive/hcatalog/listener/DbNotificationListener.java
##########
@@ -1242,64 +1244,50 @@ private void process(NotificationEvent event,
ListenerEvent listenerEvent) throw
}
private static class CleanerThread extends Thread {
- private RawStore rs;
+ private final RawStore rs;
private int ttl;
- private boolean shouldRun = true;
private long sleepTime;
CleanerThread(Configuration conf, RawStore rs) {
super("DB-Notification-Cleaner");
- this.rs = rs;
- boolean isReplEnabled = MetastoreConf.getBoolVar(conf,
ConfVars.REPLCMENABLED);
- if(isReplEnabled){
- setTimeToLive(MetastoreConf.getTimeVar(conf,
ConfVars.REPL_EVENT_DB_LISTENER_TTL,
- TimeUnit.SECONDS));
- }
- else {
- setTimeToLive(MetastoreConf.getTimeVar(conf,
ConfVars.EVENT_DB_LISTENER_TTL,
- TimeUnit.SECONDS));
- }
- setCleanupInterval(MetastoreConf.getTimeVar(conf,
ConfVars.EVENT_DB_LISTENER_CLEAN_INTERVAL,
- TimeUnit.MILLISECONDS));
setDaemon(true);
+ this.rs = Objects.requireNonNull(rs);
+
+ boolean isReplEnabled = MetastoreConf.getBoolVar(conf,
ConfVars.REPLCMENABLED);
+ ConfVars ttlConf = (isReplEnabled) ?
ConfVars.REPL_EVENT_DB_LISTENER_TTL : ConfVars.EVENT_DB_LISTENER_TTL;
+ setTimeToLive(MetastoreConf.getTimeVar(conf, ttlConf, TimeUnit.SECONDS));
+ setCleanupInterval(
+ MetastoreConf.getTimeVar(conf,
ConfVars.EVENT_DB_LISTENER_CLEAN_INTERVAL, TimeUnit.MILLISECONDS));
}
@Override
public void run() {
- while (shouldRun) {
+ while (true) {
+ LOG.debug("Cleaner thread running");
try {
rs.cleanNotificationEvents(ttl);
rs.cleanWriteNotificationEvents(ttl);
} catch (Exception ex) {
- //catching exceptions here makes sure that the thread doesn't die in
case of unexpected
- //exceptions
- LOG.warn("Exception received while cleaning notifications: ", ex);
+ LOG.warn("Exception received while cleaning notifications", ex);
Review comment:
No, go ahead and merge it
----------------------------------------------------------------
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]
Issue Time Tracking
-------------------
Worklog Id: (was: 517797)
Time Spent: 50m (was: 40m)
> Improve DbNotificationListener Thread
> -------------------------------------
>
> Key: HIVE-24423
> URL: https://issues.apache.org/jira/browse/HIVE-24423
> Project: Hive
> Issue Type: Improvement
> Affects Versions: 3.1.0
> Reporter: David Mollitor
> Assignee: David Mollitor
> Priority: Major
> Labels: pull-request-available
> Time Spent: 50m
> Remaining Estimate: 0h
>
> Clean up and simplify {{DbNotificationListener}} thread class.
> Most importantly, stop the thread and wait for it to finish before launching
> a new thread.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)