[ 
https://issues.apache.org/jira/browse/PHOENIX-5404?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17108879#comment-17108879
 ] 

Chinmay Kulkarni commented on PHOENIX-5404:
-------------------------------------------

In 4.15 onwards, when we drop a base table/view, we don’t immediately drop its 
child view(s), but instead create a task within SYSTEM.TASK to drop the child 
view(s) at some scheduled later point. It is then possible that when we try to 
recreate the table/view, the child view(s) from that table/view’s previous life 
have not yet been dropped. 

In order to prevent this situation and ensure that there are not any child 
views that haven't been cleaned up by the DropChildView task yet, we explicitly 
make a call to ViewUtil.dropChildViews from MetaDataEndpointImpl inside 
createTable. Here's the problem:

* This is basically a *server-server RPC* from the RS hosting SYSTEM.CATALOG to 
the RS hosting SYSTEM.CHILD_LINK to find all child views and issue DROP VIEW 
commands to each of them (which in turn sends an RPC to the RS hosting 
SYSTEM.CATALOG again to invoke MetaDataEndpointImpl.dropTable).
* If this is frequent, it can hold up RS handlers and also slow down view 
creation, so we should either try to co-locate SYSTEM.CATALOG and 
SYSTEM.CHILD_LINK (though co-location probably won't fix the handlers being 
held up), or fix this JIRA which aims at moving this down to the client-side 
rather than doing server-server RPCs.

Also note that this is not an issue for pre-4.15 clients connecting to a 4.15 
server *that has old metadata* (never been connected to by a 4.15 client) since 
in this scenario, we do not allow the client to drop a table/view if it has 
child views (even if the cascade option is set).

This may be useful to get in as part of 4.16.0, to reduce the number of Phoenix 
deployments since it involves both server and client-side changes.[~yanxinyi] 
[~sukuna...@gmail.com]
WDYT [~larsh] [~kadir] [~gjacoby]?

> Move check to client side to see if there are any child views that need to be 
> dropped while receating a table/view
> ------------------------------------------------------------------------------------------------------------------
>
>                 Key: PHOENIX-5404
>                 URL: https://issues.apache.org/jira/browse/PHOENIX-5404
>             Project: Phoenix
>          Issue Type: Sub-task
>    Affects Versions: 5.0.0, 4.15.0
>            Reporter: Thomas D'Silva
>            Priority: Major
>             Fix For: 5.1.0, 4.16.0
>
>
> Remove  {{ViewUtil.dropChildViews(env, tenantIdBytes, schemaName, 
> tableName);}} call in MetdataEndpointImpl.createTable
> While creating a table or view we need to ensure that are not any child views 
> that haven't been clean up by the DropChildView task yet. Move this check to 
> the client (issue a scan against SYSTEM.CHILD_LINK to see if a single linking 
> row exists).



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to