summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--storage/innobase/include/fil0fil.h2
-rw-r--r--storage/innobase/include/mtr0mtr.h12
-rw-r--r--storage/innobase/mtr/mtr0mtr.cc5
3 files changed, 7 insertions, 12 deletions
diff --git a/storage/innobase/include/fil0fil.h b/storage/innobase/include/fil0fil.h
index 119880a2041..e860ceb5084 100644
--- a/storage/innobase/include/fil0fil.h
+++ b/storage/innobase/include/fil0fil.h
@@ -234,6 +234,8 @@ new_range:
add_range(new_range);
}
+ void clear() { ranges.clear(); }
+
bool empty() const { return ranges.empty(); }
typename range_set_t<T>::iterator begin() { return ranges.begin(); }
diff --git a/storage/innobase/include/mtr0mtr.h b/storage/innobase/include/mtr0mtr.h
index bdb626eafbd..14bb64a87b4 100644
--- a/storage/innobase/include/mtr0mtr.h
+++ b/storage/innobase/include/mtr0mtr.h
@@ -583,20 +583,14 @@ public:
/** Add freed page numbers to freed_pages */
void add_freed_offset(page_id_t id)
{
- if (!m_freed_ranges)
- m_freed_ranges= new range_set<uint32_t>();
-
ut_ad(m_user_space == NULL || id.space() == m_user_space->id);
- m_freed_ranges->add_value(id.page_no());
+ m_freed_ranges.add_value(id.page_no());
}
/** Clear the freed pages */
void clear_freed_ranges()
{
- if (!m_freed_ranges)
- return;
- delete m_freed_ranges;
- m_freed_ranges= nullptr;
+ m_freed_ranges.clear();
}
private:
/** Log a write of a byte string to a page.
@@ -690,7 +684,7 @@ private:
lsn_t m_commit_lsn;
/** set of freed page ids */
- range_set<uint32_t> *m_freed_ranges;
+ range_set<uint32_t> m_freed_ranges;
};
#include "mtr0mtr.ic"
diff --git a/storage/innobase/mtr/mtr0mtr.cc b/storage/innobase/mtr/mtr0mtr.cc
index ffac1670255..8649aca2c65 100644
--- a/storage/innobase/mtr/mtr0mtr.cc
+++ b/storage/innobase/mtr/mtr0mtr.cc
@@ -372,7 +372,6 @@ void mtr_t::start()
ut_d(m_user_space_id= TRX_SYS_SPACE);
m_user_space= nullptr;
m_commit_lsn= 0;
- m_freed_ranges= nullptr;
}
/** Release the resources */
@@ -415,7 +414,7 @@ void mtr_t::commit()
log_mutex_exit();
fil_space_t *freed_space= m_user_space;
- if (m_freed_ranges != nullptr)
+ if (!m_freed_ranges.empty())
{
/* Get the freed tablespace in case of predefined tablespace */
if (freed_space == NULL)
@@ -429,7 +428,7 @@ void mtr_t::commit()
ut_ad(mtr_memo_contains(this, &freed_space->latch,
MTR_MEMO_X_LOCK));
- for (const auto& range : *m_freed_ranges)
+ for (const auto& range : m_freed_ranges)
freed_space->free_range(range);
}