forked from cockroachdb/cockroach
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
132881: drtprod: add tpcc_run.sh to workload-scale r=nameisbhaskar a=vidit-bhat This PR add the `tpcc_run.sh` to all `workload-scale` nodes Epic: none Release note: None Co-authored-by: Vidit Bhat <[email protected]>
- Loading branch information
Showing
2 changed files
with
74 additions
and
8 deletions.
There are no files selected for viewing
This file contains 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 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,58 @@ | ||
#!/bin/bash | ||
|
||
# Copyright 2024 The Cockroach Authors. | ||
# | ||
# Use of this software is governed by the CockroachDB Software License | ||
# included in the /LICENSE file. | ||
|
||
# This script sets up the tpcc run workload script in the workload nodes | ||
# The --warehouses flag is passed as argument to this script | ||
# NOTE - This uses CLUSTER and WORKLOAD_CLUSTER environment variable, if not set the script fails | ||
|
||
if [ -z "${CLUSTER}" ]; then | ||
echo "environment CLUSTER is not set" | ||
exit 1 | ||
fi | ||
|
||
if [ -z "${WORKLOAD_CLUSTER}" ]; then | ||
echo "environment WORKLOAD_CLUSTER is not set" | ||
exit 1 | ||
fi | ||
|
||
if [ -z "${WORKLOAD_NODES}" ]; then | ||
echo "environment WORKLOAD_NODES is not set" | ||
exit 1 | ||
fi | ||
|
||
# Prepare PGURLS | ||
PGURLS=$(roachprod pgurl $CLUSTER | sed s/\'//g) | ||
|
||
# Loop through each node | ||
for NODE in $(seq 1 $WORKLOAD_NODES) | ||
do | ||
# Create the workload script | ||
cat <<EOF >/tmp/tpcc_run.sh | ||
#!/usr/bin/env bash | ||
read -r -a PGURLS_ARR <<< "$PGURLS" | ||
j=0 | ||
while true; do | ||
echo ">> Starting tpcc workload" | ||
((j++)) | ||
LOG=./tpcc_\$j.txt | ||
./cockroach workload run tpcc $@ \ | ||
--tolerate-errors \ | ||
--families \ | ||
"\${PGURLS_ARR[@]}" | tee \$LOG | ||
if [ \$? -eq 0 ]; then | ||
rm "\$LOG" | ||
fi | ||
sleep 1 | ||
done | ||
EOF | ||
|
||
# Upload the script to the workload cluster | ||
roachprod put $WORKLOAD_CLUSTER:$NODE /tmp/tpcc_run.sh | ||
roachprod ssh $WORKLOAD_CLUSTER:$NODE -- chmod +x tpcc_run.sh | ||
done |