goutamadwant opened a new pull request, #12080:
URL: https://github.com/apache/seatunnel/pull/12080

   ### Purpose of this pull request
   
   Closes #12078.
   
   This PR fixes strict checksum fallback in both file update paths. The 
previous implementation compared the byte counts returned by paired 
`InputStream.read(byte[])` calls. Identical streams can legally return 
different chunk sizes, so equal files could be classified as changed and copied 
or enqueued again.
   
   Both production paths now use the module's existing Apache Commons IO 
`IOUtils.contentEquals` implementation. It compares the complete byte sequences 
independently of read boundaries, uses constant-size buffers, and adds no 
dependency.
   
   The change retains try-with-resources ownership and the existing 
fail-open-to-copy behavior when checksum or content comparison raises an I/O 
error.
   
   ### Does this PR introduce _any_ user-facing change?
   
   Yes.
   
   When `sync_mode = "update"`, `update_strategy = "strict"`, and `compare_mode 
= "checksum"` fall back to content comparison, an unchanged file is no longer 
recopied merely because its source and target streams return different numbers 
of bytes per read.
   
   Configuration, defaults, behavior for different content, and failure 
handling remain unchanged.
   
   ### How was this patch tested?
   
   * Java 8 (`1.8.0_172`): the complete `connector-file-base` test suite 
passed, 276/276.
   * Java 11 (`11.0.19`): the complete `connector-file-base` test suite passed, 
276/276.
   * Java 11 skip-tests module verification passed, including Spotless, 
compilation, and packaging.
   * `git diff --check` passed.
   
   The tests exercise the real batch and continuous update-mode paths with 
checksum-unavailable streams. Coverage includes equal content returned in 
3-byte versus 5-byte chunks, different bytes, different lengths, empty streams, 
and continuous split enumeration.
   
   ### Check list
   
   * [x] No new Jar binary package or dependency is added; Commons IO 2.11 is 
already used by this module.
   * [x] Documentation is not required because no option, default, or supported 
behavior changes.
   * [x] `incompatible-changes.md` is not required; the patch corrects equality 
detection for existing strict comparison semantics.
   * [x] No connector mapping, distribution POM, label scope, or new connector 
E2E entry is required; this is an internal fix in the existing shared file 
connector base.


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