-
-
Notifications
You must be signed in to change notification settings - Fork 2k
MDEV-38079: Crash Recovery Fails After ALTER TABLE…PAGE_COMPRESSED=1 #4586
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
base: 10.6
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -268,6 +268,8 @@ struct recv_sys_t | |
| /** set when an inconsistency with the file system contents is detected | ||
| during log scan or apply */ | ||
| bool found_corrupt_fs; | ||
| /** Last applied LSN for space->flags updates (used to prevent stale updates) */ | ||
| std::map<uint32_t, lsn_t> space_flags_lsn; | ||
|
Comment on lines
+271
to
+272
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This could significantly increase the memory footprint. Do we really need an ordered map? We already store similar information in Could we slightly repurpose If the information is being read before a |
||
| public: | ||
| /** whether we are applying redo log records during crash recovery. | ||
| This is protected by recv_sys.mutex */ | ||
|
|
@@ -351,6 +353,8 @@ struct recv_sys_t | |
| if (pages_it != pages.end() && pages_it->first.space() == space_id) | ||
| pages_it= pages.end(); | ||
| } | ||
| /** Update space->flags only if lsn >= last recorded space-flags LSN */ | ||
| void update_space_flags(fil_space_t *space, uint32_t flags, lsn_t lsn); | ||
|
Comment on lines
+356
to
+357
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Which LSN? This comment should also somehow refer to |
||
|
|
||
| private: | ||
| /** Attempt to initialize a page based on redo log records. | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1093,6 +1093,17 @@ class mlog_init_t | |
|
|
||
| static mlog_init_t mlog_init; | ||
|
|
||
| /** Update space->flags only if lsn >= last recorded space-flags LSN */ | ||
| void recv_sys_t::update_space_flags(fil_space_t *space, uint32_t flags, lsn_t lsn) | ||
| { | ||
| auto it= space_flags_lsn.find(space->id); | ||
| if (it == space_flags_lsn.end() || lsn >= it->second) | ||
| { | ||
| space->flags= flags; | ||
| space_flags_lsn[space->id]= lsn; | ||
| } | ||
|
Comment on lines
+1099
to
+1104
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why not We are missing |
||
| } | ||
|
|
||
| /** Try to recover a tablespace that was not readable earlier | ||
| @param p iterator to the page | ||
| @param name tablespace file name | ||
|
|
@@ -1334,7 +1345,7 @@ static void fil_name_process(const char *name, ulint len, uint32_t space_id, | |
| if (f.size | ||
| || f.flags != f.initial_flags) { | ||
| fil_space_set_recv_size_and_flags( | ||
| space->id, f.size, f.flags); | ||
| space->id, f.size, f.flags, lsn); | ||
| } | ||
|
Comment on lines
1345
to
1349
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is passing the start LSN of the mini-transaction of a |
||
|
|
||
| f.space = space; | ||
|
|
@@ -2723,7 +2734,7 @@ bool recv_sys_t::parse(lsn_t checkpoint_lsn, store_t *store, bool apply) | |
| if (has_flags) | ||
| it->second.flags= flags; | ||
| } | ||
| fil_space_set_recv_size_and_flags(space_id, size, flags); | ||
| fil_space_set_recv_size_and_flags(space_id, size, flags, start_lsn); | ||
| } | ||
| } | ||
| last_offset+= rlen; | ||
|
|
@@ -3081,9 +3092,10 @@ static buf_block_t *recv_recover_page(buf_block_t *block, mtr_t &mtr, | |
| : fil_space_t::get(block->page.id().space())) { | ||
| switch (a) { | ||
| case log_phys_t::APPLIED_TO_FSP_HEADER: | ||
| s->flags = mach_read_from_4( | ||
| FSP_HEADER_OFFSET | ||
| + FSP_SPACE_FLAGS + frame); | ||
| recv_sys.update_space_flags( | ||
| s, mach_read_from_4(FSP_HEADER_OFFSET + | ||
| FSP_SPACE_FLAGS + frame), | ||
| l->start_lsn); | ||
|
Comment on lines
3094
to
+3098
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could this code be moved to |
||
| s->size_in_header = mach_read_from_4( | ||
| FSP_HEADER_OFFSET + FSP_SIZE | ||
| + frame); | ||
|
|
||
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.
The
@param lsncomment is not adding any value. Which specific LSN does it refer to? Also thesizeandflagscould be described more accurately. Let us use spaces instead of TAB also in the comment:This comment would also answer the question what would happen or how we would identify the situation when a mini-transaction is modifying only one of
FSP_SIZEorFSP_SPACE_FLAGS.