HBASE-30087: Create a nightly Jenkins test for the Read-Replica feature - #8517
HBASE-30087: Create a nightly Jenkins test for the Read-Replica feature#8517kgeisz wants to merge 3 commits into
Conversation
|
Better add this to nightly or integration tests. Typically we do not require integration test when merging a PR. |
| Note: In the Terminal, we usually put double quotes around everything after "-c", | ||
| but doing that with subprocess.run() results in a failure. | ||
| """ | ||
| cmd = ["docker", "exec", self._container_name, "bash", "-c", f'''{bash_cmd}'''] |
There was a problem hiding this comment.
Could it be easier to use docker python module to execute commands inside the container instead of subprocessing the docker command?
exec_run(cmd, stdout=True, stderr=True, stdin=False, tty=False, privileged=False, user='', detach=False, stream=False, socket=False, environment=None, workdir=None, demux=False)
Run a command inside this container. Similar to docker exec.
There was a problem hiding this comment.
I updated run_docker_exec_command() method in hbase_docker_client.py do use Docker's Python library for running docker exec commands. Unfortunately, this library does not support docker compose, so I am still using Python's subprocess to run docker compose commands.
13b8d57 to
8678d7a
Compare
898dc35 to
4439c4c
Compare
- Some code was created using Claude Opus 4.6 Change-Id: I17da2eba97f7385540a564ba31c462d796347e4d
Change-Id: I74edb45cf1123e72c9445301c7333db18d1a67a3
26d87ac to
63f626f
Compare
|
Hi @Apache9, thanks for the feedback! I updated the PR by adding a read-replica stage to Is there any way this updated Jenkinsfile can be tested with upstream Jenkins before merging the PR? |
Change-Id: I47a7f5e87cff5b554731cd15ada2fd207b98f22e
HBASE-30087: Create a nightly Jenkins test for the Read-Replica feature
Note: Some code in the pull request was written using Claude Opus 4.6.
Introduction
HBase's Read-Replica feature was merged into master in PR #8364. This pull request introduces integration tests for Read-Replica via Jenkins and Docker containers. Jenkins 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 and 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
dev-support/Jenkinsfile.dev-support/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 within a stage in HBase's nighly Jenkins run. The stage starts by cloning the current HBase repository to dev-support/read-replica. From here, the repo gets used to build a Docker image designed to run HBase in a Read-Replica setup. After the image has been built, two Docker containers are started, where one starts as the active cluster (read-write mode), and the other container starts as a replica cluster (read-only mode). These clusters share a
data-storedirectory containing 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. The directory is also given777permissions in order to avoid HBase startup failures. There are other volumes as well for easy access, such as each container'sconfdirectory, autilsdirectory for bulkloading data, and alogsdirectory for preserving HBase logs from each container.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 (changing
hbase.global.readonly.enabledvia dynamic configuration), verifying bug fixes, etc. If the Jenkins stage finishes successfully or a failure occurs at any point, then the HBase logs are saved to the Jenkins output directory, the containers are stopped, and the Docker image is deleted.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 HBase.cluster1andcluster2directories contain cluster-specific conf files and HBase log output directories. 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. The mounted logs directory is useful because it helps preserve the HBase logs so they can be copied to the Jenkins output directory if a test failure occurs.