Skip to content

MDEV-40023 Clean up dead code in check_expected_crash_and_restart#5229

Open
FarihaIS wants to merge 1 commit into
MariaDB:mainfrom
FarihaIS:mdev-40023
Open

MDEV-40023 Clean up dead code in check_expected_crash_and_restart#5229
FarihaIS wants to merge 1 commit into
MariaDB:mainfrom
FarihaIS:mdev-40023

Conversation

@FarihaIS

@FarihaIS FarihaIS commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Description

check_expected_crash_and_restart() in mariadb-test-run.pl contains dead code for restart_bindir (no test ever sets $restart_bindir) and silently ignores unknown commands in the expect file. This made it easy for bugs like MDEV-39153 to go undetected.

Fix:

  • Remove the unused restart_bindir handler from mariadb-test-run.pl and start_mysqld.inc
  • Call mtr_error() when an unrecognized command is found in the expect file

Release Notes

N/A

How can this PR be tested?

Execute the full MTR test suite — no test uses restart_bindir, so removing it should have no effect. The mtr_error() change will prevent any future invalid expect file commands from failing silently.

Basing the PR against the correct MariaDB version

  • This is a minor fix, and the PR is based against the main branch.

Copyright

All new code of the whole pull request, including one or several files that are either new files or modified ones, are contributed under the BSD-new license. I am contributing on behalf of my employer Amazon Web Services, Inc.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request simplifies the restart command handling in the MariaDB test suite by removing the unused restart_bindir command and its associated environment variable handling. It also introduces strict error checking for unknown commands in the expect file. The review feedback highlights that the regular expression /^restart/ is too loose and will match any command starting with "restart" (e.g., "restarting"), suggesting it be tightened to /^restart\s*$/ to prevent silently ignoring invalid commands.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

my @rest_opt= split(' ', $1);
$mysqld->{'restart_opts'}= \@rest_opt;
} else {
} elsif ($last_line =~ /^restart/) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The regular expression /^restart/ is too loose and will match any command starting with restart (such as restart_foo or restarting). This means invalid commands starting with restart will be silently treated as a plain restart instead of triggering the mtr_error as intended. To ensure only exact restart commands (with optional trailing whitespace) are matched, use /^restart\s*$/ instead.

      } elsif ($last_line =~ /^restart\s*$/) {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is intentional as existing tests (e.g. maria_empty_logs.inc) write tagged restart commands like restart-maria_empty_logs.inc to the expect file as a plain restart, so using /^restart\s*$/ would reject those.

@CLAassistant

CLAassistant commented Jun 12, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@FarihaIS FarihaIS changed the base branch from 12.3 to main June 12, 2026 23:12
Remove the unused restart_bindir handler from mariadb-test-run.pl and
start_mysqld.inc (no test ever sets $restart_bindir). Error on
unrecognized expect file commands instead of silently ignoring them.

All new code of the whole pull request, including one or several files
that are either new files or modified ones, are contributed under the
BSD-new license. I am contributing on behalf of my employer Amazon Web
Services, Inc.
@FarihaIS FarihaIS marked this pull request as ready for review June 13, 2026 00:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants