priyankporwal commented on a change in pull request #640: PHOENIX-5578 - CREATE 
TABLE IF NOT EXISTS loads IndexRegionObserver o…
URL: https://github.com/apache/phoenix/pull/640#discussion_r349735532
 
 

 ##########
 File path: 
phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java
 ##########
 @@ -999,6 +1007,23 @@ private void addCoprocessors(byte[] tableName, 
HTableDescriptor descriptor, PTab
         }
     }
 
+    private boolean doesPhoenixTableAlreadyExist(HTableDescriptor 
existingDesc) {
+        //if the table descriptor already has Phoenix coprocs, we assume it's
+        //already gone through a Phoenix create statement once
+        if (existingDesc == null){
+            return false;
+        }
+        boolean hasScanObserver = 
existingDesc.hasCoprocessor(ScanRegionObserver.class.getName());
+        boolean hasUnAggObserver = existingDesc.hasCoprocessor(
+            UngroupedAggregateRegionObserver.class.getName());
+        boolean hasGroupedObserver = existingDesc.hasCoprocessor(
+            GroupedAggregateRegionObserver.class.getName());
+        boolean hasIndexObserver = 
existingDesc.hasCoprocessor(Indexer.class.getName())
+            || existingDesc.hasCoprocessor(IndexRegionObserver.class.getName())
+            || existingDesc.hasCoprocessor(GlobalIndexChecker.class.getName());
+        return hasScanObserver && hasUnAggObserver && hasGroupedObserver && 
hasIndexObserver;
 
 Review comment:
   If any of these coprocs are missing, we would still end-up adding the 
indexing coprocs, possibly under the similar rolling upgrade time as we have 
recently experienced. Should we confirm if 'CREATE .. IF NOT EXISTS' is 
supposed to so such 'repairs' or are there other better mechanisms?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to