nicoloboschi commented on code in PR #21204:
URL: https://github.com/apache/pulsar/pull/21204#discussion_r1335463391


##########
pulsar-io/elastic-search/src/main/java/org/apache/pulsar/io/elasticsearch/ElasticSearchClient.java:
##########
@@ -94,16 +103,13 @@ public void afterBulk(long executionId, 
List<BulkProcessor.BulkOperationRequest>
         };
         this.backoffRetry = new 
RandomExponentialRetry(elasticSearchConfig.getMaxRetryTimeInSec());
         this.client = retry(() -> RestClientFactory.createClient(config, 
bulkListener), -1, "client creation");
+        state.set(State.Open);
     }
 
     void failed(Exception e) {
-        if (irrecoverableError.compareAndSet(null, e)) {
-            log.error("Irrecoverable error:", e);
-        }
-    }
-
-    boolean isFailed() {
-        return irrecoverableError.get() != null;
+        state.set(State.Failed);

Review Comment:
   we should call fatal and close only once
   
   ```
   if (state.compareAndSet(State.Open, State.Failed)) {
     sinkContext.fatal(e);
     close();
   }
   ```



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