You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@phoenix.apache.org by sk...@apache.org on 2019/06/26 20:40:29 UTC

[phoenix] branch master updated: PHOENIX-5359: Remove (Global-Indexing)new coprocessors in CQSI#addCoprocessors with flag(INDEX_REGION_OBSERVER_ENABLED_ATTRIB) disabled (#522)

This is an automated email from the ASF dual-hosted git repository.

skadam pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/phoenix.git


The following commit(s) were added to refs/heads/master by this push:
     new c4d75dd  PHOENIX-5359: Remove (Global-Indexing)new coprocessors in CQSI#addCoprocessors with flag(INDEX_REGION_OBSERVER_ENABLED_ATTRIB) disabled (#522)
c4d75dd is described below

commit c4d75ddeb5134e245dbe9019481758f81fb30e9d
Author: Swaroopa Kadam <sw...@gmail.com>
AuthorDate: Wed Jun 26 13:40:24 2019 -0700

    PHOENIX-5359: Remove (Global-Indexing)new coprocessors in CQSI#addCoprocessors with flag(INDEX_REGION_OBSERVER_ENABLED_ATTRIB) disabled (#522)
---
 .../apache/phoenix/query/ConnectionQueryServicesImpl.java | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

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 e2eb079..133737f 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
@@ -906,12 +906,14 @@ public class ConnectionQueryServicesImpl extends DelegateQueryServices implement
             TransactionFactory.Provider provider = getTransactionProvider(tableProps);
             boolean isTransactional = (provider != null);
 
-            boolean globalIndexerEnabled = config.getBoolean(
+            boolean indexRegionObserverEnabled = config.getBoolean(
                     QueryServices.INDEX_REGION_OBSERVER_ENABLED_ATTRIB,
                     QueryServicesOptions.DEFAULT_INDEX_REGION_OBSERVER_ENABLED);
 
             if (tableType == PTableType.INDEX && !isTransactional) {
-                if (globalIndexerEnabled && !newDesc.hasCoprocessor(GlobalIndexChecker.class.getName())) {
+                if (!indexRegionObserverEnabled && newDesc.hasCoprocessor(GlobalIndexChecker.class.getName())) {
+                    builder.removeCoprocessor(GlobalIndexChecker.class.getName());
+                } else if (indexRegionObserverEnabled && !newDesc.hasCoprocessor(GlobalIndexChecker.class.getName())) {
                     builder.addCoprocessor(GlobalIndexChecker.class.getName(), null, priority - 1, null);
                 }
             }
@@ -952,14 +954,19 @@ public class ConnectionQueryServicesImpl extends DelegateQueryServices implement
                     if (newDesc.hasCoprocessor(PhoenixTransactionalIndexer.class.getName())) {
                         builder.removeCoprocessor(PhoenixTransactionalIndexer.class.getName());
                     }
-                    if (globalIndexerEnabled) {
+                    if (indexRegionObserverEnabled) {
+                        if (newDesc.hasCoprocessor(Indexer.class.getName())) {
+                            builder.removeCoprocessor(Indexer.class.getName());
+                        }
                         if (!newDesc.hasCoprocessor(IndexRegionObserver.class.getName())) {
                             Map<String, String> opts = Maps.newHashMapWithExpectedSize(1);
                             opts.put(NonTxIndexBuilder.CODEC_CLASS_NAME_KEY, PhoenixIndexCodec.class.getName());
                             IndexRegionObserver.enableIndexing(builder, PhoenixIndexBuilder.class, opts, priority);
                         }
-
                     } else {
+                        if (newDesc.hasCoprocessor(IndexRegionObserver.class.getName())) {
+                            builder.removeCoprocessor(IndexRegionObserver.class.getName());
+                        }
                         if (!newDesc.hasCoprocessor(Indexer.class.getName())) {
                             Map<String, String> opts = Maps.newHashMapWithExpectedSize(1);
                             opts.put(NonTxIndexBuilder.CODEC_CLASS_NAME_KEY, PhoenixIndexCodec.class.getName());