You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by sa...@apache.org on 2019/02/18 07:00:14 UTC
[hive] branch master updated: HIVE-19430:
ObjectStore.cleanNotificationEvents OutOfMemory on large number of pending
events (Ashutosh Bapat, reviewed by Sankar Hariappan, Vihang Karajgaonkar)
This is an automated email from the ASF dual-hosted git repository.
sankarh pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hive.git
The following commit(s) were added to refs/heads/master by this push:
new 5ff5657 HIVE-19430: ObjectStore.cleanNotificationEvents OutOfMemory on large number of pending events (Ashutosh Bapat, reviewed by Sankar Hariappan, Vihang Karajgaonkar)
5ff5657 is described below
commit 5ff5657dd34f2d37f4cb4ad90a09cb624b45b239
Author: Ashutosh Bapat <ab...@cloudera.com>
AuthorDate: Mon Feb 18 12:29:01 2019 +0530
HIVE-19430: ObjectStore.cleanNotificationEvents OutOfMemory on large number of pending events (Ashutosh Bapat, reviewed by Sankar Hariappan, Vihang Karajgaonkar)
Signed-off-by: Sankar Hariappan <sa...@apache.org>
---
.../org/apache/hive/hcatalog/listener/DbNotificationListener.java | 5 +----
.../java/org/apache/hadoop/hive/metastore/conf/MetastoreConf.java | 5 +++++
.../src/main/java/org/apache/hadoop/hive/metastore/ObjectStore.java | 5 +++++
3 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/hcatalog/server-extensions/src/main/java/org/apache/hive/hcatalog/listener/DbNotificationListener.java b/hcatalog/server-extensions/src/main/java/org/apache/hive/hcatalog/listener/DbNotificationListener.java
index 963b227..e611394 100644
--- a/hcatalog/server-extensions/src/main/java/org/apache/hive/hcatalog/listener/DbNotificationListener.java
+++ b/hcatalog/server-extensions/src/main/java/org/apache/hive/hcatalog/listener/DbNotificationListener.java
@@ -1142,10 +1142,7 @@ public class DbNotificationListener extends TransactionalMetaStoreEventListener
} 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. More details can be found in debug mode"
- + ex.getMessage());
- LOG.debug(ex.getMessage(), ex);
+ LOG.warn("Exception received while cleaning notifications: ", ex);
}
LOG.debug("Cleaner thread done");
diff --git a/standalone-metastore/metastore-common/src/main/java/org/apache/hadoop/hive/metastore/conf/MetastoreConf.java b/standalone-metastore/metastore-common/src/main/java/org/apache/hadoop/hive/metastore/conf/MetastoreConf.java
index 7c1e30a..3a9912f 100644
--- a/standalone-metastore/metastore-common/src/main/java/org/apache/hadoop/hive/metastore/conf/MetastoreConf.java
+++ b/standalone-metastore/metastore-common/src/main/java/org/apache/hadoop/hive/metastore/conf/MetastoreConf.java
@@ -555,6 +555,11 @@ public class MetastoreConf {
EVENT_DB_LISTENER_TTL("metastore.event.db.listener.timetolive",
"hive.metastore.event.db.listener.timetolive", 86400, TimeUnit.SECONDS,
"time after which events will be removed from the database listener queue"),
+ EVENT_CLEAN_MAX_EVENTS("metastore.event.db.clean.maxevents",
+ "hive.metastore.event.db.clean.maxevents", 10000,
+ "Limit on number events to be cleaned at a time in metastore cleanNotificationEvents " +
+ "call, to avoid OOM. The configuration is not effective when set to zero or " +
+ "a negative value."),
EVENT_DB_LISTENER_CLEAN_INTERVAL("metastore.event.db.listener.clean.interval",
"hive.metastore.event.db.listener.clean.interval", 7200, TimeUnit.SECONDS,
"sleep interval between each run for cleanup of events from the database listener queue"),
diff --git a/standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/ObjectStore.java b/standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/ObjectStore.java
index c0bae3b..f9a4e48 100644
--- a/standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/ObjectStore.java
+++ b/standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/ObjectStore.java
@@ -10080,6 +10080,11 @@ public class ObjectStore implements RawStore, Configurable {
int tooOld = (tmp > Integer.MAX_VALUE) ? 0 : (int) tmp;
query = pm.newQuery(MNotificationLog.class, "eventTime < tooOld");
query.declareParameters("java.lang.Integer tooOld");
+
+ int max_events = MetastoreConf.getIntVar(conf, MetastoreConf.ConfVars.EVENT_CLEAN_MAX_EVENTS);
+ max_events = max_events > 0 ? max_events : Integer.MAX_VALUE;
+ query.setRange(0, max_events);
+
Collection<MNotificationLog> toBeRemoved = (Collection) query.execute(tooOld);
if (CollectionUtils.isNotEmpty(toBeRemoved)) {
pm.deletePersistentAll(toBeRemoved);