summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2022-06-16 11:15:21 +0300
committerMarko Mäkelä <marko.makela@mariadb.com>2022-06-16 11:15:21 +0300
commitcb19e211ec7ba1501e4f0e55da5c7dc3933ee0ec (patch)
tree7849c5f74f96e21f3a6bbdc701b88dab3215263e
parent4c0cd953abffea841271f3a5cce1712d5e6c5633 (diff)
parenta8c22dae8b4ef478ede71ac9ea9978ab43d8951a (diff)
downloadmariadb-git-cb19e211ec7ba1501e4f0e55da5c7dc3933ee0ec.tar.gz
Merge 10.7 into 10.8
-rw-r--r--extra/mariabackup/xtrabackup.cc26
-rw-r--r--storage/innobase/buf/buf0buf.cc11
-rw-r--r--storage/innobase/buf/buf0lru.cc8
-rw-r--r--storage/innobase/handler/handler0alter.cc2
-rw-r--r--storage/innobase/include/buf0buf.h2
-rw-r--r--storage/innobase/include/buf0types.h6
6 files changed, 38 insertions, 17 deletions
diff --git a/extra/mariabackup/xtrabackup.cc b/extra/mariabackup/xtrabackup.cc
index f48eeaa3bf9..a5fca55355a 100644
--- a/extra/mariabackup/xtrabackup.cc
+++ b/extra/mariabackup/xtrabackup.cc
@@ -4692,23 +4692,27 @@ fail:
log_sys.create();
/* get current checkpoint_lsn */
+ {
+ mysql_mutex_lock(&recv_sys.mutex);
- mysql_mutex_lock(&recv_sys.mutex);
+ dberr_t err = recv_sys.find_checkpoint();
- if (recv_sys.find_checkpoint() != DB_SUCCESS) {
- msg("Error: cannot read redo log header");
-unlock_and_fail:
+ if (err != DB_SUCCESS) {
+ msg("Error: cannot read redo log header");
+ } else if (!log_sys.is_latest()) {
+ msg("Error: cannot process redo log before "
+ "MariaDB 10.8");
+ err = DB_ERROR;
+ } else {
+ recv_needed_recovery = true;
+ }
mysql_mutex_unlock(&recv_sys.mutex);
- }
- if (!log_sys.is_latest()) {
- msg("Error: cannot process redo log before MariaDB 10.8");
- goto unlock_and_fail;
+ if (err != DB_SUCCESS) {
+ goto fail;
+ }
}
- recv_needed_recovery = true;
- mysql_mutex_unlock(&recv_sys.mutex);
-
/* create extra LSN dir if it does not exist. */
if (xtrabackup_extra_lsndir
&&!my_stat(xtrabackup_extra_lsndir,&stat_info,MYF(0))
diff --git a/storage/innobase/buf/buf0buf.cc b/storage/innobase/buf/buf0buf.cc
index 1ee5aabdc94..b8c1de88db3 100644
--- a/storage/innobase/buf/buf0buf.cc
+++ b/storage/innobase/buf/buf0buf.cc
@@ -2861,7 +2861,9 @@ ibuf_merge_corrupted:
*err = e;
}
- buf_pool.corrupted_evict(&block->page, state);
+ if (block->page.id().is_corrupted()) {
+ buf_pool.corrupted_evict(&block->page, state);
+ }
return nullptr;
}
@@ -3199,6 +3201,7 @@ static buf_block_t *buf_page_create_low(page_id_t page_id, ulint zip_size,
free_block->initialise(page_id, zip_size, buf_page_t::MEMORY);
buf_pool_t::hash_chain &chain= buf_pool.page_hash.cell_get(page_id.fold());
+retry:
mysql_mutex_lock(&buf_pool.mutex);
buf_page_t *bpage= buf_pool.page_hash.get(page_id, chain);
@@ -3217,6 +3220,12 @@ static buf_block_t *buf_page_create_low(page_id_t page_id, ulint zip_size,
{
mysql_mutex_unlock(&buf_pool.mutex);
bpage->lock.x_lock();
+ const page_id_t id{bpage->id()};
+ if (UNIV_UNLIKELY(id != page_id))
+ {
+ ut_ad(id.is_corrupted());
+ goto retry;
+ }
mysql_mutex_lock(&buf_pool.mutex);
}
diff --git a/storage/innobase/buf/buf0lru.cc b/storage/innobase/buf/buf0lru.cc
index eedeb5076fc..33264bc88a1 100644
--- a/storage/innobase/buf/buf0lru.cc
+++ b/storage/innobase/buf/buf0lru.cc
@@ -1216,14 +1216,14 @@ void buf_pool_t::corrupted_evict(buf_page_t *bpage, uint32_t state)
ut_ad(!bpage->oldest_modification());
bpage->set_corrupt_id();
- auto unfix= state - buf_page_t::UNFIXED;
+ auto unfix= state - buf_page_t::FREED;
auto s= bpage->zip.fix.fetch_sub(unfix) - unfix;
bpage->lock.x_unlock(true);
- while (s != buf_page_t::UNFIXED)
+ while (s != buf_page_t::FREED || bpage->lock.is_locked_or_waiting())
{
- ut_ad(s > buf_page_t::UNFIXED);
- ut_ad(s < buf_page_t::READ_FIX);
+ ut_ad(s >= buf_page_t::FREED);
+ ut_ad(s < buf_page_t::UNFIXED);
/* Wait for other threads to release the fix count
before releasing the bpage from LRU list. */
(void) LF_BACKOFF();
diff --git a/storage/innobase/handler/handler0alter.cc b/storage/innobase/handler/handler0alter.cc
index ff38cf9ea7b..d794506dc15 100644
--- a/storage/innobase/handler/handler0alter.cc
+++ b/storage/innobase/handler/handler0alter.cc
@@ -7629,6 +7629,7 @@ ha_innobase::prepare_inplace_alter_table(
if (!(ha_alter_info->handler_flags & ~INNOBASE_INPLACE_IGNORE)) {
/* Nothing to do */
DBUG_ASSERT(!m_prebuilt->trx->dict_operation_lock_mode);
+ m_prebuilt->trx_id = 0;
DBUG_RETURN(false);
}
@@ -10442,6 +10443,7 @@ handle_error:
sql_print_error("InnoDB: %s: %s\n", op,
ut_strerr(error));
DBUG_ASSERT(error == DB_IO_ERROR
+ || error == DB_LOCK_TABLE_FULL
|| error == DB_DECRYPTION_FAILED
|| error == DB_PAGE_CORRUPTED
|| error == DB_CORRUPTION);
diff --git a/storage/innobase/include/buf0buf.h b/storage/innobase/include/buf0buf.h
index 0a2e677e483..24a092ed5b5 100644
--- a/storage/innobase/include/buf0buf.h
+++ b/storage/innobase/include/buf0buf.h
@@ -2020,7 +2020,7 @@ inline void buf_page_t::set_corrupt_id()
is_write_locked());
}
#endif
- id_= page_id_t(~0ULL);
+ id_.set_corrupted();
}
/** Set oldest_modification when adding to buf_pool.flush_list */
diff --git a/storage/innobase/include/buf0types.h b/storage/innobase/include/buf0types.h
index bad3fd79571..6c13f5ee308 100644
--- a/storage/innobase/include/buf0types.h
+++ b/storage/innobase/include/buf0types.h
@@ -148,6 +148,12 @@ public:
constexpr ulonglong raw() const { return m_id; }
+ /** Flag the page identifier as corrupted. */
+ void set_corrupted() { m_id= ~0ULL; }
+
+ /** @return whether the page identifier belongs to a corrupted page */
+ constexpr bool is_corrupted() const { return m_id == ~0ULL; }
+
private:
/** The page identifier */
uint64_t m_id;