stackabletech / hbase-operator

Kubernetes Operator for Apache HBase built by Stackable for the Stackable Data Platform
https://stackable.tech
Other
16 stars 4 forks source link

Improve graceful shutdown of RegionSevers #508

Open sbernauer opened 5 months ago

sbernauer commented 5 months ago

Relevant docs: https://hbase.apache.org/book.html#decommission Relevant script: graceful_stop.sh Relevant class: org.apache.hadoop.hbase.util.RegionMover, with relevant function

In https://github.com/stackabletech/hbase-operator/issues/400 we implemented a graceful shutdown for all HBase components which is similar to ./bin/hbase-daemon.sh stop <service>. While this works in general it has downsides, such regions being offline for some time, resulting in (short) outages.

Instead we should try to call or mimic graceful_stop.sh. The graceful_stop.sh script will move the regions off the decommissioned RegionServer one at a time to minimize region churn. It will verify the region deployed in the new location before it will moves the next region and so on until the decommissioned server is carrying zero regions. At this point, the graceful_stop.sh tells the RegionServer stop. The master will at this point notice the RegionServer gone but all regions will have already been redeployed and because the RegionServer went down cleanly, there will be no WAL logs to split.

### Acceptance criteria
- [ ] Must: Call or mimic `graceful_stop.sh`
- [ ] Must: The docs say "Disable the Load Balancer before Decommissioning a node". We found a solution to this by either doing so or making sure we (or our customers) are not using LBs
- [ ] Should: Decommissioning several Regions Servers concurrently: To gracefully drain multiple regionservers at the same time, RegionServers can be put into a "draining" state. This is done by marking a RegionServer as a draining node by creating an entry in ZooKeeper under the hbase_root/draining znode. Watch out to clean up or make sure the regionserver does this when starting up again
NickLarsenNZ commented 2 months ago

Must: The docs say "Disable the Load Balancer before Decommissioning a node". We found a solution to this by either doing so or making sure we (or our customers) are not using LBs

Can we just use readiness probes to take the pod out of service?

razvan commented 1 month ago

There need to be at lease two shutdown modes:

Findings (in progress):

razvan commented 1 week ago

During testing it was discovered that region servers already transfer regions when shutting down. This behavior is implemented in the 2.4 and 2.6 versions.

To clarify:

Another idea : since this is the default behavior anyway, maybe in cases like rolling cluster restarts, the user would benefit more from actually disabling the region mover altogether during that period.

NickLarsenNZ commented 2 days ago

This will be discussed next week