Prove retained connectors close on shutdown
This commit is contained in:
@@ -119,4 +119,25 @@ while (( SECONDS < deadline )); do
|
||||
done
|
||||
[[ "$connections" == "0" ]] || { echo "final pooled fixture connection remained after idle eviction" >&2; exit 1; }
|
||||
|
||||
echo "Persistent MySQL idle eviction preserved hot reuse and retired the expired connection"
|
||||
retained=$(request /database.uce)
|
||||
IFS='|' read -r retained_pid retained_id retained_source <<<"$retained"
|
||||
[[ "$retained_pid" == "$first_pid" && "$retained_source" == "new" ]]
|
||||
connections=$(mariadb --batch --skip-column-names -e "SELECT COUNT(*) FROM information_schema.PROCESSLIST WHERE USER='$test_user'")
|
||||
[[ "$connections" == "1" ]] || { echo "shutdown fixture connection was not retained in the worker pool" >&2; exit 1; }
|
||||
|
||||
journal_cursor=$(journalctl -u mariadb.service -n 0 --show-cursor --no-pager | sed -n 's/^-- cursor: //p')
|
||||
[[ -n "$journal_cursor" ]] || { echo "could not capture MariaDB journal cursor" >&2; exit 1; }
|
||||
kill -TERM "$server_pid"
|
||||
deadline=$((SECONDS + 10))
|
||||
while kill -0 "$server_pid" 2>/dev/null && (( SECONDS < deadline )); do sleep 0.05; done
|
||||
[[ ! -e "/proc/$server_pid" ]] || { echo "private UCE server did not stop cleanly" >&2; exit 1; }
|
||||
wait "$server_pid" 2>/dev/null || true
|
||||
server_pid=""
|
||||
sleep 1
|
||||
shutdown_log=$(journalctl -u mariadb.service --after-cursor "$journal_cursor" --no-pager)
|
||||
if grep -F "$test_user" <<<"$shutdown_log" | grep -Fq "Aborted connection"; then
|
||||
echo "clean UCE shutdown aborted a retained MySQL connection" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Persistent MySQL idle eviction preserved hot reuse, retired expired connections, and closed a retained connection on clean shutdown"
|
||||
|
||||
Reference in New Issue
Block a user