MDEV-30479 optimization: Invoke recv_sys_t::trim() earlier
recv_sys_t::parse(): Discard old page-level redo log when parsing a TRIM_PAGES record. recv_sys_t::apply(): trim() was invoked in parse() already. recv_sys_t::truncated_undo_spaces[]: Only store the size, no LSN.
This commit is contained in:
parent
461402a564
commit
acd23da4c2
@ -266,15 +266,9 @@ private:
|
|||||||
@param lsn log sequence number of the shrink operation */
|
@param lsn log sequence number of the shrink operation */
|
||||||
inline void trim(const page_id_t page_id, lsn_t lsn);
|
inline void trim(const page_id_t page_id, lsn_t lsn);
|
||||||
|
|
||||||
/** Undo tablespaces for which truncate has been logged
|
/** Truncated undo tablespace size for which truncate has been logged
|
||||||
(indexed by page_id_t::space() - srv_undo_space_id_start) */
|
(indexed by page_id_t::space() - srv_undo_space_id_start), or 0 */
|
||||||
struct trunc
|
unsigned truncated_undo_spaces[127];
|
||||||
{
|
|
||||||
/** log sequence number of FILE_CREATE, or 0 if none */
|
|
||||||
lsn_t lsn;
|
|
||||||
/** truncated size of the tablespace, or 0 if not truncated */
|
|
||||||
unsigned pages;
|
|
||||||
} truncated_undo_spaces[127];
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/** The contents of the doublewrite buffer */
|
/** The contents of the doublewrite buffer */
|
||||||
|
@ -1949,8 +1949,10 @@ same_page:
|
|||||||
goto record_corrupted;
|
goto record_corrupted;
|
||||||
static_assert(UT_ARR_SIZE(truncated_undo_spaces) ==
|
static_assert(UT_ARR_SIZE(truncated_undo_spaces) ==
|
||||||
TRX_SYS_MAX_UNDO_SPACES, "compatibility");
|
TRX_SYS_MAX_UNDO_SPACES, "compatibility");
|
||||||
truncated_undo_spaces[space_id - srv_undo_space_id_start]=
|
/* The entire undo tablespace will be reinitialized by
|
||||||
{ recovered_lsn, page_no };
|
innodb_undo_log_truncate=ON. Discard old log for all pages. */
|
||||||
|
trim({space_id, 0}, recovered_lsn);
|
||||||
|
truncated_undo_spaces[space_id - srv_undo_space_id_start]= page_no;
|
||||||
if (undo_space_trunc)
|
if (undo_space_trunc)
|
||||||
undo_space_trunc(space_id);
|
undo_space_trunc(space_id);
|
||||||
#endif
|
#endif
|
||||||
@ -2675,17 +2677,15 @@ void recv_sys_t::apply(bool last_batch)
|
|||||||
|
|
||||||
for (auto id= srv_undo_tablespaces_open; id--;)
|
for (auto id= srv_undo_tablespaces_open; id--;)
|
||||||
{
|
{
|
||||||
const trunc& t= truncated_undo_spaces[id];
|
if (unsigned pages= truncated_undo_spaces[id])
|
||||||
if (t.lsn)
|
|
||||||
{
|
{
|
||||||
trim(page_id_t(id + srv_undo_space_id_start, 0), t.lsn);
|
if (fil_space_t *space= fil_space_get(id + srv_undo_space_id_start))
|
||||||
if (fil_space_t *space = fil_space_get(id + srv_undo_space_id_start))
|
|
||||||
{
|
{
|
||||||
ut_ad(UT_LIST_GET_LEN(space->chain) == 1);
|
ut_ad(UT_LIST_GET_LEN(space->chain) == 1);
|
||||||
fil_node_t *file= UT_LIST_GET_FIRST(space->chain);
|
fil_node_t *file= UT_LIST_GET_FIRST(space->chain);
|
||||||
ut_ad(file->is_open());
|
ut_ad(file->is_open());
|
||||||
os_file_truncate(file->name, file->handle,
|
os_file_truncate(file->name, file->handle,
|
||||||
os_offset_t{t.pages} << srv_page_size_shift, true);
|
os_offset_t{pages} << srv_page_size_shift, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user