SEPURI-SAI-KRISHNA opened a new issue, #12569:
URL: https://github.com/apache/seatunnel/issues/12569

   ### Search before asking
   
   - [X] I had searched in the 
[issues](https://github.com/apache/seatunnel/issues?q=is%3Aissue+label%3A%22bug%22)
 and found no similar issues.
   
   ### What happened
   
   `multi_table_sink_replica` has no lower bound. Setting it to `0`, or to any 
negative value, is accepted by the option layer and then fails the job with an 
`IllegalArgumentException` whose message is `null`. The exception names neither 
the option, nor the value, nor the table, and it is thrown from a JDK class on 
a worker rather than at job submission, so there is nothing in it to point an 
operator at the line of config they got wrong.
   
   ### SeaTunnel Version
   
   `dev` (3.0.0-SNAPSHOT), verified at `53733a11`.
   
   ### SeaTunnel Config
   
   ```conf
   sink {
     Jdbc {
       # any sink that declares MULTI_TABLE_SINK_REPLICA in its optionRule
       multi_table_sink_replica = 0
     }
   }
   ```
   
   ### Running Command
   
   Any multi-table sink job whose sink sets `multi_table_sink_replica` below 1.
   
   ### Error Exception
   
   ```
   java.lang.IllegalArgumentException: null
       at 
java.util.concurrent.ThreadPoolExecutor.<init>(ThreadPoolExecutor.java:1303)
       at java.util.concurrent.Executors.newFixedThreadPool(Executors.java:155)
       at 
org.apache.seatunnel.api.sink.multitablesink.MultiTableSinkWriter.<init>(MultiTableSinkWriter.java:206)
       at 
org.apache.seatunnel.api.sink.multitablesink.MultiTableSink.createWriter(MultiTableSink.java:150)
   ```
   
   ### Analysis
   
   The option is declared without validation and is consumed as a thread-pool 
size six steps later. Each step below was checked against `dev`, and the 
parsing and the throw were both measured rather than inferred.
   
   1. 
`seatunnel-api/src/main/java/org/apache/seatunnel/api/options/SinkConnectorCommonOptions.java:30-34`
 declares it as `.intType().defaultValue(1)` with no bound.
   2. `ReadonlyConfig` returns `0`, `-1` and `-7` unchanged for this key.
   3. 
`seatunnel-api/src/main/java/org/apache/seatunnel/api/sink/multitablesink/MultiTableSink.java:91-92`
 reads it into `replicaNum`.
   4. `MultiTableSink.java:130` loops `for (int i = 0; i < replicaNum; i++)`, 
so no writer is created at all.
   5. `MultiTableSink.java:144-147` passes `replicaNum` as the `queueSize` 
constructor argument.
   6. 
`seatunnel-api/src/main/java/org/apache/seatunnel/api/sink/multitablesink/MultiTableSinkWriter.java:205-209`
 calls `Executors.newFixedThreadPool(queueSize * 2)`. `ThreadPoolExecutor` 
rejects a pool size below 1 with `new IllegalArgumentException()`, which is the 
no-argument constructor, which is why the message is `null`.
   
   Worth separating two things here. The job failing on an invalid replica 
count is correct and not the complaint. The complaint is that the failure is 
undiagnosable: it names nothing, and it happens at writer creation on a worker 
rather than when the config is read.
   
   This is also the config-side route to a degenerate writer count, which is 
relevant to the routing work in #12290 where a zero bucket count was read as 
unreachable.
   
   ### What you expected to happen
   
   The option is rejected where it is read, with a message naming the option 
key and the offending value, before any writer or thread pool is created.
   
   ### Are you willing to submit PR?
   
   - [X] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [X] I agree to follow this project's [Code of 
Conduct](https://www.apache.org/foundation/policies/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