Repository: phoenix Updated Branches: refs/heads/5.x-HBase-2.0 8e5b4131b -> 06bb5d95a
PHOENIX-4304 adding checks whether coprocesseros presently already before adding again(Rajeshbabu) Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/06bb5d95 Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/06bb5d95 Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/06bb5d95 Branch: refs/heads/5.x-HBase-2.0 Commit: 06bb5d95ada56ccd86b538b29d12468a096ff376 Parents: 8e5b413 Author: Rajeshbabu Chintaguntla <rajeshb...@apache.org> Authored: Tue Nov 28 09:45:46 2017 +0530 Committer: Rajeshbabu Chintaguntla <rajeshb...@apache.org> Committed: Tue Nov 28 09:45:46 2017 +0530 ---------------------------------------------------------------------- .../phoenix/query/ConnectionQueryServicesImpl.java | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/phoenix/blob/06bb5d95/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 2077272..bcc5aa4 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 @@ -833,13 +833,19 @@ public class ConnectionQueryServicesImpl extends DelegateQueryServices implement // The phoenix jar must be available on HBase classpath int priority = props.getInt(QueryServices.COPROCESSOR_PRIORITY_ATTRIB, QueryServicesOptions.DEFAULT_COPROCESSOR_PRIORITY); try { + TableDescriptor newDesc = builder.build(); + if(newDesc.hasCoprocessor(ScanRegionObserver.class.getName())) { builder.addCoprocessor(ScanRegionObserver.class.getName(), null, priority, null); - + } + if(newDesc.hasCoprocessor(UngroupedAggregateRegionObserver.class.getName())) { builder.addCoprocessor(UngroupedAggregateRegionObserver.class.getName(), null, priority, null); - + } + if(newDesc.hasCoprocessor(GroupedAggregateRegionObserver.class.getName())) { builder.addCoprocessor(GroupedAggregateRegionObserver.class.getName(), null, priority, null); - + } + if(newDesc.hasCoprocessor(ServerCachingEndpointImpl.class.getName())) { builder.addCoprocessor(ServerCachingEndpointImpl.class.getName(), null, priority, null); + } boolean isTransactional = Boolean.TRUE.equals(tableProps.get(TableProperty.TRANSACTIONAL.name())) || Boolean.TRUE.equals(tableProps.get(PhoenixTransactionContext.READ_NON_TX_DATA)); // For ALTER TABLE @@ -855,7 +861,7 @@ public class ConnectionQueryServicesImpl extends DelegateQueryServices implement // For alter table, remove non transactional index coprocessor builder.removeCoprocessor(Indexer.class.getName()); } else { - if (!builder.build().hasCoprocessor(Indexer.class.getName())) { + if (!newDesc.hasCoprocessor(Indexer.class.getName())) { // If exception on alter table to transition back to non transactional builder.removeCoprocessor(PhoenixTransactionalIndexer.class.getName()); Map<String, String> opts = Maps.newHashMapWithExpectedSize(1);