Skip to content

Commit 70a0500

Browse files
committed
Remove some InnoDB purge definitions from trx0types.h.
1 parent 7a30d86 commit 70a0500

File tree

2 files changed

+129
-132
lines changed

2 files changed

+129
-132
lines changed

storage/innobase/include/trx0purge.h

Lines changed: 129 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,135 @@ purge_state_t
113113
trx_purge_state(void);
114114
/*=================*/
115115

116-
// Forward declaration
117-
struct TrxUndoRsegsIterator;
116+
/** Rollback segements from a given transaction with trx-no
117+
scheduled for purge. */
118+
class TrxUndoRsegs {
119+
private:
120+
typedef std::vector<trx_rseg_t*, ut_allocator<trx_rseg_t*> >
121+
trx_rsegs_t;
122+
public:
123+
typedef trx_rsegs_t::iterator iterator;
124+
125+
/** Default constructor */
126+
TrxUndoRsegs() : m_trx_no() { }
127+
128+
explicit TrxUndoRsegs(trx_id_t trx_no)
129+
:
130+
m_trx_no(trx_no)
131+
{
132+
// Do nothing
133+
}
134+
135+
/** Get transaction number
136+
@return trx_id_t - get transaction number. */
137+
trx_id_t get_trx_no() const
138+
{
139+
return(m_trx_no);
140+
}
141+
142+
/** Add rollback segment.
143+
@param rseg rollback segment to add. */
144+
void push_back(trx_rseg_t* rseg)
145+
{
146+
m_rsegs.push_back(rseg);
147+
}
148+
149+
/** Erase the element pointed by given iterator.
150+
@param[in] iterator iterator */
151+
void erase(iterator& it)
152+
{
153+
m_rsegs.erase(it);
154+
}
155+
156+
/** Number of registered rsegs.
157+
@return size of rseg list. */
158+
ulint size() const
159+
{
160+
return(m_rsegs.size());
161+
}
162+
163+
/**
164+
@return an iterator to the first element */
165+
iterator begin()
166+
{
167+
return(m_rsegs.begin());
168+
}
169+
170+
/**
171+
@return an iterator to the end */
172+
iterator end()
173+
{
174+
return(m_rsegs.end());
175+
}
176+
177+
/** Append rollback segments from referred instance to current
178+
instance. */
179+
void append(const TrxUndoRsegs& append_from)
180+
{
181+
ut_ad(get_trx_no() == append_from.get_trx_no());
182+
183+
m_rsegs.insert(m_rsegs.end(),
184+
append_from.m_rsegs.begin(),
185+
append_from.m_rsegs.end());
186+
}
187+
188+
/** Compare two TrxUndoRsegs based on trx_no.
189+
@param elem1 first element to compare
190+
@param elem2 second element to compare
191+
@return true if elem1 > elem2 else false.*/
192+
bool operator()(const TrxUndoRsegs& lhs, const TrxUndoRsegs& rhs)
193+
{
194+
return(lhs.m_trx_no > rhs.m_trx_no);
195+
}
196+
197+
/** Compiler defined copy-constructor/assignment operator
198+
should be fine given that there is no reference to a memory
199+
object outside scope of class object.*/
200+
201+
private:
202+
/** The rollback segments transaction number. */
203+
trx_id_t m_trx_no;
204+
205+
/** Rollback segments of a transaction, scheduled for purge. */
206+
trx_rsegs_t m_rsegs;
207+
};
208+
209+
typedef std::priority_queue<
210+
TrxUndoRsegs,
211+
std::vector<TrxUndoRsegs, ut_allocator<TrxUndoRsegs> >,
212+
TrxUndoRsegs> purge_pq_t;
213+
214+
/**
215+
Chooses the rollback segment with the smallest trx_no. */
216+
struct TrxUndoRsegsIterator {
217+
218+
/** Constructor */
219+
TrxUndoRsegsIterator(trx_purge_t* purge_sys);
220+
221+
/** Sets the next rseg to purge in m_purge_sys.
222+
@return page size of the table for which the log is.
223+
NOTE: if rseg is NULL when this function returns this means that
224+
there are no rollback segments to purge and then the returned page
225+
size object should not be used. */
226+
const page_size_t set_next();
227+
228+
private:
229+
// Disable copying
230+
TrxUndoRsegsIterator(const TrxUndoRsegsIterator&);
231+
TrxUndoRsegsIterator& operator=(const TrxUndoRsegsIterator&);
232+
233+
/** The purge system pointer */
234+
trx_purge_t* m_purge_sys;
235+
236+
/** The current element to process */
237+
TrxUndoRsegs m_trx_undo_rsegs;
238+
239+
/** Track the current element in m_trx_undo_rseg */
240+
TrxUndoRsegs::iterator m_iter;
241+
242+
/** Sentinel value */
243+
static const TrxUndoRsegs NullElement;
244+
};
118245

119246
/** This is the purge pointer/iterator. We need both the undo no and the
120247
transaction no up to which purge has parsed and applied the records. */
@@ -467,38 +594,6 @@ struct trx_purge_rec_t {
467594
roll_ptr_t roll_ptr; /*!< File pointr to UNDO record */
468595
};
469596

470-
/**
471-
Chooses the rollback segment with the smallest trx_no. */
472-
struct TrxUndoRsegsIterator {
473-
474-
/** Constructor */
475-
TrxUndoRsegsIterator(trx_purge_t* purge_sys);
476-
477-
/** Sets the next rseg to purge in m_purge_sys.
478-
@return page size of the table for which the log is.
479-
NOTE: if rseg is NULL when this function returns this means that
480-
there are no rollback segments to purge and then the returned page
481-
size object should not be used. */
482-
const page_size_t set_next();
483-
484-
private:
485-
// Disable copying
486-
TrxUndoRsegsIterator(const TrxUndoRsegsIterator&);
487-
TrxUndoRsegsIterator& operator=(const TrxUndoRsegsIterator&);
488-
489-
/** The purge system pointer */
490-
trx_purge_t* m_purge_sys;
491-
492-
/** The current element to process */
493-
TrxUndoRsegs m_trx_undo_rsegs;
494-
495-
/** Track the current element in m_trx_undo_rseg */
496-
TrxUndoRsegs::iterator m_iter;
497-
498-
/** Sentinel value */
499-
static const TrxUndoRsegs NullElement;
500-
};
501-
502597
#ifndef UNIV_NONINL
503598
#include "trx0purge.ic"
504599
#endif /* UNIV_NOINL */

storage/innobase/include/trx0types.h

Lines changed: 0 additions & 98 deletions
Original file line numberDiff line numberDiff line change
@@ -174,104 +174,6 @@ typedef ib_mutex_t UndoMutex;
174174
typedef ib_mutex_t PQMutex;
175175
typedef ib_mutex_t TrxSysMutex;
176176

177-
/** Rollback segements from a given transaction with trx-no
178-
scheduled for purge. */
179-
class TrxUndoRsegs {
180-
private:
181-
typedef std::vector<trx_rseg_t*, ut_allocator<trx_rseg_t*> >
182-
trx_rsegs_t;
183-
public:
184-
typedef trx_rsegs_t::iterator iterator;
185-
186-
/** Default constructor */
187-
TrxUndoRsegs() : m_trx_no() { }
188-
189-
explicit TrxUndoRsegs(trx_id_t trx_no)
190-
:
191-
m_trx_no(trx_no)
192-
{
193-
// Do nothing
194-
}
195-
196-
/** Get transaction number
197-
@return trx_id_t - get transaction number. */
198-
trx_id_t get_trx_no() const
199-
{
200-
return(m_trx_no);
201-
}
202-
203-
/** Add rollback segment.
204-
@param rseg rollback segment to add. */
205-
void push_back(trx_rseg_t* rseg)
206-
{
207-
m_rsegs.push_back(rseg);
208-
}
209-
210-
/** Erase the element pointed by given iterator.
211-
@param[in] iterator iterator */
212-
void erase(iterator& it)
213-
{
214-
m_rsegs.erase(it);
215-
}
216-
217-
/** Number of registered rsegs.
218-
@return size of rseg list. */
219-
ulint size() const
220-
{
221-
return(m_rsegs.size());
222-
}
223-
224-
/**
225-
@return an iterator to the first element */
226-
iterator begin()
227-
{
228-
return(m_rsegs.begin());
229-
}
230-
231-
/**
232-
@return an iterator to the end */
233-
iterator end()
234-
{
235-
return(m_rsegs.end());
236-
}
237-
238-
/** Append rollback segments from referred instance to current
239-
instance. */
240-
void append(const TrxUndoRsegs& append_from)
241-
{
242-
ut_ad(get_trx_no() == append_from.get_trx_no());
243-
244-
m_rsegs.insert(m_rsegs.end(),
245-
append_from.m_rsegs.begin(),
246-
append_from.m_rsegs.end());
247-
}
248-
249-
/** Compare two TrxUndoRsegs based on trx_no.
250-
@param elem1 first element to compare
251-
@param elem2 second element to compare
252-
@return true if elem1 > elem2 else false.*/
253-
bool operator()(const TrxUndoRsegs& lhs, const TrxUndoRsegs& rhs)
254-
{
255-
return(lhs.m_trx_no > rhs.m_trx_no);
256-
}
257-
258-
/** Compiler defined copy-constructor/assignment operator
259-
should be fine given that there is no reference to a memory
260-
object outside scope of class object.*/
261-
262-
private:
263-
/** The rollback segments transaction number. */
264-
trx_id_t m_trx_no;
265-
266-
/** Rollback segments of a transaction, scheduled for purge. */
267-
trx_rsegs_t m_rsegs;
268-
};
269-
270-
typedef std::priority_queue<
271-
TrxUndoRsegs,
272-
std::vector<TrxUndoRsegs, ut_allocator<TrxUndoRsegs> >,
273-
TrxUndoRsegs> purge_pq_t;
274-
275177
typedef std::vector<trx_id_t, ut_allocator<trx_id_t> > trx_ids_t;
276178

277179
/** Mapping read-write transactions from id to transaction instance, for

0 commit comments

Comments
 (0)