twdsilva commented on a change in pull request #541: PHOENIX-4893 Move parent 
column combining logic of view and view inde…
URL: https://github.com/apache/phoenix/pull/541#discussion_r303634994
 
 

 ##########
 File path: 
phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataEndpointImpl.java
 ##########
 @@ -2898,35 +2381,65 @@ else if (tableType != PTableType.VIEW) {
                 EnvironmentEdgeManager.currentTimeMillis(), table, 
tableNamesToDelete, sharedTablesToDelete);
     }
 
-    private static interface ColumnMutator {
-        MetaDataMutationResult updateMutation(PTable table, byte[][] 
rowKeyMetaData,
-                List<Mutation> tableMetadata, Region region, 
List<ImmutableBytesPtr> invalidateList,
-                List<RowLock> locks, long clientTimeStamp) throws IOException, 
SQLException;
-    }
-
     private MetaDataMutationResult
-    mutateColumn(MutatateColumnType mutateColumnType, List<Mutation> 
tableMetadata, ColumnMutator mutator, int clientVersion) throws IOException {
+    mutateColumn(List<Mutation> tableMetadata, ColumnMutator mutator, int 
clientVersion, PTable parentTable)
+            throws IOException {
         byte[][] rowKeyMetaData = new byte[5][];
         MetaDataUtil.getTenantIdAndSchemaAndTableName(tableMetadata, 
rowKeyMetaData);
         byte[] tenantId = 
rowKeyMetaData[PhoenixDatabaseMetaData.TENANT_ID_INDEX];
         byte[] schemaName = 
rowKeyMetaData[PhoenixDatabaseMetaData.SCHEMA_NAME_INDEX];
         byte[] tableName = 
rowKeyMetaData[PhoenixDatabaseMetaData.TABLE_NAME_INDEX];
         byte[] key = SchemaUtil.getTableKey(tenantId, schemaName, tableName);
         String fullTableName = SchemaUtil.getTableName(schemaName, tableName);
+        // server-side, except for indexing, we always expect the keyvalues to 
be standard KeyValues
+        PTableType expectedType = MetaDataUtil.getTableType(tableMetadata, 
GenericKeyValueBuilder.INSTANCE,
+                new ImmutableBytesWritable());
+        List<byte[]> tableNamesToDelete = Lists.newArrayList();
+        List<SharedTableState> sharedTablesToDelete = Lists.newArrayList();
+        List<PTable> childViews = Lists.newArrayList();
+        long clientTimeStamp = MetaDataUtil.getClientTimeStamp(tableMetadata);
         try {
             Region region = env.getRegion();
             MetaDataMutationResult result = checkTableKeyInRegion(key, region);
             if (result != null) {
                 return result;
             }
+
             List<RowLock> locks = Lists.newArrayList();
             try {
+                if (expectedType == PTableType.TABLE) {
+                    childViews = findAllChildViews(clientTimeStamp, tenantId, 
schemaName, tableName);
 
 Review comment:
   find the child views before locking the current parent table row.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to