Taranpreet Kaur created FLINK-40188:
---------------------------------------
Summary: Check connection string at the start of job for
opensearch distributor
Key: FLINK-40188
URL: https://issues.apache.org/jira/browse/FLINK-40188
Project: Flink
Issue Type: Bug
Components: Connectors / Opensearch
Reporter: Taranpreet Kaur
In Kafka Connector distributor, bootstrap URL is validated at the start of
Flink job while for OpenSearch distributor connection is validated when records
are sent.
Fix:
Add a lightweight connectivity check (e.g., a simple HTTP HEAD or GET to the
cluster root /) in OpensearchWriter
constructor, right after creating the RestHighLevelClient. Something like:
// After: this.client = new RestHighLevelClient(builder);
// Add early validation:
try {
boolean pingSuccess = client.ping(RequestOptions.DEFAULT);
if (!pingSuccess) {
throw new FlinkRuntimeException(
"Failed to connect to OpenSearch cluster at " + hosts + ". Ping
returned false.");
}
} catch (IOException e) {
throw new FlinkRuntimeException(
"Failed to connect to OpenSearch cluster at " + hosts + ". Please
verify the hosts configuration.", e);
}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)