Repository: phoenix Updated Branches: refs/heads/4.x-HBase-1.0 edd2923ff -> 855c88ab6
PHOENIX-2057 Acquire lock in MetaDataEndPointImpl.addRowsToChildViews() before calling doGetTable() Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/855c88ab Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/855c88ab Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/855c88ab Branch: refs/heads/4.x-HBase-1.0 Commit: 855c88ab6baeae7f18072f7f0b8c81f8bf259f2b Parents: edd2923 Author: Samarth <[email protected]> Authored: Thu Jun 18 20:17:19 2015 -0700 Committer: Samarth <[email protected]> Committed: Thu Jun 18 20:17:19 2015 -0700 ---------------------------------------------------------------------- .../apache/phoenix/coprocessor/MetaDataEndpointImpl.java | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/phoenix/blob/855c88ab/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataEndpointImpl.java ---------------------------------------------------------------------- diff --git a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataEndpointImpl.java b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataEndpointImpl.java index 18a1d75..74499b6 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataEndpointImpl.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataEndpointImpl.java @@ -1159,13 +1159,14 @@ public class MetaDataEndpointImpl extends MetaDataProtocol implements Coprocesso } - private static void acquireLock(HRegion region, byte[] key, List<RowLock> locks) + private static RowLock acquireLock(HRegion region, byte[] key, List<RowLock> locks) throws IOException { RowLock rowLock = region.getRowLock(key); if (rowLock == null) { throw new IOException("Failed to acquire lock on " + Bytes.toStringBinary(key)); } locks.add(rowLock); + return rowLock; } private static final byte[] PHYSICAL_TABLE_BYTES = new byte[] {PTable.LinkType.PHYSICAL_TABLE.getSerializedValue()}; @@ -1577,18 +1578,16 @@ public class MetaDataEndpointImpl extends MetaDataProtocol implements Coprocesso byte[] viewSchemaName = rowViewKeyMetaData[PhoenixDatabaseMetaData.SCHEMA_NAME_INDEX]; byte[] viewName = rowViewKeyMetaData[PhoenixDatabaseMetaData.TABLE_NAME_INDEX]; byte[] viewKey = SchemaUtil.getTableKey(viewTenantId, viewSchemaName, viewName); - PTable view = doGetTable(viewKey, clientTimeStamp); + // 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.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; } - // lock the rows corresponding to views so that no other thread can modify the view meta-data - acquireLock(region, viewKey, locks); - int deltaNumberOfColumns = 0; - for (Mutation m : tableMetadata) { byte[][] rkmd = new byte[5][]; int pkCount = getVarChars(m.getRow(), rkmd);
