mirror of
https://github.com/rsyslog/rsyslog.git
synced 2026-06-19 10:32:55 +02:00
Why: da-mainmsg-q is meant to exercise disk-assisted main queue draining, but its diagnostic injector could overrun the deliberately tiny queue under CI stress. That made the test report message loss before it had actually isolated the DA queue behavior it intends to verify. Impact: Reduces da-mainmsg-q flakes without weakening the tested DA queue oracle. Before/After: Before, imdiag injected a 2000-message burst as non-delayable traffic; after, the burst participates in queue flow control and the final output count is observed before shutdown. Technical Overview: Set RSTB_IMDIAG_INJECT_DELAY_MODE=full before generate_conf so imdiag marks generated messages as fully delayable. This keeps the test's small queue configuration intact while avoiding diagnostic-input loss as a side effect of the stress setup. The test still verifies the complete sequence 0..2099 after forcing DA mode. It now also waits for the final 2100 output lines after the post-DA recovery burst, so shutdown is not used as a substitute for the omfile output oracle. The header comment was updated to document the setup, stimulus, oracle, and why the injection mode is part of the test plumbing rather than the behavior under test. With the help of AI-Agents: OpenAI Codex
53 lines
2.0 KiB
Bash
Executable File
53 lines
2.0 KiB
Bash
Executable File
#!/bin/bash
|
|
# Test disk-assisted mode on the main message queue. The test uses a very small
|
|
# in-memory main queue so the 2000-message burst must spill to disk and then
|
|
# drain back into the configured omfile action. imdiag injection is marked fully
|
|
# delayable so the diagnostic injector does not overrun the intentionally tiny
|
|
# queue; the behavior under test is DA queue persistence and recovery, not
|
|
# non-delayable input loss. The oracle is the complete output sequence 0..2099:
|
|
# first the pre-DA messages, then the DA-triggering burst, then a final small
|
|
# post-DA burst that proves normal processing resumed.
|
|
# added 2009-04-22 by Rgerhards
|
|
# This file is part of the rsyslog project, released under ASL 2.0
|
|
. ${srcdir:=.}/diag.sh init
|
|
export RSTB_IMDIAG_INJECT_DELAY_MODE=full
|
|
generate_conf
|
|
add_conf '
|
|
$ModLoad ../plugins/imtcp/.libs/imtcp
|
|
$MainMsgQueueTimeoutShutdown 10000
|
|
input(type="imtcp" port="0" listenPortFileName="'$RSYSLOG_DYNNAME'.tcpflood_port")
|
|
|
|
# set spool locations and switch queue to disk assisted mode
|
|
$WorkDirectory '$RSYSLOG_DYNNAME'.spool
|
|
$MainMsgQueueSize 200 # this *should* trigger moving on to DA mode...
|
|
# note: we must set QueueSize sufficiently high, so that 70% (light delay mark)
|
|
# is high enough above HighWatermark!
|
|
$MainMsgQueueHighWatermark 80
|
|
$MainMsgQueueLowWatermark 40
|
|
$MainMsgQueueFilename mainq
|
|
$MainMsgQueueType linkedlist
|
|
|
|
$template outfmt,"%msg:F,58:2%\n"
|
|
template(name="dynfile" type="string" string=`echo $RSYSLOG_OUT_LOG`) # trick to use relative path names!
|
|
:msg, contains, "msgnum:" ?dynfile;outfmt
|
|
'
|
|
startup
|
|
|
|
# part1: send first 50 messages (in memory, only)
|
|
injectmsg 0 50
|
|
wait_file_lines $RSYSLOG_OUT_LOG 50 # let queue drain for this test case
|
|
|
|
# part 2: send bunch of messages. This should trigger DA mode
|
|
injectmsg 50 2000
|
|
ls -l ${RSYSLOG_DYNNAME}.spool # for manual review
|
|
wait_file_lines $RSYSLOG_OUT_LOG 2050 # wait to ensure DA queue is "empty"
|
|
|
|
# send another handful
|
|
injectmsg 2050 50
|
|
wait_file_lines $RSYSLOG_OUT_LOG 2100
|
|
|
|
shutdown_when_empty
|
|
wait_shutdown
|
|
seq_check 0 2099
|
|
exit_test
|