Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

MDEV-35420 Server aborts while deleting the record in spatial index #3887

Merged
merged 1 commit into from
Mar 21, 2025

Conversation

Thirunarayanan
Copy link
Member

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

Description

  • InnoDB spatial index keep track of all active r-tree search cursor. While deleting a record from the index, spatial index discards the page present in the active r-tree search cursor.
    rtr_check_discard_page() have the assumption that all active r-tree cursor should point to shadow block for the matched records. If the cursor was opened when the table is empty then there won't be any shadow block.

How can this PR be tested?

./mtr innodb_gis.rollback

Basing the PR against the correct MariaDB version

  • This is a new feature or a refactoring, and the PR is based against the main branch.
  • This is a bug fix, and the PR is based against the earliest maintained branch in which the bug can be reproduced.

PR quality check

  • I checked the CODING_STANDARDS.md file and my PR conforms to this where appropriate.
  • For any trivial modifications to the PR, I am ok with the reviewer making the changes themselves.

@CLAassistant
Copy link

CLAassistant commented Mar 11, 2025

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

Copy link
Contributor

@dr-m dr-m left a comment

Choose a reason for hiding this comment

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

The fix looks reasonable to me, but it feels a little like treating the symptoms and not the cause. I think that we should do a little more and try to document these data structures a little better.

It would seem to me that at least 10.6 should be affected by the same issue, possibly also 10.5. Can you check that and retarget if appropriate?

@Thirunarayanan Thirunarayanan changed the base branch from 10.11 to 10.5 March 14, 2025 09:51
Copy link
Contributor

@dr-m dr-m left a comment

Choose a reason for hiding this comment

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

Thank you. This fixes the regression that was caused by my #3088 and makes some related code slightly better. There are many concurrency issues and open bugs related to InnoDB SPATIAL INDEX both in MySQL and MariaDB, and fixing all of it would require a significant redesign effort.

- This issue caused by commit a032f14(MDEV-33559).
In MDEV-33559, matched_rec::block was changed to pointer
and assinged with the help of buf_block_alloc(). But patch
fails to check for the block can be nullptr in
rtr_check_discard_page().

rtr_cur_search_with_match(): Acquire rtr_match_mutex before
creating shadow block for the matched records

rtr_pcur_move_to_next(): Copy the shadow block to page cursor
block under rtr_match_mutex
@vuvova vuvova force-pushed the 10.11-MDEV-35420 branch from 0b6b7d2 to d3fde0c Compare March 21, 2025 14:00
@vuvova vuvova enabled auto-merge (rebase) March 21, 2025 14:00
@vuvova vuvova merged commit f1deebb into 10.5 Mar 21, 2025
7 of 9 checks passed
# for free to join this conversation on GitHub. Already have an account? # to comment
Development

Successfully merging this pull request may close these issues.

5 participants