Github user ChinmaySKulkarni commented on a diff in the pull request: https://github.com/apache/phoenix/pull/313#discussion_r204968948 --- Diff: phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java --- @@ -1874,6 +1881,31 @@ private static boolean checkAndValidateRowTimestampCol(ColumnDef colDef, Primary } return false; } + + /** + * If we are creating a view we write a cell to the SYSTEM.MUTEX table + * with the rowkey of the parent table to prevent concurrent modifications + */ + private void writeCell(String tenantId, String schemaName, String tableName, String columnName) throws SQLException { + byte[] rowKey = columnName != null + ? SchemaUtil.getColumnKey(tenantId, schemaName, tableName, columnName, null) + : SchemaUtil.getTableKey(tenantId, schemaName, tableName); + boolean success = connection.getQueryServices().writeMutexCell(rowKey); + if (!success) { + throw new ConcurrentTableMutationException(schemaName, tableName); + } + } + + /** + * Remove the cell that was written to to the SYSTEM.CHILD_LINK table with --- End diff -- Update the comment since you're using SYSMUTEX now
---