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

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

[~tdsilva] We can't do 3. until 2. concludes that the table/view doesn't 
already exist otherwise we might drop legitimate child views instead of orphan 
views. For ex: 
 # Client A creates Table T and creates views V1 and V2 on top of T
 # Client B issues CREATE TABLE T --> Should fail with TABLE_ALREADY_EXISTS
 ## If we do RPC 3 and 4 first, we will drop child views (V1 and V2) of T since 
it assumes they are from the previous life of T, which is wrong.

We have to know that the table already exists and if it does, then skip the 
dropChildViews, which is why RPC 2 needs to be before RPC 3 and 4. Other wise, 
we can introduce a new RPC to just check existence of the table and then do 3,4 
before 1 and 2. 

> 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
>            Assignee: Chinmay Kulkarni
>            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