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

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

richardantal commented on a change in pull request #929:
URL: https://github.com/apache/phoenix/pull/929#discussion_r516853365



##########
File path: 
phoenix-core/src/it/java/org/apache/phoenix/end2end/index/ViewIndexIT.java
##########
@@ -280,6 +282,64 @@ public void testCoprocsOnGlobalNonMTImmutableViewIndex() 
throws Exception {
         testCoprocsOnGlobalViewIndexHelper(false, false);
     }
 
+    @Test
+    public void testDroppingColumnWhileCreatingIndex() throws Exception {
+        String schemaName = "S1";
+        String tableName = generateUniqueName();
+        String viewSchemaName = "S1";
+        String fullTableName = SchemaUtil.getTableName(schemaName, tableName);
+        String indexName = "IND_" + generateUniqueName();
+        String viewName = "VIEW_" + generateUniqueName();
+        String fullViewName = SchemaUtil.getTableName(viewSchemaName, 
viewName);
+
+        createBaseTable(schemaName, tableName, false, null, null, true);
+        try (Connection conn = getConnection()) {
+            conn.setAutoCommit(true);
+            conn.createStatement().execute("CREATE VIEW " + fullViewName + " 
AS SELECT * FROM " + fullTableName);
+            conn.commit();
+
+            final int[] exceptionCode = new int[1];

Review comment:
       Yeah I think this a better solution. Nice one :) 
   Thanks for the review @virajjasani I have updated the commit.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> View index creation does a checkAndPut on an incorrect row key
> --------------------------------------------------------------
>
>                 Key: PHOENIX-6083
>                 URL: https://issues.apache.org/jira/browse/PHOENIX-6083
>             Project: Phoenix
>          Issue Type: Bug
>    Affects Versions: 5.0.0, 4.15.0
>            Reporter: Chinmay Kulkarni
>            Assignee: Richard Antal
>            Priority: Critical
>              Labels: phoenix-hardening, quality-improvement
>             Fix For: 5.1.0, 4.16.0
>
>         Attachments: image-2020-08-18-11-09-35-080.png, 
> image-2020-08-18-11-09-53-816.png
>
>
> When creating a view index, we "lock" on the indexed and included columns by 
> doing a checkAndPut on the cell: 
> (<physical parent's schema name>, <physical parent's table name>, <name of 
> the indexed/included column>)
> This is done to prevent another client from concurrently dropping any of the 
> indexed/included columns. This however, is not working as expected since the 
> indexed column naming convention is different (<column family>:<column name>) 
> rather than just <column name>. 
> Thus, concurrent dropping of the column is not prevented and this leads to 
> failure in view index creation with either an NPE or IllegalArgumentException.
> !image-2020-08-18-11-09-35-080.png!
> !image-2020-08-18-11-09-53-816.png!
>  



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

Reply via email to