You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@phoenix.apache.org by sa...@apache.org on 2015/06/19 05:09:40 UTC
phoenix git commit: PHOENIX-2057 Acquire lock in
MetaDataEndPointImpl.addRowsToChildViews() before calling doGetTable()
Repository: phoenix
Updated Branches:
refs/heads/4.x-HBase-0.98 e001c63f8 -> 4a7022066
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/4a702206
Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/4a702206
Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/4a702206
Branch: refs/heads/4.x-HBase-0.98
Commit: 4a70220668855041f33b8a7bc11dd037e6520500
Parents: e001c63
Author: Samarth <sa...@salesforce.com>
Authored: Thu Jun 18 19:32:52 2015 -0700
Committer: Samarth <sa...@salesforce.com>
Committed: Thu Jun 18 19:32:52 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/4a702206/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 f1b5373..f80a69d 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
@@ -1158,13 +1158,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()};
@@ -1576,18 +1577,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);