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

   ### Purpose of this pull request
   
   In transaction mode the MongoDB sink creates its `ClientSession` on the 
first commit. `MongodbSinkAggregatedCommitter.close()` calls 
`clientSession.hasActiveTransaction()` before it checks whether the session 
exists, so closing or cancelling the job before the first commit throws a 
`NullPointerException`. Because the exception leaves `close()` early, the 
`MongoClient` is not closed either.
   
   This moves the active-transaction wait under the existing null check and 
adds a test that closes a newly created transactional committer before any 
commit.
   
   ### Does this PR introduce any user-facing change?
   
   A transactional MongoDB sink now closes cleanly, and releases its client, 
when the job stops before its first commit. Commit behaviour is unchanged once 
a session exists.
   
   ### How was this patch tested?
   
   `MongodbSinkAggregatedCommitterTest` closes a committer before the first 
commit. It fails on `dev` with the `NullPointerException` and passes with the 
fix. The module builds with `-Dmaven.compiler.release=8`.
   


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