~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to storage/innobase/trx/trx0undo.c

  • Committer: Monty Taylor
  • Date: 2009-04-14 19:16:51 UTC
  • mto: (997.2.5 mordred)
  • mto: This revision was merged to the branch mainline in revision 994.
  • Revision ID: mordred@inaugust.com-20090414191651-ltbww6hpqks8k7qk
Clarified instructions in README.

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
 
17
17
*****************************************************************************/
18
18
 
19
 
/**************************************************//**
20
 
@file trx/trx0undo.c
 
19
/******************************************************
21
20
Transaction undo log
22
21
 
23
22
Created 3/26/1996 Heikki Tuuri
30
29
#endif
31
30
 
32
31
#include "fsp0fsp.h"
33
 
#ifndef UNIV_HOTBACKUP
34
32
#include "mach0data.h"
35
 
#include "mtr0log.h"
36
33
#include "trx0rseg.h"
37
34
#include "trx0trx.h"
38
35
#include "srv0srv.h"
39
36
#include "trx0rec.h"
40
37
#include "trx0purge.h"
 
38
#include "trx0xa.h"
41
39
 
42
40
/* How should the old versions in the history list be managed?
43
41
   ----------------------------------------------------------
93
91
of the list and release undo log segments. In stepping through the list,
94
92
s-latches on the undo log pages are enough, but in a truncate, x-latches must
95
93
be obtained on the rollback segment and individual pages. */
96
 
#endif /* !UNIV_HOTBACKUP */
97
94
 
98
 
/********************************************************************//**
 
95
/************************************************************************
99
96
Initializes the fields in an undo log segment page. */
100
97
static
101
98
void
102
99
trx_undo_page_init(
103
100
/*===============*/
104
 
        page_t* undo_page,      /*!< in: undo log segment page */
105
 
        ulint   type,           /*!< in: undo log segment type */
106
 
        mtr_t*  mtr);           /*!< in: mtr */
107
 
 
108
 
#ifndef UNIV_HOTBACKUP
109
 
/********************************************************************//**
110
 
Creates and initializes an undo log memory object.
111
 
@return own: the undo log memory object */
 
101
        page_t* undo_page,      /* in: undo log segment page */
 
102
        ulint   type,           /* in: undo log segment type */
 
103
        mtr_t*  mtr);           /* in: mtr */
 
104
/************************************************************************
 
105
Creates and initializes an undo log memory object. */
112
106
static
113
107
trx_undo_t*
114
108
trx_undo_mem_create(
115
109
/*================*/
116
 
        trx_rseg_t*     rseg,   /*!< in: rollback segment memory object */
117
 
        ulint           id,     /*!< in: slot index within rseg */
118
 
        ulint           type,   /*!< in: type of the log: TRX_UNDO_INSERT or
 
110
                                /* out, own: the undo log memory object */
 
111
        trx_rseg_t*     rseg,   /* in: rollback segment memory object */
 
112
        ulint           id,     /* in: slot index within rseg */
 
113
        ulint           type,   /* in: type of the log: TRX_UNDO_INSERT or
119
114
                                TRX_UNDO_UPDATE */
120
 
        trx_id_t        trx_id, /*!< in: id of the trx for which the undo log
 
115
        dulint          trx_id, /* in: id of the trx for which the undo log
121
116
                                is created */
122
 
        const XID*      xid,    /*!< in: X/Open XA transaction identification*/
123
 
        ulint           page_no,/*!< in: undo log header page number */
124
 
        ulint           offset);/*!< in: undo log header byte offset on page */
125
 
#endif /* !UNIV_HOTBACKUP */
126
 
/***************************************************************//**
 
117
        const XID*      xid,    /* in: X/Open XA transaction identification*/
 
118
        ulint           page_no,/* in: undo log header page number */
 
119
        ulint           offset);/* in: undo log header byte offset on page */
 
120
/*******************************************************************
127
121
Initializes a cached insert undo log header page for new use. NOTE that this
128
122
function has its own log record type MLOG_UNDO_HDR_REUSE. You must NOT change
129
 
the operation of this function!
130
 
@return undo log header byte offset on page */
 
123
the operation of this function! */
131
124
static
132
125
ulint
133
126
trx_undo_insert_header_reuse(
134
127
/*=========================*/
135
 
        page_t*         undo_page,      /*!< in/out: insert undo log segment
136
 
                                        header page, x-latched */
137
 
        trx_id_t        trx_id,         /*!< in: transaction id */
138
 
        mtr_t*          mtr);           /*!< in: mtr */
139
 
/**********************************************************************//**
 
128
                                /* out: undo log header byte offset on page */
 
129
        page_t* undo_page,      /* in: insert undo log segment header page,
 
130
                                x-latched */
 
131
        dulint  trx_id,         /* in: transaction id */
 
132
        mtr_t*  mtr);           /* in: mtr */
 
133
/**************************************************************************
140
134
If an update undo log can be discarded immediately, this function frees the
141
135
space, resetting the page to the proper state for caching. */
142
136
static
143
137
void
144
138
trx_undo_discard_latest_update_undo(
145
139
/*================================*/
146
 
        page_t* undo_page,      /*!< in: header page of an undo log of size 1 */
147
 
        mtr_t*  mtr);           /*!< in: mtr */
148
 
 
149
 
#ifndef UNIV_HOTBACKUP
150
 
/***********************************************************************//**
151
 
Gets the previous record in an undo log from the previous page.
152
 
@return undo log record, the page s-latched, NULL if none */
 
140
        page_t* undo_page,      /* in: header page of an undo log of size 1 */
 
141
        mtr_t*  mtr);           /* in: mtr */
 
142
 
 
143
 
 
144
/***************************************************************************
 
145
Gets the previous record in an undo log from the previous page. */
153
146
static
154
147
trx_undo_rec_t*
155
148
trx_undo_get_prev_rec_from_prev_page(
156
149
/*=================================*/
157
 
        trx_undo_rec_t* rec,    /*!< in: undo record */
158
 
        ulint           page_no,/*!< in: undo log header page number */
159
 
        ulint           offset, /*!< in: undo log header offset on page */
160
 
        mtr_t*          mtr)    /*!< in: mtr */
 
150
                                /* out: undo log record, the page s-latched,
 
151
                                NULL if none */
 
152
        trx_undo_rec_t* rec,    /* in: undo record */
 
153
        ulint           page_no,/* in: undo log header page number */
 
154
        ulint           offset, /* in: undo log header offset on page */
 
155
        mtr_t*          mtr)    /* in: mtr */
161
156
{
162
157
        ulint   space;
163
158
        ulint   zip_size;
185
180
        return(trx_undo_page_get_last_rec(prev_page, page_no, offset));
186
181
}
187
182
 
188
 
/***********************************************************************//**
189
 
Gets the previous record in an undo log.
190
 
@return undo log record, the page s-latched, NULL if none */
 
183
/***************************************************************************
 
184
Gets the previous record in an undo log. */
191
185
UNIV_INTERN
192
186
trx_undo_rec_t*
193
187
trx_undo_get_prev_rec(
194
188
/*==================*/
195
 
        trx_undo_rec_t* rec,    /*!< in: undo record */
196
 
        ulint           page_no,/*!< in: undo log header page number */
197
 
        ulint           offset, /*!< in: undo log header offset on page */
198
 
        mtr_t*          mtr)    /*!< in: mtr */
 
189
                                /* out: undo log record, the page s-latched,
 
190
                                NULL if none */
 
191
        trx_undo_rec_t* rec,    /* in: undo record */
 
192
        ulint           page_no,/* in: undo log header page number */
 
193
        ulint           offset, /* in: undo log header offset on page */
 
194
        mtr_t*          mtr)    /* in: mtr */
199
195
{
200
196
        trx_undo_rec_t* prev_rec;
201
197
 
213
209
                                                    mtr));
214
210
}
215
211
 
216
 
/***********************************************************************//**
217
 
Gets the next record in an undo log from the next page.
218
 
@return undo log record, the page latched, NULL if none */
 
212
/***************************************************************************
 
213
Gets the next record in an undo log from the next page. */
219
214
static
220
215
trx_undo_rec_t*
221
216
trx_undo_get_next_rec_from_next_page(
222
217
/*=================================*/
223
 
        ulint   space,  /*!< in: undo log header space */
224
 
        ulint   zip_size,/*!< in: compressed page size in bytes
 
218
                        /* out: undo log record, the page latched, NULL if
 
219
                        none */
 
220
        ulint   space,  /* in: undo log header space */
 
221
        ulint   zip_size,/* in: compressed page size in bytes
225
222
                        or 0 for uncompressed pages */
226
 
        page_t* undo_page, /*!< in: undo log page */
227
 
        ulint   page_no,/*!< in: undo log header page number */
228
 
        ulint   offset, /*!< in: undo log header offset on page */
229
 
        ulint   mode,   /*!< in: latch mode: RW_S_LATCH or RW_X_LATCH */
230
 
        mtr_t*  mtr)    /*!< in: mtr */
 
223
        page_t* undo_page, /* in: undo log page */
 
224
        ulint   page_no,/* in: undo log header page number */
 
225
        ulint   offset, /* in: undo log header offset on page */
 
226
        ulint   mode,   /* in: latch mode: RW_S_LATCH or RW_X_LATCH */
 
227
        mtr_t*  mtr)    /* in: mtr */
231
228
{
232
229
        trx_ulogf_t*    log_hdr;
233
230
        ulint           next_page_no;
265
262
        return(trx_undo_page_get_first_rec(next_page, page_no, offset));
266
263
}
267
264
 
268
 
/***********************************************************************//**
269
 
Gets the next record in an undo log.
270
 
@return undo log record, the page s-latched, NULL if none */
 
265
/***************************************************************************
 
266
Gets the next record in an undo log. */
271
267
UNIV_INTERN
272
268
trx_undo_rec_t*
273
269
trx_undo_get_next_rec(
274
270
/*==================*/
275
 
        trx_undo_rec_t* rec,    /*!< in: undo record */
276
 
        ulint           page_no,/*!< in: undo log header page number */
277
 
        ulint           offset, /*!< in: undo log header offset on page */
278
 
        mtr_t*          mtr)    /*!< in: mtr */
 
271
                                /* out: undo log record, the page s-latched,
 
272
                                NULL if none */
 
273
        trx_undo_rec_t* rec,    /* in: undo record */
 
274
        ulint           page_no,/* in: undo log header page number */
 
275
        ulint           offset, /* in: undo log header offset on page */
 
276
        mtr_t*          mtr)    /* in: mtr */
279
277
{
280
278
        ulint           space;
281
279
        ulint           zip_size;
296
294
                                                    RW_S_LATCH, mtr));
297
295
}
298
296
 
299
 
/***********************************************************************//**
300
 
Gets the first record in an undo log.
301
 
@return undo log record, the page latched, NULL if none */
 
297
/***************************************************************************
 
298
Gets the first record in an undo log. */
302
299
UNIV_INTERN
303
300
trx_undo_rec_t*
304
301
trx_undo_get_first_rec(
305
302
/*===================*/
306
 
        ulint   space,  /*!< in: undo log header space */
307
 
        ulint   zip_size,/*!< in: compressed page size in bytes
 
303
                        /* out: undo log record, the page latched, NULL if
 
304
                        none */
 
305
        ulint   space,  /* in: undo log header space */
 
306
        ulint   zip_size,/* in: compressed page size in bytes
308
307
                        or 0 for uncompressed pages */
309
 
        ulint   page_no,/*!< in: undo log header page number */
310
 
        ulint   offset, /*!< in: undo log header offset on page */
311
 
        ulint   mode,   /*!< in: latching mode: RW_S_LATCH or RW_X_LATCH */
312
 
        mtr_t*  mtr)    /*!< in: mtr */
 
308
        ulint   page_no,/* in: undo log header page number */
 
309
        ulint   offset, /* in: undo log header offset on page */
 
310
        ulint   mode,   /* in: latching mode: RW_S_LATCH or RW_X_LATCH */
 
311
        mtr_t*  mtr)    /* in: mtr */
313
312
{
314
313
        page_t*         undo_page;
315
314
        trx_undo_rec_t* rec;
334
333
 
335
334
/*============== UNDO LOG FILE COPY CREATION AND FREEING ==================*/
336
335
 
337
 
/**********************************************************************//**
 
336
/**************************************************************************
338
337
Writes the mtr log entry of an undo log page initialization. */
339
338
UNIV_INLINE
340
339
void
341
340
trx_undo_page_init_log(
342
341
/*===================*/
343
 
        page_t* undo_page,      /*!< in: undo log page */
344
 
        ulint   type,           /*!< in: undo log type */
345
 
        mtr_t*  mtr)            /*!< in: mtr */
 
342
        page_t* undo_page,      /* in: undo log page */
 
343
        ulint   type,           /* in: undo log type */
 
344
        mtr_t*  mtr)            /* in: mtr */
346
345
{
347
346
        mlog_write_initial_log_record(undo_page, MLOG_UNDO_INIT, mtr);
348
347
 
349
348
        mlog_catenate_ulint_compressed(mtr, type);
350
349
}
351
 
#else /* !UNIV_HOTBACKUP */
352
 
# define trx_undo_page_init_log(undo_page,type,mtr) ((void) 0)
353
 
#endif /* !UNIV_HOTBACKUP */
354
350
 
355
 
/***********************************************************//**
356
 
Parses the redo log entry of an undo log page initialization.
357
 
@return end of log record or NULL */
 
351
/***************************************************************
 
352
Parses the redo log entry of an undo log page initialization. */
358
353
UNIV_INTERN
359
354
byte*
360
355
trx_undo_parse_page_init(
361
356
/*=====================*/
362
 
        byte*   ptr,    /*!< in: buffer */
363
 
        byte*   end_ptr,/*!< in: buffer end */
364
 
        page_t* page,   /*!< in: page or NULL */
365
 
        mtr_t*  mtr)    /*!< in: mtr or NULL */
 
357
                        /* out: end of log record or NULL */
 
358
        byte*   ptr,    /* in: buffer */
 
359
        byte*   end_ptr,/* in: buffer end */
 
360
        page_t* page,   /* in: page or NULL */
 
361
        mtr_t*  mtr)    /* in: mtr or NULL */
366
362
{
367
363
        ulint   type;
368
364
 
380
376
        return(ptr);
381
377
}
382
378
 
383
 
/********************************************************************//**
 
379
/************************************************************************
384
380
Initializes the fields in an undo log segment page. */
385
381
static
386
382
void
387
383
trx_undo_page_init(
388
384
/*===============*/
389
 
        page_t* undo_page,      /*!< in: undo log segment page */
390
 
        ulint   type,           /*!< in: undo log segment type */
391
 
        mtr_t*  mtr)            /*!< in: mtr */
 
385
        page_t* undo_page,      /* in: undo log segment page */
 
386
        ulint   type,           /* in: undo log segment type */
 
387
        mtr_t*  mtr)            /* in: mtr */
392
388
{
393
389
        trx_upagef_t*   page_hdr;
394
390
 
406
402
        trx_undo_page_init_log(undo_page, type, mtr);
407
403
}
408
404
 
409
 
#ifndef UNIV_HOTBACKUP
410
 
/***************************************************************//**
411
 
Creates a new undo log segment in file.
412
 
@return DB_SUCCESS if page creation OK possible error codes are:
413
 
DB_TOO_MANY_CONCURRENT_TRXS DB_OUT_OF_FILE_SPACE */
 
405
/*******************************************************************
 
406
Creates a new undo log segment in file. */
414
407
static
415
408
ulint
416
409
trx_undo_seg_create(
417
410
/*================*/
418
 
        trx_rseg_t*     rseg __attribute__((unused)),/*!< in: rollback segment */
419
 
        trx_rsegf_t*    rseg_hdr,/*!< in: rollback segment header, page
 
411
                                /* out: DB_SUCCESS if page creation OK
 
412
                                possible error codes are:
 
413
                                DB_TOO_MANY_CONCURRENT_TRXS
 
414
                                DB_OUT_OF_FILE_SPACE */
 
415
        trx_rseg_t*     rseg __attribute__((unused)),/* in: rollback segment */
 
416
        trx_rsegf_t*    rseg_hdr,/* in: rollback segment header, page
420
417
                                x-latched */
421
 
        ulint           type,   /*!< in: type of the segment: TRX_UNDO_INSERT or
 
418
        ulint           type,   /* in: type of the segment: TRX_UNDO_INSERT or
422
419
                                TRX_UNDO_UPDATE */
423
 
        ulint*          id,     /*!< out: slot index within rseg header */
 
420
        ulint*          id,     /* out: slot index within rseg header */
424
421
        page_t**        undo_page,
425
 
                                /*!< out: segment header page x-latched, NULL
 
422
                                /* out: segment header page x-latched, NULL
426
423
                                if there was an error */
427
 
        mtr_t*          mtr)    /*!< in: mtr */
 
424
        mtr_t*          mtr)    /* in: mtr */
428
425
{
429
426
        ulint           slot_no;
430
427
        ulint           space;
503
500
        return(err);
504
501
}
505
502
 
506
 
/**********************************************************************//**
 
503
/**************************************************************************
507
504
Writes the mtr log entry of an undo log header initialization. */
508
505
UNIV_INLINE
509
506
void
510
507
trx_undo_header_create_log(
511
508
/*=======================*/
512
 
        const page_t*   undo_page,      /*!< in: undo log header page */
513
 
        trx_id_t        trx_id,         /*!< in: transaction id */
514
 
        mtr_t*          mtr)            /*!< in: mtr */
 
509
        page_t* undo_page,      /* in: undo log header page */
 
510
        dulint  trx_id,         /* in: transaction id */
 
511
        mtr_t*  mtr)            /* in: mtr */
515
512
{
516
513
        mlog_write_initial_log_record(undo_page, MLOG_UNDO_HDR_CREATE, mtr);
517
514
 
518
515
        mlog_catenate_dulint_compressed(mtr, trx_id);
519
516
}
520
 
#else /* !UNIV_HOTBACKUP */
521
 
# define trx_undo_header_create_log(undo_page,trx_id,mtr) ((void) 0)
522
 
#endif /* !UNIV_HOTBACKUP */
523
517
 
524
 
/***************************************************************//**
 
518
/*******************************************************************
525
519
Creates a new undo log header in file. NOTE that this function has its own
526
520
log record type MLOG_UNDO_HDR_CREATE. You must NOT change the operation of
527
 
this function!
528
 
@return header byte offset on page */
 
521
this function! */
529
522
static
530
523
ulint
531
524
trx_undo_header_create(
532
525
/*===================*/
533
 
        page_t*         undo_page,      /*!< in/out: undo log segment
534
 
                                        header page, x-latched; it is
535
 
                                        assumed that there is
536
 
                                        TRX_UNDO_LOG_XA_HDR_SIZE bytes
537
 
                                        free space on it */
538
 
        trx_id_t        trx_id,         /*!< in: transaction id */
539
 
        mtr_t*          mtr)            /*!< in: mtr */
 
526
                                /* out: header byte offset on page */
 
527
        page_t* undo_page,      /* in: undo log segment header page,
 
528
                                x-latched; it is assumed that there are
 
529
                                TRX_UNDO_LOG_XA_HDR_SIZE bytes free space
 
530
                                on it */
 
531
        dulint  trx_id,         /* in: transaction id */
 
532
        mtr_t*  mtr)            /* in: mtr */
540
533
{
541
534
        trx_upagef_t*   page_hdr;
542
535
        trx_usegf_t*    seg_hdr;
594
587
        return(free);
595
588
}
596
589
 
597
 
#ifndef UNIV_HOTBACKUP
598
 
/********************************************************************//**
 
590
/************************************************************************
599
591
Write X/Open XA Transaction Identification (XID) to undo log header */
600
592
static
601
593
void
602
594
trx_undo_write_xid(
603
595
/*===============*/
604
 
        trx_ulogf_t*    log_hdr,/*!< in: undo log header */
605
 
        const XID*      xid,    /*!< in: X/Open XA Transaction Identification */
606
 
        mtr_t*          mtr)    /*!< in: mtr */
 
596
        trx_ulogf_t*    log_hdr,/* in: undo log header */
 
597
        const XID*      xid,    /* in: X/Open XA Transaction Identification */
 
598
        mtr_t*          mtr)    /* in: mtr */
607
599
{
608
600
        mlog_write_ulint(log_hdr + TRX_UNDO_XA_FORMAT,
609
601
                         (ulint)xid->formatID, MLOG_4BYTES, mtr);
618
610
                          XIDDATASIZE, mtr);
619
611
}
620
612
 
621
 
/********************************************************************//**
 
613
/************************************************************************
622
614
Read X/Open XA Transaction Identification (XID) from undo log header */
623
615
static
624
616
void
625
617
trx_undo_read_xid(
626
618
/*==============*/
627
 
        trx_ulogf_t*    log_hdr,/*!< in: undo log header */
628
 
        XID*            xid)    /*!< out: X/Open XA Transaction Identification */
 
619
        trx_ulogf_t*    log_hdr,/* in: undo log header */
 
620
        XID*            xid)    /* out: X/Open XA Transaction Identification */
629
621
{
630
622
        xid->formatID = (long)mach_read_from_4(log_hdr + TRX_UNDO_XA_FORMAT);
631
623
 
637
629
        memcpy(xid->data, log_hdr + TRX_UNDO_XA_XID, XIDDATASIZE);
638
630
}
639
631
 
640
 
/***************************************************************//**
 
632
/*******************************************************************
641
633
Adds space for the XA XID after an undo log old-style header. */
642
634
static
643
635
void
644
636
trx_undo_header_add_space_for_xid(
645
637
/*==============================*/
646
 
        page_t*         undo_page,/*!< in: undo log segment header page */
647
 
        trx_ulogf_t*    log_hdr,/*!< in: undo log header */
648
 
        mtr_t*          mtr)    /*!< in: mtr */
 
638
        page_t*         undo_page,/* in: undo log segment header page */
 
639
        trx_ulogf_t*    log_hdr,/* in: undo log header */
 
640
        mtr_t*          mtr)    /* in: mtr */
649
641
{
650
642
        trx_upagef_t*   page_hdr;
651
643
        ulint           free;
675
667
                         MLOG_2BYTES, mtr);
676
668
}
677
669
 
678
 
/**********************************************************************//**
 
670
/**************************************************************************
679
671
Writes the mtr log entry of an undo log header reuse. */
680
672
UNIV_INLINE
681
673
void
682
674
trx_undo_insert_header_reuse_log(
683
675
/*=============================*/
684
 
        const page_t*   undo_page,      /*!< in: undo log header page */
685
 
        trx_id_t        trx_id,         /*!< in: transaction id */
686
 
        mtr_t*          mtr)            /*!< in: mtr */
 
676
        page_t* undo_page,      /* in: undo log header page */
 
677
        dulint  trx_id,         /* in: transaction id */
 
678
        mtr_t*  mtr)            /* in: mtr */
687
679
{
688
680
        mlog_write_initial_log_record(undo_page, MLOG_UNDO_HDR_REUSE, mtr);
689
681
 
690
682
        mlog_catenate_dulint_compressed(mtr, trx_id);
691
683
}
692
 
#else /* !UNIV_HOTBACKUP */
693
 
# define trx_undo_insert_header_reuse_log(undo_page,trx_id,mtr) ((void) 0)
694
 
#endif /* !UNIV_HOTBACKUP */
695
684
 
696
 
/***********************************************************//**
697
 
Parses the redo log entry of an undo log page header create or reuse.
698
 
@return end of log record or NULL */
 
685
/***************************************************************
 
686
Parses the redo log entry of an undo log page header create or reuse. */
699
687
UNIV_INTERN
700
688
byte*
701
689
trx_undo_parse_page_header(
702
690
/*=======================*/
703
 
        ulint   type,   /*!< in: MLOG_UNDO_HDR_CREATE or MLOG_UNDO_HDR_REUSE */
704
 
        byte*   ptr,    /*!< in: buffer */
705
 
        byte*   end_ptr,/*!< in: buffer end */
706
 
        page_t* page,   /*!< in: page or NULL */
707
 
        mtr_t*  mtr)    /*!< in: mtr or NULL */
 
691
                        /* out: end of log record or NULL */
 
692
        ulint   type,   /* in: MLOG_UNDO_HDR_CREATE or MLOG_UNDO_HDR_REUSE */
 
693
        byte*   ptr,    /* in: buffer */
 
694
        byte*   end_ptr,/* in: buffer end */
 
695
        page_t* page,   /* in: page or NULL */
 
696
        mtr_t*  mtr)    /* in: mtr or NULL */
708
697
{
709
 
        trx_id_t        trx_id;
 
698
        dulint  trx_id;
710
699
 
711
700
        ptr = mach_dulint_parse_compressed(ptr, end_ptr, &trx_id);
712
701
 
727
716
        return(ptr);
728
717
}
729
718
 
730
 
/***************************************************************//**
 
719
/*******************************************************************
731
720
Initializes a cached insert undo log header page for new use. NOTE that this
732
721
function has its own log record type MLOG_UNDO_HDR_REUSE. You must NOT change
733
 
the operation of this function!
734
 
@return undo log header byte offset on page */
 
722
the operation of this function! */
735
723
static
736
724
ulint
737
725
trx_undo_insert_header_reuse(
738
726
/*=========================*/
739
 
        page_t*         undo_page,      /*!< in/out: insert undo log segment
740
 
                                        header page, x-latched */
741
 
        trx_id_t        trx_id,         /*!< in: transaction id */
742
 
        mtr_t*          mtr)            /*!< in: mtr */
 
727
                                /* out: undo log header byte offset on page */
 
728
        page_t* undo_page,      /* in: insert undo log segment header page,
 
729
                                x-latched */
 
730
        dulint  trx_id,         /* in: transaction id */
 
731
        mtr_t*  mtr)            /* in: mtr */
743
732
{
744
733
        trx_upagef_t*   page_hdr;
745
734
        trx_usegf_t*    seg_hdr;
787
776
        return(free);
788
777
}
789
778
 
790
 
#ifndef UNIV_HOTBACKUP
791
 
/**********************************************************************//**
 
779
/**************************************************************************
792
780
Writes the redo log entry of an update undo log header discard. */
793
781
UNIV_INLINE
794
782
void
795
783
trx_undo_discard_latest_log(
796
784
/*========================*/
797
 
        page_t* undo_page,      /*!< in: undo log header page */
798
 
        mtr_t*  mtr)            /*!< in: mtr */
 
785
        page_t* undo_page,      /* in: undo log header page */
 
786
        mtr_t*  mtr)            /* in: mtr */
799
787
{
800
788
        mlog_write_initial_log_record(undo_page, MLOG_UNDO_HDR_DISCARD, mtr);
801
789
}
802
 
#else /* !UNIV_HOTBACKUP */
803
 
# define trx_undo_discard_latest_log(undo_page, mtr) ((void) 0)
804
 
#endif /* !UNIV_HOTBACKUP */
805
790
 
806
 
/***********************************************************//**
807
 
Parses the redo log entry of an undo log page header discard.
808
 
@return end of log record or NULL */
 
791
/***************************************************************
 
792
Parses the redo log entry of an undo log page header discard. */
809
793
UNIV_INTERN
810
794
byte*
811
795
trx_undo_parse_discard_latest(
812
796
/*==========================*/
813
 
        byte*   ptr,    /*!< in: buffer */
814
 
        byte*   end_ptr __attribute__((unused)), /*!< in: buffer end */
815
 
        page_t* page,   /*!< in: page or NULL */
816
 
        mtr_t*  mtr)    /*!< in: mtr or NULL */
 
797
                        /* out: end of log record or NULL */
 
798
        byte*   ptr,    /* in: buffer */
 
799
        byte*   end_ptr __attribute__((unused)), /* in: buffer end */
 
800
        page_t* page,   /* in: page or NULL */
 
801
        mtr_t*  mtr)    /* in: mtr or NULL */
817
802
{
818
803
        ut_ad(end_ptr);
819
804
 
824
809
        return(ptr);
825
810
}
826
811
 
827
 
/**********************************************************************//**
 
812
/**************************************************************************
828
813
If an update undo log can be discarded immediately, this function frees the
829
814
space, resetting the page to the proper state for caching. */
830
815
static
831
816
void
832
817
trx_undo_discard_latest_update_undo(
833
818
/*================================*/
834
 
        page_t* undo_page,      /*!< in: header page of an undo log of size 1 */
835
 
        mtr_t*  mtr)            /*!< in: mtr */
 
819
        page_t* undo_page,      /* in: header page of an undo log of size 1 */
 
820
        mtr_t*  mtr)            /* in: mtr */
836
821
{
837
822
        trx_usegf_t*    seg_hdr;
838
823
        trx_upagef_t*   page_hdr;
866
851
        trx_undo_discard_latest_log(undo_page, mtr);
867
852
}
868
853
 
869
 
#ifndef UNIV_HOTBACKUP
870
 
/********************************************************************//**
871
 
Tries to add a page to the undo log segment where the undo log is placed.
872
 
@return page number if success, else FIL_NULL */
 
854
/************************************************************************
 
855
Tries to add a page to the undo log segment where the undo log is placed. */
873
856
UNIV_INTERN
874
857
ulint
875
858
trx_undo_add_page(
876
859
/*==============*/
877
 
        trx_t*          trx,    /*!< in: transaction */
878
 
        trx_undo_t*     undo,   /*!< in: undo log memory object */
879
 
        mtr_t*          mtr)    /*!< in: mtr which does not have a latch to any
 
860
                                /* out: page number if success, else
 
861
                                FIL_NULL */
 
862
        trx_t*          trx,    /* in: transaction */
 
863
        trx_undo_t*     undo,   /* in: undo log memory object */
 
864
        mtr_t*          mtr)    /* in: mtr which does not have a latch to any
880
865
                                undo log page; the caller must have reserved
881
866
                                the rollback segment mutex */
882
867
{
937
922
        return(page_no);
938
923
}
939
924
 
940
 
/********************************************************************//**
941
 
Frees an undo log page that is not the header page.
942
 
@return last page number in remaining log */
 
925
/************************************************************************
 
926
Frees an undo log page that is not the header page. */
943
927
static
944
928
ulint
945
929
trx_undo_free_page(
946
930
/*===============*/
947
 
        trx_rseg_t* rseg,       /*!< in: rollback segment */
948
 
        ibool   in_history,     /*!< in: TRUE if the undo log is in the history
 
931
                                /* out: last page number in remaining log */
 
932
        trx_rseg_t* rseg,       /* in: rollback segment */
 
933
        ibool   in_history,     /* in: TRUE if the undo log is in the history
949
934
                                list */
950
 
        ulint   space,          /*!< in: space */
951
 
        ulint   hdr_page_no,    /*!< in: header page number */
952
 
        ulint   page_no,        /*!< in: page number to free: must not be the
 
935
        ulint   space,          /* in: space */
 
936
        ulint   hdr_page_no,    /* in: header page number */
 
937
        ulint   page_no,        /* in: page number to free: must not be the
953
938
                                header page */
954
 
        mtr_t*  mtr)            /*!< in: mtr which does not have a latch to any
 
939
        mtr_t*  mtr)            /* in: mtr which does not have a latch to any
955
940
                                undo log page; the caller must have reserved
956
941
                                the rollback segment mutex */
957
942
{
996
981
        return(last_addr.page);
997
982
}
998
983
 
999
 
/********************************************************************//**
 
984
/************************************************************************
1000
985
Frees an undo log page when there is also the memory object for the undo
1001
986
log. */
1002
987
static
1003
988
void
1004
989
trx_undo_free_page_in_rollback(
1005
990
/*===========================*/
1006
 
        trx_t*          trx __attribute__((unused)), /*!< in: transaction */
1007
 
        trx_undo_t*     undo,   /*!< in: undo log memory copy */
1008
 
        ulint           page_no,/*!< in: page number to free: must not be the
 
991
        trx_t*          trx __attribute__((unused)), /* in: transaction */
 
992
        trx_undo_t*     undo,   /* in: undo log memory copy */
 
993
        ulint           page_no,/* in: page number to free: must not be the
1009
994
                                header page */
1010
 
        mtr_t*          mtr)    /*!< in: mtr which does not have a latch to any
 
995
        mtr_t*          mtr)    /* in: mtr which does not have a latch to any
1011
996
                                undo log page; the caller must have reserved
1012
997
                                the rollback segment mutex */
1013
998
{
1023
1008
        undo->size--;
1024
1009
}
1025
1010
 
1026
 
/********************************************************************//**
 
1011
/************************************************************************
1027
1012
Empties an undo log header page of undo records for that undo log. Other
1028
1013
undo logs may still have records on that page, if it is an update undo log. */
1029
1014
static
1030
1015
void
1031
1016
trx_undo_empty_header_page(
1032
1017
/*=======================*/
1033
 
        ulint   space,          /*!< in: space */
1034
 
        ulint   zip_size,       /*!< in: compressed page size in bytes
 
1018
        ulint   space,          /* in: space */
 
1019
        ulint   zip_size,       /* in: compressed page size in bytes
1035
1020
                                or 0 for uncompressed pages */
1036
 
        ulint   hdr_page_no,    /*!< in: header page number */
1037
 
        ulint   hdr_offset,     /*!< in: header offset */
1038
 
        mtr_t*  mtr)            /*!< in: mtr */
 
1021
        ulint   hdr_page_no,    /* in: header page number */
 
1022
        ulint   hdr_offset,     /* in: header offset */
 
1023
        mtr_t*  mtr)            /* in: mtr */
1039
1024
{
1040
1025
        page_t*         header_page;
1041
1026
        trx_ulogf_t*    log_hdr;
1050
1035
        mlog_write_ulint(log_hdr + TRX_UNDO_LOG_START, end, MLOG_2BYTES, mtr);
1051
1036
}
1052
1037
 
1053
 
/***********************************************************************//**
 
1038
/***************************************************************************
1054
1039
Truncates an undo log from the end. This function is used during a rollback
1055
1040
to free space from an undo log. */
1056
1041
UNIV_INTERN
1057
1042
void
1058
1043
trx_undo_truncate_end(
1059
1044
/*==================*/
1060
 
        trx_t*          trx,    /*!< in: transaction whose undo log it is */
1061
 
        trx_undo_t*     undo,   /*!< in: undo log */
1062
 
        undo_no_t       limit)  /*!< in: all undo records with undo number
 
1045
        trx_t*          trx,    /* in: transaction whose undo log it is */
 
1046
        trx_undo_t*     undo,   /* in: undo log */
 
1047
        dulint          limit)  /* in: all undo records with undo number
1063
1048
                                >= this value should be truncated */
1064
1049
{
1065
1050
        page_t*         undo_page;
1125
1110
        mtr_commit(&mtr);
1126
1111
}
1127
1112
 
1128
 
/***********************************************************************//**
 
1113
/***************************************************************************
1129
1114
Truncates an undo log from the start. This function is used during a purge
1130
1115
operation. */
1131
1116
UNIV_INTERN
1132
1117
void
1133
1118
trx_undo_truncate_start(
1134
1119
/*====================*/
1135
 
        trx_rseg_t*     rseg,           /*!< in: rollback segment */
1136
 
        ulint           space,          /*!< in: space id of the log */
1137
 
        ulint           hdr_page_no,    /*!< in: header page number */
1138
 
        ulint           hdr_offset,     /*!< in: header offset on the page */
1139
 
        undo_no_t       limit)          /*!< in: all undo pages with
1140
 
                                        undo numbers < this value
1141
 
                                        should be truncated; NOTE that
1142
 
                                        the function only frees whole
1143
 
                                        pages; the header page is not
1144
 
                                        freed, but emptied, if all the
1145
 
                                        records there are < limit */
 
1120
        trx_rseg_t* rseg,       /* in: rollback segment */
 
1121
        ulint   space,          /* in: space id of the log */
 
1122
        ulint   hdr_page_no,    /* in: header page number */
 
1123
        ulint   hdr_offset,     /* in: header offset on the page */
 
1124
        dulint  limit)          /* in: all undo pages with undo numbers <
 
1125
                                this value should be truncated; NOTE that
 
1126
                                the function only frees whole pages; the
 
1127
                                header page is not freed, but emptied, if
 
1128
                                all the records there are < limit */
1146
1129
{
1147
1130
        page_t*         undo_page;
1148
1131
        trx_undo_rec_t* rec;
1197
1180
        goto loop;
1198
1181
}
1199
1182
 
1200
 
/**********************************************************************//**
 
1183
/**************************************************************************
1201
1184
Frees an undo log segment which is not in the history list. */
1202
1185
static
1203
1186
void
1204
1187
trx_undo_seg_free(
1205
1188
/*==============*/
1206
 
        trx_undo_t*     undo)   /*!< in: undo log */
 
1189
        trx_undo_t*     undo)   /* in: undo log */
1207
1190
{
1208
1191
        trx_rseg_t*     rseg;
1209
1192
        fseg_header_t*  file_seg;
1246
1229
 
1247
1230
/*========== UNDO LOG MEMORY COPY INITIALIZATION =====================*/
1248
1231
 
1249
 
/********************************************************************//**
 
1232
/************************************************************************
1250
1233
Creates and initializes an undo log memory object according to the values
1251
1234
in the header in file, when the database is started. The memory object is
1252
 
inserted in the appropriate list of rseg.
1253
 
@return own: the undo log memory object */
 
1235
inserted in the appropriate list of rseg. */
1254
1236
static
1255
1237
trx_undo_t*
1256
1238
trx_undo_mem_create_at_db_start(
1257
1239
/*============================*/
1258
 
        trx_rseg_t*     rseg,   /*!< in: rollback segment memory object */
1259
 
        ulint           id,     /*!< in: slot index within rseg */
1260
 
        ulint           page_no,/*!< in: undo log segment page number */
1261
 
        mtr_t*          mtr)    /*!< in: mtr */
 
1240
                                /* out, own: the undo log memory object */
 
1241
        trx_rseg_t*     rseg,   /* in: rollback segment memory object */
 
1242
        ulint           id,     /* in: slot index within rseg */
 
1243
        ulint           page_no,/* in: undo log segment page number */
 
1244
        mtr_t*          mtr)    /* in: mtr */
1262
1245
{
1263
1246
        page_t*         undo_page;
1264
1247
        trx_upagef_t*   page_header;
1267
1250
        trx_undo_t*     undo;
1268
1251
        ulint           type;
1269
1252
        ulint           state;
1270
 
        trx_id_t        trx_id;
 
1253
        dulint          trx_id;
1271
1254
        ulint           offset;
1272
1255
        fil_addr_t      last_addr;
1273
1256
        page_t*         last_page;
1370
1353
        return(undo);
1371
1354
}
1372
1355
 
1373
 
/********************************************************************//**
 
1356
/************************************************************************
1374
1357
Initializes the undo log lists for a rollback segment memory copy. This
1375
1358
function is only called when the database is started or a new rollback
1376
 
segment is created.
1377
 
@return the combined size of undo log segments in pages */
 
1359
segment is created. */
1378
1360
UNIV_INTERN
1379
1361
ulint
1380
1362
trx_undo_lists_init(
1381
1363
/*================*/
1382
 
        trx_rseg_t*     rseg)   /*!< in: rollback segment memory object */
 
1364
                                /* out: the combined size of undo log segments
 
1365
                                in pages */
 
1366
        trx_rseg_t*     rseg)   /* in: rollback segment memory object */
1383
1367
{
1384
1368
        ulint           page_no;
1385
1369
        trx_undo_t*     undo;
1428
1412
        return(size);
1429
1413
}
1430
1414
 
1431
 
/********************************************************************//**
1432
 
Creates and initializes an undo log memory object.
1433
 
@return own: the undo log memory object */
 
1415
/************************************************************************
 
1416
Creates and initializes an undo log memory object. */
1434
1417
static
1435
1418
trx_undo_t*
1436
1419
trx_undo_mem_create(
1437
1420
/*================*/
1438
 
        trx_rseg_t*     rseg,   /*!< in: rollback segment memory object */
1439
 
        ulint           id,     /*!< in: slot index within rseg */
1440
 
        ulint           type,   /*!< in: type of the log: TRX_UNDO_INSERT or
 
1421
                                /* out, own: the undo log memory object */
 
1422
        trx_rseg_t*     rseg,   /* in: rollback segment memory object */
 
1423
        ulint           id,     /* in: slot index within rseg */
 
1424
        ulint           type,   /* in: type of the log: TRX_UNDO_INSERT or
1441
1425
                                TRX_UNDO_UPDATE */
1442
 
        trx_id_t        trx_id, /*!< in: id of the trx for which the undo log
 
1426
        dulint          trx_id, /* in: id of the trx for which the undo log
1443
1427
                                is created */
1444
 
        const XID*      xid,    /*!< in: X/Open transaction identification */
1445
 
        ulint           page_no,/*!< in: undo log header page number */
1446
 
        ulint           offset) /*!< in: undo log header byte offset on page */
 
1428
        const XID*      xid,    /* in: X/Open transaction identification */
 
1429
        ulint           page_no,/* in: undo log header page number */
 
1430
        ulint           offset) /* in: undo log header byte offset on page */
1447
1431
{
1448
1432
        trx_undo_t*     undo;
1449
1433
 
1487
1471
        return(undo);
1488
1472
}
1489
1473
 
1490
 
/********************************************************************//**
 
1474
/************************************************************************
1491
1475
Initializes a cached undo log object for new use. */
1492
1476
static
1493
1477
void
1494
1478
trx_undo_mem_init_for_reuse(
1495
1479
/*========================*/
1496
 
        trx_undo_t*     undo,   /*!< in: undo log to init */
1497
 
        trx_id_t        trx_id, /*!< in: id of the trx for which the undo log
 
1480
        trx_undo_t*     undo,   /* in: undo log to init */
 
1481
        dulint          trx_id, /* in: id of the trx for which the undo log
1498
1482
                                is created */
1499
 
        const XID*      xid,    /*!< in: X/Open XA transaction identification*/
1500
 
        ulint           offset) /*!< in: undo log header byte offset on page */
 
1483
        const XID*      xid,    /* in: X/Open XA transaction identification*/
 
1484
        ulint           offset) /* in: undo log header byte offset on page */
1501
1485
{
1502
1486
        ut_ad(mutex_own(&((undo->rseg)->mutex)));
1503
1487
 
1520
1504
        undo->empty = TRUE;
1521
1505
}
1522
1506
 
1523
 
/********************************************************************//**
 
1507
/************************************************************************
1524
1508
Frees an undo log memory copy. */
1525
1509
static
1526
1510
void
1527
1511
trx_undo_mem_free(
1528
1512
/*==============*/
1529
 
        trx_undo_t*     undo)   /*!< in: the undo object to be freed */
 
1513
        trx_undo_t*     undo)   /* in: the undo object to be freed */
1530
1514
{
1531
1515
        if (undo->id >= TRX_RSEG_N_SLOTS) {
1532
1516
                fprintf(stderr,
1537
1521
        mem_free(undo);
1538
1522
}
1539
1523
 
1540
 
/**********************************************************************//**
1541
 
Creates a new undo log.
1542
 
@return DB_SUCCESS if successful in creating the new undo lob object,
1543
 
possible error codes are: DB_TOO_MANY_CONCURRENT_TRXS
1544
 
DB_OUT_OF_FILE_SPACE DB_OUT_OF_MEMORY */
 
1524
/**************************************************************************
 
1525
Creates a new undo log. */
1545
1526
static
1546
1527
ulint
1547
1528
trx_undo_create(
1548
1529
/*============*/
1549
 
        trx_t*          trx,    /*!< in: transaction */
1550
 
        trx_rseg_t*     rseg,   /*!< in: rollback segment memory copy */
1551
 
        ulint           type,   /*!< in: type of the log: TRX_UNDO_INSERT or
 
1530
                                /* out: DB_SUCCESS if successful in creating
 
1531
                                the new undo lob object, possible error
 
1532
                                codes are: 
 
1533
                                DB_TOO_MANY_CONCURRENT_TRXS
 
1534
                                DB_OUT_OF_FILE_SPACE 
 
1535
                                DB_OUT_OF_MEMORY*/
 
1536
        trx_t*          trx,    /* in: transaction */
 
1537
        trx_rseg_t*     rseg,   /* in: rollback segment memory copy */
 
1538
        ulint           type,   /* in: type of the log: TRX_UNDO_INSERT or
1552
1539
                                TRX_UNDO_UPDATE */
1553
 
        trx_id_t        trx_id, /*!< in: id of the trx for which the undo log
 
1540
        dulint          trx_id, /* in: id of the trx for which the undo log
1554
1541
                                is created */
1555
 
        const XID*      xid,    /*!< in: X/Open transaction identification*/
1556
 
        trx_undo_t**    undo,   /*!< out: the new undo log object, undefined
 
1542
        const XID*      xid,    /* in: X/Open transaction identification*/
 
1543
        trx_undo_t**    undo,   /* out: the new undo log object, undefined
1557
1544
                                 * if did not succeed */
1558
 
        mtr_t*          mtr)    /*!< in: mtr */
 
1545
        mtr_t*          mtr)    /* in: mtr */
1559
1546
{
1560
1547
        trx_rsegf_t*    rseg_header;
1561
1548
        ulint           page_no;
1608
1595
 
1609
1596
/*================ UNDO LOG ASSIGNMENT AND CLEANUP =====================*/
1610
1597
 
1611
 
/********************************************************************//**
1612
 
Reuses a cached undo log.
1613
 
@return the undo log memory object, NULL if none cached */
 
1598
/************************************************************************
 
1599
Reuses a cached undo log. */
1614
1600
static
1615
1601
trx_undo_t*
1616
1602
trx_undo_reuse_cached(
1617
1603
/*==================*/
1618
 
        trx_t*          trx,    /*!< in: transaction */
1619
 
        trx_rseg_t*     rseg,   /*!< in: rollback segment memory object */
1620
 
        ulint           type,   /*!< in: type of the log: TRX_UNDO_INSERT or
 
1604
                                /* out: the undo log memory object, NULL if
 
1605
                                none cached */
 
1606
        trx_t*          trx,    /* in: transaction */
 
1607
        trx_rseg_t*     rseg,   /* in: rollback segment memory object */
 
1608
        ulint           type,   /* in: type of the log: TRX_UNDO_INSERT or
1621
1609
                                TRX_UNDO_UPDATE */
1622
 
        trx_id_t        trx_id, /*!< in: id of the trx for which the undo log
 
1610
        dulint          trx_id, /* in: id of the trx for which the undo log
1623
1611
                                is used */
1624
 
        const XID*      xid,    /*!< in: X/Open XA transaction identification */
1625
 
        mtr_t*          mtr)    /*!< in: mtr */
 
1612
        const XID*      xid,    /* in: X/Open XA transaction identification */
 
1613
        mtr_t*          mtr)    /* in: mtr */
1626
1614
{
1627
1615
        trx_undo_t*     undo;
1628
1616
        page_t*         undo_page;
1688
1676
        return(undo);
1689
1677
}
1690
1678
 
1691
 
/**********************************************************************//**
 
1679
/**************************************************************************
1692
1680
Marks an undo log header as a header of a data dictionary operation
1693
1681
transaction. */
1694
1682
static
1695
1683
void
1696
1684
trx_undo_mark_as_dict_operation(
1697
1685
/*============================*/
1698
 
        trx_t*          trx,    /*!< in: dict op transaction */
1699
 
        trx_undo_t*     undo,   /*!< in: assigned undo log */
1700
 
        mtr_t*          mtr)    /*!< in: mtr */
 
1686
        trx_t*          trx,    /* in: dict op transaction */
 
1687
        trx_undo_t*     undo,   /* in: assigned undo log */
 
1688
        mtr_t*          mtr)    /* in: mtr */
1701
1689
{
1702
1690
        page_t* hdr_page;
1703
1691
 
1726
1714
        undo->dict_operation = TRUE;
1727
1715
}
1728
1716
 
1729
 
/**********************************************************************//**
 
1717
/**************************************************************************
1730
1718
Assigns an undo log for a transaction. A new undo log is created or a cached
1731
 
undo log reused.
1732
 
@return DB_SUCCESS if undo log assign successful, possible error codes
1733
 
are: DB_TOO_MANY_CONCURRENT_TRXS DB_OUT_OF_FILE_SPACE
1734
 
DB_OUT_OF_MEMORY */
 
1719
undo log reused. */
1735
1720
UNIV_INTERN
1736
1721
ulint
1737
1722
trx_undo_assign_undo(
1738
1723
/*=================*/
1739
 
        trx_t*          trx,    /*!< in: transaction */
1740
 
        ulint           type)   /*!< in: TRX_UNDO_INSERT or TRX_UNDO_UPDATE */
 
1724
                                /* out: DB_SUCCESS if undo log assign
 
1725
                                successful, possible error codes are:
 
1726
                                DB_TOO_MANY_CONCURRENT_TRXS
 
1727
                                DB_OUT_OF_FILE_SPACE DB_OUT_OF_MEMORY*/
 
1728
        trx_t*          trx,    /* in: transaction */
 
1729
        ulint           type)   /* in: TRX_UNDO_INSERT or TRX_UNDO_UPDATE */
1741
1730
{
1742
1731
        trx_rseg_t*     rseg;
1743
1732
        trx_undo_t*     undo;
1789
1778
        return err;
1790
1779
}
1791
1780
 
1792
 
/******************************************************************//**
1793
 
Sets the state of the undo log segment at a transaction finish.
1794
 
@return undo log segment header page, x-latched */
 
1781
/**********************************************************************
 
1782
Sets the state of the undo log segment at a transaction finish. */
1795
1783
UNIV_INTERN
1796
1784
page_t*
1797
1785
trx_undo_set_state_at_finish(
1798
1786
/*=========================*/
1799
 
        trx_rseg_t*     rseg,   /*!< in: rollback segment memory object */
1800
 
        trx_t*          trx __attribute__((unused)), /*!< in: transaction */
1801
 
        trx_undo_t*     undo,   /*!< in: undo log memory copy */
1802
 
        mtr_t*          mtr)    /*!< in: mtr */
 
1787
                                /* out: undo log segment header page,
 
1788
                                x-latched */
 
1789
        trx_rseg_t*     rseg,   /* in: rollback segment memory object */
 
1790
        trx_t*          trx __attribute__((unused)), /* in: transaction */
 
1791
        trx_undo_t*     undo,   /* in: undo log memory copy */
 
1792
        mtr_t*          mtr)    /* in: mtr */
1803
1793
{
1804
1794
        trx_usegf_t*    seg_hdr;
1805
1795
        trx_upagef_t*   page_hdr;
1856
1846
        return(undo_page);
1857
1847
}
1858
1848
 
1859
 
/******************************************************************//**
1860
 
Sets the state of the undo log segment at a transaction prepare.
1861
 
@return undo log segment header page, x-latched */
 
1849
/**********************************************************************
 
1850
Sets the state of the undo log segment at a transaction prepare. */
1862
1851
UNIV_INTERN
1863
1852
page_t*
1864
1853
trx_undo_set_state_at_prepare(
1865
1854
/*==========================*/
1866
 
        trx_t*          trx,    /*!< in: transaction */
1867
 
        trx_undo_t*     undo,   /*!< in: undo log memory copy */
1868
 
        mtr_t*          mtr)    /*!< in: mtr */
 
1855
                                /* out: undo log segment header page,
 
1856
                                x-latched */
 
1857
        trx_t*          trx,    /* in: transaction */
 
1858
        trx_undo_t*     undo,   /* in: undo log memory copy */
 
1859
        mtr_t*          mtr)    /* in: mtr */
1869
1860
{
1870
1861
        trx_usegf_t*    seg_hdr;
1871
1862
        trx_upagef_t*   page_hdr;
1907
1898
        return(undo_page);
1908
1899
}
1909
1900
 
1910
 
/**********************************************************************//**
 
1901
/**************************************************************************
1911
1902
Adds the update undo log header as the first in the history list, and
1912
1903
frees the memory object, or puts it to the list of cached update undo log
1913
1904
segments. */
1915
1906
void
1916
1907
trx_undo_update_cleanup(
1917
1908
/*====================*/
1918
 
        trx_t*  trx,            /*!< in: trx owning the update undo log */
1919
 
        page_t* undo_page,      /*!< in: update undo log header page,
 
1909
        trx_t*  trx,            /* in: trx owning the update undo log */
 
1910
        page_t* undo_page,      /* in: update undo log header page,
1920
1911
                                x-latched */
1921
 
        mtr_t*  mtr)            /*!< in: mtr */
 
1912
        mtr_t*  mtr)            /* in: mtr */
1922
1913
{
1923
1914
        trx_rseg_t*     rseg;
1924
1915
        trx_undo_t*     undo;
1944
1935
        }
1945
1936
}
1946
1937
 
1947
 
/******************************************************************//**
 
1938
/**********************************************************************
1948
1939
Frees or caches an insert undo log after a transaction commit or rollback.
1949
1940
Knowledge of inserts is not needed after a commit or rollback, therefore
1950
1941
the data can be discarded. */
1952
1943
void
1953
1944
trx_undo_insert_cleanup(
1954
1945
/*====================*/
1955
 
        trx_t*  trx)    /*!< in: transaction handle */
 
1946
        trx_t*  trx)    /* in: transaction handle */
1956
1947
{
1957
1948
        trx_undo_t*     undo;
1958
1949
        trx_rseg_t*     rseg;
1990
1981
 
1991
1982
        mutex_exit(&(rseg->mutex));
1992
1983
}
1993
 
#endif /* !UNIV_HOTBACKUP */