31
32
#include "fsp0fsp.h"
32
33
#include "mach0data.h"
35
34
#include "trx0undo.h"
36
#ifndef UNIV_HOTBACKUP
36
37
#include "dict0dict.h"
37
38
#include "ut0mem.h"
38
39
#include "row0ext.h"
39
40
#include "row0upd.h"
40
41
#include "que0que.h"
41
42
#include "trx0purge.h"
42
44
#include "row0row.h"
44
46
/*=========== UNDO LOG RECORD CREATION AND DECODING ====================*/
46
/**************************************************************************
48
/**********************************************************************//**
47
49
Writes the mtr log entry of the inserted undo log record on the undo log
51
53
trx_undof_page_add_undo_rec_log(
52
54
/*============================*/
53
page_t* undo_page, /* in: undo log page */
54
ulint old_free, /* in: start offset of the inserted entry */
55
ulint new_free, /* in: end offset of the entry */
56
mtr_t* mtr) /* in: mtr */
55
page_t* undo_page, /*!< in: undo log page */
56
ulint old_free, /*!< in: start offset of the inserted entry */
57
ulint new_free, /*!< in: end offset of the entry */
58
mtr_t* mtr) /*!< in: mtr */
59
61
const byte* log_end;
82
84
mlog_catenate_string(mtr, undo_page + old_free + 2, len);
87
#endif /* !UNIV_HOTBACKUP */
86
/***************************************************************
87
Parses a redo log record of adding an undo log record. */
89
/***********************************************************//**
90
Parses a redo log record of adding an undo log record.
91
@return end of log record or NULL */
90
94
trx_undo_parse_add_undo_rec(
91
95
/*========================*/
92
/* out: end of log record or NULL */
93
byte* ptr, /* in: buffer */
94
byte* end_ptr,/* in: buffer end */
95
page_t* page) /* in: page or NULL */
96
byte* ptr, /*!< in: buffer */
97
byte* end_ptr,/*!< in: buffer end */
98
page_t* page) /*!< in: page or NULL */
130
133
return(ptr + len);
133
/**************************************************************************
134
Calculates the free space left for extending an undo log record. */
136
#ifndef UNIV_HOTBACKUP
137
/**********************************************************************//**
138
Calculates the free space left for extending an undo log record.
139
@return bytes left */
139
/* out: bytes left */
140
const page_t* page, /* in: undo log page */
141
const byte* ptr) /* in: pointer to page */
144
const page_t* page, /*!< in: undo log page */
145
const byte* ptr) /*!< in: pointer to page */
143
147
/* The '- 10' is a safety margin, in case we have some small
144
148
calculation error below */
146
150
return(UNIV_PAGE_SIZE - (ptr - page) - 10 - FIL_PAGE_DATA_END);
149
/**************************************************************************
153
/**********************************************************************//**
150
154
Set the next and previous pointers in the undo page for the undo record
151
155
that was written to ptr. Update the first free value by the number of bytes
152
written for this undo record.*/
156
written for this undo record.
157
@return offset of the inserted entry on the page if succeeded, 0 if fail */
155
160
trx_undo_page_set_next_prev_and_add(
156
161
/*================================*/
157
/* out: offset of the inserted entry
158
on the page if succeeded, 0 if fail */
159
page_t* undo_page, /* in/out: undo log page */
160
byte* ptr, /* in: ptr up to where data has been
162
page_t* undo_page, /*!< in/out: undo log page */
163
byte* ptr, /*!< in: ptr up to where data has been
161
164
written on this undo page. */
162
mtr_t* mtr) /* in: mtr */
165
mtr_t* mtr) /*!< in: mtr */
164
ulint first_free; /* offset within undo_page */
165
ulint end_of_rec; /* offset within undo_page */
167
ulint first_free; /*!< offset within undo_page */
168
ulint end_of_rec; /*!< offset within undo_page */
166
169
byte* ptr_to_first_free;
167
170
/* pointer within undo_page
168
171
that points to the next free
199
202
return(first_free);
202
/**************************************************************************
203
Reports in the undo log of an insert of a clustered index record. */
205
/**********************************************************************//**
206
Reports in the undo log of an insert of a clustered index record.
207
@return offset of the inserted entry on the page if succeed, 0 if fail */
206
210
trx_undo_page_report_insert(
207
211
/*========================*/
208
/* out: offset of the inserted entry
209
on the page if succeed, 0 if fail */
210
page_t* undo_page, /* in: undo log page */
211
trx_t* trx, /* in: transaction */
212
dict_index_t* index, /* in: clustered index */
213
const dtuple_t* clust_entry, /* in: index entry which will be
212
page_t* undo_page, /*!< in: undo log page */
213
trx_t* trx, /*!< in: transaction */
214
dict_index_t* index, /*!< in: clustered index */
215
const dtuple_t* clust_entry, /*!< in: index entry which will be
214
216
inserted to the clustered index */
215
mtr_t* mtr) /* in: mtr */
217
mtr_t* mtr) /*!< in: mtr */
217
219
ulint first_free;
272
274
return(trx_undo_page_set_next_prev_and_add(undo_page, ptr, mtr));
275
/**************************************************************************
276
Reads from an undo log record the general parameters. */
277
/**********************************************************************//**
278
Reads from an undo log record the general parameters.
279
@return remaining part of undo log record after reading these values */
279
282
trx_undo_rec_get_pars(
280
283
/*==================*/
281
/* out: remaining part of undo log
282
record after reading these values */
283
trx_undo_rec_t* undo_rec, /* in: undo log record */
284
ulint* type, /* out: undo record type:
284
trx_undo_rec_t* undo_rec, /*!< in: undo log record */
285
ulint* type, /*!< out: undo record type:
285
286
TRX_UNDO_INSERT_REC, ... */
286
ulint* cmpl_info, /* out: compiler info, relevant only
287
ulint* cmpl_info, /*!< out: compiler info, relevant only
287
288
for update type records */
288
ibool* updated_extern, /* out: TRUE if we updated an
289
ibool* updated_extern, /*!< out: TRUE if we updated an
289
290
externally stored fild */
290
dulint* undo_no, /* out: undo log record number */
291
dulint* table_id) /* out: table id */
291
undo_no_t* undo_no, /*!< out: undo log record number */
292
dulint* table_id) /*!< out: table id */
320
/**************************************************************************
321
Reads from an undo log record a stored column value. */
321
/**********************************************************************//**
322
Reads from an undo log record a stored column value.
323
@return remaining part of undo log record after reading these values */
324
326
trx_undo_rec_get_col_val(
325
327
/*=====================*/
326
/* out: remaining part of undo log record after
327
reading these values */
328
byte* ptr, /* in: pointer to remaining part of undo log record */
329
byte** field, /* out: pointer to stored field */
330
ulint* len, /* out: length of the field, or UNIV_SQL_NULL */
331
ulint* orig_len)/* out: original length of the locally
328
byte* ptr, /*!< in: pointer to remaining part of undo log record */
329
byte** field, /*!< out: pointer to stored field */
330
ulint* len, /*!< out: length of the field, or UNIV_SQL_NULL */
331
ulint* orig_len)/*!< out: original length of the locally
332
332
stored part of an externally stored column, or 0 */
334
334
*len = mach_read_compressed(ptr);
370
/***********************************************************************
371
Builds a row reference from an undo log record. */
370
/*******************************************************************//**
371
Builds a row reference from an undo log record.
372
@return pointer to remaining part of undo record */
374
375
trx_undo_rec_get_row_ref(
375
376
/*=====================*/
376
/* out: pointer to remaining part of undo
378
byte* ptr, /* in: remaining part of a copy of an undo log
377
byte* ptr, /*!< in: remaining part of a copy of an undo log
379
378
record, at the start of the row reference;
380
379
NOTE that this copy of the undo log record must
381
380
be preserved as long as the row reference is
382
381
used, as we do NOT copy the data in the
384
dict_index_t* index, /* in: clustered index */
385
dtuple_t** ref, /* out, own: row reference */
386
mem_heap_t* heap) /* in: memory heap from which the memory
383
dict_index_t* index, /*!< in: clustered index */
384
dtuple_t** ref, /*!< out, own: row reference */
385
mem_heap_t* heap) /*!< in: memory heap from which the memory
387
386
needed is allocated */
417
/***********************************************************************
418
Skips a row reference from an undo log record. */
416
/*******************************************************************//**
417
Skips a row reference from an undo log record.
418
@return pointer to remaining part of undo record */
421
421
trx_undo_rec_skip_row_ref(
422
422
/*======================*/
423
/* out: pointer to remaining part of undo
425
byte* ptr, /* in: remaining part in update undo log
423
byte* ptr, /*!< in: remaining part in update undo log
426
424
record, at the start of the row reference */
427
dict_index_t* index) /* in: clustered index */
425
dict_index_t* index) /*!< in: clustered index */
448
/**************************************************************************
446
/**********************************************************************//**
449
447
Fetch a prefix of an externally stored column, for writing to the undo log
450
of an update or delete marking of a clustered index record. */
448
of an update or delete marking of a clustered index record.
453
452
trx_undo_page_fetch_ext(
454
453
/*====================*/
456
byte* ext_buf, /* in: a buffer of
454
byte* ext_buf, /*!< in: a buffer of
457
455
REC_MAX_INDEX_COL_LEN
458
456
+ BTR_EXTERN_FIELD_REF_SIZE */
459
ulint zip_size, /* compressed page size in bytes,
457
ulint zip_size, /*!< compressed page size in bytes,
460
458
or 0 for uncompressed BLOB */
461
const byte* field, /* in: an externally stored column */
462
ulint* len) /* in: length of field;
459
const byte* field, /*!< in: an externally stored column */
460
ulint* len) /*!< in: length of field;
463
461
out: used length of ext_buf */
465
463
/* Fetch the BLOB. */
478
/**************************************************************************
479
Writes to the undo log a prefix of an externally stored column. */
476
/**********************************************************************//**
477
Writes to the undo log a prefix of an externally stored column.
478
@return undo log position */
482
481
trx_undo_page_report_modify_ext(
483
482
/*============================*/
484
/* out: undo log position */
485
byte* ptr, /* in: undo log position,
483
byte* ptr, /*!< in: undo log position,
486
484
at least 15 bytes must be available */
487
byte* ext_buf, /* in: a buffer of
485
byte* ext_buf, /*!< in: a buffer of
488
486
REC_MAX_INDEX_COL_LEN
489
487
+ BTR_EXTERN_FIELD_REF_SIZE,
490
488
or NULL when should not fetch
491
489
a longer prefix */
492
ulint zip_size, /* compressed page size in bytes,
490
ulint zip_size, /*!< compressed page size in bytes,
493
491
or 0 for uncompressed BLOB */
494
const byte** field, /* in/out: the locally stored part of
492
const byte** field, /*!< in/out: the locally stored part of
495
493
the externally stored column */
496
ulint* len) /* in/out: length of field, in bytes */
494
ulint* len) /*!< in/out: length of field, in bytes */
499
497
/* If an ordering column is externally stored, we will
519
/**************************************************************************
517
/**********************************************************************//**
520
518
Reports in the undo log of an update or delete marking of a clustered index
520
@return byte offset of the inserted undo log entry on the page if
521
succeed, 0 if fail */
524
524
trx_undo_page_report_modify(
525
525
/*========================*/
526
/* out: byte offset of the inserted
527
undo log entry on the page if succeed,
529
page_t* undo_page, /* in: undo log page */
530
trx_t* trx, /* in: transaction */
531
dict_index_t* index, /* in: clustered index where update or
526
page_t* undo_page, /*!< in: undo log page */
527
trx_t* trx, /*!< in: transaction */
528
dict_index_t* index, /*!< in: clustered index where update or
532
529
delete marking is done */
533
const rec_t* rec, /* in: clustered index record which
530
const rec_t* rec, /*!< in: clustered index record which
534
531
has NOT yet been modified */
535
const ulint* offsets, /* in: rec_get_offsets(rec, index) */
536
const upd_t* update, /* in: update vector which tells the
532
const ulint* offsets, /*!< in: rec_get_offsets(rec, index) */
533
const upd_t* update, /*!< in: update vector which tells the
537
534
columns to be updated; in the case of
538
535
a delete, this should be set to NULL */
539
ulint cmpl_info, /* in: compiler info on secondary
536
ulint cmpl_info, /*!< in: compiler info on secondary
541
mtr_t* mtr) /* in: mtr */
538
mtr_t* mtr) /*!< in: mtr */
543
540
dict_table_t* table;
544
541
ulint first_free;
825
822
return(first_free);
828
/**************************************************************************
825
/**********************************************************************//**
829
826
Reads from an undo log update record the system field values of the old
828
@return remaining part of undo log record after reading these values */
833
831
trx_undo_update_rec_get_sys_cols(
834
832
/*=============================*/
835
/* out: remaining part of undo log
836
record after reading these values */
837
byte* ptr, /* in: remaining part of undo log
838
record after reading general
840
dulint* trx_id, /* out: trx id */
841
dulint* roll_ptr, /* out: roll ptr */
842
ulint* info_bits) /* out: info bits state */
833
byte* ptr, /*!< in: remaining part of undo
834
log record after reading
835
general parameters */
836
trx_id_t* trx_id, /*!< out: trx id */
837
roll_ptr_t* roll_ptr, /*!< out: roll ptr */
838
ulint* info_bits) /*!< out: info bits state */
844
840
/* Read the state of the info bits */
845
841
*info_bits = mach_read_from_1(ptr);
859
/**************************************************************************
860
Reads from an update undo log record the number of updated fields. */
855
/**********************************************************************//**
856
Reads from an update undo log record the number of updated fields.
857
@return remaining part of undo log record after reading this value */
863
860
trx_undo_update_rec_get_n_upd_fields(
864
861
/*=================================*/
865
/* out: remaining part of undo log record after
866
reading this value */
867
byte* ptr, /* in: pointer to remaining part of undo log record */
868
ulint* n) /* out: number of fields */
862
byte* ptr, /*!< in: pointer to remaining part of undo log record */
863
ulint* n) /*!< out: number of fields */
870
865
*n = mach_read_compressed(ptr);
871
866
ptr += mach_get_compressed_size(*n);
876
/**************************************************************************
877
Reads from an update undo log record a stored field number. */
871
/**********************************************************************//**
872
Reads from an update undo log record a stored field number.
873
@return remaining part of undo log record after reading this value */
880
876
trx_undo_update_rec_get_field_no(
881
877
/*=============================*/
882
/* out: remaining part of undo log record after
883
reading this value */
884
byte* ptr, /* in: pointer to remaining part of undo log record */
885
ulint* field_no)/* out: field number */
878
byte* ptr, /*!< in: pointer to remaining part of undo log record */
879
ulint* field_no)/*!< out: field number */
887
881
*field_no = mach_read_compressed(ptr);
888
882
ptr += mach_get_compressed_size(*field_no);
893
/***********************************************************************
894
Builds an update vector based on a remaining part of an undo log record. */
887
/*******************************************************************//**
888
Builds an update vector based on a remaining part of an undo log record.
889
@return remaining part of the record, NULL if an error detected, which
890
means that the record is corrupted */
897
893
trx_undo_update_rec_get_update(
898
894
/*===========================*/
899
/* out: remaining part of the record,
900
NULL if an error detected, which means that
901
the record is corrupted */
902
byte* ptr, /* in: remaining part in update undo log
895
byte* ptr, /*!< in: remaining part in update undo log
903
896
record, after reading the row reference
904
897
NOTE that this copy of the undo log record must
905
898
be preserved as long as the update vector is
906
899
used, as we do NOT copy the data in the
908
dict_index_t* index, /* in: clustered index */
909
ulint type, /* in: TRX_UNDO_UPD_EXIST_REC,
901
dict_index_t* index, /*!< in: clustered index */
902
ulint type, /*!< in: TRX_UNDO_UPD_EXIST_REC,
910
903
TRX_UNDO_UPD_DEL_REC, or
911
904
TRX_UNDO_DEL_MARK_REC; in the last case,
912
905
only trx id and roll ptr fields are added to
913
906
the update vector */
914
dulint trx_id, /* in: transaction id from this undo record */
915
dulint roll_ptr,/* in: roll pointer from this undo record */
916
ulint info_bits,/* in: info bits from this undo record */
917
trx_t* trx, /* in: transaction */
918
mem_heap_t* heap, /* in: memory heap from which the memory
907
trx_id_t trx_id, /*!< in: transaction id from this undo record */
908
roll_ptr_t roll_ptr,/*!< in: roll pointer from this undo record */
909
ulint info_bits,/*!< in: info bits from this undo record */
910
trx_t* trx, /*!< in: transaction */
911
mem_heap_t* heap, /*!< in: memory heap from which the memory
919
912
needed is allocated */
920
upd_t** upd) /* out, own: update vector */
913
upd_t** upd) /*!< out, own: update vector */
922
915
upd_field_t* upd_field;
1015
/***********************************************************************
1008
/*******************************************************************//**
1016
1009
Builds a partial row from an update undo log record. It contains the
1017
columns which occur as ordering in any index of the table. */
1010
columns which occur as ordering in any index of the table.
1011
@return pointer to remaining part of undo record */
1020
1014
trx_undo_rec_get_partial_row(
1021
1015
/*=========================*/
1022
/* out: pointer to remaining part of undo
1024
byte* ptr, /* in: remaining part in update undo log
1016
byte* ptr, /*!< in: remaining part in update undo log
1025
1017
record of a suitable type, at the start of
1026
1018
the stored index columns;
1027
1019
NOTE that this copy of the undo log record must
1028
1020
be preserved as long as the partial row is
1029
1021
used, as we do NOT copy the data in the
1031
dict_index_t* index, /* in: clustered index */
1032
dtuple_t** row, /* out, own: partial row */
1033
ibool ignore_prefix, /* in: flag to indicate if we
1023
dict_index_t* index, /*!< in: clustered index */
1024
dtuple_t** row, /*!< out, own: partial row */
1025
ibool ignore_prefix, /*!< in: flag to indicate if we
1034
1026
expect blob prefixes in undo. Used
1035
1027
only in the assertion. */
1036
mem_heap_t* heap) /* in: memory heap from which the memory
1028
mem_heap_t* heap) /*!< in: memory heap from which the memory
1037
1029
needed is allocated */
1039
1031
const byte* end_ptr;
1087
#endif /* !UNIV_HOTBACKUP */
1096
/***************************************************************************
1089
/***********************************************************************//**
1097
1090
Erases the unused undo log page end. */
1100
1093
trx_undo_erase_page_end(
1101
1094
/*====================*/
1102
page_t* undo_page, /* in: undo page whose end to erase */
1103
mtr_t* mtr) /* in: mtr */
1095
page_t* undo_page, /*!< in: undo page whose end to erase */
1096
mtr_t* mtr) /*!< in: mtr */
1105
1098
ulint first_free;
1112
1105
mlog_write_initial_log_record(undo_page, MLOG_UNDO_ERASE_END, mtr);
1115
/***************************************************************
1116
Parses a redo log record of erasing of an undo page end. */
1108
/***********************************************************//**
1109
Parses a redo log record of erasing of an undo page end.
1110
@return end of log record or NULL */
1119
1113
trx_undo_parse_erase_page_end(
1120
1114
/*==========================*/
1121
/* out: end of log record or NULL */
1122
byte* ptr, /* in: buffer */
1123
byte* end_ptr __attribute__((unused)), /* in: buffer end */
1124
page_t* page, /* in: page or NULL */
1125
mtr_t* mtr) /* in: mtr or NULL */
1115
byte* ptr, /*!< in: buffer */
1116
byte* end_ptr __attribute__((unused)), /*!< in: buffer end */
1117
page_t* page, /*!< in: page or NULL */
1118
mtr_t* mtr) /*!< in: mtr or NULL */
1127
1120
ut_ad(ptr && end_ptr);
1139
/***************************************************************************
1132
#ifndef UNIV_HOTBACKUP
1133
/***********************************************************************//**
1140
1134
Writes information to an undo log about an insert, update, or a delete marking
1141
1135
of a clustered index record. This information is used in a rollback of the
1142
1136
transaction and in consistent reads that must look to the history of this
1138
@return DB_SUCCESS or error code */
1146
1141
trx_undo_report_row_operation(
1147
1142
/*==========================*/
1148
/* out: DB_SUCCESS or error code */
1149
ulint flags, /* in: if BTR_NO_UNDO_LOG_FLAG bit is
1143
ulint flags, /*!< in: if BTR_NO_UNDO_LOG_FLAG bit is
1150
1144
set, does nothing */
1151
ulint op_type, /* in: TRX_UNDO_INSERT_OP or
1145
ulint op_type, /*!< in: TRX_UNDO_INSERT_OP or
1152
1146
TRX_UNDO_MODIFY_OP */
1153
que_thr_t* thr, /* in: query thread */
1154
dict_index_t* index, /* in: clustered index */
1155
const dtuple_t* clust_entry, /* in: in the case of an insert,
1147
que_thr_t* thr, /*!< in: query thread */
1148
dict_index_t* index, /*!< in: clustered index */
1149
const dtuple_t* clust_entry, /*!< in: in the case of an insert,
1156
1150
index entry to insert into the
1157
1151
clustered index, otherwise NULL */
1158
const upd_t* update, /* in: in the case of an update,
1152
const upd_t* update, /*!< in: in the case of an update,
1159
1153
the update vector, otherwise NULL */
1160
ulint cmpl_info, /* in: compiler info on secondary
1154
ulint cmpl_info, /*!< in: compiler info on secondary
1161
1155
index updates */
1162
const rec_t* rec, /* in: in case of an update or delete
1156
const rec_t* rec, /*!< in: in case of an update or delete
1163
1157
marking, the record in the clustered
1164
1158
index, otherwise NULL */
1165
dulint* roll_ptr) /* out: rollback pointer to the
1159
roll_ptr_t* roll_ptr) /*!< out: rollback pointer to the
1166
1160
inserted undo log record,
1167
1161
ut_dulint_zero if BTR_NO_UNDO_LOG
1168
1162
flag was specified */
1325
1319
/*============== BUILDING PREVIOUS VERSION OF A RECORD ===============*/
1327
/**********************************************************************
1321
/******************************************************************//**
1328
1322
Copies an undo record to heap. This function can be called if we know that
1329
the undo log record exists. */
1323
the undo log record exists.
1324
@return own: copy of the record */
1331
1326
trx_undo_rec_t*
1332
1327
trx_undo_get_undo_rec_low(
1333
1328
/*======================*/
1334
/* out, own: copy of the record */
1335
dulint roll_ptr, /* in: roll pointer to record */
1336
mem_heap_t* heap) /* in: memory heap where copied */
1329
roll_ptr_t roll_ptr, /*!< in: roll pointer to record */
1330
mem_heap_t* heap) /*!< in: memory heap where copied */
1338
1332
trx_undo_rec_t* undo_rec;
1360
1354
return(undo_rec);
1363
/**********************************************************************
1364
Copies an undo record to heap. */
1357
/******************************************************************//**
1358
Copies an undo record to heap.
1360
NOTE: the caller must have latches on the clustered index page and
1363
@return DB_SUCCESS, or DB_MISSING_HISTORY if the undo log has been
1364
truncated and we cannot fetch the old version */
1367
1367
trx_undo_get_undo_rec(
1368
1368
/*==================*/
1369
/* out: DB_SUCCESS, or
1370
DB_MISSING_HISTORY if the undo log
1371
has been truncated and we cannot
1372
fetch the old version; NOTE: the
1373
caller must have latches on the
1374
clustered index page and purge_view */
1375
dulint roll_ptr, /* in: roll pointer to record */
1376
dulint trx_id, /* in: id of the trx that generated
1369
roll_ptr_t roll_ptr, /*!< in: roll pointer to record */
1370
trx_id_t trx_id, /*!< in: id of the trx that generated
1377
1371
the roll pointer: it points to an
1378
1372
undo log of this transaction */
1379
trx_undo_rec_t** undo_rec, /* out, own: copy of the record */
1380
mem_heap_t* heap) /* in: memory heap where copied */
1373
trx_undo_rec_t** undo_rec, /*!< out, own: copy of the record */
1374
mem_heap_t* heap) /*!< in: memory heap where copied */
1382
1376
#ifdef UNIV_SYNC_DEBUG
1383
1377
ut_ad(rw_lock_own(&(purge_sys->latch), RW_LOCK_SHARED));
1396
1390
return(DB_SUCCESS);
1399
/***********************************************************************
1393
/*******************************************************************//**
1400
1394
Build a previous version of a clustered index record. This function checks
1401
1395
that the caller has a latch on the index page of the clustered index record
1402
1396
and an s-latch on the purge_view. This guarantees that the stack of versions
1403
is locked all the way down to the purge_view. */
1397
is locked all the way down to the purge_view.
1398
@return DB_SUCCESS, or DB_MISSING_HISTORY if the previous version is
1399
earlier than purge_view, which means that it may have been removed,
1400
DB_ERROR if corrupted record */
1406
1403
trx_undo_prev_version_build(
1407
1404
/*========================*/
1408
/* out: DB_SUCCESS, or DB_MISSING_HISTORY if
1409
the previous version is not >= purge_view,
1410
which means that it may have been removed,
1411
DB_ERROR if corrupted record */
1412
const rec_t* index_rec,/* in: clustered index record in the
1405
const rec_t* index_rec,/*!< in: clustered index record in the
1414
1407
mtr_t* index_mtr __attribute__((unused)),
1415
/* in: mtr which contains the latch to
1408
/*!< in: mtr which contains the latch to
1416
1409
index_rec page and purge_view */
1417
const rec_t* rec, /* in: version of a clustered index record */
1418
dict_index_t* index, /* in: clustered index */
1419
ulint* offsets,/* in: rec_get_offsets(rec, index) */
1420
mem_heap_t* heap, /* in: memory heap from which the memory
1410
const rec_t* rec, /*!< in: version of a clustered index record */
1411
dict_index_t* index, /*!< in: clustered index */
1412
ulint* offsets,/*!< in: rec_get_offsets(rec, index) */
1413
mem_heap_t* heap, /*!< in: memory heap from which the memory
1421
1414
needed is allocated */
1422
rec_t** old_vers)/* out, own: previous version, or NULL if
1415
rec_t** old_vers)/*!< out, own: previous version, or NULL if
1423
1416
rec is the first inserted version, or if
1424
1417
history data has been deleted (an error),
1425
1418
or if the purge COULD have removed the version