[jira] [Updated] (PHOENIX-6154) Move check to client side to see if there are any child views that need to be dropped while dropping a table/view

2020-09-22 Thread Chinmay Kulkarni (Jira)


 [ 
https://issues.apache.org/jira/browse/PHOENIX-6154?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Chinmay Kulkarni updated PHOENIX-6154:
--
Description: 
When we issue a {{DROP TABLE/VIEW}}, if the table/view being dropped has child 
views (and {{CASCADE}} is provided), we add a 
{{[DropChildViewsTask|https://github.com/apache/phoenix/blob/1d844950bb4ec8221873ecd2b094c20f427cd984/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/tasks/DropChildViewsTask.java]}}
 in the {{SYSTEM.TASK}} table (see 
[this|https://github.com/apache/phoenix/blob/1d844950bb4ec8221873ecd2b094c20f427cd984/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataEndpointImpl.java#L2479]).
 This means that *while holding the row lock* for the table/view’s header row 
([here|https://github.com/apache/phoenix/blob/1d844950bb4ec8221873ecd2b094c20f427cd984/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataEndpointImpl.java#L2253])
 we do the following:
 # Make an 
[RPC|https://github.com/apache/phoenix/blob/1d844950bb4ec8221873ecd2b094c20f427cd984/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataEndpointImpl.java#L2459-L2461]
 to the region hosting {{SYSTEM.CHILD_LINK}} to scan it in order to find child 
views.
 # If any child views are found in the step above, we make additional RPCs to 
the region hosting {{SYSTEM.TASK}} to 
{{[UPSERT|https://github.com/apache/phoenix/blob/1d844950bb4ec8221873ecd2b094c20f427cd984/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataEndpointImpl.java#L2479-L2484]}}
 a {{DropChildViewsTask}} for immediate child views.
 # We [send remote 
mutations|https://github.com/apache/phoenix/blob/1d844950bb4ec8221873ecd2b094c20f427cd984/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataEndpointImpl.java#L2298-L2302]
 to drop parent→child links from the {{SYSTEM.CHILD_LINK}} table.

Of the above extra RPCs, note that even if the table/view has no child views or 
if {{CASCADE}} is not provided, we will still do the first RPC from the server 
while holding a row lock.

We should move this check to the client (issue a scan against SYSTEM.CHILD_LINK 
to see if a single linking row exists) and also add the task from the client.

  was:
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).


> Move check to client side to see if there are any child views that need to be 
> dropped while dropping a table/view
> -
>
> Key: PHOENIX-6154
> URL: https://issues.apache.org/jira/browse/PHOENIX-6154
> Project: Phoenix
>  Issue Type: Sub-task
>Affects Versions: 5.0.0, 4.15.0
>Reporter: Chinmay Kulkarni
>Priority: Major
> Fix For: 5.1.0, 4.16.0
>
>
> When we issue a {{DROP TABLE/VIEW}}, if the table/view being dropped has 
> child views (and {{CASCADE}} is provided), we add a 
> {{[DropChildViewsTask|https://github.com/apache/phoenix/blob/1d844950bb4ec8221873ecd2b094c20f427cd984/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/tasks/DropChildViewsTask.java]}}
>  in the {{SYSTEM.TASK}} table (see 
> [this|https://github.com/apache/phoenix/blob/1d844950bb4ec8221873ecd2b094c20f427cd984/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataEndpointImpl.java#L2479]).
>  This means that *while holding the row lock* for the table/view’s header row 
> ([here|https://github.com/apache/phoenix/blob/1d844950bb4ec8221873ecd2b094c20f427cd984/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataEndpointImpl.java#L2253])
>  we do the following:
>  # Make an 
> [RPC|https://github.com/apache/phoenix/blob/1d844950bb4ec8221873ecd2b094c20f427cd984/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataEndpointImpl.java#L2459-L2461]
>  to the region hosting {{SYSTEM.CHILD_LINK}} to scan it in order to find 
> child views.
>  # If any child views are found in the step above, we make additional RPCs to 
> the region hosting {{SYSTEM.TASK}} to 
> {{[UPSERT|https://github.com/apache/phoenix/blob/1d844950bb4ec8221873ecd2b094c20f427cd984/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataEndpointImpl.java#L2479-L2484]}}
>  a {{DropChildViewsTask}} for immediate child views.
>  # We [send remote 
> mutations|https://github.com/apache/phoenix/blob/1d844950bb4ec8221873ecd2b094c20f427cd984/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataEndpointImpl.java#L2298-L2302]
>  to drop parent→child links from the 

[jira] [Updated] (PHOENIX-6154) Move check to client side to see if there are any child views that need to be dropped while dropping a table/view

2020-09-22 Thread Chinmay Kulkarni (Jira)


 [ 
https://issues.apache.org/jira/browse/PHOENIX-6154?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Chinmay Kulkarni updated PHOENIX-6154:
--
Reporter: Chinmay Kulkarni  (was: Thomas D'Silva)

> Move check to client side to see if there are any child views that need to be 
> dropped while dropping a table/view
> -
>
> Key: PHOENIX-6154
> URL: https://issues.apache.org/jira/browse/PHOENIX-6154
> Project: Phoenix
>  Issue Type: Sub-task
>Affects Versions: 5.0.0, 4.15.0
>Reporter: Chinmay Kulkarni
>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)