summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--storage/innobase/trx/trx0sys.cc14
1 files changed, 5 insertions, 9 deletions
diff --git a/storage/innobase/trx/trx0sys.cc b/storage/innobase/trx/trx0sys.cc
index 2479e5a4cc1..66b535c7188 100644
--- a/storage/innobase/trx/trx0sys.cc
+++ b/storage/innobase/trx/trx0sys.cc
@@ -196,9 +196,8 @@ size_t trx_sys_t::history_size()
{
rseg.latch.rd_lock(SRW_LOCK_CALL);
size+= rseg.history_size;
- }
- for (auto &rseg : rseg_array)
rseg.latch.rd_unlock();
+ }
return size;
}
@@ -207,20 +206,17 @@ bool trx_sys_t::history_exceeds(size_t threshold)
ut_ad(is_initialised());
size_t size= 0;
bool exceeds= false;
- size_t i;
- for (i= 0; i < array_elements(rseg_array); i++)
+ for (auto &rseg : rseg_array)
{
- rseg_array[i].latch.rd_lock(SRW_LOCK_CALL);
- size+= rseg_array[i].history_size;
+ rseg.latch.rd_lock(SRW_LOCK_CALL);
+ size+= rseg.history_size;
+ rseg.latch.rd_unlock();
if (size > threshold)
{
exceeds= true;
- i++;
break;
}
}
- while (i)
- rseg_array[--i].latch.rd_unlock();
return exceeds;
}