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

Hudson commented on PHOENIX-2110:
---------------------------------

FAILURE: Integrated in Phoenix-master #852 (See 
[https://builds.apache.org/job/Phoenix-master/852/])
PHOENIX-2110 Primary key changes should be pushed to diverged views 
(samarth.jain: rev 5b46793b6951cf1ca04850a5ad771f2cd9f5802a)
* 
phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataEndpointImpl.java
* phoenix-core/src/it/java/org/apache/phoenix/end2end/AlterTableWithViewsIT.java
* phoenix-core/src/it/java/org/apache/phoenix/end2end/AlterTableIT.java


> Primary key changes should be pushed to diverged views
> ------------------------------------------------------
>
>                 Key: PHOENIX-2110
>                 URL: https://issues.apache.org/jira/browse/PHOENIX-2110
>             Project: Phoenix
>          Issue Type: Improvement
>            Reporter: James Taylor
>            Assignee: Samarth Jain
>             Fix For: 4.5.0
>
>         Attachments: PHOENIX-2110.patch
>
>
> If a view is diverged, we should not abort the adding of a column to the base 
> table. Instead, we should add it if it's a PK (as otherwise the view will 
> become unusable) and not add it otherwise. If that's problematic, then 
> perhaps we can just block it if a PK column is being added.
> The code is in MetaDataEndPointImpl here:
> {code}
>     private MetaDataMutationResult addRowsToChildViews(List<Mutation> 
> tableMetadata, List<Mutation> mutationsForAddingColumnsToViews, byte[] 
> schemaName, byte[] tableName,
>             List<ImmutableBytesPtr> invalidateList, long clientTimeStamp, 
> TableViewFinderResult childViewsResult,
>             Region region, List<RowLock> locks) throws IOException, 
> SQLException {
>         for (Result viewResult : childViewsResult.getResults()) {
>             byte[][] rowViewKeyMetaData = new byte[3][];
>             getVarChars(viewResult.getRow(), 3, rowViewKeyMetaData);
>             byte[] viewTenantId = 
> rowViewKeyMetaData[PhoenixDatabaseMetaData.TENANT_ID_INDEX];
>             byte[] viewSchemaName = 
> rowViewKeyMetaData[PhoenixDatabaseMetaData.SCHEMA_NAME_INDEX];
>             byte[] viewName = 
> rowViewKeyMetaData[PhoenixDatabaseMetaData.TABLE_NAME_INDEX];
>             byte[] viewKey = SchemaUtil.getTableKey(viewTenantId, 
> viewSchemaName, viewName);
>             // lock the rows corresponding to views so that no other thread 
> can modify the view meta-data
>             RowLock viewRowLock = acquireLock(region, viewKey, locks);
>             PTable view = doGetTable(viewKey, clientTimeStamp, viewRowLock);
>             if (view.getBaseColumnCount() == 
> QueryConstants.DIVERGED_VIEW_BASE_COLUMN_COUNT) {
>                 // if a view has divorced itself from the base table, we 
> don't allow schema changes
>                 // to be propagated to it.
>               return new 
> MetaDataMutationResult(MutationCode.UNALLOWED_TABLE_MUTATION, 
> EnvironmentEdgeManager.currentTimeMillis(), null);
>             }
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to