gjacoby126 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_r356309832
##########
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:
@priyankporwal - the tricky thing is that it's legal to take a raw HBase
table, run a "CREATE TABLE" statement, and expect it to get the coprocs.
Proving that that's not what's happening (or is in the middle of happening on
some other transaction) is hard, so I'm being conservative + not trying to
solve the general problem of making an existent table not touched (which I
agree is the ideal behavior.)
----------------------------------------------------------------
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