hive-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From da...@apache.org
Subject hive git commit: HIVE-19251: ObjectStore.getNextNotification with LIMIT should use less memory (Daniel Dai, reviewed by Thejas Nair, Vihang Karajgaonkar)
Date Fri, 20 Apr 2018 21:33:57 GMT
Repository: hive
Updated Branches:
  refs/heads/branch-2 7cea4d0da -> 780db578b


HIVE-19251: ObjectStore.getNextNotification with LIMIT should use less memory (Daniel Dai,
reviewed by Thejas Nair, Vihang Karajgaonkar)


Project: http://git-wip-us.apache.org/repos/asf/hive/repo
Commit: http://git-wip-us.apache.org/repos/asf/hive/commit/780db578
Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/780db578
Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/780db578

Branch: refs/heads/branch-2
Commit: 780db578bc99092186a99a51b180073418cfada8
Parents: 7cea4d0
Author: Daniel Dai <daijyc@gmail.com>
Authored: Fri Apr 20 14:33:33 2018 -0700
Committer: Daniel Dai <daijyc@gmail.com>
Committed: Fri Apr 20 14:33:33 2018 -0700

----------------------------------------------------------------------
 .../src/java/org/apache/hadoop/hive/metastore/ObjectStore.java | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hive/blob/780db578/metastore/src/java/org/apache/hadoop/hive/metastore/ObjectStore.java
----------------------------------------------------------------------
diff --git a/metastore/src/java/org/apache/hadoop/hive/metastore/ObjectStore.java b/metastore/src/java/org/apache/hadoop/hive/metastore/ObjectStore.java
index 587865f..d85a001 100644
--- a/metastore/src/java/org/apache/hadoop/hive/metastore/ObjectStore.java
+++ b/metastore/src/java/org/apache/hadoop/hive/metastore/ObjectStore.java
@@ -8203,18 +8203,18 @@ public class ObjectStore implements RawStore, Configurable {
     try {
       openTransaction();
       long lastEvent = rqst.getLastEvent();
+      int maxEvents = rqst.getMaxEvents() > 0 ? rqst.getMaxEvents() : Integer.MAX_VALUE;
       query = pm.newQuery(MNotificationLog.class, "eventId > lastEvent");
       query.declareParameters("java.lang.Long lastEvent");
       query.setOrdering("eventId ascending");
+      query.setRange(0, maxEvents);
       Collection<MNotificationLog> events = (Collection) query.execute(lastEvent);
       commited = commitTransaction();
       if (events == null) {
         return result;
       }
       Iterator<MNotificationLog> i = events.iterator();
-      int maxEvents = rqst.getMaxEvents() > 0 ? rqst.getMaxEvents() : Integer.MAX_VALUE;
-      int numEvents = 0;
-      while (i.hasNext() && numEvents++ < maxEvents) {
+      while (i.hasNext()) {
         result.addToEvents(translateDbToThrift(i.next()));
       }
       return result;


Mime
View raw message