SEZ9 commented on PR #13238:
URL: https://github.com/apache/seatunnel/pull/13238#issuecomment-7116156624

   @nzw921rx thanks for clarifying. I agree with your main point: the normal 
creation path is what must be validated, and a constructor-only check cannot 
prove that.
   
   **Constructor guard (your "redundant interception" point)**
   On the normal path the option rule is validated immediately before the 
composite `MultiTableSink` is constructed, so the guard is a duplicate there. 
Its only separate role is the public direct-construction path, which 
`MultiTableSinkFixture` uses. I'm fine with either choice, but please make it 
consistent:
   - **If you remove it:** account for direct callers and tests explicitly, so 
the direct-construction behavior is defined rather than left implicit.
   - **If you keep it:** restore the reason for the bound in the comment, 
document the exception in the constructor Javadoc, and update the PR 
description, which still says the guard is removed.
   
   **Validation boundary**
   The lower bound is declared only on `MultiTableSinkFactory`, which 
option-rule discovery filters out. It is checked only after every per-table 
sink has been built, and on Flink and Spark that is also after save mode has 
run. An invalid replica value can therefore still drop or truncate target 
tables before the job is rejected. I'm not asking you to move that in this PR. 
Please make the docs and PR description claim only "validated before 
constructing the composite `MultiTableSink`", not protection before save-mode 
side effects.
   
   **Tests**
   - Add a regression test that goes through the actual factory creation path, 
so the rule-based validation is what gets exercised.
   - Fix the assertions that cannot fail.
   - Stop mutating the `ReadonlyConfig` through `getSourceMap()`.
   - Is `Integer.MAX_VALUE` really intended to be asserted as a valid replica 
count? If so, please explain why; otherwise drop that assertion.
   
   Which way do you want to go on the guard? Once that is settled, the 
description, comment/Javadoc and tests can be aligned in one pass.
   
   <!-- streview-comment:2564 -->


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