Skip to content

Test that resume of partition merge is blocked #5082

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

Merged
merged 1 commit into from
Mar 24, 2025
Merged
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
1 change: 1 addition & 0 deletions tests/TODO
Original file line number Diff line number Diff line change
Expand Up @@ -83,5 +83,6 @@ rowlocks_blkseq.test
sc_async_constraints.test
sigstopcluster.test
weighted_standing_queue.test -- failing in rhel8 + podman
sc_resume_partition.test -- Pending PR #5073

# vim: set sw=4 ts=4 et:
8 changes: 8 additions & 0 deletions tests/sc_resume_partition.test/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
ifeq ($(TESTSROOTDIR),)
include ../testcase.mk
else
include $(TESTSROOTDIR)/testcase.mk
endif
ifeq ($(TEST_TIMEOUT),)
export TEST_TIMEOUT=2m
endif
60 changes: 60 additions & 0 deletions tests/sc_resume_partition.test/runit
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
#!/usr/bin/env bash

source ${TESTSROOTDIR}/tools/runit_common.sh
source ${TESTSROOTDIR}/tools/cluster_utils.sh

set -ex

[ -z "${CLUSTER}" ] && { echo "Test requires a cluster"; exit 0; }

dbnm=$1

restart_cluster() {
set +e
for node in ${CLUSTER} ; do
kill_restart_node ${node} &
done
set -e

sleep 2

wait_for_cluster
}

test_partition_merge_resume() {
# Given
local starttime
starttime=$(get_timestamp 120)
local master
master=`cdb2sql --tabs ${CDB2_OPTIONS} $dbnm default 'SELECT host FROM comdb2_cluster WHERE is_master="Y"'`

cdb2sql $dbnm --host $master "EXEC PROCEDURE sys.cmd.send('convert_record_sleep 1')"
cdb2sql ${CDB2_OPTIONS} ${dbnm} default "create table t(a int) partitioned by time period 'daily' retention 2 start '${starttime}'"
cdb2sql ${CDB2_OPTIONS} $dbnm default "insert into t values (1)"

# When
cdb2sql ${CDB2_OPTIONS} ${dbnm} default "alter table t partitioned by none" &
waitpid=$!
sleep 1
restart_cluster &> /dev/null

# Then
if wait ${waitpid};
then
echo "FAIL: Merge succeeded before cluster bounced. Test is buggy."
return 1
fi

local timepart
timepart=$(cdb2sql --tabs ${CDB2_OPTIONS} ${dbnm} default "select * from comdb2_timepartitions where name='t'")
if [[ -z ${timepart} ]];
then
echo "FAIL: Could not find expected time partition"
return 1
fi

# Cleanup
cdb2sql ${CDB2_OPTIONS} ${dbnm} default "drop table t"
}

test_partition_merge_resume
7 changes: 6 additions & 1 deletion tests/tools/cluster_utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -246,4 +246,9 @@ function kill_restart_tertiary_node
waitmach $node $TERTIARY_DBNAME
}


function wait_for_cluster
{
for node in ${CLUSTER} ; do
waitmach ${node}
done
}