Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 7D2A3200BBB for ; Thu, 10 Nov 2016 23:48:28 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 7BD0A160B01; Thu, 10 Nov 2016 22:48:28 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id C2D43160AF7 for ; Thu, 10 Nov 2016 23:48:27 +0100 (CET) Received: (qmail 56327 invoked by uid 500); 10 Nov 2016 22:48:27 -0000 Mailing-List: contact commits-help@phoenix.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@phoenix.apache.org Delivered-To: mailing list commits@phoenix.apache.org Received: (qmail 56317 invoked by uid 99); 10 Nov 2016 22:48:27 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 10 Nov 2016 22:48:26 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id D1FC7E01F4; Thu, 10 Nov 2016 22:48:26 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: maryannxue@apache.org To: commits@phoenix.apache.org Message-Id: <0b82ff397fbf4b8394f7749bad3db1b1@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: phoenix git commit: Fix memory issue caused by PHOENIX-3394 Date: Thu, 10 Nov 2016 22:48:26 +0000 (UTC) archived-at: Thu, 10 Nov 2016 22:48:28 -0000 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 Authored: Thu Nov 10 14:38:23 2016 -0800 Committer: maryannxue 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++) {