SEPURI-SAI-KRISHNA commented on PR #13261: URL: https://github.com/apache/seatunnel/pull/13261#issuecomment-6844282433
@SEZ9 Thanks for the careful review. Done in `24b8e5153a`: 1. **Lock**: `run()`, `addSplitsBack()`, `registerReader()` and `assignSplit()` are now `synchronized`. One correction on the cause: the window already existed on dev. A new enumerator starts with `assigned == false`, and dev's `addSplitsBack` already called `assignSplit()`, so a restored split and a second reader registering could already both assign it. The new concurrency test fails on the dev code too. No caller holds the enumerator lock while it takes an engine lock (`context.assignSplit` and `registeredReaders()` take none on Zeta, and Flink calls everything on the coordinator thread), so this adds no lock order. `testReaderRegisteringDuringAnAssignmentDoesNotAssignTheSplitAgain` registers a second reader from another thread during the assignment; without `synchronized` it failed 3 of 3 runs, and with it it passed 3 of 3. 2. **Split back while the reader is registered**: `testSplitGivenBackWhileTheReaderIsRegisteredIsAssignedAtOnce` asserts the immediate second assignment, then that `run()` and a registration add no third. `testSplitGivenBackGoesToARegisteredReader` covers a second reader id. 4. **Javadoc**: it now says why the empty list is safe. I checked all three reader families that pair with this enumerator: `AbstractSingleSplitReader`, `GooglePubSubSourceReader` and `AzureQueueStorageSourceReader` all return their `SingleSplit` from `snapshotState`. 5. **`run()` after a re-assignment**: added to both re-assignment tests. 6. **Zeta restore order**: `testRestoredSplitIsAssignedOnceWhenTheReaderRegistersAndRunFollows` (new enumerator, `addSplitsBack`, `registerReader`, `run`) asserts one assignment of the same split. 7. **Test visibility**: the class and methods are `public` now. I left out the debug log: the class has no logger yet, and it is not part of this fix. Against dev, 6 of the 9 tests fail; the PR description lists each test and the mutation results. -- 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]
