goutamadwant opened a new issue, #12428:
URL: https://github.com/apache/seatunnel/issues/12428

   ### Search before asking
   
   - [x] Searched existing issues and pull requests for Cassandra 
bootstrap/contact-point handling; no matching fix was found.
   
   ### What happened
   
   Cassandra source and sink accept multiple comma-separated hosts, but the 
shared `CassandraClient.getCqlSessionBuilder()` creates a separate builder for 
each address and returns one randomly selected builder. Only one configured 
address reaches the driver.
   
   If that selected seed is unavailable, initialization can fail even though 
another configured seed is reachable. This affects job startup; it is not a 
claim about recovery after a session has already discovered the cluster 
topology.
   
   ### SeaTunnel Version
   
   Reproduced in development code at 
`71860b4469bbd83722c81aa85ddd7e57f5f440de`. The affected helper is unchanged at 
the validation baseline `398fdfac5c6f48e894ce94c7b0ba7eeb74c96f7c` and current 
`dev` checked at `801e330cbaf69345e644300f8cf00bb8878b4798`.
   
   ### Reproduction
   
   1. Start a disposable Cassandra 4.1.1 instance reachable as `cassandra:9042` 
from the job. Ensure that `cassandra:1` refuses connections and the instance is 
healthy before testing.
   2. Create a `test` keyspace in `datacenter1` and a populated `source_table`.
   3. Configure both the unavailable and reachable addresses as below, then 
repeat startup with a fresh session. Repeat with the address order reversed.
   4. Compare with a single reachable-host control.
   
   The original live Java 11 probe recorded 10 successful and 6 failed startups 
in 16 attempts. This is a bounded reproduction of random seed selection, not an 
estimated production failure rate. Separate Java 8 and Java 11 builder probes 
consistently found only one registered address when two or three were 
configured; single-host controls passed.
   
   ### SeaTunnel Config
   
   ```hocon
   env {
     parallelism = 1
     job.mode = "BATCH"
   }
   source {
     Cassandra {
       host = "cassandra:1,cassandra:9042"
       keyspace = "test"
       datacenter = "datacenter1"
       cql = "select * from source_table"
     }
   }
   sink {
     Console {}
   }
   ```
   
   ### Running Command
   
   With the Cassandra connector installed and the fixture reachable from the 
runtime:
   
   ```sh
   sh bin/seatunnel.sh --config cassandra-bootstrap.conf -e local
   ```
   
   The measured baseline above invokes the actual shared helper directly 
against Cassandra; the configuration illustrates the equivalent job setup. The 
fix also extends the existing source-to-sink E2E configuration with the 
unavailable/reachable pair in opposite orders on source and sink.
   
   ### Error Exception
   
   The live baseline's failed initialization attempts raised 
`AllNodesFailedException`, despite the other configured seed being reachable.
   
   ### Expected behavior and proposed fix
   
   Register all configured contact points on one `CqlSessionBuilder`, then 
apply authentication, keyspace and datacenter once. Let the existing driver 
choose among the supplied seeds and discover topology.
   
   - Before: one randomly selected configured seed is supplied to the driver.
   - After: every configured seed is supplied, allowing startup through a 
reachable seed when another is unavailable.
   - Benefit: honor the existing multi-host configuration and remove avoidable 
startup failures for both source and sink.
   - Compatibility: no new options, dependencies or defaults; existing address 
parsing, single-host configuration and driver topology discovery remain 
unchanged. No migration is required. This does not guarantee startup when all 
seeds are unavailable or credentials/configuration are invalid.
   
   ### Validation of the proposed fix
   
   - Java 8 and Java 11: 25 connector unit tests pass, including address 
registration, authentication/settings preservation, single-host and 
duplicate-address controls.
   - Java 8 and Java 11: live unavailable/reachable-seed initialization passes 
in both address orders.
   - Java 11 harness: existing source-to-sink E2E passes across Flink 
1.13/1.15/1.18/1.20, Zeta, Spark 2.4 and Spark 3.3.
   - Root formatting and Java 11 `./mvnw -q -DskipTests verify` pass. The 
latter is a compilation/packaging check, not a full test-suite run.
   
   ### Java or Scala Version
   
   Java 8 (Corretto 1.8.0_504) and Java 11 (11.0.32.1). Live service: Cassandra 
4.1.1.
   
   ### Are you willing to submit PR?
   
   - [x] Yes.
   
   ### Code of Conduct
   
   - [x] I agree to follow the project's Code of Conduct.
   


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