29 #include "row0vers.ic"
80 ut_ad(mutex_own(&kernel_mutex));
81 #ifdef UNIV_SYNC_DEBUG
85 mutex_exit(&kernel_mutex);
110 mutex_enter(&kernel_mutex);
117 clust_offsets = rec_get_offsets(clust_rec, clust_index, NULL,
118 ULINT_UNDEFINED, &heap);
123 mutex_enter(&kernel_mutex);
133 clust_offsets, TRUE)) {
163 mutex_exit(&kernel_mutex);
178 clust_index, clust_offsets,
179 heap, &prev_version);
182 if (prev_version == NULL) {
183 mutex_enter(&kernel_mutex);
195 ut_ad(err == DB_SUCCESS);
205 clust_offsets = rec_get_offsets(prev_version, clust_index,
206 NULL, ULINT_UNDEFINED, &heap);
217 if (vers_del && trx_id != prev_trx_id) {
219 mutex_enter(&kernel_mutex);
226 row =
row_build(ROW_COPY_POINTERS, clust_index, prev_version,
227 clust_offsets, NULL, &ext, heap);
235 mutex_enter(&kernel_mutex);
251 ut_ad(err == DB_SUCCESS);
260 if (rec_del != vers_del) {
279 }
else if (!rec_del) {
288 if (trx_id != prev_trx_id) {
295 version = prev_version;
318 #ifdef UNIV_SYNC_DEBUG
356 const rec_t* version;
359 ulint* clust_offsets;
367 ut_ad(mtr_memo_contains_page(mtr, rec, MTR_MEMO_PAGE_X_FIX)
368 || mtr_memo_contains_page(mtr, rec, MTR_MEMO_PAGE_S_FIX));
369 #ifdef UNIV_SYNC_DEBUG
374 clust_index = dict_table_get_first_index(index->
table);
379 clust_offsets = rec_get_offsets(rec, clust_index, NULL,
380 ULINT_UNDEFINED, &heap);
388 row =
row_build(ROW_COPY_POINTERS, clust_index,
389 rec, clust_offsets, NULL, &ext, heap);
427 clust_index, clust_offsets,
428 heap, &prev_version);
431 if (err != DB_SUCCESS || !prev_version) {
439 clust_offsets = rec_get_offsets(prev_version, clust_index,
440 NULL, ULINT_UNDEFINED, &heap);
448 row =
row_build(ROW_COPY_POINTERS, clust_index,
449 prev_version, clust_offsets,
473 version = prev_version;
505 const rec_t* version;
513 ut_ad(mtr_memo_contains_page(mtr, rec, MTR_MEMO_PAGE_X_FIX)
514 || mtr_memo_contains_page(mtr, rec, MTR_MEMO_PAGE_S_FIX));
515 #ifdef UNIV_SYNC_DEBUG
555 *old_vers =
rec_copy(buf, version, *offsets);
556 rec_offs_make_valid(*old_vers, index,
571 if (err != DB_SUCCESS) {
575 if (prev_version == NULL) {
583 *offsets = rec_get_offsets(prev_version, index, *offsets,
584 ULINT_UNDEFINED, offset_heap);
594 *old_vers =
rec_copy(buf, prev_version, *offsets);
595 rec_offs_make_valid(*old_vers, index, *offsets);
601 version = prev_version;
632 const rec_t** old_vers)
636 const rec_t* version;
643 ut_ad(mtr_memo_contains_page(mtr, rec, MTR_MEMO_PAGE_X_FIX)
644 || mtr_memo_contains_page(mtr, rec, MTR_MEMO_PAGE_S_FIX));
645 #ifdef UNIV_SYNC_DEBUG
666 if (rec == version) {
667 rec_trx_id = version_trx_id;
670 mutex_enter(&kernel_mutex);
673 && (version_trx->
conc_state == TRX_COMMITTED_IN_MEMORY
674 || version_trx->
conc_state == TRX_NOT_STARTED)) {
678 mutex_exit(&kernel_mutex);
685 if (rec == version) {
696 if (rec_trx_id == version_trx_id) {
703 *offsets = rec_get_offsets(version,
710 *old_vers =
rec_copy(buf, version, *offsets);
711 rec_offs_make_valid(*old_vers, index, *offsets);
727 if (UNIV_UNLIKELY(err != DB_SUCCESS)) {
731 if (prev_version == NULL) {
739 version = prev_version;
740 *offsets = rec_get_offsets(version, index, *offsets,
741 ULINT_UNDEFINED, offset_heap);
UNIV_INTERN rec_t * row_get_clust_rec(ulint mode, const rec_t *rec, dict_index_t *index, dict_index_t **clust_index, mtr_t *mtr)
UNIV_INLINE ibool read_view_sees_trx_id(const read_view_t *view, trx_id_t trx_id)
UNIV_INLINE trx_id_t row_get_rec_trx_id(const rec_t *rec, dict_index_t *index, const ulint *offsets)
UNIV_INLINE trx_t * trx_get_on_id(trx_id_t trx_id)
UNIV_INLINE roll_ptr_t row_get_rec_roll_ptr(const rec_t *rec, dict_index_t *index, const ulint *offsets)
UNIV_INTERN int cmp_dtuple_rec(const dtuple_t *dtuple, const rec_t *rec, const ulint *offsets)
#define mtr_s_lock(B, MTR)
UNIV_INTERN dtuple_t * row_build(ulint type, const dict_index_t *index, const rec_t *rec, const ulint *offsets, const dict_table_t *col_table, row_ext_t **ext, mem_heap_t *heap)
UNIV_INTERN int dtuple_coll_cmp(const dtuple_t *tuple1, const dtuple_t *tuple2)
UNIV_INTERN trx_undo_rec_t * trx_undo_get_undo_rec_low(roll_ptr_t roll_ptr, mem_heap_t *heap)
UNIV_INLINE ibool dict_table_is_comp(const dict_table_t *table)
UNIV_INTERN dtuple_t * row_build_index_entry(const dtuple_t *row, row_ext_t *ext, dict_index_t *index, mem_heap_t *heap)
UNIV_INLINE rec_t * rec_copy(void *buf, const rec_t *rec, const ulint *offsets)
#define mem_heap_free(heap)
UNIV_INLINE ulint dtuple_get_n_fields(const dtuple_t *tuple)
UNIV_INLINE ulint rec_get_deleted_flag(const rec_t *rec, ulint comp)
UNIV_INTERN void mtr_commit(mtr_t *mtr) __attribute__((nonnull))
UNIV_INLINE ulint page_rec_is_comp(const rec_t *rec)
UNIV_INLINE ulint dict_index_is_clust(const dict_index_t *index) __attribute__((pure))
UNIV_INTERN ibool trx_purge_update_undo_must_exist(trx_id_t trx_id)
UNIV_INTERN ibool row_vers_old_has_index_entry(ibool also_curr, const rec_t *rec, mtr_t *mtr, dict_index_t *index, const dtuple_t *ientry)
#define VIEW_HIGH_GRANULARITY
UNIV_INLINE void * mem_heap_alloc(mem_heap_t *heap, ulint n)
#define mem_heap_create(N)
UNIV_INLINE ibool trx_is_active(trx_id_t trx_id)
UNIV_INTERN ibool row_vers_must_preserve_del_marked(trx_id_t trx_id, mtr_t *mtr)
UNIV_INTERN ulint row_vers_build_for_consistent_read(const rec_t *rec, mtr_t *mtr, dict_index_t *index, ulint **offsets, read_view_t *view, mem_heap_t **offset_heap, mem_heap_t *in_heap, rec_t **old_vers)
UNIV_INLINE void mem_heap_empty(mem_heap_t *heap)
#define rw_lock_s_lock(M)
UNIV_INLINE undo_no_t trx_undo_rec_get_undo_no(const trx_undo_rec_t *undo_rec)
UNIV_INTERN ulint row_vers_build_for_semi_consistent_read(const rec_t *rec, mtr_t *mtr, dict_index_t *index, ulint **offsets, mem_heap_t **offset_heap, mem_heap_t *in_heap, const rec_t **old_vers)
UNIV_INLINE void dtuple_set_types_binary(dtuple_t *tuple, ulint n)
UNIV_INLINE void mtr_start(mtr_t *mtr) __attribute__((nonnull))
UNIV_INLINE ulint rec_offs_size(const ulint *offsets)
UNIV_INTERN ulint trx_undo_prev_version_build(const rec_t *index_rec, mtr_t *index_mtr, const rec_t *rec, dict_index_t *index, ulint *offsets, mem_heap_t *heap, rec_t **old_vers)
UNIV_INTERN trx_t * row_vers_impl_x_locked_off_kernel(const rec_t *rec, dict_index_t *index, const ulint *offsets)
UNIV_INTERN ibool lock_check_trx_id_sanity(trx_id_t trx_id, const rec_t *rec, dict_index_t *index, const ulint *offsets, ibool has_kernel_mutex)
UNIV_INLINE ibool rec_offs_validate(const rec_t *rec, const dict_index_t *index, const ulint *offsets)