virajjasani commented on a change in pull request #960:
URL: https://github.com/apache/phoenix/pull/960#discussion_r524897168



##########
File path: phoenix-core/src/main/java/org/apache/phoenix/schema/task/Task.java
##########
@@ -141,12 +216,68 @@ public static void addTask(PhoenixConnection conn, 
PTable.TaskType taskType, Str
                     PhoenixDatabaseMetaData.TASK_END_TS + ", " +
                     PhoenixDatabaseMetaData.TASK_DATA +
                     " ) VALUES(?,?,?,?,?,?,?,?,?)");
-            stmt = setValuesToAddTaskPS(stmt, taskType, tenantId, schemaName, 
tableName, taskStatus, data, priority, startTs, endTs);
-            LOGGER.info("Adding task " + taskType + "," +tableName + "," + 
taskStatus + "," + startTs, ","+endTs);
+            stmt = setValuesToAddTaskPS(stmt, systemTaskParams.getTaskType(),
+                systemTaskParams.getTenantId(),
+                systemTaskParams.getSchemaName(),
+                systemTaskParams.getTableName(),
+                systemTaskParams.getTaskStatus(), systemTaskParams.getData(),
+                systemTaskParams.getPriority(), systemTaskParams.getStartTs(),
+                systemTaskParams.getEndTs());
+            LOGGER.info("Adding task type: {} , tableName: {} , taskStatus: {}"
+                + " , startTs: {} , endTs: {}", systemTaskParams.getTaskType(),
+                systemTaskParams.getTableName(),
+                systemTaskParams.getTaskStatus(), 
systemTaskParams.getStartTs(),
+                systemTaskParams.getEndTs());
         } catch (SQLException e) {
             throw new IOException(e);
         }
-        mutateSystemTaskTable(conn, stmt, accessCheckEnabled);
+        // if query is getting executed by client, do not execute and commit
+        // mutations
+        if (isCommitAllowed) {

Review comment:
       > This is used just for the index rebuild task that gets triggered from 
the client-side, right? For the tasks that are triggered from the server (i.e. 
from `MetaDataEndpointImpl` and `TaskRO`, we can just directly call 
`Task.addTask()` right?
   
   That's right, both of above are correct. Sure, let me rename it to 
`shouldCommit`, that one sounds better.




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


Reply via email to