MDEV-37138: Innochecksum fails to handle doublewrite buffer and

multiple file tablespace

Problem:
=======
- innochecksum was incorrectly interpreting doublewrite buffer
pages as index pages, causing confusion about stale tables
in the system tablespace.

- innochecksum fails to parse the multi-file system tablespace

Solution:
========
1. Rewrite checksum of doublewrite buffer pages
are skipped.

2. Introduced the option --tablespace-flags which can be used
to initialize page size. This option can handle the ibdata2,
ibdata3 etc without parsing ibdata1.

This is a cherry-pick of commit 9f8716ab61
This commit is contained in:
Thirunarayanan Balathandayuthapani 2025-11-11 12:50:42 +05:30
commit cfaaf93ead
11 changed files with 400 additions and 81 deletions

View file

@ -150,6 +150,7 @@ enum fsp_reserve_t {
FSP_CLEANING, /* reservation done during purge operations */
FSP_BLOB /* reservation being done for BLOB insertion */
};
#endif /* UNIV_INNOCHECKSUM */
/* Number of pages described in a single descriptor page: currently each page
description takes less than 1 byte; a descriptor page is repeated every
@ -190,6 +191,7 @@ every XDES_DESCRIBED_PER_PAGE pages in every tablespace. */
/*--------------------------------------*/
/* @} */
#ifndef UNIV_INNOCHECKSUM
/** Check if tablespace is system temporary.
@param[in] space_id verify is checksum is enabled for given space.
@return true if tablespace is system temporary. */

View file

@ -24,6 +24,7 @@ Transaction system
Created 3/26/1996 Heikki Tuuri
*******************************************************/
#ifndef UNIV_INNOCHECKSUM
#pragma once
#include "buf0buf.h"
#include "fil0fil.h"
@ -272,6 +273,7 @@ FIXED WSREP XID info offsets for 4k page size 10.0.32-galera
#define TRX_SYS_WSREP_XID_BQUAL_LEN 12
#define TRX_SYS_WSREP_XID_DATA 16
#endif /* WITH_WSREP*/
#endif /* !UNIV_INNOCHECKSUM */
/** Doublewrite buffer */
/* @{ */
@ -320,7 +322,7 @@ constexpr uint32_t TRX_SYS_DOUBLEWRITE_MAGIC_N= 536853855;
/** Contents of TRX_SYS_DOUBLEWRITE_SPACE_ID_STORED */
constexpr uint32_t TRX_SYS_DOUBLEWRITE_SPACE_ID_STORED_N= 1783657386;
/* @} */
#ifndef UNIV_INNOCHECKSUM
trx_t* current_trx();
struct rw_trx_hash_element_t
@ -1286,3 +1288,4 @@ private:
/** The transaction system */
extern trx_sys_t trx_sys;
#endif /* !UNIV_INNOCHECKSUM */

View file

@ -27,9 +27,8 @@ Created 3/26/1996 Heikki Tuuri
#ifndef trx0undo_h
#define trx0undo_h
#ifndef UNIV_INNOCHECKSUM
#include "trx0sys.h"
#ifndef UNIV_INNOCHECKSUM
/** The LSB of the "is insert" flag in DB_ROLL_PTR */
#define ROLL_PTR_INSERT_FLAG_POS 55
/** The LSB of the 7-bit trx_rseg_t::id in DB_ROLL_PTR */