virajjasani commented on code in PR #1955:
URL: https://github.com/apache/phoenix/pull/1955#discussion_r1724102616
##########
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:
Exactly, we will need some level of re-iteration of PHOENIX-6883 with UCF.
Ultimately, when client sets UCF to some value other than ALWAYS and NEVER, we
need to ensure no getTable() or validateDdlTimestamp() RPC calls are initiated
by clients for the duration of UCF. Its good that now we know this, so we will
re-iterate on PHOENIX-6883 :)
--
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]