You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@phoenix.apache.org by "Chinmay Kulkarni (Jira)" <ji...@apache.org> on 2020/09/22 17:30:00 UTC
[jira] [Updated] (PHOENIX-5404) Move check to client side to see if
there are any child views that need to be dropped while receating a
table/view
[ https://issues.apache.org/jira/browse/PHOENIX-5404?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Chinmay Kulkarni updated PHOENIX-5404:
--------------------------------------
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 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
>
>
> 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.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)