@@ -37,9 +37,6 @@ Created 3/26/1996 Heikki Tuuri
37
37
#include " fil0fil.h"
38
38
#include " read0types.h"
39
39
40
- /* * The global data structure coordinating a purge */
41
- extern trx_purge_t * purge_sys;
42
-
43
40
/* * A dummy undo record used as a return value when we have a whole undo log
44
41
which needs no purge */
45
42
extern trx_undo_rec_t trx_purge_dummy_rec;
@@ -54,12 +51,6 @@ trx_purge_get_log_from_hist(
54
51
/* ========================*/
55
52
fil_addr_t node_addr); /* !< in: file address of the history
56
53
list node of the log */
57
- /* * Create the global purge system data structure. */
58
- void
59
- trx_purge_sys_create ();
60
- /* * Free the global purge system data structure. */
61
- void
62
- trx_purge_sys_close ();
63
54
/* ***********************************************************************
64
55
Adds the update undo log as the first log in the history list. Removes the
65
56
update undo log segment from the rseg slot if it is too big for reuse. */
@@ -216,9 +207,9 @@ Chooses the rollback segment with the smallest trx_no. */
216
207
struct TrxUndoRsegsIterator {
217
208
218
209
/* * Constructor */
219
- TrxUndoRsegsIterator (trx_purge_t * purge_sys );
210
+ TrxUndoRsegsIterator ();
220
211
221
- /* * Sets the next rseg to purge in m_purge_sys .
212
+ /* * Sets the next rseg to purge in purge_sys .
222
213
@return page size of the table for which the log is.
223
214
NOTE: if rseg is NULL when this function returns this means that
224
215
there are no rollback segments to purge and then the returned page
@@ -230,9 +221,6 @@ struct TrxUndoRsegsIterator {
230
221
TrxUndoRsegsIterator (const TrxUndoRsegsIterator&);
231
222
TrxUndoRsegsIterator& operator =(const TrxUndoRsegsIterator&);
232
223
233
- /* * The purge system pointer */
234
- trx_purge_t * m_purge_sys;
235
-
236
224
/* * The current element to process */
237
225
TrxUndoRsegs m_trx_undo_rsegs;
238
226
@@ -506,13 +494,16 @@ namespace undo {
506
494
}; /* namespace undo */
507
495
508
496
/* * The control structure used in the purge operation */
509
- struct trx_purge_t {
497
+ class purge_sys_t
498
+ {
499
+ public:
500
+ /* * Construct the purge system. */
501
+ purge_sys_t ();
502
+ /* * Destruct the purge system. */
503
+ ~purge_sys_t ();
504
+
510
505
sess_t * sess; /* !< System session running the purge
511
506
query */
512
- trx_t * trx; /* !< System transaction running the
513
- purge query: this trx is not in the
514
- trx list of the trx system and it
515
- never ends */
516
507
rw_lock_t latch; /* !< The latch protecting the purge
517
508
view. A purge operation must acquire an
518
509
x-latch here for the instant at which
@@ -522,7 +513,7 @@ struct trx_purge_t{
522
513
protects state and running */
523
514
os_event_t event; /* !< State signal event;
524
515
os_event_set() and os_event_reset()
525
- are protected by trx_purge_t ::latch
516
+ are protected by purge_sys_t ::latch
526
517
X-lock */
527
518
ulint n_stop; /* !< Counter to track number stops */
528
519
volatile bool running; /* !< true, if purge is active,
@@ -534,7 +525,6 @@ struct trx_purge_t{
534
525
parallelized purge operation */
535
526
ReadView view; /* !< The purge will not remove undo logs
536
527
which are >= this view (purge view) */
537
- bool view_active; /* !< true if view is active */
538
528
volatile ulint n_submitted; /* !< Count of total tasks submitted
539
529
to the task queue */
540
530
volatile ulint n_completed; /* !< Count of total tasks completed */
@@ -557,11 +547,8 @@ struct trx_purge_t{
557
547
purged already accurately. */
558
548
#endif /* UNIV_DEBUG */
559
549
/* -----------------------------*/
560
- ibool next_stored; /* !< TRUE if the info of the next record
561
- to purge is stored below: if yes, then
562
- the transaction number and the undo
563
- number of the record are stored in
564
- purge_trx_no and purge_undo_no above */
550
+ bool next_stored; /* !< whether rseg holds the next record
551
+ to purge */
565
552
trx_rseg_t * rseg; /* !< Rollback segment for the next undo
566
553
record to purge */
567
554
ulint page_no; /* !< Page number for the next undo
@@ -575,11 +562,11 @@ struct trx_purge_t{
575
562
ulint hdr_offset; /* !< Header byte offset on the page */
576
563
577
564
578
- TrxUndoRsegsIterator*
565
+ TrxUndoRsegsIterator
579
566
rseg_iter; /* !< Iterator to get the next rseg
580
567
to process */
581
568
582
- purge_pq_t * purge_queue; /* !< Binary min-heap, ordered on
569
+ purge_pq_t purge_queue; /* !< Binary min-heap, ordered on
583
570
TrxUndoRsegs::trx_no. It is protected
584
571
by the pq_mutex */
585
572
PQMutex pq_mutex; /* !< Mutex protecting purge_queue */
@@ -588,6 +575,9 @@ struct trx_purge_t{
588
575
for truncate. */
589
576
};
590
577
578
+ /* * The global data structure coordinating a purge */
579
+ extern purge_sys_t * purge_sys;
580
+
591
581
/* * Info required to purge a record */
592
582
struct trx_purge_rec_t {
593
583
trx_undo_rec_t * undo_rec; /* !< Record to purge */
0 commit comments