phoenix-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "James Taylor (JIRA)" <>
Subject [jira] [Created] (PHOENIX-2110) Diverged view should not block adding of column to base table
Date Sun, 12 Jul 2015 07:01:04 GMT
James Taylor created PHOENIX-2110:

             Summary: Diverged view should not block adding of column to base table
                 Key: PHOENIX-2110
             Project: Phoenix
          Issue Type: Bug
            Reporter: James Taylor
            Assignee: Samarth Jain

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

The code is in MetaDataEndPointImpl here:
    private MetaDataMutationResult addRowsToChildViews(List<Mutation> tableMetadata,
List<Mutation> mutationsForAddingColumnsToViews, byte[] schemaName, byte[] tableName,
            List<ImmutableBytesPtr> invalidateList, long clientTimeStamp, TableViewFinderResult
            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
                // to be propagated to it.
            	return new MetaDataMutationResult(MutationCode.UNALLOWED_TABLE_MUTATION, EnvironmentEdgeManager.currentTimeMillis(),

This message was sent by Atlassian JIRA

View raw message