You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@phoenix.apache.org by mu...@apache.org on 2014/08/01 20:19:45 UTC
git commit: PHOENIX-1141 Fix HTable resource leak in
ConnectionQueryServicesImpl.metaDataCoprocessorExec (SamarthJain)
Repository: phoenix
Updated Branches:
refs/heads/4.0 55c2ea21e -> 0c9863ed9
PHOENIX-1141 Fix HTable resource leak in ConnectionQueryServicesImpl.metaDataCoprocessorExec (SamarthJain)
Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo
Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/0c9863ed
Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/0c9863ed
Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/0c9863ed
Branch: refs/heads/4.0
Commit: 0c9863ed9711faa46bc66740d0ba2a9bfd4263b3
Parents: 55c2ea2
Author: Mujtaba <mu...@apache.org>
Authored: Fri Aug 1 11:18:35 2014 -0700
Committer: Mujtaba <mu...@apache.org>
Committed: Fri Aug 1 11:18:35 2014 -0700
----------------------------------------------------------------------
.../query/ConnectionQueryServicesImpl.java | 25 +++++++++++---------
1 file changed, 14 insertions(+), 11 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/phoenix/blob/0c9863ed/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java b/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java
index 4ac64d4..ff70adb 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java
@@ -26,7 +26,6 @@ import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.SYSTEM_CATALOG_NAM
import static org.apache.phoenix.query.QueryServicesOptions.DEFAULT_DROP_METADATA;
import java.io.IOException;
-import java.sql.Connection;
import java.sql.SQLException;
import java.util.Collections;
import java.util.List;
@@ -885,17 +884,21 @@ public class ConnectionQueryServicesImpl extends DelegateQueryServices implement
}
HTableInterface ht = this.getTable(PhoenixDatabaseMetaData.SYSTEM_CATALOG_NAME_BYTES);
- final Map<byte[], MetaDataResponse> results =
- ht.coprocessorService(MetaDataService.class, tableKey, tableKey, callable);
-
- assert(results.size() == 1);
- MetaDataResponse result = results.values().iterator().next();
- if (result.getReturnCode() == MetaDataProtos.MutationCode.TABLE_NOT_IN_REGION) {
- if (retried) return MetaDataMutationResult.constructFromProto(result);
- retried = true;
- continue;
+ try {
+ final Map<byte[], MetaDataResponse> results =
+ ht.coprocessorService(MetaDataService.class, tableKey, tableKey, callable);
+
+ assert(results.size() == 1);
+ MetaDataResponse result = results.values().iterator().next();
+ if (result.getReturnCode() == MetaDataProtos.MutationCode.TABLE_NOT_IN_REGION) {
+ if (retried) return MetaDataMutationResult.constructFromProto(result);
+ retried = true;
+ continue;
+ }
+ return MetaDataMutationResult.constructFromProto(result);
+ } finally {
+ Closeables.closeQuietly(ht);
}
- return MetaDataMutationResult.constructFromProto(result);
}
} catch (IOException e) {
throw ServerUtil.parseServerException(e);