Github user JamesRTaylor commented on a diff in the pull request:
https://github.com/apache/phoenix/pull/290#discussion_r164182566
--- Diff:
phoenix-core/src/main/java/org/apache/phoenix/optimize/QueryOptimizer.java ---
@@ -312,6 +317,16 @@ private static QueryPlan addPlan(PhoenixStatement
statement, SelectStatement sel
return null;
}
+ // returns true if we can still use the index
+ // retuns false if we've been in PENDING_DISABLE too long - index
should be considered disabled
+ private static boolean isUnderPendingDisableThreshold(PhoenixStatement
statement, PTable indexTable) {
+ return EnvironmentEdgeManager
+ .currentTimeMillis() -
indexTable.getIndexDisableTimestamp() <= statement
+
.getConnection().getQueryServices().getConfiguration()
+
.getLong(QueryServices.INDEX_PENDING_DISABLE_THRESHOLD,
+
QueryServicesOptions.DEFAULT_INDEX_PENDING_DISABLE_THRESHOLD);
--- End diff --
Use .getConnection().getQueryServices().getProps() instead and add a member
variable to QueryOptimizer for indexPendingDisableThreshold. The ReadOnlyProps
should be used client-side as it's an immutable, read-only copy of
Configuration and prevents lock contention that we were seeing on the
Configuration object when there are many clients on a single JVM.
---