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 */
98
/********************************************************************//**
95
/************************************************************************
99
96
Initializes the fields in an undo log segment page. */
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 */
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. */
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
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! */
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,
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. */
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 */
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 */
144
/***************************************************************************
145
Gets the previous record in an undo log from the previous page. */
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,
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 */
185
180
return(trx_undo_page_get_last_rec(prev_page, page_no, offset));
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. */
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,
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 */
200
196
trx_undo_rec_t* prev_rec;
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. */
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
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 */
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));
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. */
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,
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 */
296
294
RW_S_LATCH, mtr));
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. */
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
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 */
314
313
page_t* undo_page;
315
314
trx_undo_rec_t* rec;
335
334
/*============== UNDO LOG FILE COPY CREATION AND FREEING ==================*/
337
/**********************************************************************//**
336
/**************************************************************************
338
337
Writes the mtr log entry of an undo log page initialization. */
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 */
347
346
mlog_write_initial_log_record(undo_page, MLOG_UNDO_INIT, mtr);
349
348
mlog_catenate_ulint_compressed(mtr, type);
351
#else /* !UNIV_HOTBACKUP */
352
# define trx_undo_page_init_log(undo_page,type,mtr) ((void) 0)
353
#endif /* !UNIV_HOTBACKUP */
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. */
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 */
406
402
trx_undo_page_init_log(undo_page, type, mtr);
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. */
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
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 */
506
/**********************************************************************//**
503
/**************************************************************************
507
504
Writes the mtr log entry of an undo log header initialization. */
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 */
516
513
mlog_write_initial_log_record(undo_page, MLOG_UNDO_HDR_CREATE, mtr);
518
515
mlog_catenate_dulint_compressed(mtr, trx_id);
520
#else /* !UNIV_HOTBACKUP */
521
# define trx_undo_header_create_log(undo_page,trx_id,mtr) ((void) 0)
522
#endif /* !UNIV_HOTBACKUP */
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
528
@return header byte offset on page */
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
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
531
dulint trx_id, /* in: transaction id */
532
mtr_t* mtr) /* in: mtr */
541
534
trx_upagef_t* page_hdr;
542
535
trx_usegf_t* seg_hdr;
675
667
MLOG_2BYTES, mtr);
678
/**********************************************************************//**
670
/**************************************************************************
679
671
Writes the mtr log entry of an undo log header reuse. */
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 */
688
680
mlog_write_initial_log_record(undo_page, MLOG_UNDO_HDR_REUSE, mtr);
690
682
mlog_catenate_dulint_compressed(mtr, trx_id);
692
#else /* !UNIV_HOTBACKUP */
693
# define trx_undo_insert_header_reuse_log(undo_page,trx_id,mtr) ((void) 0)
694
#endif /* !UNIV_HOTBACKUP */
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. */
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 */
711
700
ptr = mach_dulint_parse_compressed(ptr, end_ptr, &trx_id);
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! */
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,
730
dulint trx_id, /* in: transaction id */
731
mtr_t* mtr) /* in: mtr */
744
733
trx_upagef_t* page_hdr;
745
734
trx_usegf_t* seg_hdr;
790
#ifndef UNIV_HOTBACKUP
791
/**********************************************************************//**
779
/**************************************************************************
792
780
Writes the redo log entry of an update undo log header discard. */
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 */
800
788
mlog_write_initial_log_record(undo_page, MLOG_UNDO_HDR_DISCARD, mtr);
802
#else /* !UNIV_HOTBACKUP */
803
# define trx_undo_discard_latest_log(undo_page, mtr) ((void) 0)
804
#endif /* !UNIV_HOTBACKUP */
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. */
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 */
866
851
trx_undo_discard_latest_log(undo_page, mtr);
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. */
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
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 */
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. */
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
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
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 */
996
981
return(last_addr.page);
999
/********************************************************************//**
984
/************************************************************************
1000
985
Frees an undo log page when there is also the memory object for the undo
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
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 */
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. */
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 */
1040
1025
page_t* header_page;
1041
1026
trx_ulogf_t* log_hdr;
1125
1110
mtr_commit(&mtr);
1128
/***********************************************************************//**
1113
/***************************************************************************
1129
1114
Truncates an undo log from the start. This function is used during a purge
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 */
1147
1130
page_t* undo_page;
1148
1131
trx_undo_rec_t* rec;
1247
1230
/*========== UNDO LOG MEMORY COPY INITIALIZATION =====================*/
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. */
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 */
1263
1246
page_t* undo_page;
1264
1247
trx_upagef_t* page_header;
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. */
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
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 */
1448
1432
trx_undo_t* undo;
1490
/********************************************************************//**
1474
/************************************************************************
1491
1475
Initializes a cached undo log object for new use. */
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
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 */
1502
1486
ut_ad(mutex_own(&((undo->rseg)->mutex)));
1537
1521
mem_free(undo);
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. */
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
1533
DB_TOO_MANY_CONCURRENT_TRXS
1534
DB_OUT_OF_FILE_SPACE
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
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 */
1560
1547
trx_rsegf_t* rseg_header;
1609
1596
/*================ UNDO LOG ASSIGNMENT AND CLEANUP =====================*/
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. */
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
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
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 */
1627
1615
trx_undo_t* undo;
1628
1616
page_t* undo_page;
1726
1714
undo->dict_operation = TRUE;
1729
/**********************************************************************//**
1717
/**************************************************************************
1730
1718
Assigns an undo log for a transaction. A new undo log is created or a cached
1732
@return DB_SUCCESS if undo log assign successful, possible error codes
1733
are: DB_TOO_MANY_CONCURRENT_TRXS DB_OUT_OF_FILE_SPACE
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 */
1742
1731
trx_rseg_t* rseg;
1743
1732
trx_undo_t* undo;
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. */
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,
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 */
1804
1794
trx_usegf_t* seg_hdr;
1805
1795
trx_upagef_t* page_hdr;
1856
1846
return(undo_page);
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. */
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,
1857
trx_t* trx, /* in: transaction */
1858
trx_undo_t* undo, /* in: undo log memory copy */
1859
mtr_t* mtr) /* in: mtr */
1870
1861
trx_usegf_t* seg_hdr;
1871
1862
trx_upagef_t* page_hdr;