kadirozde commented on code in PR #1964:
URL: https://github.com/apache/phoenix/pull/1964#discussion_r1742539259


##########
phoenix-core-client/src/main/java/org/apache/phoenix/schema/MetaDataClient.java:
##########
@@ -1946,27 +1946,32 @@ public MutationState createCDC(CreateCDCStatement 
statement) throws SQLException
         Map<String, Object> commonFamilyProps = 
Maps.newHashMapWithExpectedSize(
                 statement.getProps().size() + 1);
         populatePropertyMaps(statement.getProps(), tableProps, 
commonFamilyProps, PTableType.CDC);
-
-        PhoenixStatement pstmt = new PhoenixStatement(connection);
-        String dataTableFullName = 
SchemaUtil.getTableName(statement.getDataTable().getSchemaName(),
-                statement.getDataTable().getTableName());
-        String createIndexSql = "CREATE UNCOVERED INDEX " +
-                (statement.isIfNotExists() ? "IF NOT EXISTS " : "") +
-                "\"" + 
CDCUtil.getCDCIndexName(statement.getCdcObjName().getName()) + "\"" +
-                " ON " + dataTableFullName + " (" + 
PhoenixRowTimestampFunction.NAME + "()) ASYNC";
-        List<String> indexProps = new ArrayList<>();
-        Object saltBucketNum = TableProperty.SALT_BUCKETS.getValue(tableProps);
-        if (saltBucketNum != null) {
-            indexProps.add("SALT_BUCKETS=" + saltBucketNum);
-        }
-        Object columnEncodedBytes = 
TableProperty.COLUMN_ENCODED_BYTES.getValue(tableProps);
-        if (columnEncodedBytes != null) {
-            indexProps.add("COLUMN_ENCODED_BYTES=" + columnEncodedBytes);
-        }
-        createIndexSql = createIndexSql + " " + String.join(", ", indexProps);
-        try {
-            pstmt.execute(createIndexSql);
-        } catch (SQLException e) {
+        Properties props = connection.getClientInfo();
+        props.put(INDEX_CREATE_DEFAULT_STATE, "ACTIVE");
+        try (Connection internalConnection = QueryUtil.getConnection(props, 
connection.getQueryServices().getConfiguration())) {
+            PhoenixStatement pstmt = new PhoenixStatement((PhoenixConnection) 
internalConnection);

Review Comment:
   The CDC index table should not be replicated. If needed, it can be rebuilt 
on the destination. 



-- 
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.

To unsubscribe, e-mail: issues-unsubscr...@phoenix.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to