Skip to content
Permalink
Browse files
MDEV-21174: Optimize page_set_autoinc()
page_set_autoinc(): Check if any change would take place,
and omit the mtr_t::OPT parameter. This should avoid
unnecessarily redo log writes for ROW_FORMAT=COMPRESSED pages.
  • Loading branch information
dr-m committed Jan 8, 2020
1 parent a0eefdf commit c4de197
Showing 1 changed file with 4 additions and 3 deletions.
@@ -2,7 +2,7 @@
Copyright (c) 1994, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2012, Facebook Inc.
Copyright (c) 2017, 2019, MariaDB Corporation.
Copyright (c) 2017, 2020, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -231,15 +231,16 @@ page_set_autoinc(
MTR_MEMO_PAGE_SX_FIX));

byte *field= PAGE_HEADER + PAGE_ROOT_AUTO_INC + block->frame;
if (!reset && mach_read_from_8(field) >= autoinc)
ib_uint64_t old= mach_read_from_8(field);
if (old == autoinc || (old > autoinc && !reset))
/* nothing to update */;
else if (page_zip_des_t* page_zip = buf_block_get_page_zip(block))
{
mach_write_to_8(field, autoinc);
page_zip_write_header(page_zip, field, 8, mtr);
}
else
mtr->write<8,mtr_t::OPT>(*block, field, autoinc);
mtr->write<8>(*block, field, autoinc);
}

/** The page infimum and supremum of an empty page in ROW_FORMAT=REDUNDANT */

0 comments on commit c4de197

Please sign in to comment.