kadirozde commented on a change in pull request #457:  PHOENIX-5190 Implement 
TaskRegionObserver for Index rebuild
URL: https://github.com/apache/phoenix/pull/457#discussion_r265385457
 
 

 ##########
 File path: 
phoenix-core/src/main/java/org/apache/phoenix/coprocessor/TaskRegionObserver.java
 ##########
 @@ -157,18 +191,58 @@ public static void addTask(PhoenixConnection conn, 
TaskType taskType, String ten
                     PhoenixDatabaseMetaData.TENANT_ID + ", " +
                     PhoenixDatabaseMetaData.TABLE_SCHEM + ", " +
                     PhoenixDatabaseMetaData.TABLE_NAME + " ) VALUES(?,?,?,?)");
-            stmt.setByte(1, taskType.getSerializedValue());
-            if (tenantId != null) {
-                stmt.setString(2, tenantId);
+            stmt = setValuesToAddTaskPS(stmt, taskType, tenantId, schemaName, 
tableName);
+        } catch (SQLException e) {
+            throw new IOException(e);
+        }
+        mutateSystemTaskTable(conn, stmt, accessCheckEnabled);
+    }
+
+    public static void addTask(PhoenixConnection conn, TaskType taskType, 
String tenantId, String schemaName,
+            String tableName, String indexName, String taskStatus, String 
data, Byte priority, Timestamp endTs,
+            boolean accessCheckEnabled)
+            throws IOException {
+        PreparedStatement stmt = null;
+        try {
+            stmt = conn.prepareStatement("UPSERT INTO " +
+                    PhoenixDatabaseMetaData.SYSTEM_TASK_NAME + " ( " +
+                    PhoenixDatabaseMetaData.TASK_TYPE + ", " +
+                    PhoenixDatabaseMetaData.TENANT_ID + ", " +
+                    PhoenixDatabaseMetaData.TABLE_SCHEM + ", " +
+                    PhoenixDatabaseMetaData.TABLE_NAME + ", " +
+                    PhoenixDatabaseMetaData.INDEX_NAME + ", " +
 
 Review comment:
   INDEX_NAME should be a task specific attribute. I do not think it should be 
part of the generic task attributes.  Either the name of the index table should 
be stored in the TABLE_NAME column or encoded in the DATA column. I suggest 
removing INDEX_NAME from from the DDL

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