phoenix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From maryann...@apache.org
Subject [16/47] phoenix git commit: PHOENIX-2057 Acquire lock in MetaDataEndPointImpl.addRowsToChildViews() before calling doGetTable()
Date Thu, 02 Jul 2015 21:01:19 GMT
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/466eeb35
Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/466eeb35
Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/466eeb35

Branch: refs/heads/calcite
Commit: 466eeb35f904c1c768dd3da7b396001826a1b40c
Parents: e78eb6f
Author: Samarth <samarth.jain@salesforce.com>
Authored: Thu Jun 18 20:14:53 2015 -0700
Committer: Samarth <samarth.jain@salesforce.com>
Committed: Thu Jun 18 20:14:53 2015 -0700

----------------------------------------------------------------------
 .../phoenix/coprocessor/MetaDataEndpointImpl.java       | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/phoenix/blob/466eeb35/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 077e325..b848565 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
@@ -1160,13 +1160,15 @@ public class MetaDataEndpointImpl extends MetaDataProtocol implements
Coprocesso
     }
 
 
-    private static void acquireLock(Region region, byte[] key, List<RowLock> locks)
+
+    private static RowLock acquireLock(Region region, byte[] key, List<RowLock> locks)
         throws IOException {
         RowLock rowLock = region.getRowLock(key, true);
         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()};
@@ -1579,18 +1581,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);


Mime
View raw message