Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added ability to gracefully interrupt application in both fetch and p… #47

Merged
merged 1 commit into from
May 17, 2024

Conversation

percona-ysorokin
Copy link
Collaborator

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

  • Inside receiving / processing individual binlog events loop in 'receive_binlog_events()'.
  • In the 'pull' mode idle-reconnection loop.
  • Inside the idle time sleep function.

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

…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.
* Inside receiving / processing individual binlog events loop in 'receive_binlog_events()'.
* In the 'pull' mode idle-reconnection loop.
* Inside the idle time sleep function.

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).
@percona-ysorokin percona-ysorokin merged commit 0a79d56 into Percona-Lab:main May 17, 2024
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant