Skip to content

Commit cb6b5e2

Browse files
committed
MDEV-39344: fetch_data_into_cache() clears "is_truncated"
There is a memory limit implemented for the INFORMATION_SCHEMA tables innodb_trx, innodb_locks, innodb_lock_waits. The predicate trx_i_s_cache_is_truncated() would never hold in trx_i_s_common_fill_table() due to a logic bug that had been introduced in a refactoring. fetch_data_into_cache(): Shrink the critical section of lock_sys.latch and do not unconditionally reset cache->is_truncated when leaving the function. This fixes a correctness regression that had been introduced back in 2007 by commit 5cbf4e3 for the InnoDB Plugin for MySQL 5.1, which later became the built-in InnoDB in MySQL 5.5 and MariaDB Server 5.5.
1 parent 6bc94e0 commit cb6b5e2

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

storage/innobase/trx/trx0i_s.cc

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1045,8 +1045,11 @@ static void fetch_data_into_cache_low(trx_i_s_cache_t *cache, const trx_t *trx)
10451045

10461046
static void fetch_data_into_cache(trx_i_s_cache_t *cache)
10471047
{
1048-
LockMutexGuard g{SRW_LOCK_CALL};
1048+
/* these are protected by cache->rw_lock.wr_lock() */
10491049
trx_i_s_cache_clear(cache);
1050+
/* this flag may be set by fetch_data_into_cache_low() below */
1051+
cache->is_truncated= false;
1052+
LockMutexGuard g{SRW_LOCK_CALL};
10501053

10511054
/* Capture the state of transactions */
10521055
trx_sys.trx_list.for_each([cache](trx_t &trx) {
@@ -1059,7 +1062,6 @@ static void fetch_data_into_cache(trx_i_s_cache_t *cache)
10591062
trx.mutex_unlock();
10601063
}
10611064
});
1062-
cache->is_truncated= false;
10631065
}
10641066

10651067

0 commit comments

Comments
 (0)