[#1221] feat(rust): Add grpc graceful shutdown - #1292
Conversation
…b.com/wenlongbrother/incubator-uniffle into users/wenlong/AddGrpcGracefulShutDown
Codecov Report
@@ Coverage Diff @@
## master #1292 +/- ##
============================================
+ Coverage 53.83% 54.74% +0.90%
Complexity 2691 2691
============================================
Files 401 383 -18
Lines 23418 21096 -2322
Branches 1992 1992
============================================
- Hits 12606 11548 -1058
+ Misses 10036 8844 -1192
+ Partials 776 704 -72 see 28 files with indirect coverage changes 📣 Codecov offers a browser extension for seamless coverage viewing on GitHub. Try it in Chrome or Firefox today! |
zuston
left a comment
There was a problem hiding this comment.
Great work! @wenlongbrother
Overall LGTM. left minor comments.
| use signal_hook::{consts::TERM_SIGNALS, iterator::Signals}; | ||
| use tokio::sync::oneshot::Sender; | ||
|
|
||
| pub fn wait_for_signal() { |
|
BTW, please run the |
Maybe we can add this |
|
Hi @zuston , I push some new changes, can you take a look again, thank you for your review. |
fmt check has been added into CI. but the formatting code for developer is not suitable. |
|
Thanks for your contribution! @wenlongbrother |
What changes were proposed in this pull request?
Add grpc gracful shutdown
Why are the changes needed?
Data Integrity: To ensure that any ongoing write operations or transactions are properly handled to prevent data corruption or loss.
Resource Cleanup: To release resources such as file handles, network connections, and memory to prevent resource leaks.
User Experience: To provide feedback to users, where possible, informing them that the program is shutting down, to avoid sudden service interruptions causing distress.
State Preservation: In some applications, it may be necessary to save the current state so that the next start can continue from the same point.
Dependency Service Coordination: If your service is a dependency for other services, a graceful shutdown can ensure dependent services are notified to avoid causing cascading failures.
Error Tracking and Logging: Recording sufficient information during the shutdown process is very helpful for subsequent error analysis and troubleshooting.
Compliance with Laws and Regulations: Some applications process sensitive data and need to ensure compliance with legal and regulatory requirements to prevent data breaches during the shutdown process.
In distributed systems and microservices architectures, graceful shutdown becomes particularly important, as the interactions between services are more complex, and improper shutdowns can trigger a range of issues. For example, if a database service shuts down abruptly without gracefully handling current operations, it could lead to data inconsistencies that affect the stability of the entire system.
Overall, graceful shutdown is about ensuring the robustness and reliability of systems, maintaining service quality, and protecting data security even when service termination is necessary.
Does this PR introduce any user-facing change?
No.
How was this patch tested?