stinger1206 commented on code in PR #113:
URL: 
https://github.com/apache/doris-kafka-connector/pull/113#discussion_r4704982189


##########
src/main/java/org/apache/doris/kafka/connector/writer/load/AsyncDorisStreamLoad.java:
##########
@@ -263,13 +348,29 @@ public void load(String label, RecordBuffer buffer) 
throws IOException {
                     if (respContent == null || respContent.getMessage() == 
null) {
                         throw new StreamLoadException("response error : " + 
loadResult);
                     }
-                    if 
(!DORIS_SUCCESS_STATUS.contains(respContent.getStatus())) {
+                    boolean confirmedFinishedDuplicate =
+                            
LABEL_ALREADY_EXISTS_STATUS.equals(respContent.getStatus())
+                                    && EXISTING_JOB_STATUS_FINISHED.equals(
+                                            respContent.getExistingJobStatus())
+                                    && label != null
+                                    && label.equals(respContent.getLabel());
+                    if (!DORIS_SUCCESS_STATUS.contains(respContent.getStatus())
+                            && !confirmedFinishedDuplicate) {
+                        // a duplicate-label rejection without a FINISHED 
existing job is
+                        // ambiguous: the existing load may still be running 
or may have
+                        // failed, so it keeps failing until it resolves or 
retries end

Review Comment:
   Agreed. With a different label for each retry, the FINISHED handling is no 
longer needed. It was specifically intended to resolve ambiguous outcomes when 
retrying with the original label. I'll remove it.



##########
src/main/java/org/apache/doris/kafka/connector/writer/load/AsyncDorisStreamLoad.java:
##########
@@ -73,6 +79,12 @@ public class AsyncDorisStreamLoad extends DataLoad {
     private final AtomicBoolean started;
     private volatile boolean loadThreadAlive = false;
     private AtomicReference<Throwable> exception = new AtomicReference<>(null);
+    // Set for the lifetime of this object once a load failed and its retries 
were exhausted:
+    // the failed buffer is dropped and the records it held can only be 
recovered by replaying
+    // from the last committed Kafka offsets (task restart). start() restarts 
the executor
+    // thread but must not clear this latch, otherwise later commits could 
advance offsets
+    // past the records that were dropped by the failed load.
+    private final AtomicBoolean loadFailed = new AtomicBoolean(false);

Review Comment:
   You're right. With the retry loop in place, intermediate failures are 
handled internally, and the exception is only published on terminal failure.
   
   Removing the reset from `start()` preserves the sticky failure state, so the 
separate `loadFailed` flag is redundant. I'll simplify this and retain the 
original exception and the restart guidance in the logs.



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to