Skip to content
/ server Public

Conversation

@mariadb-TafzeelShams
Copy link
Contributor

@mariadb-TafzeelShams mariadb-TafzeelShams commented Jan 20, 2026

  • The Jira issue number for this PR is: MDEV-38079

Description

Issue:
Recovery fails because the expected space ID does not match the space
ID stored in the page.

Root Cause:

  • Before the crash, the nth page (n != 0) gets flushed to disk as a
    compressed page.
  • Page 0 remains unflushed, and the compressed flag for the space is
    made durable only in the redo logs.
  • During recovery, the compressed flag is first set to indicate a
    compressed space.
  • Later, while applying redo logs, an earlier LSN may reset it to
    non-compressed and then back to compressed.
  • If the nth page is read during this intermediate state, a compressed
    page may be read as non-compressed, causing a space ID mismatch.

Fix:

  • recv_sys_t::space_flags_lsn : Added a map to track the last applied
    LSN for each space and avoid stale updates from earlier LSNs.
  • recv_sys_t::update_space_flags() : Updates space->flags during
    recovery only if the update comes from the latest LSN.

How can this PR be tested?

Tested with the data directory mentioned in the Jira ticket.

Basing the PR against the correct MariaDB version

  • This is a new feature and the PR is based against the latest MariaDB development branch
  • This is a bug fix and the PR is based against the earliest branch in which the bug can be reproduced

Issue:
Recovery fails because the expected space ID does not match the space
ID stored in the page.

Root Cause:
- Before the crash, the nth page (n != 0) gets flushed to disk as a
  compressed page.
- Page 0 remains unflushed, and the compressed flag for the space is
  made durable only in the redo logs.
- During recovery, the compressed flag is first set to indicate a
  compressed space.
- Later, while applying redo logs on page 0, an earlier LSN may reset
  it to non-compressed and then back to compressed.
- If the nth page is read during this intermediate state, a compressed
  page may be read as non-compressed, causing a space ID mismatch.

Fix:
- recv_sys_t::space_flags_lsn : Added a map to track the last applied
  LSN for each space and avoid stale updates from earlier LSNs.
- recv_sys_t::update_space_flags() : Updates space->flags during
  recovery only if the update comes from the latest LSN.
@mariadb-TafzeelShams
Copy link
Contributor Author

Opened PR-4586 based against 10.6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

2 participants