Skip to content

Commit b867609

Browse files
markhannumclaude
andcommitted
{185361198} tests: verify revconn skips rtcpu'd/decomm'd hosts
Add physrep_revconn_rtcpu to phys_rep_tiered.test, modeled on the existing physrep_rtcpu_source case. Using the 'fakedr' trap to force machine_is_up() to report a host as down, it asserts that the new 'revconn_host_is_up' predicate (physrep_revconn_host_is_up) returns "up" for a healthy host, "down" once the host is marked rtcpu'd, and "up" again after the mark is cleared -- i.e. the reverse-connection sender and receiver will skip a decommissioned/rtcpu'd host. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Signed-off-by: Mark Hannum <mhannum@bloomberg.net>
1 parent 3099031 commit b867609

1 file changed

Lines changed: 52 additions & 0 deletions

File tree

  • tests/phys_rep_tiered.test

tests/phys_rep_tiered.test/runit

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2649,6 +2649,53 @@ function physrep_rtcpu_source
26492649
done
26502650
}
26512651

2652+
function physrep_revconn_rtcpu
2653+
{
2654+
local out
2655+
local cmd
2656+
local sql
2657+
local rc
2658+
2659+
echo "== physrep_revconn_rtcpu =="
2660+
2661+
# Verify that the reverse-connection rtcpu predicate
2662+
# (physrep_revconn_host_is_up) used by both the reverse-conn sender
2663+
# (reverse_conn.c) and receiver (reversesql.c) treats an rtcpu'd /
2664+
# decommissioned host as "down", so we don't spin trying to establish
2665+
# reverse connections to a machine that is never coming back (DRQS
2666+
# 185361198). Exercised via the 'revconn_host_is_up' message command on the
2667+
# intermediary source db, which is the side that runs the revconn workers.
2668+
#
2669+
# Connections use --admin: $firstNode is itself one of $CLUSTER, so on the
2670+
# iteration where it is the target it gets marked rtcpu'd (drtest) and would
2671+
# otherwise refuse normal client traffic.
2672+
for tgt in $CLUSTER ; do
2673+
cmd="revconn_host_is_up $tgt"
2674+
sql="exec procedure sys.cmd.send(\"$cmd\")"
2675+
2676+
# Host is up before it is marked rtcpu'd -> connection allowed
2677+
out=$($CDB2SQL_EXE --tabs --admin $CDB2_OPTIONS ${REPL_CLUS_DBNAME} --host $firstNode "$sql")
2678+
rc=${out##*=}
2679+
[[ "$rc" == "1" ]] || cleanFailExit "revconn_host_is_up should allow $tgt before rtcpu, got rc=$rc"
2680+
2681+
# Mark the host rtcpu'd -> connection must be skipped
2682+
echo "Marking $tgt as RTCPU'd"
2683+
$CDB2SQL_EXE --admin $CDB2_OPTIONS ${REPL_CLUS_DBNAME} --host $firstNode \
2684+
"exec procedure sys.cmd.send(\"fakedr add $tgt\")"
2685+
out=$($CDB2SQL_EXE --tabs --admin $CDB2_OPTIONS ${REPL_CLUS_DBNAME} --host $firstNode "$sql")
2686+
rc=${out##*=}
2687+
[[ "$rc" == "0" ]] || cleanFailExit "revconn_host_is_up should skip rtcpu'd $tgt, got rc=$rc"
2688+
2689+
# Clear the rtcpu mark -> connection allowed again
2690+
echo "Removing RTCPU mark for $tgt"
2691+
$CDB2SQL_EXE --admin $CDB2_OPTIONS ${REPL_CLUS_DBNAME} --host $firstNode \
2692+
"exec procedure sys.cmd.send(\"fakedr del $tgt\")"
2693+
out=$($CDB2SQL_EXE --tabs --admin $CDB2_OPTIONS ${REPL_CLUS_DBNAME} --host $firstNode "$sql")
2694+
rc=${out##*=}
2695+
[[ "$rc" == "1" ]] || cleanFailExit "revconn_host_is_up should allow $tgt after removing rtcpu, got rc=$rc"
2696+
done
2697+
}
2698+
26522699
function physrep_block_writes_correct_rcode
26532700
{
26542701
# Make sure that physreps block writes & return the correct rcode when they do
@@ -3361,6 +3408,11 @@ function run_tests
33613408
physrep_rtcpu_source
33623409
testcase_finish $testcase
33633410

3411+
testcase="physrep_revconn_rtcpu"
3412+
testcase_preamble $testcase
3413+
physrep_revconn_rtcpu
3414+
testcase_finish $testcase
3415+
33643416
testcase="test_intermediate_physrep_active_status"
33653417
testcase_preamble $testcase
33663418
test_intermediate_physrep_active_status

0 commit comments

Comments
 (0)