Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

MDEV-35394 Innochecksum misinterprets freed undo pages #3636

Open
wants to merge 1 commit into
base: 10.6
Choose a base branch
from

Conversation

Thirunarayanan
Copy link
Member

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

Description

  • Innochecksum misinterprets the freed undo log pages as active one. This leads the user to think there are too many undo log pages exist.

  • Innochecksum can safely assume the undo log page is freed if the respective extent doesn't belong to a segment and marked as freed in XDES_BITMAP in extent descriptor page.

  • Innochecksum shouldn't assume that zero-filled page as extent descriptor page.

How can this PR be tested?

./mtr innodb.innochecksum_undo_page

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

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.

@Thirunarayanan Thirunarayanan force-pushed the 10.6-MDEV-35394 branch 2 times, most recently from 29e04c6 to d93ade0 Compare November 18, 2024 08:49
extra/innochecksum.cc Outdated Show resolved Hide resolved
extra/innochecksum.cc Outdated Show resolved Hide resolved
mysql-test/suite/innodb/t/innochecksum_undo_page.test Outdated Show resolved Hide resolved
@Thirunarayanan Thirunarayanan force-pushed the 10.6-MDEV-35394 branch 3 times, most recently from 532eed6 to e95959e Compare November 21, 2024 09:34
extra/innochecksum.cc Outdated Show resolved Hide resolved
extra/innochecksum.cc Outdated Show resolved Hide resolved
extra/innochecksum.cc Outdated Show resolved Hide resolved
- Innochecksum misinterprets the freed pages as active one.
This leads the user to think there are too many valid
pages exist.

- To avoid this confusion, innochecksum introduced one
more option --skip-freed-pages and -r to avoid the freed
pages while dumping or printing the summary of the tablespace.

- Innochecksum can safely assume the page is freed if
the respective extent doesn't belong to a segment and marked as
freed in XDES_BITMAP in extent descriptor page.

- Innochecksum shouldn't assume that zero-filled page as extent
descriptor page.
Comment on lines -1250 to +1266
const char *argument MY_ATTRIBUTE((unused)),
const char *argument,
Copy link
Contributor

Choose a reason for hiding this comment

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

I suggested to drop also the argument if it is actually unused. That’s the C++98 way of indicating unused arguments. However, I see that the argument is used #ifndef DBUG_OFF. A better way would be to write the following to avoid a warning in non-debug builds:

const char *IF_DBUG(argument,),

Curiously, when I was searching for warnings in non-debug builds, I found some for other InnoDB files, but not for this one.

Comment on lines 1600 to +1602
init_page_size(buf);

extent_size = FSP_EXTENT_SIZE;
Copy link
Contributor

Choose a reason for hiding this comment

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

This is the only caller of init_page_size(), but I think that it would be more future-proof to initialize the extent_size there.

Comment on lines +11 to +15
let $resultlog=$MYSQLTEST_VARDIR/tmp/result.log;
exec $INNOCHECKSUM -S -r $MYSQLD_DATADIR/ibdata1 > $resultlog;

let SEARCH_FILE = $MYSQLTEST_VARDIR/tmp/result.log;
let SEARCH_PATTERN= Undo page state: 0 active, 0 cached, 0 to_purge, 0 prepared, 0 other;
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we add one more test that uses a nonzero -s option? I might expect that such a test would report some undo pages, because it would not have access to the allocation metadata in the first page.

Comment on lines 101 to +105
/* Enabled for log write option. */
static bool is_log_enabled = false;

/* Skip freed pages */
static bool skip_freed_pages;
Copy link
Contributor

Choose a reason for hiding this comment

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

The comment before the variable declaration is not adding any value, and it is not in Doxygen format either.

In my previous review, I quoted the redundant initialization of is_log_enabled with the thought that you’d remove all redundant zero-initialization of any global variables in this compilation unit.

I also quoted some code in innochecksum_get_one_option() that seemed to be redundant. You addressed that comment by not adding further redundant code there, but you did not remove other redundant code:

	case 'n':
		no_check = true;
		break;
	case 'a':
	case 'S':
		break;
	case 'w':
		do_write = true;
		break;
	case 'l':
		is_log_enabled = true;
		break;

Note: the following is not redundant in the same way, because the parameter that is bound to the D option is &page_dump_filename. For now, I am not suggesting to remove the variable page_type_dump, although I would assume that it is redundant too: page_type_dump == !!page_dump_filename.

	case 'D':
		page_type_dump = true;
		break;

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.

3 participants