yeyudefeng opened a new pull request, #50:
URL: https://github.com/apache/doris-flink-connector/pull/50

   
   # Proposed changes
   
   Issue Number: close #Fix bug when maxRetry is set to 0
   
   ## Problem Summary:
   
   When using Doris Flink connector, if the retry is set to 0, 100% of the 
error will be reported.
   the version is : 
   
           <dependency>
               <groupId>org.apache.doris</groupId>
               <artifactId>flink-doris-connector-1.14_2.12</artifactId>
               <version>1.1.0</version>
           </dependency>
   
   
   for example :
   
   DorisExecutionOptions.builder().setMaxRetries(0);
   
   error: 
   
   Caused by: 
TimerException{org.apache.doris.flink.exception.DorisRuntimeException: stream 
load error: null}
        ... 14 more
   Caused by: org.apache.doris.flink.exception.DorisRuntimeException: stream 
load error: null
        at 
org.apache.doris.flink.sink.committer.DorisCommitter.commitTransaction(DorisCommitter.java:107)
        at 
org.apache.doris.flink.sink.committer.DorisCommitter.commit(DorisCommitter.java:71)
        at 
org.apache.flink.streaming.runtime.operators.sink.StreamingCommitterHandler.commit(StreamingCommitterHandler.java:54)
        at 
org.apache.flink.streaming.runtime.operators.sink.AbstractStreamingCommitterHandler.retry(AbstractStreamingCommitterHandler.java:96)
        at 
org.apache.flink.streaming.runtime.operators.sink.AbstractCommitterHandler.retry(AbstractCommitterHandler.java:66)
        at 
org.apache.flink.streaming.runtime.operators.sink.CommitRetrier.retry(CommitRetrier.java:80)
        at 
org.apache.flink.streaming.runtime.operators.sink.CommitRetrier.lambda$retryAt$0(CommitRetrier.java:63)
        at 
org.apache.flink.streaming.runtime.tasks.StreamTask.invokeProcessingTimeCallback(StreamTask.java:1693)
        ... 13 more
   
   Reason:
   
        If the maxRetry is set to 0, the while loop in the committransaction 
method will never enter.
        statusCode != 200 will be true forever, and throw exception.
        so I change the code, modify the code 'retry++ < maxRetry' as 'retry++ 
<= maxRetry' 
   
       private void commitTransaction(DorisCommittable committable) throws 
IOException {
           int statusCode = -1;
           String reasonPhrase = null;
           int retry = 0;
           String hostPort = committable.getHostPort();
           CloseableHttpResponse response = null;
           while (retry++ <= maxRetry) {
                    
               }
           if (statusCode != 200) {
               throw new DorisRuntimeException("stream load error: " + 
reasonPhrase);
           }
       }
        
        
   
   
   ## Checklist(Required)
   
   1. Does it affect the original behavior: I Don't know
   2. Has unit tests been added: No
   3. Has document been added or modified: Yes
   4. Does it need to update dependencies: No
   5. Are there any changes that cannot be rolled back: No
   
   


-- 
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: commits-unsubscr...@doris.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to