00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00026 #pragma once
00027 #ifndef row0upd_h
00028 #define row0upd_h
00029
00030 #include "univ.i"
00031 #include "data0data.h"
00032 #include "row0types.h"
00033 #include "btr0types.h"
00034 #include "dict0types.h"
00035 #include "trx0types.h"
00036
00037 #ifndef UNIV_HOTBACKUP
00038 # include "btr0pcur.h"
00039 # include "que0types.h"
00040 # include "pars0types.h"
00041 #endif
00042
00043
00046 UNIV_INLINE
00047 upd_t*
00048 upd_create(
00049
00050 ulint n,
00051 mem_heap_t* heap);
00052
00056 UNIV_INLINE
00057 ulint
00058 upd_get_n_fields(
00059
00060 const upd_t* update);
00061 #ifdef UNIV_DEBUG
00062
00065 UNIV_INLINE
00066 upd_field_t*
00067 upd_get_nth_field(
00068
00069 const upd_t* update,
00070 ulint n);
00071 #else
00072 # define upd_get_nth_field(update, n) ((update)->fields + (n))
00073 #endif
00074 #ifndef UNIV_HOTBACKUP
00075
00077 UNIV_INLINE
00078 void
00079 upd_field_set_field_no(
00080
00081 upd_field_t* upd_field,
00082 ulint field_no,
00084 dict_index_t* index,
00085 trx_t* trx);
00086
00089 UNIV_INLINE
00090 const upd_field_t*
00091 upd_get_field_by_field_no(
00092
00093 const upd_t* update,
00094 ulint no)
00095 __attribute__((nonnull, pure));
00096
00100 UNIV_INTERN
00101 byte*
00102 row_upd_write_sys_vals_to_log(
00103
00104 dict_index_t* index,
00105 trx_t* trx,
00106 roll_ptr_t roll_ptr,
00107 byte* log_ptr,
00109 mtr_t* mtr);
00110
00113 UNIV_INLINE
00114 void
00115 row_upd_rec_sys_fields(
00116
00117 rec_t* rec,
00118 page_zip_des_t* page_zip,
00120 dict_index_t* index,
00121 const ulint* offsets,
00122 trx_t* trx,
00123 roll_ptr_t roll_ptr);
00124
00126 UNIV_INTERN
00127 void
00128 row_upd_index_entry_sys_field(
00129
00130 dtuple_t* entry,
00134 dict_index_t* index,
00135 ulint type,
00136 ib_uint64_t val);
00137
00140 UNIV_INTERN
00141 upd_node_t*
00142 upd_node_create(
00143
00144 mem_heap_t* heap);
00145
00147 UNIV_INTERN
00148 void
00149 row_upd_index_write_log(
00150
00151 const upd_t* update,
00152 byte* log_ptr,
00156 mtr_t* mtr);
00157
00162 UNIV_INTERN
00163 ibool
00164 row_upd_changes_field_size_or_external(
00165
00166 dict_index_t* index,
00167 const ulint* offsets,
00168 const upd_t* update);
00169 #endif
00170
00176 UNIV_INTERN
00177 void
00178 row_upd_rec_in_place(
00179
00180 rec_t* rec,
00181 dict_index_t* index,
00182 const ulint* offsets,
00183 const upd_t* update,
00184 page_zip_des_t* page_zip);
00186 #ifndef UNIV_HOTBACKUP
00187
00192 UNIV_INTERN
00193 upd_t*
00194 row_upd_build_sec_rec_difference_binary(
00195
00196 dict_index_t* index,
00197 const dtuple_t* entry,
00198 const rec_t* rec,
00199 trx_t* trx,
00200 mem_heap_t* heap);
00201
00207 UNIV_INTERN
00208 upd_t*
00209 row_upd_build_difference_binary(
00210
00211 dict_index_t* index,
00212 const dtuple_t* entry,
00213 const rec_t* rec,
00214 trx_t* trx,
00215 mem_heap_t* heap);
00216
00219 UNIV_INTERN
00220 void
00221 row_upd_index_replace_new_col_vals_index_pos(
00222
00223 dtuple_t* entry,
00227 dict_index_t* index,
00229 const upd_t* update,
00232 ibool order_only,
00236 mem_heap_t* heap)
00238 __attribute__((nonnull));
00239
00242 UNIV_INTERN
00243 void
00244 row_upd_index_replace_new_col_vals(
00245
00246 dtuple_t* entry,
00250 dict_index_t* index,
00252 const upd_t* update,
00255 mem_heap_t* heap)
00257 __attribute__((nonnull));
00258
00260 UNIV_INTERN
00261 void
00262 row_upd_replace(
00263
00264 dtuple_t* row,
00269 row_ext_t** ext,
00271 const dict_index_t* index,
00272 const upd_t* update,
00274 mem_heap_t* heap);
00275
00282 UNIV_INTERN
00283 ibool
00284 row_upd_changes_ord_field_binary(
00285
00286 const dtuple_t* row,
00290 dict_index_t* index,
00291 const upd_t* update);
00294
00301 UNIV_INTERN
00302 ibool
00303 row_upd_changes_some_index_ord_field_binary(
00304
00305 const dict_table_t* table,
00306 const upd_t* update);
00307
00311 UNIV_INTERN
00312 que_thr_t*
00313 row_upd_step(
00314
00315 que_thr_t* thr);
00316 #endif
00317
00320 UNIV_INTERN
00321 byte*
00322 row_upd_parse_sys_vals(
00323
00324 byte* ptr,
00325 byte* end_ptr,
00326 ulint* pos,
00327 trx_id_t* trx_id,
00328 roll_ptr_t* roll_ptr);
00329
00332 UNIV_INTERN
00333 void
00334 row_upd_rec_sys_fields_in_recovery(
00335
00336 rec_t* rec,
00337 page_zip_des_t* page_zip,
00338 const ulint* offsets,
00339 ulint pos,
00340 trx_id_t trx_id,
00341 roll_ptr_t roll_ptr);
00342
00345 UNIV_INTERN
00346 byte*
00347 row_upd_index_parse(
00348
00349 byte* ptr,
00350 byte* end_ptr,
00351 mem_heap_t* heap,
00353 upd_t** update_out);
00356
00357 struct upd_field_struct{
00358 unsigned field_no:16;
00363 #ifndef UNIV_HOTBACKUP
00364 unsigned orig_len:16;
00367 que_node_t* exp;
00371 #endif
00372 dfield_t new_val;
00373 };
00374
00375
00376 struct upd_struct{
00377 ulint info_bits;
00379 ulint n_fields;
00380 upd_field_t* fields;
00381 };
00382
00383 #ifndef UNIV_HOTBACKUP
00384
00385
00386
00387 struct upd_node_struct{
00388 que_common_t common;
00389 ibool is_delete;
00390 ibool searched_update;
00391
00392
00393 ibool in_mysql_interface;
00394
00395
00396 dict_foreign_t* foreign;
00397
00398
00399 upd_node_t* cascade_node;
00400
00401
00402 mem_heap_t* cascade_heap;
00403
00404 sel_node_t* select;
00407 btr_pcur_t* pcur;
00412 dict_table_t* table;
00413 upd_t* update;
00414 ulint update_n_fields;
00415
00416
00417
00418
00419 sym_node_list_t columns;
00420
00421 ibool has_clust_rec_x_lock;
00422
00423
00424
00425
00426 ulint cmpl_info;
00427
00428
00429
00430
00431
00432 ulint state;
00433 dict_index_t* index;
00435 dtuple_t* row;
00438 row_ext_t* ext;
00440 dtuple_t* upd_row;
00441 row_ext_t* upd_ext;
00442
00443 mem_heap_t* heap;
00446
00447 sym_node_t* table_sym;
00448 que_node_t* col_assign_list;
00449
00450 ulint magic_n;
00451 };
00452
00453 #define UPD_NODE_MAGIC_N 1579975
00454
00455
00456 #define UPD_NODE_SET_IX_LOCK 1
00457
00458
00459
00460
00461 #define UPD_NODE_UPDATE_CLUSTERED 2
00462
00463 #define UPD_NODE_INSERT_CLUSTERED 3
00464
00465
00466 #define UPD_NODE_UPDATE_ALL_SEC 4
00467
00468
00469
00470 #define UPD_NODE_UPDATE_SOME_SEC 5
00471
00472
00473
00474
00475 #define UPD_NODE_NO_ORD_CHANGE 1
00476
00477
00478 #define UPD_NODE_NO_SIZE_CHANGE 2
00479
00480
00481 #endif
00482
00483 #ifndef UNIV_NONINL
00484 #include "row0upd.ic"
00485 #endif
00486
00487 #endif