You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by "nicoloboschi (via GitHub)" <gi...@apache.org> on 2023/09/25 07:01:54 UTC
[GitHub] [pulsar] nicoloboschi commented on a diff in pull request #21204: [improve][io] Use `SinkContext.fatal` in elastic search connector
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: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org