You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@phoenix.apache.org by ma...@apache.org on 2016/11/10 22:48:26 UTC

phoenix git commit: Fix memory issue caused by PHOENIX-3394

Repository: phoenix
Updated Branches:
  refs/heads/calcite d65122b88 -> 26bd75582


Fix memory issue caused by PHOENIX-3394


Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo
Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/26bd7558
Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/26bd7558
Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/26bd7558

Branch: refs/heads/calcite
Commit: 26bd755823eac60944f438522d51cf688f8b5f80
Parents: d65122b
Author: maryannxue <ma...@gmail.com>
Authored: Thu Nov 10 14:38:23 2016 -0800
Committer: maryannxue <ma...@gmail.com>
Committed: Thu Nov 10 14:48:14 2016 -0800

----------------------------------------------------------------------
 .../main/java/org/apache/phoenix/calcite/PhoenixSchema.java  | 2 ++
 .../java/org/apache/phoenix/compile/SequenceManager.java     | 8 ++++++++
 2 files changed, 10 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/phoenix/blob/26bd7558/phoenix-core/src/main/java/org/apache/phoenix/calcite/PhoenixSchema.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/calcite/PhoenixSchema.java b/phoenix-core/src/main/java/org/apache/phoenix/calcite/PhoenixSchema.java
index 47b63fc..8f27567 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/calcite/PhoenixSchema.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/calcite/PhoenixSchema.java
@@ -344,6 +344,8 @@ public class PhoenixSchema implements Schema {
             sequenceManager.validateSequences(Sequence.ValueOp.VALIDATE_SEQUENCE);
         } catch (SQLException e){
             return null;
+        } finally {
+            sequenceManager.reset();
         }
 
         return new PhoenixSequence(schemaName, name, pc);

http://git-wip-us.apache.org/repos/asf/phoenix/blob/26bd7558/phoenix-core/src/main/java/org/apache/phoenix/compile/SequenceManager.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/compile/SequenceManager.java b/phoenix-core/src/main/java/org/apache/phoenix/compile/SequenceManager.java
index bdc4da9..a349fa4 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/compile/SequenceManager.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/compile/SequenceManager.java
@@ -61,6 +61,14 @@ public class SequenceManager {
         return sequenceMap == null ? 0 : sequenceMap.size();
     }
     
+    public void reset() {
+        sequenceMap.clear();
+        isNextSequence.clear();
+        sequencePosition = null;
+        nextSequences = null;
+        currentSequences = null;
+    }
+    
     private void setSequenceValues(long[] srcSequenceValues, long[] dstSequenceValues, SQLException[] sqlExceptions) throws SQLException {
         SQLException eTop = null;
         for (int i = 0; i < sqlExceptions.length; i++) {