HBASE-30087: Create GitHub Actions for testing Read-Replica feature - #8517
Open
kgeisz wants to merge 1 commit into
Open
HBASE-30087: Create GitHub Actions for testing Read-Replica feature#8517kgeisz wants to merge 1 commit into
kgeisz wants to merge 1 commit into
Conversation
Change-Id: I17da2eba97f7385540a564ba31c462d796347e4d
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
HBASE-30087: Create GitHub Actions for testing Read-Replica feature
Introduction
HBase's Read-Replica feature was merged into master in PR #8364. This pull request introduces integration tests for Read-Replica via GitHub Actions and Docker containers. GitHub Actions and Docker containers have been useful for testing this feature because it works around the
META_TABLE_NAMEissue mentioned in HBASE-29691 and PR #7730.In a Read-Replica setup, clusters share the same storage location but need to have different
META_TABLE_NAMEs. The table names are distinguished using thehbase.meta.table.suffixconfiguration property. However, this still leads to problems when usingMiniHBaseClusterto test a multi-cluster Read-Replica setup because these clusters run in the same JVM and end up sharing the samestatic META_TABLE_NAMEvariable.How It Works
.github/workflows/read-replica-integration-tests.ymlfile is the main driver of the integration tests. This file defines the workflow and steps performed during the integration test.dev-support/integration-test/read-replicadirectory contains various files for building a Docker image, running containers with HBase procecces, and running integration test scripts written in Python. It also contains files and directories used by HBase, such asconfdirectories.hbase_docker_client.pyfile is the most important Python file. Every test script uses this file to communicate with each hbase-docker container. It does so by usingdocker execto run commands in a container's HBase shell.The tests are triggered when a someone submits a pull request with the
read-replicalabel. Once the label is added, the test begins by checking out the HBase repo. This repo contains the pull request's code, so any changes toread-replica-integration-tests.ymlanddev-support/integration-test/read-replicacan be tested immediately. After, some environment setup is done.Next, the test checks out the submitted pull request's HBase repo again, except the repo's directory is placed in
dev-support/integration-test/read-replica. Here, the repo can be used to build a Docker image for running HBase. After the image has been built, two Docker containers are started, each of which are running HBase in a Read-Replica setup. One container starts as the active cluster (read-write mode), while the other container starts as a replica cluster (read-only mode). These clusters share adata-storedirectory that contain thehbase.rootdir. It is a mounted volume between each container and the local filesystem, and it is created by the Python scripts before container startup and given777permissions in order to avoid HBase startup failures. There are other volumes as well for easy access, such as each container'sconfdirectory and autilsdirectory for bulkloading data.Once the containers are up and running, a series of Python scripts are run as integration tests. They test expected behavior for a Read-Replica cluster setup, such as verifying valid/invalid startup, blocking writes on replica clusters, being able to refresh meta and HFiles on replica clusters to make them consistent with the active cluster, read-only flag flipping (
hbase.global.readonly.enabled), verifying bug fixes, etc. The containers are shut down when the test is complete. If a failure occurs at any point, the workflow is stopped and the HBase logs for each container are dumped.Other Information
docker-compose.ymldefines and configures two hbase-docker containers capable of running in a read-replica setup.build_images.shusesDockerfileto build an hbase-docker image. This script assumes there is anhbaserepo in the same directory..envdefines environment variables used bydocker-compose.yml,build_images.sh, and Python scripts.proto_compiler.pycopiesActiveClusterSuffix.protofrom the hbase repo and compiles it. The generated output is used for verifying theactive.cluster.suffix.idfile.utilsis a directory containing scripts for bulkloading data into HBaseconf1andconf2are the active and replica cluster's configuration directories, respectively. They each contain their ownhbase-site.xml,log4j2.properties, andzoo.cfgfiles. The directories are defined as mounted volumes indocker-compose.yml. This is especially useful for changing the value ofhbase.global.readonly.enabledin order to change a cluster's read-only mode.Example Test Runs