You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@phoenix.apache.org by ja...@apache.org on 2015/02/11 01:52:08 UTC
phoenix git commit: PHOENIX-1650 Possible resource leak in upsert
select query (Rajeshbabu)
Repository: phoenix
Updated Branches:
refs/heads/4.0 677952de4 -> 21731bcd2
PHOENIX-1650 Possible resource leak in upsert select query (Rajeshbabu)
Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo
Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/21731bcd
Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/21731bcd
Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/21731bcd
Branch: refs/heads/4.0
Commit: 21731bcd262d129edf3ef238e33242b3988327f7
Parents: 677952d
Author: James Taylor <jt...@salesforce.com>
Authored: Tue Feb 10 16:51:10 2015 -0800
Committer: James Taylor <jt...@salesforce.com>
Committed: Tue Feb 10 16:51:10 2015 -0800
----------------------------------------------------------------------
.../apache/phoenix/compile/UpsertCompiler.java | 26 +++++++++++---------
1 file changed, 15 insertions(+), 11 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/phoenix/blob/21731bcd/phoenix-core/src/main/java/org/apache/phoenix/compile/UpsertCompiler.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/compile/UpsertCompiler.java b/phoenix-core/src/main/java/org/apache/phoenix/compile/UpsertCompiler.java
index 2ac075e..b21cc2f 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/compile/UpsertCompiler.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/compile/UpsertCompiler.java
@@ -670,18 +670,22 @@ public class UpsertCompiler {
if (parallelIteratorFactory == null) {
return upsertSelect(statement, tableRef, projector, iterator, columnIndexes, pkSlotIndexes);
}
- parallelIteratorFactory.setRowProjector(projector);
- parallelIteratorFactory.setColumnIndexes(columnIndexes);
- parallelIteratorFactory.setPkSlotIndexes(pkSlotIndexes);
- Tuple tuple;
- long totalRowCount = 0;
- while ((tuple=iterator.next()) != null) {// Runs query
- Cell kv = tuple.getValue(0);
- totalRowCount += PLong.INSTANCE.getCodec().decodeLong(kv.getValueArray(), kv.getValueOffset(), SortOrder.getDefault());
+ try {
+ parallelIteratorFactory.setRowProjector(projector);
+ parallelIteratorFactory.setColumnIndexes(columnIndexes);
+ parallelIteratorFactory.setPkSlotIndexes(pkSlotIndexes);
+ Tuple tuple;
+ long totalRowCount = 0;
+ while ((tuple=iterator.next()) != null) {// Runs query
+ Cell kv = tuple.getValue(0);
+ totalRowCount += PLong.INSTANCE.getCodec().decodeLong(kv.getValueArray(), kv.getValueOffset(), SortOrder.getDefault());
+ }
+ // Return total number of rows that have been updated. In the case of auto commit being off
+ // the mutations will all be in the mutation state of the current connection.
+ return new MutationState(maxSize, statement.getConnection(), totalRowCount);
+ } finally {
+ iterator.close();
}
- // Return total number of rows that have been updated. In the case of auto commit being off
- // the mutations will all be in the mutation state of the current connection.
- return new MutationState(maxSize, statement.getConnection(), totalRowCount);
}
@Override