-
-
Notifications
You must be signed in to change notification settings - Fork 6
feat: Support graceful shutdown #407
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
Merged
Merged
Changes from all commits
Commits
Show all changes
34 commits
Select commit
Hold shift + click to select a range
6f6f954
feat: Support graceful shutdown
sbernauer 7635754
update docs
sbernauer 129a7f1
docs
sbernauer b5869c5
changelog
sbernauer 5dd4c04
link code in docs
sbernauer bcb3ad4
increase default of datanodes to 30 min
sbernauer ce72ff8
move into constants
sbernauer abe0f23
use new operator-rs
sbernauer 692dace
docs: Format 15 minutes
sbernauer dcb6bbb
Use new operator-rs
sbernauer 2f7e46f
improve docs
sbernauer de3c4bb
Merge branch 'main' into feat/graceful-shutdown-2
sbernauer cc23be8
fix link
sbernauer 5fbceee
use operator-rs 0.55.0
sbernauer 765a4bd
Merge branch 'main' into feat/graceful-shutdown-2
sbernauer 9a07707
fixup
sbernauer 58dbdc7
improve docs
sbernauer b78d559
set error context
sbernauer 7733ec1
Added a high level description of graceful shutdown
Jimvin 2ed5795
Revert "Added a high level description of graceful shutdown"
sbernauer 0d154da
Merge remote-tracking branch 'origin/main' into feat/graceful-shutdown-2
sbernauer 6b0b883
Move rustdoc above field attributes
sbernauer 752b699
Avoid snafu context(false)
sbernauer 153b2c2
docs wording
sbernauer 7bd7d3e
newline
sbernauer 862cd3a
fix: Vector graceful shutdown
sbernauer 65415c4
downgrade ring again
sbernauer 23d52c9
Merge remote-tracking branch 'origin/main' into feat/graceful-shutdown-2
sbernauer f3aa0f8
fix links
sbernauer ab32002
use new operator-rs
sbernauer 4e14d57
chore: Bump operator-rs to 0.56.0
sbernauer f15b73a
Revert "chore: Bump operator-rs to 0.56.0"
sbernauer 37077f7
Merge remote-tracking branch 'origin/main' into feat/graceful-shutdown-2
sbernauer 85e67df
Update docs/modules/hdfs/pages/usage-guide/operations/graceful-shutdo…
sbernauer File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 34 additions & 3 deletions
37
docs/modules/hdfs/pages/usage-guide/operations/graceful-shutdown.adoc
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,37 @@ | ||
= Graceful shutdown | ||
|
||
Graceful shutdown of HDFS nodes is either not supported by the product itself | ||
or we have not implemented it yet. | ||
You can configure the graceful shutdown as described in xref:concepts:operations/graceful_shutdown.adoc[]. | ||
|
||
Outstanding implementation work for the graceful shutdowns of all products where this functionality is relevant is tracked in https://github.com/stackabletech/issues/issues/357 | ||
== JournalNodes | ||
|
||
As a default, JournalNodes have `15 minutes` to shut down gracefully. | ||
|
||
The JournalNode process will always run as PID `1` and will receive a `SIGTERM` signal when Kubernetes wants to terminate the Pod. | ||
It will log the received signal as shown in the log below and initiate a graceful shutdown. | ||
After the graceful shutdown timeout runs out, and the process still didn't exit, Kubernetes will issue a `SIGKILL` signal. | ||
|
||
https://github.com/apache/hadoop/blob/a585a73c3e02ac62350c136643a5e7f6095a3dbb/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/qjournal/server/JournalNode.java#L272[This] is the relevant code that gets executed in the JournalNodes as of HDFS version `3.3.4`. | ||
|
||
|
||
[source,text] | ||
---- | ||
2023-10-10 13:37:41,525 ERROR server.JournalNode (LogAdapter.java:error(75)) - RECEIVED SIGNAL 15: SIGTERM | ||
2023-10-10 13:37:41,526 INFO server.JournalNode (LogAdapter.java:info(51)) - SHUTDOWN_MSG: | ||
/************************************************************ | ||
SHUTDOWN_MSG: Shutting down JournalNode at hdfs-journalnode-default-0/10.244.0.38 | ||
************************************************************/ | ||
---- | ||
|
||
== NameNodes | ||
|
||
As a default, NameNodes have `15 minutes` to shut down gracefully. | ||
They use the same mechanism described above. | ||
|
||
https://github.com/apache/hadoop/blob/a585a73c3e02ac62350c136643a5e7f6095a3dbb/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/NameNode.java#L1080[This] is the relevant code that gets executed in the NameNodes as of HDFS version `3.3.4`. | ||
|
||
== DataNodes | ||
|
||
As a default, DataNodes have `30 minutes` to shut down gracefully. | ||
They use the same mechanism described above. | ||
|
||
https://github.com/apache/hadoop/blob/a585a73c3e02ac62350c136643a5e7f6095a3dbb/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/DataNode.java#L2004[This] is the relevant code that gets executed in the DataNodes as of HDFS version `3.3.4`. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
use snafu::{ResultExt, Snafu}; | ||
use stackable_hdfs_crd::MergedConfig; | ||
use stackable_operator::builder::PodBuilder; | ||
|
||
#[derive(Debug, Snafu)] | ||
pub enum Error { | ||
#[snafu(display("Failed to set terminationGracePeriod"))] | ||
SetTerminationGracePeriod { | ||
source: stackable_operator::builder::pod::Error, | ||
}, | ||
} | ||
|
||
pub fn add_graceful_shutdown_config( | ||
merged_config: &(dyn MergedConfig + Send + 'static), | ||
pod_builder: &mut PodBuilder, | ||
) -> Result<(), Error> { | ||
// This must be always set by the merge mechanism, as we provide a default value, | ||
// users can not disable graceful shutdown. | ||
if let Some(graceful_shutdown_timeout) = merged_config.graceful_shutdown_timeout() { | ||
pod_builder | ||
.termination_grace_period(graceful_shutdown_timeout) | ||
.context(SetTerminationGracePeriodSnafu)?; | ||
} | ||
|
||
Ok(()) | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
pub mod graceful_shutdown; | ||
pub mod pdb; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
Uh oh!
There was an error while loading. Please reload this page.