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

Commits on May 17, 2024

  1. Added ability to gracefully interrupt application in both fetch and p…

    …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 committed May 17, 2024
    Configuration menu
    Copy the full SHA
    33e26dc View commit details
    Browse the repository at this point in the history