24
23
mem_heap_t* heap) /* in: heap from which memory allocated */
28
update = (upd_t*) mem_heap_alloc(heap, sizeof(upd_t));
28
update = mem_heap_alloc(heap, sizeof(upd_t));
30
30
update->info_bits = 0;
31
31
update->n_fields = n;
32
update->fields = (upd_field_t*)
33
mem_heap_alloc(heap, sizeof(upd_field_t) * n);
32
update->fields = mem_heap_alloc(heap, sizeof(upd_field_t) * n);
34
for (i = 0; i < n; i++) {
35
update->fields[i].extern_storage = 0;
45
/* out: number of fields */
46
const upd_t* update) /* in: update vector */
48
/* out: number of fields */
49
upd_t* update) /* in: update vector */
50
53
return(update->n_fields);
54
56
/*************************************************************************
55
57
Returns the nth field of an update vector. */
60
/* out: update vector field */
61
const upd_t* update, /* in: update vector */
62
ulint n) /* in: field position in update vector */
62
/* out: update vector field */
63
upd_t* update, /* in: update vector */
64
ulint n) /* in: field position in update vector */
65
67
ut_ad(n < update->n_fields);
67
return((upd_field_t*) update->fields + n);
69
return(update->fields + n);
69
#endif /* UNIV_DEBUG */
71
72
/*************************************************************************
72
73
Sets an index field number to be updated by an update vector field. */
96
96
dict_col_copy_type(dict_index_get_nth_col(index, field_no),
97
dfield_get_type(&upd_field->new_val));
100
/*************************************************************************
101
Returns a field of an update vector by field_no. */
104
upd_get_field_by_field_no(
105
/*======================*/
106
/* out: update vector field, or NULL */
107
const upd_t* update, /* in: update vector */
108
ulint no) /* in: field_no */
111
for (i = 0; i < upd_get_n_fields(update); i++) {
112
const upd_field_t* uf = upd_get_nth_field(update, i);
114
if (uf->field_no == no) {
97
dfield_get_type(&(upd_field->new_val)));
123
100
/*************************************************************************
128
105
row_upd_rec_sys_fields(
129
106
/*===================*/
130
rec_t* rec, /* in/out: record */
131
page_zip_des_t* page_zip,/* in/out: compressed page whose
132
uncompressed part will be updated, or NULL */
107
rec_t* rec, /* in: record */
133
108
dict_index_t* index, /* in: clustered index */
134
109
const ulint* offsets,/* in: rec_get_offsets(rec, index) */
135
110
trx_t* trx, /* in: transaction */
136
111
dulint roll_ptr)/* in: roll ptr of the undo log record */
138
ut_ad(dict_index_is_clust(index));
113
ut_ad(index->type & DICT_CLUSTERED);
139
114
ut_ad(rec_offs_validate(rec, index, offsets));
140
115
#ifdef UNIV_SYNC_DEBUG
141
if (!rw_lock_own(&btr_search_latch, RW_LOCK_EX)) {
142
buf_pool_mutex_enter();
143
ut_ad(!buf_block_align(rec)->is_hashed);
144
buf_pool_mutex_exit();
116
ut_ad(!buf_block_align(rec)->is_hashed
117
|| rw_lock_own(&btr_search_latch, RW_LOCK_EX));
146
118
#endif /* UNIV_SYNC_DEBUG */
148
if (UNIV_LIKELY_NULL(page_zip)) {
149
ulint pos = dict_index_get_sys_col_pos(index, DATA_TRX_ID);
150
page_zip_write_trx_id_and_roll_ptr(page_zip, rec, offsets,
151
pos, trx->id, roll_ptr);
153
ulint offset = index->trx_id_offset;
156
offset = row_get_trx_id_offset(rec, index, offsets);
159
#if DATA_TRX_ID + 1 != DATA_ROLL_PTR
160
# error "DATA_TRX_ID + 1 != DATA_ROLL_PTR"
162
trx_write_trx_id(rec + offset, trx->id);
163
trx_write_roll_ptr(rec + offset + DATA_TRX_ID_LEN, roll_ptr);
120
row_set_rec_trx_id(rec, index, offsets, trx->id);
121
row_set_rec_roll_ptr(rec, index, offsets, roll_ptr);