[
https://issues.apache.org/jira/browse/PHOENIX-2057?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Samarth Jain updated PHOENIX-2057:
----------------------------------
Fix Version/s: 4.5.0
5.0.0
> Acquire lock in MetaDataEndPointImpl.addRowsToChildViews() before calling
> doGetTable()
> --------------------------------------------------------------------------------------
>
> Key: PHOENIX-2057
> URL: https://issues.apache.org/jira/browse/PHOENIX-2057
> Project: Phoenix
> Issue Type: Bug
> Reporter: James Taylor
> Assignee: Samarth Jain
> Fix For: 5.0.0, 4.5.0
>
> Attachments: PHOENIX-2057.patch
>
>
> Rather than acquiring the row lock in doGetTable and then letting the lock be
> released and then getting it again right afterwards, it'd be better to
> acquire the lock upfront and pass it into doGetTable, like this:
> {code}
> private void 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];
> // lock the rows corresponding to views so that no other thread
> can modify the view meta-data
> // TODO: modify acquireLock to return the RowLock
> RowLock rowLock = acquireLock(region, viewKey, locks);
> byte[] viewKey = SchemaUtil.getTableKey(viewTenantId,
> viewSchemaName, viewName);
> PTable view = doGetTable(viewKey, clientTimeStamp, rowLock);
> if (view.getBaseColumnCount() ==
> QueryConstants.DIVORCED_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;
> }
> {code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)