palashc commented on code in PR #1955:
URL: https://github.com/apache/phoenix/pull/1955#discussion_r1723983534
##########
phoenix-core-client/src/main/java/org/apache/phoenix/schema/MetaDataClient.java:
##########
@@ -785,19 +785,37 @@ private boolean avoidRpcToGetTable(boolean
alwaysHitServer, Long resolvedTimesta
final long effectiveUpdateCacheFreq;
final String ucfInfoForLogging; // Only used for logging purposes
+ boolean overrideUcfToDefault = false;
+ if (table.getType() == INDEX) {
+ overrideUcfToDefault =
+
PIndexState.PENDING_DISABLE.equals(table.getIndexState()) ||
+ !IndexMaintainer.sendIndexMaintainer(table);
+ }
+ if (!overrideUcfToDefault && !table.getIndexes().isEmpty()) {
+ List<PTable> indexes = table.getIndexes();
+ List<PTable> maintainedIndexes =
+
Lists.newArrayList(IndexMaintainer.maintainedIndexes(indexes.iterator()));
+ // The maintainedIndexes contain only the indexes that are
used by clients
+ // while generating the mutations. If all the indexes are
usable by clients,
+ // we don't need to override UPDATE_CACHE_FREQUENCY. However,
if any index is
+ // not in usable state by the client mutations, we should
override
+ // UPDATE_CACHE_FREQUENCY to default value so that we make
getTable() RPC calls
+ // until all index states change to ACTIVE, BUILDING or other
usable states.
+ overrideUcfToDefault = indexes.size() !=
maintainedIndexes.size();
+ }
+
// What if the table is created with UPDATE_CACHE_FREQUENCY
explicitly set to ALWAYS?
// i.e. explicitly set to 0. We should ideally be checking for
something like
// hasUpdateCacheFrequency().
//always fetch an Index in PENDING_DISABLE state to retrieve
server timestamp
//QueryOptimizer needs that to decide whether the index can be used
- if (PIndexState.PENDING_DISABLE.equals(table.getIndexState())) {
+ if (overrideUcfToDefault) {
Review Comment:
For PHOENIX-6883, we wanted to set default UCF to NEVER and that is why this
config was introduced. At this point, I am a little confused about how this UCF
change and PHOENIX-6883 would work together in the future.
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]