Added ability to gracefully interrupt application in both fetch and p… #47
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
…ull modes
Added custom signal handlers for SIGINT and SIGTERM that set global flag ('std::atomic_flag global_termination_flag' ).
Added extra logic that checks for a termination request in the following locations.
From the user point of view the application can now be gracefully shut down when user presses 'Ctrl+C' or kills the application by SIGTERM (e.g. 'kill <binlog_server_pid>'). "Gracefully " means that all the connections will be properly closed, data caches written to disk / uploaded to the cloud and storage will remain in consistent / resumable state.
Because of the synchronous nature of the binlog functions from the MySQL client library, there still may be a delay between receiving the signal and reacting to it. Worst case scenario, user will have to wait '<connection.read_timeout>' (the value from the configuration) + 1 second (the granularity of sleep intervals in the 'idle' mode).