diff --git a/CHANGELOG.md b/CHANGELOG.md index 8989eca5..6c5a5e5b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ - Reduce CRD size from `1.4MB` to `96KB` by accepting arbitrary YAML input instead of the underlying schema for the following fields ([#548]): - `podOverrides` - `affinity` +- Region servers can now optionally move regions to other servers before shutting down ([#568]). ### Fixed @@ -21,6 +22,7 @@ [#550]: https://github.com/stackabletech/hbase-operator/pull/550 [#556]: https://github.com/stackabletech/hbase-operator/pull/556 [#558]: https://github.com/stackabletech/hbase-operator/pull/558 +[#568]: https://github.com/stackabletech/hbase-operator/pull/568 ## [24.7.0] - 2024-07-24 diff --git a/Cargo.nix b/Cargo.nix index cc6563c9..b1c47e78 100644 --- a/Cargo.nix +++ b/Cargo.nix @@ -446,7 +446,7 @@ rec { } { name = "syn"; - packageId = "syn 2.0.75"; + packageId = "syn 2.0.77"; features = [ "full" "visit-mut" ]; } ]; @@ -473,7 +473,7 @@ rec { } { name = "syn"; - packageId = "syn 2.0.75"; + packageId = "syn 2.0.77"; usesDefaultFeatures = false; features = [ "full" "visit-mut" "parsing" "printing" "proc-macro" ]; } @@ -884,10 +884,10 @@ rec { }; "clap" = rec { crateName = "clap"; - version = "4.5.16"; + version = "4.5.17"; edition = "2021"; crateBin = []; - sha256 = "068hjwbrndn4iz4fsc6d52q4ymg1kfsymjnqbxzdil23zbzijrzd"; + sha256 = "1b7nx9wsv5kc4n02ql4ca6p7pjh1n94rjk1n7hdjywsy96w22niy"; dependencies = [ { name = "clap_builder"; @@ -925,9 +925,9 @@ rec { }; "clap_builder" = rec { crateName = "clap_builder"; - version = "4.5.15"; + version = "4.5.17"; edition = "2021"; - sha256 = "1dmas5z20yqmlmfhykr38pn1hkcnr4jzxjw4cs2f6lkn2wmyqsi1"; + sha256 = "0wqsnajayxqpmqflqiqgpix2m8jrjwj6nayssvcpl13smw9dvwlc"; dependencies = [ { name = "anstream"; @@ -983,7 +983,7 @@ rec { } { name = "syn"; - packageId = "syn 2.0.75"; + packageId = "syn 2.0.77"; features = [ "full" ]; } ]; @@ -1034,9 +1034,9 @@ rec { }; "const_format" = rec { crateName = "const_format"; - version = "0.2.32"; + version = "0.2.33"; edition = "2021"; - sha256 = "0wvns8mzqwkyciwr00p2g5g4ak7zz8m473di85srj11xmz3i98p3"; + sha256 = "0jx6ffj65prbx1w9664ddwm73k7hm5g25afyvjq4y4gi3zc5bijh"; authors = [ "rodrimati1992 " ]; @@ -1066,9 +1066,9 @@ rec { }; "const_format_proc_macros" = rec { crateName = "const_format_proc_macros"; - version = "0.2.32"; + version = "0.2.33"; edition = "2021"; - sha256 = "0015dzbjbd773nn6096dwqv11fm8m3gy4a4a56cz5x10zl4gzxn7"; + sha256 = "1c8f7xh2b2kca9hlzvjplcdkvr4iqpsk4yd236n1nyzljd5s9wgg"; procMacro = true; authors = [ "rodrimati1992 " @@ -1287,7 +1287,7 @@ rec { } { name = "syn"; - packageId = "syn 2.0.75"; + packageId = "syn 2.0.77"; features = [ "full" "extra-traits" ]; } ]; @@ -1317,16 +1317,16 @@ rec { } { name = "syn"; - packageId = "syn 2.0.75"; + packageId = "syn 2.0.77"; } ]; }; "delegate" = rec { crateName = "delegate"; - version = "0.12.0"; + version = "0.13.0"; edition = "2018"; - sha256 = "16zpkc6v2ss5qivwx7p7vb1bjnb6s0p7kkifaqkgyl7bpv68y0af"; + sha256 = "0mh98via297c51dq7b2yb0fq7gxlgb8px2iz4w3sjgxpxc7vnq2h"; procMacro = true; authors = [ "Godfrey Chan " @@ -1343,7 +1343,7 @@ rec { } { name = "syn"; - packageId = "syn 2.0.75"; + packageId = "syn 2.0.77"; features = [ "full" "visit-mut" ]; } ]; @@ -1888,7 +1888,7 @@ rec { } { name = "syn"; - packageId = "syn 2.0.75"; + packageId = "syn 2.0.77"; features = [ "full" ]; } ]; @@ -3227,10 +3227,10 @@ rec { }; "k8s-openapi" = rec { crateName = "k8s-openapi"; - version = "0.22.0"; + version = "0.23.0"; edition = "2021"; - links = "k8s-openapi-0.22.0"; - sha256 = "0mcpy1gdxpqayc74i3x3ayh3q5bl6dzvsgmw91jq1r9sjkxill0r"; + links = "k8s-openapi-0.23.0"; + sha256 = "04qv2iqwm3mgjvyp2m6n3vf6nnpjh5a60kf9ah9k1n184d04g24w"; libName = "k8s_openapi"; authors = [ "Arnav Singh " @@ -3272,17 +3272,17 @@ rec { } ]; features = { - "earliest" = [ "v1_24" ]; - "latest" = [ "v1_30" ]; + "earliest" = [ "v1_26" ]; + "latest" = [ "v1_31" ]; "schemars" = [ "dep:schemars" ]; }; - resolvedDefaultFeatures = [ "schemars" "v1_30" ]; + resolvedDefaultFeatures = [ "schemars" "v1_31" ]; }; "kube" = rec { crateName = "kube"; - version = "0.93.1"; + version = "0.95.0"; edition = "2021"; - sha256 = "05k4wwb1f1hs0izn4hnyaw0l1wljqh0sh74wc4ijs6mgfl094r83"; + sha256 = "1y04cqn7ami9rs6csjsf63c4clm5zyvyx3bzbmyaf828hly0c8gs"; authors = [ "clux " "Natalie Klestrup Röijezon " @@ -3325,34 +3325,35 @@ rec { ]; features = { "admission" = [ "kube-core/admission" ]; + "aws-lc-rs" = [ "kube-client?/aws-lc-rs" ]; "client" = [ "kube-client/client" "config" ]; "config" = [ "kube-client/config" ]; "default" = [ "client" "rustls-tls" ]; "derive" = [ "kube-derive" "kube-core/schema" ]; - "gzip" = [ "kube-client/gzip" ]; - "http-proxy" = [ "kube-client/http-proxy" ]; + "gzip" = [ "kube-client/gzip" "client" ]; + "http-proxy" = [ "kube-client/http-proxy" "client" ]; "jsonpatch" = [ "kube-core/jsonpatch" ]; "kube-client" = [ "dep:kube-client" ]; "kube-derive" = [ "dep:kube-derive" ]; "kube-runtime" = [ "dep:kube-runtime" ]; "kubelet-debug" = [ "kube-client/kubelet-debug" "kube-core/kubelet-debug" ]; - "oauth" = [ "kube-client/oauth" ]; - "oidc" = [ "kube-client/oidc" ]; - "openssl-tls" = [ "kube-client/openssl-tls" ]; + "oauth" = [ "kube-client/oauth" "client" ]; + "oidc" = [ "kube-client/oidc" "client" ]; + "openssl-tls" = [ "kube-client/openssl-tls" "client" ]; "runtime" = [ "kube-runtime" ]; - "rustls-tls" = [ "kube-client/rustls-tls" ]; - "socks5" = [ "kube-client/socks5" ]; - "unstable-client" = [ "kube-client/unstable-client" ]; - "unstable-runtime" = [ "kube-runtime/unstable-runtime" ]; + "rustls-tls" = [ "kube-client/rustls-tls" "client" ]; + "socks5" = [ "kube-client/socks5" "client" ]; + "unstable-client" = [ "kube-client/unstable-client" "client" ]; + "unstable-runtime" = [ "kube-runtime/unstable-runtime" "runtime" ]; "ws" = [ "kube-client/ws" "kube-core/ws" ]; }; resolvedDefaultFeatures = [ "client" "config" "derive" "jsonpatch" "kube-client" "kube-derive" "kube-runtime" "runtime" "rustls-tls" ]; }; "kube-client" = rec { crateName = "kube-client"; - version = "0.93.1"; + version = "0.95.0"; edition = "2021"; - sha256 = "00w69ym31mzdi7kmxq1cjjnjps92cvb7mad5jw6a842v7bmkc4yq"; + sha256 = "1dwvvd37psgzcaqv87lppx2yrmdb8wggx9ki1s8132lxbigkbhii"; libName = "kube_client"; authors = [ "clux " @@ -3543,6 +3544,7 @@ rec { features = { "__non_core" = [ "tracing" "serde_yaml" "base64" ]; "admission" = [ "kube-core/admission" ]; + "aws-lc-rs" = [ "rustls?/aws-lc-rs" ]; "base64" = [ "dep:base64" ]; "bytes" = [ "dep:bytes" ]; "chrono" = [ "dep:chrono" ]; @@ -3591,9 +3593,9 @@ rec { }; "kube-core" = rec { crateName = "kube-core"; - version = "0.93.1"; + version = "0.95.0"; edition = "2021"; - sha256 = "1rhg99v7w5qrj3ikh6n0pbbhp1kj6q7spvydcf846zbq9nkp7qyc"; + sha256 = "0rp6n4k4b1ai6ghxqci72wy67kxrgn6x9rs70ajl9dcx3kchn0zk"; libName = "kube_core"; authors = [ "clux " @@ -3635,6 +3637,10 @@ rec { packageId = "serde"; features = [ "derive" ]; } + { + name = "serde-value"; + packageId = "serde-value"; + } { name = "serde_json"; packageId = "serde_json"; @@ -3664,9 +3670,9 @@ rec { }; "kube-derive" = rec { crateName = "kube-derive"; - version = "0.93.1"; + version = "0.95.0"; edition = "2021"; - sha256 = "1wkqxfjxx4lc8gapd44kylprwgxhk29cwpdy55ri47kr8jc6r8h4"; + sha256 = "09qcgysprgrdhl838y28xfvvyrak0x367s5879vhmmyxisbvx67s"; procMacro = true; libName = "kube_derive"; authors = [ @@ -3693,7 +3699,7 @@ rec { } { name = "syn"; - packageId = "syn 2.0.75"; + packageId = "syn 2.0.77"; features = [ "extra-traits" ]; } ]; @@ -3701,9 +3707,9 @@ rec { }; "kube-runtime" = rec { crateName = "kube-runtime"; - version = "0.93.1"; + version = "0.95.0"; edition = "2021"; - sha256 = "197zjakpach42n6s62qdh0g6qrs8cawzyhqb474qaq7d1wy7711v"; + sha256 = "053r458alv2gk2q7vb8nbycw4d1bclsvja7i10j95b21ls5cp5aq"; libName = "kube_runtime"; authors = [ "clux " @@ -4788,7 +4794,7 @@ rec { } { name = "syn"; - packageId = "syn 2.0.75"; + packageId = "syn 2.0.77"; } ]; features = { @@ -4861,7 +4867,7 @@ rec { } { name = "syn"; - packageId = "syn 2.0.75"; + packageId = "syn 2.0.77"; features = [ "full" "visit-mut" ]; } ]; @@ -5498,7 +5504,7 @@ rec { } { name = "syn"; - packageId = "syn 2.0.75"; + packageId = "syn 2.0.77"; features = [ "full" "parsing" "extra-traits" "visit" "visit-mut" ]; } { @@ -5863,7 +5869,7 @@ rec { } { name = "syn"; - packageId = "syn 2.0.75"; + packageId = "syn 2.0.77"; features = [ "extra-traits" ]; } ]; @@ -6003,9 +6009,9 @@ rec { }; "serde" = rec { crateName = "serde"; - version = "1.0.208"; + version = "1.0.210"; edition = "2018"; - sha256 = "1cng2zkvv6hh137jrrqdmhi2hllfnqwlqjgviqjalkv8rg98bw6g"; + sha256 = "0flc0z8wgax1k4j5bf2zyq48bgzyv425jkd5w0i6wbh7f8j5kqy8"; authors = [ "Erick Tryzelaar " "David Tolnay " @@ -6058,9 +6064,9 @@ rec { }; "serde_derive" = rec { crateName = "serde_derive"; - version = "1.0.208"; + version = "1.0.210"; edition = "2015"; - sha256 = "1krblvy84j6d9zj12ms9l2wfbwf2w8jazkx0bf7fs4vnzy0qw014"; + sha256 = "07yzy4wafk79ps0hmbqmsqh5xjna4pm4q57wc847bb8gl3nh4f94"; procMacro = true; authors = [ "Erick Tryzelaar " @@ -6081,7 +6087,7 @@ rec { } { name = "syn"; - packageId = "syn 2.0.75"; + packageId = "syn 2.0.77"; usesDefaultFeatures = false; features = [ "clone-impls" "derive" "parsing" "printing" "proc-macro" ]; } @@ -6113,7 +6119,7 @@ rec { } { name = "syn"; - packageId = "syn 2.0.75"; + packageId = "syn 2.0.77"; usesDefaultFeatures = false; features = [ "clone-impls" "derive" "parsing" "printing" ]; } @@ -6122,9 +6128,9 @@ rec { }; "serde_json" = rec { crateName = "serde_json"; - version = "1.0.125"; + version = "1.0.128"; edition = "2021"; - sha256 = "1v9idlv5nq5f000qsv6v02h2zbsfk2m6d05af2zgbk3kl0sygj43"; + sha256 = "1n43nia50ybpcfmh3gcw4lcc627qsg9nyakzwgkk9pm10xklbxbg"; authors = [ "Erick Tryzelaar " "David Tolnay " @@ -6484,7 +6490,7 @@ rec { } { name = "syn"; - packageId = "syn 2.0.75"; + packageId = "syn 2.0.77"; features = [ "full" ]; } ]; @@ -6694,13 +6700,13 @@ rec { }; "stackable-operator" = rec { crateName = "stackable-operator"; - version = "0.74.0"; + version = "0.76.0"; edition = "2021"; workspace_member = null; src = pkgs.fetchgit { url = "https://github.com/stackabletech/operator-rs.git"; - rev = "c77a5423b66bc1667b63af7d8bec00de88a5303f"; - sha256 = "1g1a0v98wlcb36ibwv1nv75g3b3s1mjmaps443fc2w2maam94lya"; + rev = "a7e70f174fb043a1766e0a80de95834cb4f7513d"; + sha256 = "1cyyyn6lizd0wdq79fc9fjnksnzx073ipydxmh7llciq5si5dnq6"; }; libName = "stackable_operator"; authors = [ @@ -6749,7 +6755,7 @@ rec { name = "k8s-openapi"; packageId = "k8s-openapi"; usesDefaultFeatures = false; - features = [ "schemars" "v1_30" ]; + features = [ "schemars" "v1_31" ]; } { name = "kube"; @@ -6849,8 +6855,8 @@ rec { workspace_member = null; src = pkgs.fetchgit { url = "https://github.com/stackabletech/operator-rs.git"; - rev = "c77a5423b66bc1667b63af7d8bec00de88a5303f"; - sha256 = "1g1a0v98wlcb36ibwv1nv75g3b3s1mjmaps443fc2w2maam94lya"; + rev = "a7e70f174fb043a1766e0a80de95834cb4f7513d"; + sha256 = "1cyyyn6lizd0wdq79fc9fjnksnzx073ipydxmh7llciq5si5dnq6"; }; procMacro = true; libName = "stackable_operator_derive"; @@ -6872,7 +6878,7 @@ rec { } { name = "syn"; - packageId = "syn 2.0.75"; + packageId = "syn 2.0.77"; } ]; @@ -6945,7 +6951,7 @@ rec { } { name = "syn"; - packageId = "syn 2.0.75"; + packageId = "syn 2.0.77"; features = [ "parsing" "extra-traits" ]; } ]; @@ -6998,11 +7004,11 @@ rec { }; resolvedDefaultFeatures = [ "clone-impls" "default" "derive" "extra-traits" "full" "parsing" "printing" "proc-macro" "quote" "visit" ]; }; - "syn 2.0.75" = rec { + "syn 2.0.77" = rec { crateName = "syn"; - version = "2.0.75"; + version = "2.0.77"; edition = "2021"; - sha256 = "1nf72xc8pabwny8d0d4kjk5vmadg3fa240dywznka6gw6hq0dbzn"; + sha256 = "1vbkwfp9ymmi0fsyyjsqfvnv7gm8vjgl4pzprbk7p3pxc7gvqdcz"; authors = [ "David Tolnay " ]; @@ -7068,7 +7074,7 @@ rec { } { name = "syn"; - packageId = "syn 2.0.75"; + packageId = "syn 2.0.77"; } ]; @@ -7307,9 +7313,9 @@ rec { }; "tokio" = rec { crateName = "tokio"; - version = "1.39.3"; + version = "1.40.0"; edition = "2021"; - sha256 = "1xgzhj7bxqqpjaabjkgsx8hi0f600bzj4iyp9f0a9gr3k6dwkawv"; + sha256 = "166rllhfkyqp0fs7sxn6crv74iizi4wzd3cvxkcpmlk52qip1c72"; authors = [ "Tokio Contributors " ]; @@ -7430,7 +7436,7 @@ rec { } { name = "syn"; - packageId = "syn 2.0.75"; + packageId = "syn 2.0.77"; features = [ "full" ]; } ]; @@ -7964,7 +7970,7 @@ rec { } { name = "syn"; - packageId = "syn 2.0.75"; + packageId = "syn 2.0.77"; usesDefaultFeatures = false; features = [ "full" "parsing" "printing" "visit-mut" "clone-impls" "extra-traits" "proc-macro" ]; } @@ -8602,7 +8608,7 @@ rec { } { name = "syn"; - packageId = "syn 2.0.75"; + packageId = "syn 2.0.77"; features = [ "full" ]; } { @@ -8661,7 +8667,7 @@ rec { } { name = "syn"; - packageId = "syn 2.0.75"; + packageId = "syn 2.0.77"; features = [ "visit" "full" ]; } { @@ -9258,7 +9264,7 @@ rec { } { name = "syn"; - packageId = "syn 2.0.75"; + packageId = "syn 2.0.77"; } ]; diff --git a/crate-hashes.json b/crate-hashes.json index 8725a492..4ac79c7f 100644 --- a/crate-hashes.json +++ b/crate-hashes.json @@ -1,5 +1,5 @@ { - "git+https://github.com/stackabletech/operator-rs.git?tag=stackable-operator-0.74.0#stackable-operator-derive@0.3.1": "1g1a0v98wlcb36ibwv1nv75g3b3s1mjmaps443fc2w2maam94lya", - "git+https://github.com/stackabletech/operator-rs.git?tag=stackable-operator-0.74.0#stackable-operator@0.74.0": "1g1a0v98wlcb36ibwv1nv75g3b3s1mjmaps443fc2w2maam94lya", + "git+https://github.com/stackabletech/operator-rs.git?tag=stackable-operator-0.76.0#stackable-operator-derive@0.3.1": "1cyyyn6lizd0wdq79fc9fjnksnzx073ipydxmh7llciq5si5dnq6", + "git+https://github.com/stackabletech/operator-rs.git?tag=stackable-operator-0.76.0#stackable-operator@0.76.0": "1cyyyn6lizd0wdq79fc9fjnksnzx073ipydxmh7llciq5si5dnq6", "git+https://github.com/stackabletech/product-config.git?tag=0.7.0#product-config@0.7.0": "0gjsm80g6r75pm3824dcyiz4ysq1ka4c1if6k1mjm9cnd5ym0gny" } \ No newline at end of file diff --git a/docs/modules/hbase/pages/usage-guide/operations/graceful-shutdown.adoc b/docs/modules/hbase/pages/usage-guide/operations/graceful-shutdown.adoc index 3eb85373..21884118 100644 --- a/docs/modules/hbase/pages/usage-guide/operations/graceful-shutdown.adoc +++ b/docs/modules/hbase/pages/usage-guide/operations/graceful-shutdown.adoc @@ -11,8 +11,6 @@ After the graceful shutdown timeout runs out, and the process is still running, This is equivalent to executing the `bin/hbase-daemon.sh stop master` command, which internally executes `kill ` (https://github.com/apache/hbase/blob/8382f55b15be6ae190f8d202a5e6a40af177ec76/bin/hbase-daemon.sh#L338[code]), waits for a configurable period of time (defaults to 20 minutes), and finally executes `kill -9 ` to `SIGKILL` the master (https://github.com/apache/hbase/blob/8382f55b15be6ae190f8d202a5e6a40af177ec76/bin/hbase-common.sh#L20-L41[code]). -However, there is no message in the log acknowledging the graceful shutdown. - == RegionServers As a default, RegionServers have `60 minutes` to shut down gracefully. @@ -39,3 +37,8 @@ In contrast to the Master servers, they will, however, acknowledge the graceful 2023-10-11 12:40:42,309 INFO [JettyShutdownThread] server.session: node0 Stopped scavenging 2023-10-11 12:40:42,316 INFO [main] RESTServer: ***** STOPPING service 'RESTServer' ***** ---- + +There are two environment variables that you can add to the regionserver roles (or groups) that allow you more control over the shotdonw process: `MOVE_REGIONS_ON_SHUTDOWN` and `REGION_MOVER_OPTS`. + +If `MOVE_REGIONS_ON_SHUTDOWN` (default is empty) is set to any value, the region server will attempt to move it's regions away to other servers before shutting down. +The `REGION_MOVER_OPTS` variable allows you to pass additional options to the region mover. For example, you can set the `--maxthreads` option to control the number of threads used to move regions. The operator sets the `--regionserverhost localhost` and `--operation unload` options. diff --git a/docs/modules/hbase/pages/usage-guide/operations/node-management.adoc b/docs/modules/hbase/pages/usage-guide/operations/node-management.adoc new file mode 100644 index 00000000..79d21994 --- /dev/null +++ b/docs/modules/hbase/pages/usage-guide/operations/node-management.adoc @@ -0,0 +1,48 @@ += Node management +:description: Use tools provided by the HBase to decommission nodes and move regions within the cluster. +:node-management-docs: https://hbase.apache.org/book.html#node.management + +For detailed instructions on how to manage HBase nodes see the Apache {node-management-docs}[documentation]. + +Here we'll describe some common usecases and how to handle them. + +== Decommissioning a Kubernetes node + +The steps required to decommission a Kubernetes node depend on the services running on that node. +Here we'll discuss some aspects from the HBase perspective. +In a real-world scenario, additional steps are required to ensure a node is successfully removed from the cluster. +From HBase's perspective, it is important to consider the services running on that node. +A node where region servers are running usually require a transfer of those regions to other servers and nodes first as shown in the example below. + +First, turn off the region balancer during the decommissioning process to prevent regions from being moved back to the decommissioned node. +The `graceful_stop.sh` script can also do this, but it will never be able to turn the balancer back on because the container will be terminated as soon as the regions are moved. +Inform the HBase master that the region servers on the node are going to be decommissioned. +This prevents those servers to receive additional regions during the decommissioning process (puts them in "draining" mode). +The `hostname` must contain the fully qualified name of the region server as known by HBase it's self. +If you plan to decommission multiple nodes, it is recommended to decommission all nodes at once to avoid moving regions unnecessarily back and forth between servers. + +[source,bash] +---- +$ echo "balance_switch false" | /stackable/hbase shell +$ echo "decommission_regionservers " | /stackable/hbase shell +---- + +Then, decommision the server and move the regions to other servers. +The commands below are executed on the respective region server container. + +[source,bash] +---- +$ /stackable/hbase/bin/graceful_stop.sh --nobalancer localhost +---- + +Depending on the amount of data, this process can take between a couple of seconds and several hours. +You must use `localhost` and not the fully qualified name of the region server because that requires ssh tools which are not installed. + +Now the region server is guaranteed to not manage any regions and can be safely stopped and removed from the cluster. + +Finally, after removing the nodes from the cluster, turn the region balancer back on. + +[source,bash] +---- +$ echo "balance_switch true" | /stackable/hbase shell +---- diff --git a/docs/modules/hbase/partials/nav.adoc b/docs/modules/hbase/partials/nav.adoc index 49d15aeb..719fd036 100644 --- a/docs/modules/hbase/partials/nav.adoc +++ b/docs/modules/hbase/partials/nav.adoc @@ -18,6 +18,7 @@ *** xref:hbase:usage-guide/operations/pod-placement.adoc[] *** xref:hbase:usage-guide/operations/pod-disruptions.adoc[] *** xref:hbase:usage-guide/operations/graceful-shutdown.adoc[] +*** xref:hbase:usage-guide/operations/node-management.adoc[] * xref:hbase:reference/index.adoc[] ** xref:hbase:reference/crds.adoc[] *** {crd-docs}/hbase.stackable.tech/hbasecluster/v1alpha1/[HbaseCluster {external-link-icon}^] diff --git a/rust/operator-binary/src/hbase_controller.rs b/rust/operator-binary/src/hbase_controller.rs index a4fe62d7..91e6950b 100644 --- a/rust/operator-binary/src/hbase_controller.rs +++ b/rust/operator-binary/src/hbase_controller.rs @@ -57,7 +57,6 @@ use stackable_operator::{ statefulset::StatefulSetConditionBuilder, }, time::Duration, - utils::COMMON_BASH_TRAP_FUNCTIONS, }; use strum::{EnumDiscriminants, IntoStaticStr, ParseError}; @@ -100,6 +99,47 @@ const HBASE_LOG_CONFIG_TMP_DIR: &str = "/stackable/tmp/log_config"; const DOCKER_IMAGE_BASE_NAME: &str = "hbase"; const HBASE_UID: i64 = 1000; +pub const HBASE_BASH_TRAP_FUNCTIONS: &str = r#" +prepare_signal_handlers() +{ + command="$1" + unset term_child_pid + unset term_kill_needed + trap "handle_term_signal $command" TERM +} + +handle_term_signal() +{ + command="$1" + if [ "${term_child_pid}" ]; then + if [ "regionserver" == "$command" ]; then + if [ "" != "$MOVE_REGIONS_ON_SHUTDOWN" ]; then + echo Start moving regions + REGION_MOVER_OPTS="--regionserverhost localhost --operation unload $REGION_MOVER_OPTS" + bin/hbase org.apache.hadoop.hbase.util.RegionMover "$REGION_MOVER_OPTS" + echo Done moving regions + fi + fi + kill -TERM "${term_child_pid}" 2>/dev/null + else + term_kill_needed='yes' + fi +} + +wait_for_termination() +{ + set +e + term_child_pid=$1 + if [[ -v term_kill_needed ]]; then + kill -TERM "${term_child_pid}" 2>/dev/null + fi + wait ${term_child_pid} 2>/dev/null + trap - TERM + wait ${term_child_pid} 2>/dev/null + set -e +} +"#; + pub struct Ctx { pub client: stackable_operator::client::Client, pub product_config: ProductConfigManager, @@ -843,14 +883,18 @@ fn build_rolegroup_statefulset( {kerberos_container_start_commands} - {COMMON_BASH_TRAP_FUNCTIONS} + {HBASE_BASH_TRAP_FUNCTIONS} + + prepare_signal_handlers {hbase_command} {remove_vector_shutdown_file_command} - prepare_signal_handlers - bin/hbase {hbase_role_name_in_command} start & + bin/hbase {hbase_command} start & + # Save the HBase process pid so other scripts provided by the HBase distribution + # (like graceful_stop.sh) can reuse it. + echo $! > /tmp/hbase--{hbase_command}.pid wait_for_termination $! {create_vector_shutdown_file_command} ", - hbase_role_name_in_command = hbase_role.cli_role_name(), + hbase_command = hbase_role.cli_role_name(), kerberos_container_start_commands = kerberos_container_start_commands(hbase), remove_vector_shutdown_file_command = remove_vector_shutdown_file_command(STACKABLE_LOG_DIR), diff --git a/tests/test-definition.yaml b/tests/test-definition.yaml index f6c8053d..73b38eae 100644 --- a/tests/test-definition.yaml +++ b/tests/test-definition.yaml @@ -6,7 +6,6 @@ dimensions: - 2.4.18 # To use a custom image, add a comma and the full name after the product version # - 2.6.0,docker.stackable.tech/sandbox/hbase:2.6.0-stackable0.0.0-dev - # - 2.4.18,docker.stackable.tech/sandbox/hbase:2.4.18-stackable0.0.0-dev - name: hbase-opa values: - 2.6.0