gjacoby126 commented on a change in pull request #517: PHOENIX-5211 Consistent
Immutable Global Indexes for Non-Transactiona…
URL: https://github.com/apache/phoenix/pull/517#discussion_r298367865
##########
File path: phoenix-core/src/main/java/org/apache/phoenix/util/IndexUtil.java
##########
@@ -294,11 +305,37 @@ private static boolean isEmptyKeyValue(PTable table,
ColumnReference ref) {
.getLength()) == 0);
}
+
+ public static boolean isGlobalIndexCheckerEnabled(PhoenixConnection
connection, PName index)
+ throws SQLException {
+ String indexName = index.getString();
+ Boolean entry =
IndexNameGlobalIndexCheckerEnabledMap.getIfPresent(indexName);
+ if (entry != null){
+ return entry;
+ }
+
+ boolean result = false;
+ try {
+ TableDescriptor desc =
connection.getQueryServices().getTableDescriptor(index.getBytes());
+
+ if (desc != null) {
+ if (desc.hasCoprocessor(GlobalIndexChecker.class.getName())) {
+ result = true;
+ }
+ }
+ IndexNameGlobalIndexCheckerEnabledMap.put(indexName, result);
+ } catch (TableNotFoundException ex) {
Review comment:
If you can pass in the PTable rather than the PName, you could interrogate
the PTable to see whether it's a view index or not and save yourself the RPC
and the exception
----------------------------------------------------------------
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