1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-14 13:41:20 +03:00
Commit Graph

540 Commits

Author SHA1 Message Date
c770bce898 Merge branch '11.2' into 11.4 2024-10-30 15:11:17 +01:00
ebefef658e Merge 10.11 into 11.2 2024-10-18 11:32:22 +03:00
eca552a1a4 MDEV-34830: LSN in the future is not being treated as serious corruption
The invariant of write-ahead logging is that before any change to a
page is written to the data file, the corresponding log record must
must first have been durably written.

In crash recovery, there were some sloppy checks for this. Let us
implement accurate checks and flag an inconsistency as a hard error,
so that we can avoid further corruption of a corrupted database.
For data extraction from the corrupted database, innodb_force_recovery
can be used.

Before recovery is reading any data pages or invoking
buf_dblwr_t::recover() to recover torn pages from the
doublewrite buffer, InnoDB will have parsed the log until the
final LSN and updated log_sys.lsn to that. So, we can rely on
log_sys.lsn at all times. The doublewrite buffer recovery has been
refactored in such a way that the recv_sys.dblwr.pages may be consulted
while discovering files and their page sizes, but nothing will be
written back to data files before buf_dblwr_t::recover() is invoked.

recv_max_page_lsn, recv_lsn_checks_on: Remove.

recv_sys_t::validate_checkpoint(): Validate the write-ahead-logging
condition at the end of the recovery.

recv_dblwr_t::validate_page(): Keep track of the maximum LSN
(if we are checking a non-doublewrite copy of a page) but
do not complain LSN being in the future. The doublewrite buffer
is a special case, because it will be read early during recovery.
Besides, starting with commit 762bcb81b5
the dblwr=true copies of pages may legitimately be "too new".

recv_dblwr_t::find_page(): Find a valid page with the smallest
FIL_PAGE_LSN that is in the valid range for recovery.

recv_dblwr_t::restore_first_page(): Replaced by find_page().
Only buf_dblwr_t::recover() will write to data files.

buf_dblwr_t::recover(): Simplify the message output. Do attempt
doublewrite recovery on user page read error. Ignore doublewrite
pages whose FIL_PAGE_LSN is outside the usable bounds. Previously,
we could wrongly recover a too new page from the doublewrite buffer.
It is unlikely that this could have lead to an actual error.
Write back all recovered pages from the doublewrite buffer here,
including for the first page of any tablespace.

buf_page_is_corrupted(): Distinguish the return values
CORRUPTED_FUTURE_LSN and CORRUPTED_OTHER.

buf_page_check_corrupt(): Return the error code DB_CORRUPTION
in case the LSN is in the future.

Datafile::read_first_page_flags(): Split from read_first_page().
Take a copy of the first page as a parameter.

recv_sys_t::free_corrupted_page(): Take the file as a parameter
and return whether a message was displayed. This avoids some duplicated
and incomplete error messages.

buf_page_t::read_complete(): Remove some redundant output and always
display the name of the corrupted file. Never return DB_FAIL;
use it only in internal error handling.

IORequest::read_complete(): Assume that buf_page_t::read_complete()
will have reported any error.

fil_space_t::set_corrupted(): Return whether this is the first time
the tablespace had been flagged as corrupted.

Datafile::validate_first_page(), fil_node_open_file_low(),
fil_node_open_file(), fil_space_t::read_page0(),
fil_node_t::read_page0(): Add a parameter for a copy of the
first page, and a parameter to indicate whether the FIL_PAGE_LSN
check should be suppressed. Before buf_dblwr_t::recover() is
invoked, we cannot validate the FIL_PAGE_LSN, but we can trust the
FSP_SPACE_FLAGS and the tablespace ID that may be present in a
potentially too new copy of a page.

Reviewed by: Debarun Banerjee
2024-10-18 10:12:47 +03:00
b53b81e937 Merge 11.2 into 11.4 2024-10-03 14:32:14 +03:00
12a91b57e2 Merge 10.11 into 11.2 2024-10-03 13:24:43 +03:00
63913ce5af Merge 10.6 into 10.11 2024-10-03 10:55:08 +03:00
7e0afb1c73 Merge 10.5 into 10.6 2024-10-03 09:31:39 +03:00
0a5e4a0191 MDEV-31005: Make working cursor-protocol
Updated tests: cases with bugs or which cannot be run
with the cursor-protocol were excluded with
"--disable_cursor_protocol"/"--enable_cursor_protocol"

Fix for v.10.5
2024-09-18 18:39:26 +07:00
7ea9e1358f Merge 11.2 into 11.4 2024-09-18 08:07:22 +03:00
e782e416ac Merge 10.11 into 11.2 2024-09-18 07:38:49 +03:00
b187414764 Merge 10.6 into 10.11 2024-09-16 10:58:40 +03:00
a74bea7ba9 MDEV-34879 InnoDB fails to merge the change buffer to ROW_FORMAT=COMPRESSED tables
buf_page_t::read_complete(): Fix an incorrect condition that had been
added in commit aaef2e1d8c (MDEV-27058).
Also for compressed-only pages we must remember that buffered changes
may exist.

buf_read_page(): Correct the function comment; this is for a synchronous
and not asynchronous read. Pass the parameter unzip=true to
buf_read_page_low(), because each of our callers will be interested in
the uncompressed page frame. This will cause the test
encryption.innodb-compressed-blob to emit more errors when the
correct keys for decrypting the clustered index root page are unavailable.

Reviewed by: Debarun Banerjee
2024-09-12 10:52:55 +03:00
1640c9b06e Merge branch '11.2' into 11.4 2024-08-04 17:27:48 +02:00
dced6cbdb6 Merge branch '11.1' into 11.2 2024-08-03 09:50:16 +02:00
80abd847da Merge branch '10.11' into 11.1 2024-08-03 09:32:42 +02:00
0e8fb977b0 Merge branch '10.6' into 10.11 2024-08-03 09:15:40 +02:00
8f020508c8 Merge branch '10.5' into 10.6 2024-08-03 09:04:24 +02:00
533e6d5d13 MDEV-34670 IMPORT TABLESPACE unnecessary traverses tablespace list
Problem:
========
- After the commit ada1074bb1 (MDEV-14398)
fil_crypt_set_encrypt_tables() iterates through all tablespaces to
fill the default_encrypt tables list. This was a trigger to
encrypt or decrypt when key rotation age is set to 0. But import
tablespace does call fil_crypt_set_encrypt_tables() unnecessarily.
The motivation for the call is to signal the encryption threads.

Fix:
====
ha_innobase::discard_or_import_tablespace: Remove the
fil_crypt_set_encrypt_tables() and add the import tablespace
to the default encrypt list if necessary
2024-07-31 14:13:38 +05:30
99b370e023 Merge branch '11.2' into 11.4 2024-05-21 19:38:51 +02:00
bf5da43e50 Merge branch '11.1' into 11.2 2024-05-13 10:00:26 +02:00
f0a5412037 Merge branch '11.0' into 11.1 2024-05-13 09:52:30 +02:00
f9807aadef Merge branch '10.11' into 11.0 2024-05-12 12:18:28 +02:00
018d537ec1 Merge branch '10.6' into 10.11 2024-04-22 15:23:10 +02:00
bb2e125d07 Merge 10.5 into 10.6
This excludes commit 040069f4ba
because it is specific to innodb_sync_debug, which had been removed
in commit ff5d306e29.
2024-04-18 07:14:56 +03:00
061adae9a2 MDEV-16944 Fix file sharing issues on Windows in mysqltest
On Windows systems, occurrences of ERROR_SHARING_VIOLATION due to
conflicting share modes between processes accessing the same file can
result in CreateFile failures.

mysys' my_open() already incorporates a workaround by implementing
wait/retry logic on Windows.

But this does not help if files are opened using shell redirection like
mysqltest traditionally did it, i.e via

--echo exec "some text" > output_file

In such cases, it is cmd.exe, that opens the output_file, and it
won't do any sharing-violation retries.

This commit addresses the issue by introducing a new built-in command,
'write_line', in mysqltest. This new command serves as a brief alternative
to 'write_file', with a single line output, that also resolves variables
like "exec" would.

Internally, this command will use my_open(), and therefore retry-on-error
logic.

Hopefully this will eliminate the very sporadic "can't open file because
it is used by another process" error on CI.
2024-04-17 16:52:37 +02:00
cd28b2479c Merge branch '11.1' into 11.2 2024-04-09 12:12:33 +02:00
683fbced6b Merge 11.0 into 11.1 2024-03-28 12:15:36 +02:00
fec2fd6add Merge 10.11 into 11.0 2024-03-28 10:51:36 +02:00
788953463d Merge 10.6 into 10.11
Some fixes related to commit f838b2d799 and
Rows_log_event::do_apply_event() and Update_rows_log_event::do_exec_row()
for system-versioned tables were provided by Nikita Malyavin.
This was required by test versioning.rpl,trx_id,row.
2024-03-28 09:16:57 +02:00
f71d7f2f0f Merge branch '10.5' into 10.6 2024-03-13 21:02:34 +01:00
f703e72bd8 Merge 10.4 into 10.5 2024-03-11 10:08:20 +02:00
8532dd82f1 MDEV-13765 encryption.encrypt_and_grep failed in buildbot with wrong result
- Adjust the test case to check whether all tablespaces
are encrypted by comparing it with existing table count.
2024-03-06 11:57:09 +05:30
d73baa402a Merge 10.11 into 11.0 2024-02-20 12:02:01 +02:00
86c2c89743 Merge 10.6 into 10.11 2024-02-08 15:04:46 +02:00
77b4399545 MDEV-33421 innodb.corrupted_during_recovery fails due to error that the table is corrupted
This fixes up the merge commit 7e39470e33

dict_table_open_on_name(): Report ER_TABLE_CORRUPT in a consistent
fashion, with a pretty-printed table name.
2024-02-08 14:20:42 +02:00
466069b184 Merge 10.5 into 10.6 2024-02-08 10:38:53 +02:00
5e7047067e MDEV-33274 The test encryption.innodb-redo-nokeys often fails
If we fail to open a tablespace while looking for FILE_CHECKPOINT, we
set the corruption flag. Specifically, if encryption key is missing, we
would not be able to open an encrypted tablespace and the flag could be
set. We miss checking for this flag and report "Missing FILE_CHECKPOINT"

Address review comment to improve the test. Flush pages before starting
no-checkpoint block. It should improve the number of cases where the
test is skipped because some intermediate checkpoint is triggered.
2024-02-08 08:13:16 +05:30
193b22d822 Merge 11.2 into 11.3 2024-01-05 14:20:35 +02:00
f6d21a8855 Merge 11.1 into 11.2 2024-01-05 13:06:56 +02:00
50799752dc Merge 11.0 into 11.1 2023-12-21 14:39:29 +02:00
d8b8adce49 Merge 10.11 into 11.0 2023-12-21 14:38:53 +02:00
af69506de4 Merge fixup encryption.corrupted_during_recovery
Correctly merge 1ac03fd914
(superceding a52cd4aeda).

Fixes up the merge commit fd0b47f9d6
2023-12-21 11:55:11 +02:00
7f0094aac8 Merge branch '11.2' into 11.3 2023-12-21 02:14:59 +01:00
fef31a26f3 Merge branch '11.1' into 11.2 2023-12-20 23:43:05 +01:00
d470ed6857 Merge 11.0 into 11.1 2023-12-20 16:11:45 +02:00
590036b021 Merge 10.11 into 11.0 2023-12-20 16:05:20 +02:00
2b99e5f7ef Merge 10.6 into 10.11 2023-12-20 15:58:36 +02:00
2b01e5103d Merge 10.5 into 10.6 2023-12-19 18:41:42 +02:00
4ae105a37d Merge 10.4 into 10.5 2023-12-18 08:59:07 +02:00
7e34bb5ce1 MDEV-11905: Simplify encryption.innodb_encrypt_discard_import
The test was populating unnecessarily large tables and
restarting the server several times for no real reason.

Let us hope that a smaller version of the test will produce more
stable results. Occasionally, some unencrypted contents in the table t2
was revealed in the old test.
2023-12-11 10:31:49 +02:00