[ https://issues.apache.org/jira/browse/PHOENIX-2057?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14594134#comment-14594134 ]
Hudson commented on PHOENIX-2057: --------------------------------- SUCCESS: Integrated in Phoenix-master #790 (See [https://builds.apache.org/job/Phoenix-master/790/]) PHOENIX-2057 Acquire lock in MetaDataEndPointImpl.addRowsToChildViews() before calling doGetTable() (samarth.jain: rev 466eeb35f904c1c768dd3da7b396001826a1b40c) * phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataEndpointImpl.java > 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)