-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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-35169 ALTER TABLE...IMPORT TABLESPACE does not work with INDEX DESC #3784
base: 10.11
Are you sure you want to change the base?
Conversation
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we try to change the file format as little as possible?
I would modify row_quiesce_write_indexes()
so that when descending index fields are present, we would set the most significant bit in the 32 bits that we use for encoding one of type
, n_uniq
, n_nullable
, n_fields
. The last one would seem to be an obvious choice, due to the following in row_import_read_indexes()
:
} else if (cfg->m_n_indexes > 1024) {
// FIXME: What is the upper limit? */
ib_errf(thd, IB_LOG_LEVEL_ERROR, ER_IO_READ_ERROR,
"Number of indexes in meta-data file is too high: "
ULINTPF, cfg->m_n_indexes);
cfg->m_n_indexes = 0;
return(DB_CORRUPTION);
}
This would give an easy to recognize error message and still allow the file to be slightly edited so that it can be imported.
We do not even seem to need the above; we could simply store the "descending field" flag in the 32 bits that store the length of the field name:
/* The NUL byte is included in the name length. */
ulint len = mach_read_from_4(ptr);
if (len > OS_FILE_MAX_PATH) {
ib_errf(thd, IB_LOG_LEVEL_ERROR,
ER_INNODB_INDEX_CORRUPT,
"Index name length (" ULINTPF ") is too long, "
"the meta-data is corrupt", len);
return(DB_CORRUPTION);
}
7ada05c
to
2b8d361
Compare
Problem: ======= - Import tablespace fails to check the index fields descending property while matching the schema given in cfg file with the table schema. Fix: === row_quiesce_write_index_fields(): Write the descending property of the field into field fixed length field. Since the field fixed length uses only 10 bits, InnoDB can use 0th bit of the field fixed length to store the descending field property. row_import_cfg_read_index_fields(): Read the field descending information from field fixed length.
2b8d361
to
e9182a4
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please update the "Testing done" section with a test that involves an attempt to import .cfg
files from an export after this fix, to both MariaDB Server 10.11 and 10.6. I’d like to see three cases:
- No indexes declared with
DESC
- At least one secondary indexes declared with at least one
DESC
column PRIMARY KEY
includes aDESC
column
For 10.6, please include the SQL statements that need to be executed to make the imported tables pass CHECK TABLE
.
Description
Problem:
Fix:
row_import_cfg_read_index_fields(): Read the field descending property from cfg file depends on the config version
row_quiesce_write_index_fields(): Write the descending property of the index fields into cfg file
How can this PR be tested?
./mtr innodb.import_cfg --mem
Basically which does create old version cfg file and import tablespace with old cfg file
Basing the PR against the correct MariaDB version
main
branch.PR quality check