-
Jakub Łopuszański authored
Buffer pool may remove a page from memory, and even free the memory in which it resided unless it is marked as "buffer fixed". To be more precise: buf_block_t struct itself can become freed if the buffer pool is requested to shrink. Serveral places in our code dereferenced a buf_block_t pointer either after unfixing it, or before fixing it, which was not safe. This patch: - moves the accesses that happened after unfixing, to happen before - makes sure that places which store buf_block_t pointer as hint for future reference are structured in a way which prevents races with buffer pool resize. That is it introduces Block_hint class which stores a pointer, and allows accessing this pointer only by passing a functor which is run passing either the original pointer if it was still valid, or a nullptr if the pointer become stale in meantime - adds more assertions about buf_block_t's page is buffer fixed when accessed This patch also fixes Bug #31389823 BUF_BLOCK_IS_UNCOMPRESSED() RETURNS FALSE IN TOO MANY CASES, by simply removing this function and using buf_pointer_is_block_field_instance instead. It also backports important parts of Bug#20735882 REMOVE REDUNDANCY IN mtr0mtr.cc RELATED TO RELEASING MEMO SLOT fix from 8.0 RB: 24661 Reviewed-by:
Marcin Babij <marcin.babij@oracle.com> Reviewed-by:
Yasufumi Kinoshita <yasufumi.kinoshita@oracle.com>
Jakub Łopuszański authoredBuffer pool may remove a page from memory, and even free the memory in which it resided unless it is marked as "buffer fixed". To be more precise: buf_block_t struct itself can become freed if the buffer pool is requested to shrink. Serveral places in our code dereferenced a buf_block_t pointer either after unfixing it, or before fixing it, which was not safe. This patch: - moves the accesses that happened after unfixing, to happen before - makes sure that places which store buf_block_t pointer as hint for future reference are structured in a way which prevents races with buffer pool resize. That is it introduces Block_hint class which stores a pointer, and allows accessing this pointer only by passing a functor which is run passing either the original pointer if it was still valid, or a nullptr if the pointer become stale in meantime - adds more assertions about buf_block_t's page is buffer fixed when accessed This patch also fixes Bug #31389823 BUF_BLOCK_IS_UNCOMPRESSED() RETURNS FALSE IN TOO MANY CASES, by simply removing this function and using buf_pointer_is_block_field_instance instead. It also backports important parts of Bug#20735882 REMOVE REDUNDANCY IN mtr0mtr.cc RELATED TO RELEASING MEMO SLOT fix from 8.0 RB: 24661 Reviewed-by:
Marcin Babij <marcin.babij@oracle.com> Reviewed-by:
Yasufumi Kinoshita <yasufumi.kinoshita@oracle.com>
Loading