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

ASF GitHub Bot commented on PHOENIX-4799:
-----------------------------------------

Github user karanmehta93 commented on a diff in the pull request:

    https://github.com/apache/phoenix/pull/313#discussion_r207674894
  
    --- Diff: 
phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java ---
    @@ -2957,6 +3006,16 @@ MutationState dropTable(String schemaName, String 
tableName, String parentTableN
                     Delete linkDelete = new Delete(linkKey, clientTimeStamp);
                     tableMetaData.add(linkDelete);
                 }
    +            if (tableType == PTableType.TABLE) {
    +                // acquire a mutex on the table to prevent creating views 
while concurrently
    +                // dropping the base table
    +                acquiredMutex = writeCell(null, schemaName, tableName, 
null);
    +                if (!acquiredMutex) {
    +                    logger.info("Failed to acquire mutex on physical table 
" + physicalTableName);
    --- End diff --
    
    nit: You can push mutex related logs lines to the specific methods.


> Write cells using checkAndMutate to prevent conflicting changes
> ---------------------------------------------------------------
>
>                 Key: PHOENIX-4799
>                 URL: https://issues.apache.org/jira/browse/PHOENIX-4799
>             Project: Phoenix
>          Issue Type: Sub-task
>    Affects Versions: 4.15.0, 5.1.0
>            Reporter: Thomas D'Silva
>            Assignee: Thomas D'Silva
>            Priority: Major
>         Attachments: PHOENIX-4799-v2.patch, PHOENIX-4799-v3.patch, 
> PHOENIX-4799-v4-4.x-HBase-1.3.patch, PHOENIX-4799-v4.patch, 
> PHOENIX-4799-v5-4.x-HBase-1.3.patch, PHOENIX-4799-v5.patch, 
> PHOENIX-4799-v6-4.x-HBase-1.3.patch, PHOENIX-4799-v6.patch
>
>
> In order to prevent race conditions when multiple client try to mutate the 
> same column before sending the request to mutate the column to the server do 
> a checkAndMutate with the column name being added/dropped. Also:
>  1. When a view is created do a checkAndMutate with the columns in the view 
> where clause.
>  2. When an index on a view is created do a checkAndMutate with the indexed 
> columns.
>  
> To prevent a race condition in the DROP TABLE CASCADE case, when a table is 
> dropped do a checkAndMutate with the rowkey of the base table name. If a view 
> is created it also does a checkAndMutate with the same rowkey. 



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to