~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/innobase/trx/trx0purge.c

Merge initial InnoDB+ import.

This was applied by generating a patch between MySQL 5.1.50 InnoDB plugin and
the just-merged innodb+ from mysql-trunk revision-id: vasil.dimov@oracle.com-20100422110752-1zowoqxel5xx3z2e

Then, some manual merge resolving and it worked. This should make it much
easier to merge the rest of InnoDB 1.1 and 1.2 from the mysql tree using
my bzr-reapply script.

This takes us to InnoDB 1.1.1(ish).

Show diffs side-by-side

added added

removed removed

Lines of Context:
41
41
#include "row0purge.h"
42
42
#include "row0upd.h"
43
43
#include "trx0rec.h"
44
 
#include "srv0que.h"
 
44
#include "srv0srv.h"
45
45
#include "os0thread.h"
46
46
 
47
47
/** The global data structure coordinating a purge */
51
51
which needs no purge */
52
52
UNIV_INTERN trx_undo_rec_t      trx_purge_dummy_rec;
53
53
 
 
54
#ifdef UNIV_PFS_RWLOCK
 
55
/* Key to register trx_purge_latch with performance schema */
 
56
UNIV_INTERN mysql_pfs_key_t     trx_purge_latch_key;
 
57
#endif /* UNIV_PFS_RWLOCK */
 
58
 
 
59
#ifdef UNIV_PFS_MUTEX
 
60
/* Key to register purge_sys_mutex with performance schema */
 
61
UNIV_INTERN mysql_pfs_key_t     purge_sys_mutex_key;
 
62
#endif /* UNIV_PFS_MUTEX */
 
63
 
54
64
/*****************************************************************//**
55
65
Checks if trx_id is >= purge_view: then it is guaranteed that its update
56
66
undo log still exists in the system.
227
237
        purge_sys->purge_undo_no = ut_dulint_zero;
228
238
        purge_sys->next_stored = FALSE;
229
239
 
230
 
        rw_lock_create(&purge_sys->latch, SYNC_PURGE_LATCH);
 
240
        rw_lock_create(trx_purge_latch_key,
 
241
                       &purge_sys->latch, SYNC_PURGE_LATCH);
231
242
 
232
 
        mutex_create(&purge_sys->mutex, SYNC_PURGE_SYS);
 
243
        mutex_create(purge_sys_mutex_key,
 
244
                     &purge_sys->mutex, SYNC_PURGE_SYS);
233
245
 
234
246
        purge_sys->heap = mem_heap_create(256);
235
247
 
352
364
        trx_sys->rseg_history_len++;
353
365
        mutex_exit(&kernel_mutex);
354
366
 
 
367
        if (!(trx_sys->rseg_history_len % srv_purge_batch_size)) {
 
368
                /* Inform the purge thread that there is work to do. */
 
369
                srv_wake_purge_thread_if_not_active();
 
370
        }
 
371
 
355
372
        /* Write the trx number to the undo log header */
356
373
        mlog_write_dulint(undo_header + TRX_UNDO_TRX_NO, trx->no, mtr);
357
374
        /* Write information about delete markings to the undo log header */
1084
1101
@return number of undo log pages handled in the batch */
1085
1102
UNIV_INTERN
1086
1103
ulint
1087
 
trx_purge(void)
1088
 
/*===========*/
 
1104
trx_purge(
 
1105
/*======*/
 
1106
        ulint   limit)          /*!< in: the maximum number of records to
 
1107
                                purge in one batch */
1089
1108
{
1090
1109
        que_thr_t*      thr;
1091
1110
        /*      que_thr_t*      thr2; */
1146
1165
 
1147
1166
        purge_sys->state = TRX_PURGE_ON;
1148
1167
 
1149
 
        /* Handle at most 20 undo log pages in one purge batch */
1150
 
 
1151
 
        purge_sys->handle_limit = purge_sys->n_pages_handled + 20;
 
1168
        purge_sys->handle_limit = purge_sys->n_pages_handled + limit;
1152
1169
 
1153
1170
        old_pages_handled = purge_sys->n_pages_handled;
1154
1171