Skip to content

MCOL-6022 mtr step refactoring #3565

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 9 commits into
base: stable-23.10
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 6 additions & 29 deletions .drone.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -342,36 +342,13 @@ local Pipeline(branch, platform, event, arch="amd64", server="10.6-enterprise",
},
commands: [
prepareTestStage(getContainerName("mtr"), result, true),
"docker cp mysql-test/columnstore mtr$${DRONE_BUILD_NUMBER}:" + mtr_path + "/suite/",
execInnerDocker("chown -R mysql:mysql " + mtr_path, getContainerName("mtr")),
// disable systemd 'ProtectSystem' (we need to write to /usr/share/)
execInnerDocker("bash -c 'sed -i /ProtectSystem/d $(systemctl show --property FragmentPath mariadb | sed s/FragmentPath=//)'", getContainerName("mtr")),
execInnerDocker("systemctl daemon-reload", getContainerName("mtr")),
execInnerDocker("systemctl start mariadb", getContainerName("mtr")),
// Set RAM consumption limits to avoid RAM contention b/w mtr and regression steps.
execInnerDocker("/usr/bin/mcsSetConfig SystemConfig CGroup just_no_group_use_local", getContainerName("mtr")),
execInnerDocker('mariadb -e "create database if not exists test;"', getContainerName("mtr")),
execInnerDocker("systemctl restart mariadb-columnstore", getContainerName("mtr")),

// delay mtr for manual debugging on live instance
"sleep $${MTR_DELAY_SECONDS:-1s}",
'MTR_SUITE_LIST=$([ "$MTR_FULL_SUITE" == true ] && echo "' + mtr_full_set + '" || echo "$MTR_SUITE_LIST")',
if (event == "custom" || event == "cron") then
execInnerDocker('bash -c "wget -qO- https://cspkg.s3.amazonaws.com/mtr-test-data.tar.lz4 | lz4 -dc - | tar xf - -C /"',
getContainerName("mtr")),
if (event == "custom" || event == "cron") then
execInnerDocker('bash -c "cd ' + mtr_path + " && ./mtr --extern socket=" + socket_path + ' --force --print-core=detailed --print-method=gdb --max-test-fail=0 --suite=columnstore/setup"',
getContainerName("mtr")),

if (event == "cron") then
execInnerDocker('bash -c "cd ' + mtr_path + " && ./mtr --extern socket=" + socket_path +
" --force --print-core=detailed --print-method=gdb --max-test-fail=0 --suite="
+ std.join(",", std.map(function(x) "columnstore/" + x, std.split(mtr_full_set, ","))),
getContainerName("mtr")) + '"'
else
execInnerDocker('bash -c "cd ' + mtr_path + " && ./mtr --extern socket=" + socket_path +
' --force --print-core=detailed --print-method=gdb --max-test-fail=0 --suite=columnstore/$${MTR_SUITE_LIST//,/,columnstore/}"',
getContainerName("mtr")),

'bash /mdb/' + builddir + '/storage/columnstore/columnstore/build/run_mtr.sh' +
' --container-name ' + getContainerName("mtr") +
' --distro ' + platform +
' --suite-list $${MTR_SUITE_LIST}' +
' --triggering-event ' + event,
],
},
mtrlog:: {
Expand Down
2 changes: 1 addition & 1 deletion build/prepare_test_stage.sh
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ echo "Installing columnstore..."
if [[ "$RESULT" == *rocky* ]]; then
execInnerDockerWithRetry "$CONTAINER_NAME" 'yum install -y MariaDB-columnstore-engine MariaDB-test'
else
execInnerDockerWithRetry "$CONTAINER_NAME" 'apt update -y && apt install -y mariadb-plugin-columnstore mariadb-test'
execInnerDockerWithRetry "$CONTAINER_NAME" 'apt update -y && apt install -y mariadb-plugin-columnstore mariadb-test mariadb-test-data'
fi

sleep 5
Expand Down
69 changes: 69 additions & 0 deletions build/run_mtr.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
#!/bin/bash

set -eo pipefail

SCRIPT_LOCATION=$(dirname "$0")
source "$SCRIPT_LOCATION"/utils.sh

optparse.define short=c long=container-name desc="Name of the Docker container where mtr tests will run" variable=CONTAINER_NAME
optparse.define short=d long=distro desc="Linux distro for which mtr is runned" variable=DISTRO
optparse.define short=s long=suite-list desc="Comma-separated list of test suites to run" variable=MTR_SUITE_LIST
optparse.define short=e long=triggering-event desc="Event that triggers testrun" variable=EVENT
source $(optparse.build)

MTR_FULL_SET="basic,bugfixes,devregression,autopilot,extended,multinode,oracle,1pmonly"

echo "Arguments received: $@"

if [[ "$EUID" -ne 0 ]]; then
error "Please run script as root"
exit 1
fi

if [[ -z "${CONTAINER_NAME}" ]]; then
echo "Please provide mtr container name as a parameter, e.g. ./run_mtr.sh -c mtr183"
exit 1
fi

if [[ -z $(docker ps -q --filter "name=${CONTAINER_NAME}") ]]; then
error "Container '${CONTAINER_NAME}' is not running."
exit 1
fi

if [[ "$DISTRO" == *rocky* ]]; then
SOCKET_PATH="/var/lib/mysql/mysql.sock"
MTR_PATH="/usr/share/mysql-test"
else
SOCKET_PATH="/run/mysqld/mysqld.sock"
MTR_PATH="/usr/share/mysql/mysql-test"
fi

message "Running mtr tests..."

#docker cp mysql-test/columnstore "${CONTAINER_NAME}":"${MTR_PATH}/suite/" #TODO: Tests should be run from package not from sources as it works now
#execInnerDocker "${CONTAINER_NAME}" "chown -R mysql:mysql ${MTR_PATH}"
execInnerDocker "${CONTAINER_NAME}" "yum remove -y MariaDB-columnstore-engine || apt remove -y mariadb-plugin-columnstore"
execInnerDocker "${CONTAINER_NAME}" "chown -R root:root ${MTR_PATH}"

# disable systemd 'ProtectSystem' (we need to write to /usr/share/)
execInnerDocker "${CONTAINER_NAME}" "sed -i /ProtectSystem/d \$(systemctl show --property FragmentPath mariadb | sed s/FragmentPath=//)" || true
execInnerDocker "${CONTAINER_NAME}" "systemctl daemon-reload"
#execInnerDocker "${CONTAINER_NAME}" "systemctl start mariadb"

# Set RAM consumption limits to avoid RAM contention b/w mtr and regression steps.
#execInnerDocker "${CONTAINER_NAME}" "/usr/bin/mcsSetConfig SystemConfig CGroup just_no_group_use_local" || true
#execInnerDocker "${CONTAINER_NAME}" "mariadb -e \"create database if not exists test;\""
#execInnerDocker "${CONTAINER_NAME}" "systemctl restart mariadb-columnstore"

#TODO: should all actions until this point be a part of prepare_test_stage.sh?

if [[ "${EVENT}" == "custom" || "${EVENT}" == "cron" ]]; then
execInnerDocker "${CONTAINER_NAME}" "wget -qO- https://cspkg.s3.amazonaws.com/mtr-test-data.tar.lz4 | lz4 -dc - | tar xf - -C /" #TODO: Data for extended tests( out of scope of basic, bugfixes) set should be downloaded and unpacked for extended version only.
execInnerDocker "${CONTAINER_NAME}" "cd ${MTR_PATH} && perl ./mtr --force --print-core=detailed --print-method=gdb --max-test-fail=0 --suite=columnstore/setup"
fi

if [[ "${EVENT}" == "cron" ]]; then
execInnerDocker "${CONTAINER_NAME}" "cd ${MTR_PATH} && perl ./mtr --force --print-core=detailed --print-method=gdb --max-test-fail=0 --suite=columnstore/${MTR_FULL_SET//,/,columnstore/}"
else
execInnerDocker "${CONTAINER_NAME}" "cd ${MTR_PATH} && perl ./mtr --force --print-core=detailed --print-method=gdb --max-test-fail=0 --suite=columnstore/${MTR_SUITE_LIST//,/,columnstore/}"
fi
2 changes: 1 addition & 1 deletion tests/scripts/fullmtr.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ SCRIPT_LOCATION=$(dirname "$0")
MARIADB_SOURCE_PATH=$(realpath $SCRIPT_LOCATION/../../../../../)
COLUMNSTORE_MTR_SOURCE=$(realpath $SCRIPT_LOCATION/../../mysql-test/columnstore)
INSTALLED_MTR_PATH='/usr/share/mysql/mysql-test'
COLUMSNTORE_MTR_INSTALLED=${INSTALLED_MTR_PATH}/suite/columnstore
COLUMSNTORE_MTR_INSTALLED=${INSTALLED_MTR_PATH}/plugin/columnstore/columnstore/
PATCHNAME=$(realpath $SCRIPT_LOCATION)/mtr_warn.patch
CURRENT_DIR=`pwd`
mysql -e "create database if not exists test;"
Expand Down