[
https://issues.apache.org/jira/browse/PHOENIX-4634?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16393238#comment-16393238
]
Thomas D'Silva commented on PHOENIX-4634:
-----------------------------------------
[~jamestaylor]
Thanks for the review. I didn't reset it at the start of updataCache, because I
thought its possible we might return the parent view instead of the index
because of the following code that tries to avoids the rpc:
{code}
// Do not make rpc to getTable if
// 1. table is a system table
// 2. table was already resolved as of that timestamp
// 3. table does not have a ROW_TIMESTAMP column and age is less then
UPDATE_CACHE_FREQUENCY
if (table != null && !alwaysHitServer
&& (systemTable || resolvedTimestamp == tableResolvedTimestamp
||
(table.getRowTimestampColPos() == -1 &&
connection.getMetaDataCache().getAge(tableRef) <
table.getUpdateCacheFrequency() ))) {
return new
MetaDataMutationResult(MutationCode.TABLE_ALREADY_EXISTS,
QueryConstants.UNSET_TIMESTAMP, table);
}
{code}
Your right, I should have reset the result in the catch block, I will make that
change.
I think its happening more broadly. This is the exception we got (even with the
present fix in PhoenixRuntime). Its looks like updateCache is being called for
the inherited index.
{code}
org.apache.phoenix.schema.TableNotFoundException: ERROR 1012 (42M03): Table
undefined. tableName=Schema.Schema.Index#Schma.View
org.apache.phoenix.compile.FromCompiler$BaseColumnResolver.createTableRef(FromCompiler.java:577)
at
org.apache.phoenix.compile.FromCompiler$SingleTableColumnResolver.<init>(FromCompiler.java:391)
at
org.apache.phoenix.compile.FromCompiler.getResolverForQuery(FromCompiler.java:228)
at
org.apache.phoenix.compile.FromCompiler.getResolverForQuery(FromCompiler.java:206)
at org.apache.phoenix.optimize.QueryOptimizer.addPlan(QueryOptimizer.java:226)
at
org.apache.phoenix.optimize.QueryOptimizer.getApplicablePlans(QueryOptimizer.java:146)
{code}
I couldn't think of a better way to fix this. Should we modify getTable on the
server to check if the table is an inherited index and handle it on the server
(similar to what we are currently doing on the client)
{code}
// Tack on view statement to index to get proper filtering for view
String viewStatement =
IndexUtil.rewriteViewStatement(connection, index, parentTable,
view.getViewStatement());
PName modifiedIndexName =
PNameFactory.newName(index.getName().getString()
+ QueryConstants.CHILD_VIEW_INDEX_NAME_SEPARATOR +
view.getName().getString());
// add the index table with a new name so that it does not
conflict with the existing index table
// also set update cache frequency to never since the renamed
index is not present on the server
indexesToAdd.add(PTableImpl.makePTable(index,
modifiedIndexName, viewStatement, Long.MAX_VALUE, view.getTenantId()));
{code}
> Looking up a parent index table of a tenant child view fails in
> BaseColumnResolver createTableRef()
> ---------------------------------------------------------------------------------------------------
>
> Key: PHOENIX-4634
> URL: https://issues.apache.org/jira/browse/PHOENIX-4634
> Project: Phoenix
> Issue Type: Bug
> Reporter: Thomas D'Silva
> Assignee: Thomas D'Silva
> Priority: Major
> Fix For: 4.14.0
>
> Attachments: PHOENIX-4634-4.x-HBase-0.98.patch,
> PHOENIX-4634-v2.patch, PHOENIX-4634-v3.patch, PHOENIX-4634-v4.patch
>
>
> If we are looking up a parent table index of a child view , we need to
> resolve the view which will load the parent table indexes (instead of trying
> to resolve the parent table index directly).
>
> {code:java}
> org.apache.phoenix.schema.TableNotFoundException: ERROR 1012 (42M03): Table
> undefined. tableName=Schema.Schema.Index#Schma.View
> org.apache.phoenix.compile.FromCompiler$BaseColumnResolver.createTableRef(FromCompiler.java:577)
> at
> org.apache.phoenix.compile.FromCompiler$SingleTableColumnResolver.<init>(FromCompiler.java:391)
> at
> org.apache.phoenix.compile.FromCompiler.getResolverForQuery(FromCompiler.java:228)
> at
> org.apache.phoenix.compile.FromCompiler.getResolverForQuery(FromCompiler.java:206)
> at org.apache.phoenix.optimize.QueryOptimizer.addPlan(QueryOptimizer.java:226)
> at
> org.apache.phoenix.optimize.QueryOptimizer.getApplicablePlans(QueryOptimizer.java:146)
> at
> org.apache.phoenix.optimize.QueryOptimizer.getApplicablePlans(QueryOptimizer.java:103)
> at org.apache.phoenix.compile.DeleteCompiler.compile(DeleteCompiler.java:501)
> at
> org.apache.phoenix.jdbc.PhoenixStatement$ExecutableDeleteStatement.compilePlan(PhoenixStatement.java:770)
> at
> org.apache.phoenix.jdbc.PhoenixStatement$ExecutableDeleteStatement.compilePlan(PhoenixStatement.java:758)
> at org.apache.phoenix.jdbc.PhoenixStatement$2.call(PhoenixStatement.java:386)
> at org.apache.phoenix.jdbc.PhoenixStatement$2.call(PhoenixStatement.java:376)
> {code}
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)