tkhurana commented on code in PR #2297:
URL: https://github.com/apache/phoenix/pull/2297#discussion_r2415288960


##########
phoenix-core-server/src/main/java/org/apache/phoenix/hbase/index/write/AbstractParallelWriterIndexCommitter.java:
##########
@@ -116,6 +115,40 @@ public void setup(HTableFactory factory, ExecutorService 
pool, Stoppable stop,
   public void write(Multimap<HTableInterfaceReference, Mutation> toWrite,
     final boolean allowLocalUpdates, final int clientVersion)
     throws SingleIndexWriteFailureException {
+    TaskBatch<Void> tasks = new TaskBatch<>(toWrite.asMap().size());
+    addTasks(toWrite, allowLocalUpdates, clientVersion, tasks);
+    submitTasks(tasks);
+  }
+
+  /**
+   * Submits the provided task batch for execution. This method defines the 
task submission strategy
+   * and must be implemented by concrete subclasses to specify whether tasks 
should be executed
+   * synchronously (blocking until completion) or asynchronously 
(fire-and-forget).
+   * @param tasks the batch of index write tasks to submit for execution
+   * @throws SingleIndexWriteFailureException if there is an error during task 
submission or
+   *                                          execution 
(implementation-dependent)
+   */
+  protected abstract void submitTasks(TaskBatch<Void> tasks)
+    throws SingleIndexWriteFailureException;
+
+  /**
+   * Adds parallel index write tasks to the provided task batch for execution 
across multiple index
+   * tables. Each index table gets its own task that will be executed in 
parallel to optimize write
+   * performance. It is recommended that implementations of 
AbstractParallelWriterIndexCommitter
+   * class use this method rather than calling super.write() to use their own 
copy of tasks.

Review Comment:
   Looks good overall. Just a minor nit to fix this comment. Other than that 
looks great.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to