Commit 3c305d3f authored by Marko Mäkelä's avatar Marko Mäkelä

MDEV-15528: Introduce MLOG_INIT_FREE_PAGE

This is only a placeholder that allows an implementation later
during the development of MariaDB, so that downgrade to an earlier
version (with this code) will be possible.
We want to be able to zero out freed pages to reduce write amplification,
and to scrub old data. Zeroing out the pages is optional, not mandatory
for correctness. After all, the MLOG_INIT_FREE_PAGE record can only be
emitted for pages that are marked free in the allocation bitmap page.
parent ea25bdc1
...@@ -231,8 +231,11 @@ enum mlog_id_t { ...@@ -231,8 +231,11 @@ enum mlog_id_t {
/** initialize a page with a string of identical bytes */ /** initialize a page with a string of identical bytes */
MLOG_MEMSET = 63, MLOG_MEMSET = 63,
/** Zero-fill a page that is not allocated. */
MLOG_INIT_FREE_PAGE = 64,
/** biggest value (used in assertions) */ /** biggest value (used in assertions) */
MLOG_BIGGEST_TYPE = MLOG_MEMSET, MLOG_BIGGEST_TYPE = MLOG_INIT_FREE_PAGE,
/** log record for writing/updating crypt data of /** log record for writing/updating crypt data of
a tablespace */ a tablespace */
......
...@@ -1522,6 +1522,11 @@ recv_parse_or_apply_log_rec_body( ...@@ -1522,6 +1522,11 @@ recv_parse_or_apply_log_rec_body(
/* Allow anything in page_type when creating a page. */ /* Allow anything in page_type when creating a page. */
ptr = fsp_parse_init_file_page(ptr, end_ptr, block); ptr = fsp_parse_init_file_page(ptr, end_ptr, block);
break; break;
case MLOG_INIT_FREE_PAGE:
/* The page can be zero-filled and its previous
contents can be ignored. We do not write or apply
this record yet. */
break;
case MLOG_WRITE_STRING: case MLOG_WRITE_STRING:
ptr = mlog_parse_string(ptr, end_ptr, page, page_zip); ptr = mlog_parse_string(ptr, end_ptr, page, page_zip);
break; break;
...@@ -3861,6 +3866,9 @@ static const char* get_mlog_string(mlog_id_t type) ...@@ -3861,6 +3866,9 @@ static const char* get_mlog_string(mlog_id_t type)
case MLOG_MEMSET: case MLOG_MEMSET:
return("MLOG_MEMSET"); return("MLOG_MEMSET");
case MLOG_INIT_FREE_PAGE:
return("MLOG_INIT_FREE_PAGE");
case MLOG_FILE_WRITE_CRYPT_DATA: case MLOG_FILE_WRITE_CRYPT_DATA:
return("MLOG_FILE_WRITE_CRYPT_DATA"); return("MLOG_FILE_WRITE_CRYPT_DATA");
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment