Commit dd489539 authored by marko@hundin.mysql.fi's avatar marko@hundin.mysql.fi

Many files:

  Implement more compact InnoDB record format.
  Old format is available as CREATE TABLE ... ROW_FORMAT=DYNAMIC.
parent 3ca8c79e
This diff is collapsed.
This diff is collapsed.
...@@ -45,12 +45,12 @@ btr_pcur_free_for_mysql( ...@@ -45,12 +45,12 @@ btr_pcur_free_for_mysql(
mem_free(cursor->old_rec_buf); mem_free(cursor->old_rec_buf);
cursor->old_rec = NULL;
cursor->old_rec_buf = NULL; cursor->old_rec_buf = NULL;
} }
cursor->btr_cur.page_cur.rec = NULL; cursor->btr_cur.page_cur.rec = NULL;
cursor->old_rec = NULL; cursor->old_rec = NULL;
cursor->old_n_fields = 0;
cursor->old_stored = BTR_PCUR_OLD_NOT_STORED; cursor->old_stored = BTR_PCUR_OLD_NOT_STORED;
cursor->latch_mode = BTR_NO_LATCHES; cursor->latch_mode = BTR_NO_LATCHES;
...@@ -133,8 +133,9 @@ btr_pcur_store_position( ...@@ -133,8 +133,9 @@ btr_pcur_store_position(
cursor->old_stored = BTR_PCUR_OLD_STORED; cursor->old_stored = BTR_PCUR_OLD_STORED;
cursor->old_rec = dict_tree_copy_rec_order_prefix(tree, rec, cursor->old_rec = dict_tree_copy_rec_order_prefix(tree, rec,
&(cursor->old_rec_buf), &cursor->old_n_fields,
&(cursor->buf_size)); &cursor->old_rec_buf,
&cursor->buf_size);
cursor->block_when_stored = buf_block_align(page); cursor->block_when_stored = buf_block_align(page);
cursor->modify_clock = buf_frame_get_modify_clock(page); cursor->modify_clock = buf_frame_get_modify_clock(page);
...@@ -166,6 +167,8 @@ btr_pcur_copy_stored_position( ...@@ -166,6 +167,8 @@ btr_pcur_copy_stored_position(
pcur_receive->old_rec = pcur_receive->old_rec_buf pcur_receive->old_rec = pcur_receive->old_rec_buf
+ (pcur_donate->old_rec - pcur_donate->old_rec_buf); + (pcur_donate->old_rec - pcur_donate->old_rec_buf);
} }
pcur_receive->old_n_fields = pcur_donate->old_n_fields;
} }
/****************************************************************** /******************************************************************
...@@ -228,6 +231,7 @@ btr_pcur_restore_position( ...@@ -228,6 +231,7 @@ btr_pcur_restore_position(
} }
ut_a(cursor->old_rec); ut_a(cursor->old_rec);
ut_a(cursor->old_n_fields);
page = btr_cur_get_page(btr_pcur_get_btr_cur(cursor)); page = btr_cur_get_page(btr_pcur_get_btr_cur(cursor));
...@@ -242,17 +246,32 @@ btr_pcur_restore_position( ...@@ -242,17 +246,32 @@ btr_pcur_restore_position(
buf_page_dbg_add_level(page, SYNC_TREE_NODE); buf_page_dbg_add_level(page, SYNC_TREE_NODE);
#endif /* UNIV_SYNC_DEBUG */ #endif /* UNIV_SYNC_DEBUG */
if (cursor->rel_pos == BTR_PCUR_ON) { if (cursor->rel_pos == BTR_PCUR_ON) {
#ifdef UNIV_DEBUG
rec_t* rec;
ulint* offsets1;
ulint* offsets2;
dict_index_t* index;
#endif /* UNIV_DEBUG */
cursor->latch_mode = latch_mode; cursor->latch_mode = latch_mode;
#ifdef UNIV_DEBUG
ut_ad(cmp_rec_rec(cursor->old_rec, rec = btr_pcur_get_rec(cursor);
btr_pcur_get_rec(cursor), index = dict_tree_find_index(
dict_tree_find_index(
btr_cur_get_tree( btr_cur_get_tree(
btr_pcur_get_btr_cur(cursor)), btr_pcur_get_btr_cur(cursor)),
btr_pcur_get_rec(cursor))) rec);
== 0);
heap = mem_heap_create(256);
offsets1 = rec_get_offsets(cursor->old_rec,
index, ULINT_UNDEFINED, heap);
offsets2 = rec_get_offsets(rec,
index, ULINT_UNDEFINED, heap);
ut_ad(cmp_rec_rec(cursor->old_rec,
rec, offsets1, offsets2,
cursor->old_n_fields,
index) == 0);
mem_heap_free(heap);
#endif /* UNIV_DEBUG */
return(TRUE); return(TRUE);
} }
...@@ -265,7 +284,8 @@ btr_pcur_restore_position( ...@@ -265,7 +284,8 @@ btr_pcur_restore_position(
heap = mem_heap_create(256); heap = mem_heap_create(256);
tree = btr_cur_get_tree(btr_pcur_get_btr_cur(cursor)); tree = btr_cur_get_tree(btr_pcur_get_btr_cur(cursor));
tuple = dict_tree_build_data_tuple(tree, cursor->old_rec, heap); tuple = dict_tree_build_data_tuple(tree, cursor->old_rec,
cursor->old_n_fields, heap);
/* Save the old search mode of the cursor */ /* Save the old search mode of the cursor */
old_mode = cursor->search_mode; old_mode = cursor->search_mode;
...@@ -287,7 +307,10 @@ btr_pcur_restore_position( ...@@ -287,7 +307,10 @@ btr_pcur_restore_position(
if (cursor->rel_pos == BTR_PCUR_ON if (cursor->rel_pos == BTR_PCUR_ON
&& btr_pcur_is_on_user_rec(cursor, mtr) && btr_pcur_is_on_user_rec(cursor, mtr)
&& 0 == cmp_dtuple_rec(tuple, btr_pcur_get_rec(cursor))) { && 0 == cmp_dtuple_rec(tuple, btr_pcur_get_rec(cursor),
rec_get_offsets(btr_pcur_get_rec(cursor),
btr_pcur_get_btr_cur(cursor)->index,
ULINT_UNDEFINED, heap))) {
/* We have to store the NEW value for the modify clock, since /* We have to store the NEW value for the modify clock, since
the cursor can now be on a different page! But we can retain the cursor can now be on a different page! But we can retain
...@@ -376,6 +399,7 @@ btr_pcur_move_to_next_page( ...@@ -376,6 +399,7 @@ btr_pcur_move_to_next_page(
ut_ad(next_page_no != FIL_NULL); ut_ad(next_page_no != FIL_NULL);
next_page = btr_page_get(space, next_page_no, cursor->latch_mode, mtr); next_page = btr_page_get(space, next_page_no, cursor->latch_mode, mtr);
ut_a(page_is_comp(next_page) == page_is_comp(page));
buf_block_align(next_page)->check_index_page_at_flush = TRUE; buf_block_align(next_page)->check_index_page_at_flush = TRUE;
btr_leaf_page_release(page, cursor->latch_mode, mtr); btr_leaf_page_release(page, cursor->latch_mode, mtr);
......
This diff is collapsed.
...@@ -500,7 +500,7 @@ dtuple_convert_big_rec( ...@@ -500,7 +500,7 @@ dtuple_convert_big_rec(
ut_a(dtuple_check_typed_no_assert(entry)); ut_a(dtuple_check_typed_no_assert(entry));
size = rec_get_converted_size(entry); size = rec_get_converted_size(index, entry);
if (size > 1000000000) { if (size > 1000000000) {
fprintf(stderr, fprintf(stderr,
...@@ -524,9 +524,10 @@ dtuple_convert_big_rec( ...@@ -524,9 +524,10 @@ dtuple_convert_big_rec(
n_fields = 0; n_fields = 0;
while ((rec_get_converted_size(entry) while (rec_get_converted_size(index, entry)
>= page_get_free_space_of_empty() / 2) >= ut_min(page_get_free_space_of_empty(
|| rec_get_converted_size(entry) >= REC_MAX_DATA_SIZE) { index->table->comp) / 2,
REC_MAX_DATA_SIZE)) {
longest = 0; longest = 0;
for (i = dict_index_get_n_unique_in_tree(index); for (i = dict_index_get_n_unique_in_tree(index);
......
...@@ -195,7 +195,7 @@ dtype_validate( ...@@ -195,7 +195,7 @@ dtype_validate(
ut_a((type->mtype >= DATA_VARCHAR) && (type->mtype <= DATA_MYSQL)); ut_a((type->mtype >= DATA_VARCHAR) && (type->mtype <= DATA_MYSQL));
if (type->mtype == DATA_SYS) { if (type->mtype == DATA_SYS) {
ut_a(type->prtype <= DATA_MIX_ID); ut_a((type->prtype & DATA_MYSQL_TYPE_MASK) < DATA_N_SYS_COLS);
} }
return(TRUE); return(TRUE);
......
...@@ -158,7 +158,7 @@ dict_hdr_create( ...@@ -158,7 +158,7 @@ dict_hdr_create(
/*--------------------------*/ /*--------------------------*/
root_page_no = btr_create(DICT_CLUSTERED | DICT_UNIQUE, root_page_no = btr_create(DICT_CLUSTERED | DICT_UNIQUE,
DICT_HDR_SPACE, DICT_TABLES_ID, mtr); DICT_HDR_SPACE, DICT_TABLES_ID, FALSE, mtr);
if (root_page_no == FIL_NULL) { if (root_page_no == FIL_NULL) {
return(FALSE); return(FALSE);
...@@ -168,7 +168,7 @@ dict_hdr_create( ...@@ -168,7 +168,7 @@ dict_hdr_create(
MLOG_4BYTES, mtr); MLOG_4BYTES, mtr);
/*--------------------------*/ /*--------------------------*/
root_page_no = btr_create(DICT_UNIQUE, DICT_HDR_SPACE, root_page_no = btr_create(DICT_UNIQUE, DICT_HDR_SPACE,
DICT_TABLE_IDS_ID, mtr); DICT_TABLE_IDS_ID, FALSE, mtr);
if (root_page_no == FIL_NULL) { if (root_page_no == FIL_NULL) {
return(FALSE); return(FALSE);
...@@ -178,7 +178,7 @@ dict_hdr_create( ...@@ -178,7 +178,7 @@ dict_hdr_create(
MLOG_4BYTES, mtr); MLOG_4BYTES, mtr);
/*--------------------------*/ /*--------------------------*/
root_page_no = btr_create(DICT_CLUSTERED | DICT_UNIQUE, root_page_no = btr_create(DICT_CLUSTERED | DICT_UNIQUE,
DICT_HDR_SPACE, DICT_COLUMNS_ID, mtr); DICT_HDR_SPACE, DICT_COLUMNS_ID, FALSE, mtr);
if (root_page_no == FIL_NULL) { if (root_page_no == FIL_NULL) {
return(FALSE); return(FALSE);
...@@ -188,7 +188,7 @@ dict_hdr_create( ...@@ -188,7 +188,7 @@ dict_hdr_create(
MLOG_4BYTES, mtr); MLOG_4BYTES, mtr);
/*--------------------------*/ /*--------------------------*/
root_page_no = btr_create(DICT_CLUSTERED | DICT_UNIQUE, root_page_no = btr_create(DICT_CLUSTERED | DICT_UNIQUE,
DICT_HDR_SPACE, DICT_INDEXES_ID, mtr); DICT_HDR_SPACE, DICT_INDEXES_ID, FALSE, mtr);
if (root_page_no == FIL_NULL) { if (root_page_no == FIL_NULL) {
return(FALSE); return(FALSE);
...@@ -198,7 +198,7 @@ dict_hdr_create( ...@@ -198,7 +198,7 @@ dict_hdr_create(
MLOG_4BYTES, mtr); MLOG_4BYTES, mtr);
/*--------------------------*/ /*--------------------------*/
root_page_no = btr_create(DICT_CLUSTERED | DICT_UNIQUE, root_page_no = btr_create(DICT_CLUSTERED | DICT_UNIQUE,
DICT_HDR_SPACE, DICT_FIELDS_ID, mtr); DICT_HDR_SPACE, DICT_FIELDS_ID, FALSE, mtr);
if (root_page_no == FIL_NULL) { if (root_page_no == FIL_NULL) {
return(FALSE); return(FALSE);
...@@ -254,7 +254,7 @@ dict_boot(void) ...@@ -254,7 +254,7 @@ dict_boot(void)
/* Insert into the dictionary cache the descriptions of the basic /* Insert into the dictionary cache the descriptions of the basic
system tables */ system tables */
/*-------------------------*/ /*-------------------------*/
table = dict_mem_table_create("SYS_TABLES", DICT_HDR_SPACE,8); table = dict_mem_table_create("SYS_TABLES", DICT_HDR_SPACE, 8, FALSE);
dict_mem_table_add_col(table, "NAME", DATA_BINARY, 0, 0, 0); dict_mem_table_add_col(table, "NAME", DATA_BINARY, 0, 0, 0);
dict_mem_table_add_col(table, "ID", DATA_BINARY, 0, 0, 0); dict_mem_table_add_col(table, "ID", DATA_BINARY, 0, 0, 0);
...@@ -290,7 +290,7 @@ dict_boot(void) ...@@ -290,7 +290,7 @@ dict_boot(void)
index->id = DICT_TABLE_IDS_ID; index->id = DICT_TABLE_IDS_ID;
ut_a(dict_index_add_to_cache(table, index)); ut_a(dict_index_add_to_cache(table, index));
/*-------------------------*/ /*-------------------------*/
table = dict_mem_table_create("SYS_COLUMNS",DICT_HDR_SPACE,7); table = dict_mem_table_create("SYS_COLUMNS", DICT_HDR_SPACE, 7, FALSE);
dict_mem_table_add_col(table, "TABLE_ID", DATA_BINARY,0,0,0); dict_mem_table_add_col(table, "TABLE_ID", DATA_BINARY,0,0,0);
dict_mem_table_add_col(table, "POS", DATA_INT, 0, 4, 0); dict_mem_table_add_col(table, "POS", DATA_INT, 0, 4, 0);
...@@ -316,7 +316,7 @@ dict_boot(void) ...@@ -316,7 +316,7 @@ dict_boot(void)
index->id = DICT_COLUMNS_ID; index->id = DICT_COLUMNS_ID;
ut_a(dict_index_add_to_cache(table, index)); ut_a(dict_index_add_to_cache(table, index));
/*-------------------------*/ /*-------------------------*/
table = dict_mem_table_create("SYS_INDEXES",DICT_HDR_SPACE,7); table = dict_mem_table_create("SYS_INDEXES", DICT_HDR_SPACE, 7, FALSE);
dict_mem_table_add_col(table, "TABLE_ID", DATA_BINARY, 0,0,0); dict_mem_table_add_col(table, "TABLE_ID", DATA_BINARY, 0,0,0);
dict_mem_table_add_col(table, "ID", DATA_BINARY, 0, 0, 0); dict_mem_table_add_col(table, "ID", DATA_BINARY, 0, 0, 0);
...@@ -349,7 +349,7 @@ dict_boot(void) ...@@ -349,7 +349,7 @@ dict_boot(void)
index->id = DICT_INDEXES_ID; index->id = DICT_INDEXES_ID;
ut_a(dict_index_add_to_cache(table, index)); ut_a(dict_index_add_to_cache(table, index));
/*-------------------------*/ /*-------------------------*/
table = dict_mem_table_create("SYS_FIELDS", DICT_HDR_SPACE,3); table = dict_mem_table_create("SYS_FIELDS", DICT_HDR_SPACE, 3, FALSE);
dict_mem_table_add_col(table, "INDEX_ID", DATA_BINARY, 0,0,0); dict_mem_table_add_col(table, "INDEX_ID", DATA_BINARY, 0,0,0);
dict_mem_table_add_col(table, "POS", DATA_INT, 0, 4, 0); dict_mem_table_add_col(table, "POS", DATA_INT, 0, 4, 0);
......
...@@ -84,7 +84,8 @@ dict_create_sys_tables_tuple( ...@@ -84,7 +84,8 @@ dict_create_sys_tables_tuple(
dfield = dtuple_get_nth_field(entry, 5); dfield = dtuple_get_nth_field(entry, 5);
ptr = mem_heap_alloc(heap, 4); ptr = mem_heap_alloc(heap, 4);
mach_write_to_4(ptr, table->mix_len); mach_write_to_4(ptr, (table->mix_len & 0x7fffffff) |
((ulint) table->comp << 31));
dfield_set_data(dfield, ptr, 4); dfield_set_data(dfield, ptr, 4);
/* 8: CLUSTER_NAME ---------------------*/ /* 8: CLUSTER_NAME ---------------------*/
...@@ -624,7 +625,7 @@ dict_create_index_tree_step( ...@@ -624,7 +625,7 @@ dict_create_index_tree_step(
btr_pcur_move_to_next_user_rec(&pcur, &mtr); btr_pcur_move_to_next_user_rec(&pcur, &mtr);
index->page_no = btr_create(index->type, index->space, index->id, index->page_no = btr_create(index->type, index->space, index->id,
&mtr); table->comp, &mtr);
/* printf("Created a new index tree in space %lu root page %lu\n", /* printf("Created a new index tree in space %lu root page %lu\n",
index->space, index->page_no); */ index->space, index->page_no); */
...@@ -661,7 +662,8 @@ dict_drop_index_tree( ...@@ -661,7 +662,8 @@ dict_drop_index_tree(
ut_ad(mutex_own(&(dict_sys->mutex))); ut_ad(mutex_own(&(dict_sys->mutex)));
#endif /* UNIV_SYNC_DEBUG */ #endif /* UNIV_SYNC_DEBUG */
ptr = rec_get_nth_field(rec, DICT_SYS_INDEXES_PAGE_NO_FIELD, &len); ut_a(!dict_sys->sys_indexes->comp);
ptr = rec_get_nth_field_old(rec, DICT_SYS_INDEXES_PAGE_NO_FIELD, &len);
ut_ad(len == 4); ut_ad(len == 4);
...@@ -673,7 +675,8 @@ dict_drop_index_tree( ...@@ -673,7 +675,8 @@ dict_drop_index_tree(
return; return;
} }
ptr = rec_get_nth_field(rec, DICT_SYS_INDEXES_SPACE_NO_FIELD, &len); ptr = rec_get_nth_field_old(rec,
DICT_SYS_INDEXES_SPACE_NO_FIELD, &len);
ut_ad(len == 4); ut_ad(len == 4);
...@@ -699,8 +702,8 @@ dict_drop_index_tree( ...@@ -699,8 +702,8 @@ dict_drop_index_tree(
root_page_no); */ root_page_no); */
btr_free_root(space, root_page_no, mtr); btr_free_root(space, root_page_no, mtr);
page_rec_write_index_page_no(rec, DICT_SYS_INDEXES_PAGE_NO_FIELD, page_rec_write_index_page_no(rec,
FIL_NULL, mtr); DICT_SYS_INDEXES_PAGE_NO_FIELD, FIL_NULL, mtr);
} }
/************************************************************************* /*************************************************************************
......
...@@ -814,23 +814,22 @@ dict_table_add_to_cache( ...@@ -814,23 +814,22 @@ dict_table_add_to_cache(
system columns. */ system columns. */
dict_mem_table_add_col(table, "DB_ROW_ID", DATA_SYS, dict_mem_table_add_col(table, "DB_ROW_ID", DATA_SYS,
DATA_ROW_ID, 0, 0); DATA_ROW_ID | DATA_NOT_NULL, DATA_ROW_ID_LEN, 0);
#if DATA_ROW_ID != 0 #if DATA_ROW_ID != 0
#error "DATA_ROW_ID != 0" #error "DATA_ROW_ID != 0"
#endif #endif
dict_mem_table_add_col(table, "DB_TRX_ID", DATA_SYS, dict_mem_table_add_col(table, "DB_TRX_ID", DATA_SYS,
DATA_TRX_ID, 0, 0); DATA_TRX_ID | DATA_NOT_NULL, DATA_TRX_ID_LEN, 0);
#if DATA_TRX_ID != 1 #if DATA_TRX_ID != 1
#error "DATA_TRX_ID != 1" #error "DATA_TRX_ID != 1"
#endif #endif
dict_mem_table_add_col(table, "DB_ROLL_PTR", DATA_SYS, dict_mem_table_add_col(table, "DB_ROLL_PTR", DATA_SYS,
DATA_ROLL_PTR, 0, 0); DATA_ROLL_PTR | DATA_NOT_NULL, DATA_ROLL_PTR_LEN, 0);
#if DATA_ROLL_PTR != 2 #if DATA_ROLL_PTR != 2
#error "DATA_ROLL_PTR != 2" #error "DATA_ROLL_PTR != 2"
#endif #endif
dict_mem_table_add_col(table, "DB_MIX_ID", DATA_SYS, dict_mem_table_add_col(table, "DB_MIX_ID", DATA_SYS,
DATA_MIX_ID, 0, 0); DATA_MIX_ID | DATA_NOT_NULL, DATA_MIX_ID_LEN, 0);
#if DATA_MIX_ID != 3 #if DATA_MIX_ID != 3
#error "DATA_MIX_ID != 3" #error "DATA_MIX_ID != 3"
#endif #endif
...@@ -1588,7 +1587,7 @@ dict_index_find_cols( ...@@ -1588,7 +1587,7 @@ dict_index_find_cols(
/*********************************************************************** /***********************************************************************
Adds a column to index. */ Adds a column to index. */
UNIV_INLINE
void void
dict_index_add_col( dict_index_add_col(
/*===============*/ /*===============*/
...@@ -1604,6 +1603,34 @@ dict_index_add_col( ...@@ -1604,6 +1603,34 @@ dict_index_add_col(
field = dict_index_get_nth_field(index, index->n_def - 1); field = dict_index_get_nth_field(index, index->n_def - 1);
field->col = col; field->col = col;
field->fixed_len = dtype_get_fixed_size(&col->type);
if (prefix_len && field->fixed_len > prefix_len) {
field->fixed_len = prefix_len;
}
/* Long fixed-length fields that need external storage are treated as
variable-length fields, so that the extern flag can be embedded in
the length word. */
if (field->fixed_len > DICT_MAX_COL_PREFIX_LEN) {
field->fixed_len = 0;
}
if (!(dtype_get_prtype(&col->type) & DATA_NOT_NULL)) {
index->n_nullable++;
}
if (index->n_def > 1) {
const dict_field_t* field2 =
dict_index_get_nth_field(index, index->n_def - 2);
field->fixed_offs = (!field2->fixed_len ||
field2->fixed_offs == ULINT_UNDEFINED)
? ULINT_UNDEFINED
: field2->fixed_len + field2->fixed_offs;
} else {
field->fixed_offs = 0;
}
} }
/*********************************************************************** /***********************************************************************
...@@ -3580,9 +3607,10 @@ dict_tree_find_index_low( ...@@ -3580,9 +3607,10 @@ dict_tree_find_index_low(
&& (table->type != DICT_TABLE_ORDINARY)) { && (table->type != DICT_TABLE_ORDINARY)) {
/* Get the mix id of the record */ /* Get the mix id of the record */
ut_a(!table->comp);
mix_id = mach_dulint_read_compressed( mix_id = mach_dulint_read_compressed(
rec_get_nth_field(rec, table->mix_len, &len)); rec_get_nth_field_old(rec, table->mix_len, &len));
while (ut_dulint_cmp(table->mix_id, mix_id) != 0) { while (ut_dulint_cmp(table->mix_id, mix_id) != 0) {
...@@ -3715,7 +3743,8 @@ dict_tree_build_node_ptr( ...@@ -3715,7 +3743,8 @@ dict_tree_build_node_ptr(
on non-leaf levels we remove the last field, which on non-leaf levels we remove the last field, which
contains the page number of the child page */ contains the page number of the child page */
n_unique = rec_get_n_fields(rec); ut_a(!ind->table->comp);
n_unique = rec_get_n_fields_old(rec);
if (level > 0) { if (level > 0) {
ut_a(n_unique > 1); ut_a(n_unique > 1);
...@@ -3744,9 +3773,11 @@ dict_tree_build_node_ptr( ...@@ -3744,9 +3773,11 @@ dict_tree_build_node_ptr(
field = dtuple_get_nth_field(tuple, n_unique); field = dtuple_get_nth_field(tuple, n_unique);
dfield_set_data(field, buf, 4); dfield_set_data(field, buf, 4);
dtype_set(dfield_get_type(field), DATA_SYS_CHILD, 0, 0, 0); dtype_set(dfield_get_type(field), DATA_SYS_CHILD, DATA_NOT_NULL, 4, 0);
rec_copy_prefix_to_dtuple(tuple, rec, n_unique, heap); rec_copy_prefix_to_dtuple(tuple, rec, ind, n_unique, heap);
dtuple_set_info_bits(tuple, dtuple_get_info_bits(tuple) |
REC_STATUS_NODE_PTR);
ut_ad(dtuple_check_typed(tuple)); ut_ad(dtuple_check_typed(tuple));
...@@ -3763,26 +3794,25 @@ dict_tree_copy_rec_order_prefix( ...@@ -3763,26 +3794,25 @@ dict_tree_copy_rec_order_prefix(
/* out: pointer to the prefix record */ /* out: pointer to the prefix record */
dict_tree_t* tree, /* in: index tree */ dict_tree_t* tree, /* in: index tree */
rec_t* rec, /* in: record for which to copy prefix */ rec_t* rec, /* in: record for which to copy prefix */
ulint* n_fields,/* out: number of fields copied */
byte** buf, /* in/out: memory buffer for the copied prefix, byte** buf, /* in/out: memory buffer for the copied prefix,
or NULL */ or NULL */
ulint* buf_size)/* in/out: buffer size */ ulint* buf_size)/* in/out: buffer size */
{ {
dict_index_t* ind; dict_index_t* index;
rec_t* order_rec; ulint n;
ulint n_fields;
ind = dict_tree_find_index_low(tree, rec);
n_fields = dict_index_get_n_unique_in_tree(ind); index = dict_tree_find_index_low(tree, rec);
if (tree->type & DICT_UNIVERSAL) { if (tree->type & DICT_UNIVERSAL) {
ut_a(!index->table->comp);
n_fields = rec_get_n_fields(rec); n = rec_get_n_fields_old(rec);
} else {
n = dict_index_get_n_unique_in_tree(index);
} }
order_rec = rec_copy_prefix_to_buf(rec, n_fields, buf, buf_size); *n_fields = n;
return(rec_copy_prefix_to_buf(rec, index, n, buf, buf_size));
return(order_rec);
} }
/************************************************************************** /**************************************************************************
...@@ -3794,21 +3824,21 @@ dict_tree_build_data_tuple( ...@@ -3794,21 +3824,21 @@ dict_tree_build_data_tuple(
/* out, own: data tuple */ /* out, own: data tuple */
dict_tree_t* tree, /* in: index tree */ dict_tree_t* tree, /* in: index tree */
rec_t* rec, /* in: record for which to build data tuple */ rec_t* rec, /* in: record for which to build data tuple */
ulint n_fields,/* in: number of data fields */
mem_heap_t* heap) /* in: memory heap where tuple created */ mem_heap_t* heap) /* in: memory heap where tuple created */
{ {
dtuple_t* tuple; dtuple_t* tuple;
dict_index_t* ind; dict_index_t* ind;
ulint n_fields;
ind = dict_tree_find_index_low(tree, rec); ind = dict_tree_find_index_low(tree, rec);
n_fields = rec_get_n_fields(rec); ut_ad(ind->table->comp || n_fields <= rec_get_n_fields_old(rec));
tuple = dtuple_create(heap, n_fields); tuple = dtuple_create(heap, n_fields);
dict_index_copy_types(tuple, ind, n_fields); dict_index_copy_types(tuple, ind, n_fields);
rec_copy_prefix_to_dtuple(tuple, rec, n_fields, heap); rec_copy_prefix_to_dtuple(tuple, rec, ind, n_fields, heap);
ut_ad(dtuple_check_typed(tuple)); ut_ad(dtuple_check_typed(tuple));
...@@ -3826,6 +3856,27 @@ dict_index_calc_min_rec_len( ...@@ -3826,6 +3856,27 @@ dict_index_calc_min_rec_len(
ulint sum = 0; ulint sum = 0;
ulint i; ulint i;
if (index->table->comp) {
ulint nullable = 0;
sum = REC_N_NEW_EXTRA_BYTES;
for (i = 0; i < dict_index_get_n_fields(index); i++) {
dtype_t*t = dict_index_get_nth_type(index, i);
ulint size = dtype_get_fixed_size(t);
sum += size;
if (!size) {
size = dtype_get_len(t);
sum += size < 128 ? 1 : 2;
}
if (!(dtype_get_prtype(t) & DATA_NOT_NULL))
nullable++;
}
/* round the NULL flags up to full bytes */
sum += (nullable + 7) / 8;
return(sum);
}
for (i = 0; i < dict_index_get_n_fields(index); i++) { for (i = 0; i < dict_index_get_n_fields(index); i++) {
sum += dtype_get_fixed_size(dict_index_get_nth_type(index, i)); sum += dtype_get_fixed_size(dict_index_get_nth_type(index, i));
} }
...@@ -3836,7 +3887,7 @@ dict_index_calc_min_rec_len( ...@@ -3836,7 +3887,7 @@ dict_index_calc_min_rec_len(
sum += dict_index_get_n_fields(index); sum += dict_index_get_n_fields(index);
} }
sum += REC_N_EXTRA_BYTES; sum += REC_N_OLD_EXTRA_BYTES;
return(sum); return(sum);
} }
......
This diff is collapsed.
...@@ -35,7 +35,8 @@ dict_mem_table_create( ...@@ -35,7 +35,8 @@ dict_mem_table_create(
the table is placed; this parameter is the table is placed; this parameter is
ignored if the table is made a member of ignored if the table is made a member of
a cluster */ a cluster */
ulint n_cols) /* in: number of columns */ ulint n_cols, /* in: number of columns */
ibool comp) /* in: TRUE=compact page format */
{ {
dict_table_t* table; dict_table_t* table;
mem_heap_t* heap; mem_heap_t* heap;
...@@ -54,6 +55,7 @@ dict_mem_table_create( ...@@ -54,6 +55,7 @@ dict_mem_table_create(
table->space = space; table->space = space;
table->ibd_file_missing = FALSE; table->ibd_file_missing = FALSE;
table->tablespace_discarded = FALSE; table->tablespace_discarded = FALSE;
table->comp = comp;
table->n_def = 0; table->n_def = 0;
table->n_cols = n_cols + DATA_N_SYS_COLS; table->n_cols = n_cols + DATA_N_SYS_COLS;
table->mem_fix = 0; table->mem_fix = 0;
...@@ -110,7 +112,8 @@ dict_mem_cluster_create( ...@@ -110,7 +112,8 @@ dict_mem_cluster_create(
{ {
dict_table_t* cluster; dict_table_t* cluster;
cluster = dict_mem_table_create(name, space, n_cols); /* Clustered tables cannot work with the compact record format. */
cluster = dict_mem_table_create(name, space, n_cols, FALSE);
cluster->type = DICT_TABLE_CLUSTER; cluster->type = DICT_TABLE_CLUSTER;
cluster->mix_len = mix_len; cluster->mix_len = mix_len;
...@@ -197,7 +200,7 @@ dict_mem_index_create( ...@@ -197,7 +200,7 @@ dict_mem_index_create(
index->name = mem_heap_strdup(heap, index_name); index->name = mem_heap_strdup(heap, index_name);
index->table_name = table_name; index->table_name = table_name;
index->table = NULL; index->table = NULL;
index->n_def = 0; index->n_def = index->n_nullable = 0;
index->n_fields = n_fields; index->n_fields = n_fields;
index->fields = mem_heap_alloc(heap, 1 + n_fields index->fields = mem_heap_alloc(heap, 1 + n_fields
* sizeof(dict_field_t)); * sizeof(dict_field_t));
......
...@@ -1579,30 +1579,38 @@ fil_op_write_log( ...@@ -1579,30 +1579,38 @@ fil_op_write_log(
mtr_t* mtr) /* in: mini-transaction handle */ mtr_t* mtr) /* in: mini-transaction handle */
{ {
byte* log_ptr; byte* log_ptr;
ulint len;
log_ptr = mlog_open(mtr, 11 + 2);
log_ptr = mlog_open(mtr, 30); if (!log_ptr) {
/* Logging in mtr is switched off during crash recovery:
in that case mlog_open returns NULL */
return;
}
log_ptr = mlog_write_initial_log_record_for_file_op(type, space_id, 0, log_ptr = mlog_write_initial_log_record_for_file_op(type, space_id, 0,
log_ptr, mtr); log_ptr, mtr);
/* Let us store the strings as null-terminated for easier readability /* Let us store the strings as null-terminated for easier readability
and handling */ and handling */
mach_write_to_2(log_ptr, ut_strlen(name) + 1); len = strlen(name) + 1;
log_ptr += 2;
mach_write_to_2(log_ptr, len);
log_ptr += 2;
mlog_close(mtr, log_ptr); mlog_close(mtr, log_ptr);
mlog_catenate_string(mtr, (byte*) name, ut_strlen(name) + 1); mlog_catenate_string(mtr, (byte*) name, len);
if (type == MLOG_FILE_RENAME) { if (type == MLOG_FILE_RENAME) {
log_ptr = mlog_open(mtr, 30); ulint len = strlen(new_name) + 1;
mach_write_to_2(log_ptr, ut_strlen(new_name) + 1); log_ptr = mlog_open(mtr, 2 + len);
ut_a(log_ptr);
mach_write_to_2(log_ptr, len);
log_ptr += 2; log_ptr += 2;
mlog_close(mtr, log_ptr); mlog_close(mtr, log_ptr);
mlog_catenate_string(mtr, (byte*) new_name, mlog_catenate_string(mtr, (byte*) new_name, len);
ut_strlen(new_name) + 1);
} }
} }
#endif #endif
......
...@@ -910,7 +910,7 @@ fsp_header_init( ...@@ -910,7 +910,7 @@ fsp_header_init(
if (space == 0) { if (space == 0) {
fsp_fill_free_list(FALSE, space, header, mtr); fsp_fill_free_list(FALSE, space, header, mtr);
btr_create(DICT_CLUSTERED | DICT_UNIVERSAL | DICT_IBUF, space, btr_create(DICT_CLUSTERED | DICT_UNIVERSAL | DICT_IBUF, space,
ut_dulint_add(DICT_IBUF_ID_MIN, space), mtr); ut_dulint_add(DICT_IBUF_ID_MIN, space), FALSE, mtr);
} else { } else {
fsp_fill_free_list(TRUE, space, header, mtr); fsp_fill_free_list(TRUE, space, header, mtr);
} }
......
This diff is collapsed.
...@@ -155,7 +155,8 @@ ulint ...@@ -155,7 +155,8 @@ ulint
btr_node_ptr_get_child_page_no( btr_node_ptr_get_child_page_no(
/*===========================*/ /*===========================*/
/* out: child node address */ /* out: child node address */
rec_t* rec); /* in: node pointer record */ rec_t* rec, /* in: node pointer record */
const ulint* offsets);/* in: array returned by rec_get_offsets() */
/**************************************************************** /****************************************************************
Creates the root node for a new index tree. */ Creates the root node for a new index tree. */
...@@ -167,6 +168,7 @@ btr_create( ...@@ -167,6 +168,7 @@ btr_create(
ulint type, /* in: type of the index */ ulint type, /* in: type of the index */
ulint space, /* in: space where created */ ulint space, /* in: space where created */
dulint index_id,/* in: index id */ dulint index_id,/* in: index id */
ibool comp, /* in: TRUE=compact page format */
mtr_t* mtr); /* in: mini-transaction handle */ mtr_t* mtr); /* in: mini-transaction handle */
/**************************************************************** /****************************************************************
Frees a B-tree except the root page, which MUST be freed after this Frees a B-tree except the root page, which MUST be freed after this
...@@ -211,6 +213,7 @@ void ...@@ -211,6 +213,7 @@ void
btr_page_reorganize( btr_page_reorganize(
/*================*/ /*================*/
page_t* page, /* in: page to be reorganized */ page_t* page, /* in: page to be reorganized */
dict_index_t* index, /* in: record descriptor */
mtr_t* mtr); /* in: mtr */ mtr_t* mtr); /* in: mtr */
/***************************************************************** /*****************************************************************
Decides if the page should be split at the convergence point of Decides if the page should be split at the convergence point of
...@@ -273,6 +276,7 @@ void ...@@ -273,6 +276,7 @@ void
btr_set_min_rec_mark( btr_set_min_rec_mark(
/*=================*/ /*=================*/
rec_t* rec, /* in: record */ rec_t* rec, /* in: record */
ibool comp, /* in: TRUE=compact page format */
mtr_t* mtr); /* in: mtr */ mtr_t* mtr); /* in: mtr */
/***************************************************************** /*****************************************************************
Deletes on the upper level the node pointer to a page. */ Deletes on the upper level the node pointer to a page. */
...@@ -332,6 +336,7 @@ btr_parse_set_min_rec_mark( ...@@ -332,6 +336,7 @@ btr_parse_set_min_rec_mark(
/* out: end of log record or NULL */ /* out: end of log record or NULL */
byte* ptr, /* in: buffer */ byte* ptr, /* in: buffer */
byte* end_ptr,/* in: buffer end */ byte* end_ptr,/* in: buffer end */
ibool comp, /* in: TRUE=compact page format */
page_t* page, /* in: page or NULL */ page_t* page, /* in: page or NULL */
mtr_t* mtr); /* in: mtr or NULL */ mtr_t* mtr); /* in: mtr or NULL */
/*************************************************************** /***************************************************************
...@@ -343,6 +348,7 @@ btr_parse_page_reorganize( ...@@ -343,6 +348,7 @@ btr_parse_page_reorganize(
/* out: end of log record or NULL */ /* out: end of log record or NULL */
byte* ptr, /* in: buffer */ byte* ptr, /* in: buffer */
byte* end_ptr,/* in: buffer end */ byte* end_ptr,/* in: buffer end */
dict_index_t* index, /* in: record descriptor */
page_t* page, /* in: page or NULL */ page_t* page, /* in: page or NULL */
mtr_t* mtr); /* in: mtr or NULL */ mtr_t* mtr); /* in: mtr or NULL */
/****************************************************************** /******************************************************************
......
...@@ -183,17 +183,18 @@ ulint ...@@ -183,17 +183,18 @@ ulint
btr_node_ptr_get_child_page_no( btr_node_ptr_get_child_page_no(
/*===========================*/ /*===========================*/
/* out: child node address */ /* out: child node address */
rec_t* rec) /* in: node pointer record */ rec_t* rec, /* in: node pointer record */
const ulint* offsets)/* in: array returned by rec_get_offsets() */
{ {
ulint n_fields;
byte* field; byte* field;
ulint len; ulint len;
ulint page_no; ulint page_no;
n_fields = rec_get_n_fields(rec); ut_ad(!rec_offs_comp(offsets) || rec_get_node_ptr_flag(rec));
/* The child address is in the last field */ /* The child address is in the last field */
field = rec_get_nth_field(rec, n_fields - 1, &len); field = rec_get_nth_field(rec, offsets,
rec_offs_n_fields(offsets) - 1, &len);
ut_ad(len == 4); ut_ad(len == 4);
......
...@@ -34,7 +34,7 @@ page_cur_t* ...@@ -34,7 +34,7 @@ page_cur_t*
btr_cur_get_page_cur( btr_cur_get_page_cur(
/*=================*/ /*=================*/
/* out: pointer to page cursor component */ /* out: pointer to page cursor component */
btr_cur_t* cursor); /* in: tree cursor */ btr_cur_t* cursor);/* in: tree cursor */
/************************************************************* /*************************************************************
Returns the record pointer of a tree cursor. */ Returns the record pointer of a tree cursor. */
UNIV_INLINE UNIV_INLINE
...@@ -42,14 +42,14 @@ rec_t* ...@@ -42,14 +42,14 @@ rec_t*
btr_cur_get_rec( btr_cur_get_rec(
/*============*/ /*============*/
/* out: pointer to record */ /* out: pointer to record */
btr_cur_t* cursor); /* in: tree cursor */ btr_cur_t* cursor);/* in: tree cursor */
/************************************************************* /*************************************************************
Invalidates a tree cursor by setting record pointer to NULL. */ Invalidates a tree cursor by setting record pointer to NULL. */
UNIV_INLINE UNIV_INLINE
void void
btr_cur_invalidate( btr_cur_invalidate(
/*===============*/ /*===============*/
btr_cur_t* cursor); /* in: tree cursor */ btr_cur_t* cursor);/* in: tree cursor */
/************************************************************* /*************************************************************
Returns the page of a tree cursor. */ Returns the page of a tree cursor. */
UNIV_INLINE UNIV_INLINE
...@@ -57,7 +57,7 @@ page_t* ...@@ -57,7 +57,7 @@ page_t*
btr_cur_get_page( btr_cur_get_page(
/*=============*/ /*=============*/
/* out: pointer to page */ /* out: pointer to page */
btr_cur_t* cursor); /* in: tree cursor */ btr_cur_t* cursor);/* in: tree cursor */
/************************************************************* /*************************************************************
Returns the tree of a cursor. */ Returns the tree of a cursor. */
UNIV_INLINE UNIV_INLINE
...@@ -65,7 +65,7 @@ dict_tree_t* ...@@ -65,7 +65,7 @@ dict_tree_t*
btr_cur_get_tree( btr_cur_get_tree(
/*=============*/ /*=============*/
/* out: tree */ /* out: tree */
btr_cur_t* cursor); /* in: tree cursor */ btr_cur_t* cursor);/* in: tree cursor */
/************************************************************* /*************************************************************
Positions a tree cursor at a given record. */ Positions a tree cursor at a given record. */
UNIV_INLINE UNIV_INLINE
...@@ -284,6 +284,7 @@ void ...@@ -284,6 +284,7 @@ void
btr_cur_del_unmark_for_ibuf( btr_cur_del_unmark_for_ibuf(
/*========================*/ /*========================*/
rec_t* rec, /* in: record to delete unmark */ rec_t* rec, /* in: record to delete unmark */
dict_index_t* index, /* in: record descriptor */
mtr_t* mtr); /* in: mtr */ mtr_t* mtr); /* in: mtr */
/***************************************************************** /*****************************************************************
Tries to compress a page of the tree on the leaf level. It is assumed Tries to compress a page of the tree on the leaf level. It is assumed
...@@ -364,7 +365,8 @@ btr_cur_parse_update_in_place( ...@@ -364,7 +365,8 @@ btr_cur_parse_update_in_place(
/* out: end of log record or NULL */ /* out: end of log record or NULL */
byte* ptr, /* in: buffer */ byte* ptr, /* in: buffer */
byte* end_ptr,/* in: buffer end */ byte* end_ptr,/* in: buffer end */
page_t* page); /* in: page or NULL */ page_t* page, /* in: page or NULL */
dict_index_t* index); /* in: index corresponding to page */
/******************************************************************** /********************************************************************
Parses the redo log record for delete marking or unmarking of a clustered Parses the redo log record for delete marking or unmarking of a clustered
index record. */ index record. */
...@@ -375,6 +377,7 @@ btr_cur_parse_del_mark_set_clust_rec( ...@@ -375,6 +377,7 @@ btr_cur_parse_del_mark_set_clust_rec(
/* out: end of log record or NULL */ /* out: end of log record or NULL */
byte* ptr, /* in: buffer */ byte* ptr, /* in: buffer */
byte* end_ptr,/* in: buffer end */ byte* end_ptr,/* in: buffer end */
dict_index_t* index, /* in: index corresponding to page */
page_t* page); /* in: page or NULL */ page_t* page); /* in: page or NULL */
/******************************************************************** /********************************************************************
Parses the redo log record for delete marking or unmarking of a secondary Parses the redo log record for delete marking or unmarking of a secondary
...@@ -386,6 +389,7 @@ btr_cur_parse_del_mark_set_sec_rec( ...@@ -386,6 +389,7 @@ btr_cur_parse_del_mark_set_sec_rec(
/* out: end of log record or NULL */ /* out: end of log record or NULL */
byte* ptr, /* in: buffer */ byte* ptr, /* in: buffer */
byte* end_ptr,/* in: buffer end */ byte* end_ptr,/* in: buffer end */
dict_index_t* index, /* in: index corresponding to page */
page_t* page); /* in: page or NULL */ page_t* page); /* in: page or NULL */
/*********************************************************************** /***********************************************************************
Estimates the number of rows in a given index range. */ Estimates the number of rows in a given index range. */
...@@ -418,6 +422,7 @@ void ...@@ -418,6 +422,7 @@ void
btr_cur_mark_extern_inherited_fields( btr_cur_mark_extern_inherited_fields(
/*=================================*/ /*=================================*/
rec_t* rec, /* in: record in a clustered index */ rec_t* rec, /* in: record in a clustered index */
const ulint* offsets,/* in: array returned by rec_get_offsets() */
upd_t* update, /* in: update vector */ upd_t* update, /* in: update vector */
mtr_t* mtr); /* in: mtr */ mtr_t* mtr); /* in: mtr */
/*********************************************************************** /***********************************************************************
...@@ -456,6 +461,7 @@ btr_store_big_rec_extern_fields( ...@@ -456,6 +461,7 @@ btr_store_big_rec_extern_fields(
dict_index_t* index, /* in: index of rec; the index tree dict_index_t* index, /* in: index of rec; the index tree
MUST be X-latched */ MUST be X-latched */
rec_t* rec, /* in: record */ rec_t* rec, /* in: record */
const ulint* offsets, /* in: rec_get_offsets(rec, index) */
big_rec_t* big_rec_vec, /* in: vector containing fields big_rec_t* big_rec_vec, /* in: vector containing fields
to be stored externally */ to be stored externally */
mtr_t* local_mtr); /* in: mtr containing the latch to mtr_t* local_mtr); /* in: mtr containing the latch to
...@@ -496,6 +502,7 @@ btr_rec_free_externally_stored_fields( ...@@ -496,6 +502,7 @@ btr_rec_free_externally_stored_fields(
dict_index_t* index, /* in: index of the data, the index dict_index_t* index, /* in: index of the data, the index
tree MUST be X-latched */ tree MUST be X-latched */
rec_t* rec, /* in: record */ rec_t* rec, /* in: record */
const ulint* offsets,/* in: rec_get_offsets(rec, index) */
ibool do_not_free_inherited,/* in: TRUE if called in a ibool do_not_free_inherited,/* in: TRUE if called in a
rollback and we do not want to free rollback and we do not want to free
inherited fields */ inherited fields */
...@@ -510,6 +517,7 @@ btr_rec_copy_externally_stored_field( ...@@ -510,6 +517,7 @@ btr_rec_copy_externally_stored_field(
/*=================================*/ /*=================================*/
/* out: the field copied to heap */ /* out: the field copied to heap */
rec_t* rec, /* in: record */ rec_t* rec, /* in: record */
const ulint* offsets,/* in: array returned by rec_get_offsets() */
ulint no, /* in: field number */ ulint no, /* in: field number */
ulint* len, /* out: length of the field */ ulint* len, /* out: length of the field */
mem_heap_t* heap); /* in: mem heap */ mem_heap_t* heap); /* in: mem heap */
...@@ -540,10 +548,10 @@ ulint ...@@ -540,10 +548,10 @@ ulint
btr_push_update_extern_fields( btr_push_update_extern_fields(
/*==========================*/ /*==========================*/
/* out: number of values stored in ext_vect */ /* out: number of values stored in ext_vect */
ulint* ext_vect, /* in: array of ulints, must be preallocated ulint* ext_vect,/* in: array of ulints, must be preallocated
to have place for all fields in rec */ to have space for all fields in rec */
rec_t* rec, /* in: record */ const ulint* offsets,/* in: array returned by rec_get_offsets() */
upd_t* update); /* in: update vector */ upd_t* update);/* in: update vector or NULL */
/*######################################################################*/ /*######################################################################*/
......
...@@ -134,17 +134,15 @@ btr_cur_can_delete_without_compress( ...@@ -134,17 +134,15 @@ btr_cur_can_delete_without_compress(
/* out: TRUE if can be deleted without /* out: TRUE if can be deleted without
recommended compression */ recommended compression */
btr_cur_t* cursor, /* in: btr cursor */ btr_cur_t* cursor, /* in: btr cursor */
ulint rec_size,/* in: rec_get_size(btr_cur_get_rec(cursor))*/
mtr_t* mtr) /* in: mtr */ mtr_t* mtr) /* in: mtr */
{ {
ulint rec_size;
page_t* page; page_t* page;
ut_ad(mtr_memo_contains(mtr, buf_block_align( ut_ad(mtr_memo_contains(mtr, buf_block_align(
btr_cur_get_page(cursor)), btr_cur_get_page(cursor)),
MTR_MEMO_PAGE_X_FIX)); MTR_MEMO_PAGE_X_FIX));
rec_size = rec_get_size(btr_cur_get_rec(cursor));
page = btr_cur_get_page(cursor); page = btr_cur_get_page(cursor);
if ((page_get_data_size(page) - rec_size < BTR_CUR_PAGE_COMPRESS_LIMIT) if ((page_get_data_size(page) - rec_size < BTR_CUR_PAGE_COMPRESS_LIMIT)
......
...@@ -462,6 +462,7 @@ struct btr_pcur_struct{ ...@@ -462,6 +462,7 @@ struct btr_pcur_struct{
contains an initial segment of the contains an initial segment of the
latest record cursor was positioned latest record cursor was positioned
either on, before, or after */ either on, before, or after */
ulint old_n_fields; /* number of fields in old_rec */
ulint rel_pos; /* BTR_PCUR_ON, BTR_PCUR_BEFORE, or ulint rel_pos; /* BTR_PCUR_ON, BTR_PCUR_BEFORE, or
BTR_PCUR_AFTER, depending on whether BTR_PCUR_AFTER, depending on whether
cursor was on, before, or after the cursor was on, before, or after the
......
...@@ -77,8 +77,10 @@ parameters as page (this often happens when a page is split). */ ...@@ -77,8 +77,10 @@ parameters as page (this often happens when a page is split). */
void void
btr_search_move_or_delete_hash_entries( btr_search_move_or_delete_hash_entries(
/*===================================*/ /*===================================*/
page_t* new_page, /* in: records are copied to this page */ page_t* new_page, /* in: records are copied
page_t* page); /* in: index page */ to this page */
page_t* page, /* in: index page */
dict_index_t* index); /* in: record descriptor */
/************************************************************************ /************************************************************************
Drops a page hash index. */ Drops a page hash index. */
...@@ -128,9 +130,10 @@ btr_search_update_hash_on_delete( ...@@ -128,9 +130,10 @@ btr_search_update_hash_on_delete(
Validates the search system. */ Validates the search system. */
ibool ibool
btr_search_validate(void); btr_search_validate(
/*=====================*/ /*================*/
/* out: TRUE if ok */
dict_index_t* index); /* in: record descriptor */
/* Search info directions */ /* Search info directions */
#define BTR_SEA_NO_DIRECTION 1 #define BTR_SEA_NO_DIRECTION 1
......
...@@ -149,7 +149,9 @@ dtype_new_store_for_order_and_null_size( ...@@ -149,7 +149,9 @@ dtype_new_store_for_order_and_null_size(
bytes where we store the info */ bytes where we store the info */
dtype_t* type) /* in: type struct */ dtype_t* type) /* in: type struct */
{ {
ut_ad(6 == DATA_NEW_ORDER_NULL_TYPE_BUF_SIZE); #if 6 != DATA_NEW_ORDER_NULL_TYPE_BUF_SIZE
#error "6 != DATA_NEW_ORDER_NULL_TYPE_BUF_SIZE"
#endif
buf[0] = (byte)(type->mtype & 0xFFUL); buf[0] = (byte)(type->mtype & 0xFFUL);
...@@ -166,10 +168,12 @@ dtype_new_store_for_order_and_null_size( ...@@ -166,10 +168,12 @@ dtype_new_store_for_order_and_null_size(
mach_write_to_2(buf + 2, type->len & 0xFFFFUL); mach_write_to_2(buf + 2, type->len & 0xFFFFUL);
ut_ad(dtype_get_charset_coll(type->prtype) < 256);
mach_write_to_2(buf + 4, dtype_get_charset_coll(type->prtype)); mach_write_to_2(buf + 4, dtype_get_charset_coll(type->prtype));
/* Note that the second last byte is left unused, because the if (type->prtype & DATA_NOT_NULL) {
charset-collation code is always < 256 */ buf[4] |= 128;
}
} }
/************************************************************************** /**************************************************************************
...@@ -211,20 +215,26 @@ dtype_new_read_for_order_and_null_size( ...@@ -211,20 +215,26 @@ dtype_new_read_for_order_and_null_size(
{ {
ulint charset_coll; ulint charset_coll;
ut_ad(6 == DATA_NEW_ORDER_NULL_TYPE_BUF_SIZE); #if 6 != DATA_NEW_ORDER_NULL_TYPE_BUF_SIZE
#error "6 != DATA_NEW_ORDER_NULL_TYPE_BUF_SIZE"
#endif
type->mtype = buf[0] & 63; type->mtype = buf[0] & 63;
type->prtype = buf[1]; type->prtype = buf[1];
if (buf[0] & 128) { if (buf[0] & 128) {
type->prtype = type->prtype | DATA_BINARY_TYPE; type->prtype |= DATA_BINARY_TYPE;
}
if (buf[4] & 128) {
type->prtype |= DATA_NOT_NULL;
} }
type->len = mach_read_from_2(buf + 2); type->len = mach_read_from_2(buf + 2);
mach_read_from_2(buf + 4); mach_read_from_2(buf + 4);
charset_coll = mach_read_from_2(buf + 4); charset_coll = mach_read_from_2(buf + 4) & 0x7fff;
if (dtype_is_string_type(type->mtype)) { if (dtype_is_string_type(type->mtype)) {
ut_a(charset_coll < 256); ut_a(charset_coll < 256);
...@@ -257,6 +267,26 @@ dtype_get_fixed_size( ...@@ -257,6 +267,26 @@ dtype_get_fixed_size(
mtype = dtype_get_mtype(type); mtype = dtype_get_mtype(type);
switch (mtype) { switch (mtype) {
case DATA_SYS:
#ifdef UNIV_DEBUG
switch (type->prtype & DATA_MYSQL_TYPE_MASK) {
default:
ut_ad(0);
return(0);
case DATA_ROW_ID:
ut_ad(type->len == DATA_ROW_ID_LEN);
break;
case DATA_TRX_ID:
ut_ad(type->len == DATA_TRX_ID_LEN);
break;
case DATA_ROLL_PTR:
ut_ad(type->len == DATA_ROLL_PTR_LEN);
break;
case DATA_MIX_ID:
ut_ad(type->len == DATA_MIX_ID_LEN);
break;
}
#endif /* UNIV_DEBUG */
case DATA_CHAR: case DATA_CHAR:
case DATA_FIXBINARY: case DATA_FIXBINARY:
case DATA_INT: case DATA_INT:
...@@ -264,16 +294,6 @@ dtype_get_fixed_size( ...@@ -264,16 +294,6 @@ dtype_get_fixed_size(
case DATA_DOUBLE: case DATA_DOUBLE:
case DATA_MYSQL: case DATA_MYSQL:
return(dtype_get_len(type)); return(dtype_get_len(type));
case DATA_SYS: if (type->prtype == DATA_ROW_ID) {
return(DATA_ROW_ID_LEN);
} else if (type->prtype == DATA_TRX_ID) {
return(DATA_TRX_ID_LEN);
} else if (type->prtype == DATA_ROLL_PTR) {
return(DATA_ROLL_PTR_LEN);
} else {
return(0);
}
case DATA_VARCHAR: case DATA_VARCHAR:
case DATA_BINARY: case DATA_BINARY:
case DATA_DECIMAL: case DATA_DECIMAL:
......
...@@ -639,6 +639,16 @@ dict_index_get_sys_col_pos( ...@@ -639,6 +639,16 @@ dict_index_get_sys_col_pos(
dict_index_t* index, /* in: index */ dict_index_t* index, /* in: index */
ulint type); /* in: DATA_ROW_ID, ... */ ulint type); /* in: DATA_ROW_ID, ... */
/*********************************************************************** /***********************************************************************
Adds a column to index. */
void
dict_index_add_col(
/*===============*/
dict_index_t* index, /* in: index */
dict_col_t* col, /* in: column */
ulint order, /* in: order criterion */
ulint prefix_len); /* in: column prefix length */
/***********************************************************************
Copies types of fields contained in index to tuple. */ Copies types of fields contained in index to tuple. */
void void
...@@ -657,6 +667,7 @@ dict_index_rec_get_sys_col( ...@@ -657,6 +667,7 @@ dict_index_rec_get_sys_col(
/*=======================*/ /*=======================*/
/* out: system column value */ /* out: system column value */
dict_index_t* index, /* in: clustered index describing the record */ dict_index_t* index, /* in: clustered index describing the record */
const ulint* offsets,/* in: offsets returned by rec_get_offsets() */
ulint type, /* in: column type: DATA_ROLL_PTR, ... */ ulint type, /* in: column type: DATA_ROLL_PTR, ... */
rec_t* rec); /* in: record */ rec_t* rec); /* in: record */
/************************************************************************* /*************************************************************************
...@@ -770,6 +781,7 @@ dict_tree_copy_rec_order_prefix( ...@@ -770,6 +781,7 @@ dict_tree_copy_rec_order_prefix(
/* out: pointer to the prefix record */ /* out: pointer to the prefix record */
dict_tree_t* tree, /* in: index tree */ dict_tree_t* tree, /* in: index tree */
rec_t* rec, /* in: record for which to copy prefix */ rec_t* rec, /* in: record for which to copy prefix */
ulint* n_fields,/* out: number of fields copied */
byte** buf, /* in/out: memory buffer for the copied prefix, byte** buf, /* in/out: memory buffer for the copied prefix,
or NULL */ or NULL */
ulint* buf_size);/* in/out: buffer size */ ulint* buf_size);/* in/out: buffer size */
...@@ -782,6 +794,7 @@ dict_tree_build_data_tuple( ...@@ -782,6 +794,7 @@ dict_tree_build_data_tuple(
/* out, own: data tuple */ /* out, own: data tuple */
dict_tree_t* tree, /* in: index tree */ dict_tree_t* tree, /* in: index tree */
rec_t* rec, /* in: record for which to build data tuple */ rec_t* rec, /* in: record for which to build data tuple */
ulint n_fields,/* in: number of data fields */
mem_heap_t* heap); /* in: memory heap where tuple created */ mem_heap_t* heap); /* in: memory heap where tuple created */
/************************************************************************* /*************************************************************************
Gets the space id of the root of the index tree. */ Gets the space id of the root of the index tree. */
......
...@@ -168,7 +168,7 @@ dict_table_get_sys_col( ...@@ -168,7 +168,7 @@ dict_table_get_sys_col(
col = dict_table_get_nth_col(table, table->n_cols col = dict_table_get_nth_col(table, table->n_cols
- DATA_N_SYS_COLS + sys); - DATA_N_SYS_COLS + sys);
ut_ad(col->type.mtype == DATA_SYS); ut_ad(col->type.mtype == DATA_SYS);
ut_ad(col->type.prtype == sys); ut_ad(col->type.prtype == (sys | DATA_NOT_NULL));
return(col); return(col);
} }
...@@ -322,6 +322,7 @@ dict_index_rec_get_sys_col( ...@@ -322,6 +322,7 @@ dict_index_rec_get_sys_col(
/*=======================*/ /*=======================*/
/* out: system column value */ /* out: system column value */
dict_index_t* index, /* in: clustered index describing the record */ dict_index_t* index, /* in: clustered index describing the record */
const ulint* offsets,/* in: offsets returned by rec_get_offsets() */
ulint type, /* in: column type: DATA_ROLL_PTR, ... */ ulint type, /* in: column type: DATA_ROLL_PTR, ... */
rec_t* rec) /* in: record */ rec_t* rec) /* in: record */
{ {
...@@ -331,12 +332,13 @@ dict_index_rec_get_sys_col( ...@@ -331,12 +332,13 @@ dict_index_rec_get_sys_col(
ut_ad(index); ut_ad(index);
ut_ad(index->type & DICT_CLUSTERED); ut_ad(index->type & DICT_CLUSTERED);
ut_ad(rec_offs_validate(rec, index, offsets));
pos = dict_index_get_sys_col_pos(index, type); pos = dict_index_get_sys_col_pos(index, type);
ut_ad(pos != ULINT_UNDEFINED); ut_ad(pos != ULINT_UNDEFINED);
field = rec_get_nth_field(rec, pos, &len); field = rec_get_nth_field(rec, offsets, pos, &len);
if (type == DATA_ROLL_PTR) { if (type == DATA_ROLL_PTR) {
ut_ad(len == 7); ut_ad(len == 7);
...@@ -677,7 +679,10 @@ dict_is_mixed_table_rec( ...@@ -677,7 +679,10 @@ dict_is_mixed_table_rec(
byte* mix_id_field; byte* mix_id_field;
ulint len; ulint len;
mix_id_field = rec_get_nth_field(rec, table->mix_len, &len); ut_ad(!table->comp);
mix_id_field = rec_get_nth_field_old(rec,
table->mix_len, &len);
if ((len != table->mix_id_len) if ((len != table->mix_id_len)
|| (0 != ut_memcmp(table->mix_id_buf, mix_id_field, len))) { || (0 != ut_memcmp(table->mix_id_buf, mix_id_field, len))) {
......
...@@ -54,7 +54,8 @@ dict_mem_table_create( ...@@ -54,7 +54,8 @@ dict_mem_table_create(
of the table is placed; this parameter of the table is placed; this parameter
is ignored if the table is made is ignored if the table is made
a member of a cluster */ a member of a cluster */
ulint n_cols); /* in: number of columns */ ulint n_cols, /* in: number of columns */
ibool comp); /* in: TRUE=compact page format */
/************************************************************************** /**************************************************************************
Creates a cluster memory object. */ Creates a cluster memory object. */
...@@ -171,6 +172,13 @@ struct dict_field_struct{ ...@@ -171,6 +172,13 @@ struct dict_field_struct{
DICT_MAX_COL_PREFIX_LEN; NOTE that DICT_MAX_COL_PREFIX_LEN; NOTE that
in the UTF-8 charset, MySQL sets this in the UTF-8 charset, MySQL sets this
to 3 * the prefix len in UTF-8 chars */ to 3 * the prefix len in UTF-8 chars */
ulint fixed_len; /* 0 or the fixed length of the
column if smaller than
DICT_MAX_COL_PREFIX_LEN */
ulint fixed_offs; /* offset to the field, or
ULINT_UNDEFINED if it is not fixed
within the record (due to preceding
variable-length fields) */
}; };
/* Data structure for an index tree */ /* Data structure for an index tree */
...@@ -225,6 +233,7 @@ struct dict_index_struct{ ...@@ -225,6 +233,7 @@ struct dict_index_struct{
ulint n_def; /* number of fields defined so far */ ulint n_def; /* number of fields defined so far */
ulint n_fields;/* number of fields in the index */ ulint n_fields;/* number of fields in the index */
dict_field_t* fields; /* array of field descriptions */ dict_field_t* fields; /* array of field descriptions */
ulint n_nullable;/* number of nullable fields */
UT_LIST_NODE_T(dict_index_t) UT_LIST_NODE_T(dict_index_t)
indexes;/* list of indexes of the table */ indexes;/* list of indexes of the table */
dict_tree_t* tree; /* index tree struct */ dict_tree_t* tree; /* index tree struct */
...@@ -320,6 +329,7 @@ struct dict_table_struct{ ...@@ -320,6 +329,7 @@ struct dict_table_struct{
ibool tablespace_discarded;/* this flag is set TRUE when the ibool tablespace_discarded;/* this flag is set TRUE when the
user calls DISCARD TABLESPACE on this table, user calls DISCARD TABLESPACE on this table,
and reset to FALSE in IMPORT TABLESPACE */ and reset to FALSE in IMPORT TABLESPACE */
ibool comp; /* flag: TRUE=compact page format */
hash_node_t name_hash; /* hash chain node */ hash_node_t name_hash; /* hash chain node */
hash_node_t id_hash; /* hash chain node */ hash_node_t id_hash; /* hash chain node */
ulint n_def; /* number of columns defined so far */ ulint n_def; /* number of columns defined so far */
......
...@@ -47,7 +47,8 @@ lock_sec_rec_some_has_impl_off_kernel( ...@@ -47,7 +47,8 @@ lock_sec_rec_some_has_impl_off_kernel(
/* out: transaction which has the x-lock, or /* out: transaction which has the x-lock, or
NULL */ NULL */
rec_t* rec, /* in: user record */ rec_t* rec, /* in: user record */
dict_index_t* index); /* in: secondary index */ dict_index_t* index, /* in: secondary index */
const ulint* offsets);/* in: rec_get_offsets(rec, index) */
/************************************************************************* /*************************************************************************
Checks if some transaction has an implicit x-lock on a record in a clustered Checks if some transaction has an implicit x-lock on a record in a clustered
index. */ index. */
...@@ -58,7 +59,8 @@ lock_clust_rec_some_has_impl( ...@@ -58,7 +59,8 @@ lock_clust_rec_some_has_impl(
/* out: transaction which has the x-lock, or /* out: transaction which has the x-lock, or
NULL */ NULL */
rec_t* rec, /* in: user record */ rec_t* rec, /* in: user record */
dict_index_t* index); /* in: clustered index */ dict_index_t* index, /* in: clustered index */
const ulint* offsets);/* in: rec_get_offsets(rec, index) */
/***************************************************************** /*****************************************************************
Resets the lock bits for a single record. Releases transactions Resets the lock bits for a single record. Releases transactions
waiting for lock requests here. */ waiting for lock requests here. */
...@@ -275,6 +277,7 @@ lock_clust_rec_modify_check_and_lock( ...@@ -275,6 +277,7 @@ lock_clust_rec_modify_check_and_lock(
does nothing */ does nothing */
rec_t* rec, /* in: record which should be modified */ rec_t* rec, /* in: record which should be modified */
dict_index_t* index, /* in: clustered index */ dict_index_t* index, /* in: clustered index */
const ulint* offsets,/* in: rec_get_offsets(rec, index) */
que_thr_t* thr); /* in: query thread */ que_thr_t* thr); /* in: query thread */
/************************************************************************* /*************************************************************************
Checks if locks of other transactions prevent an immediate modify Checks if locks of other transactions prevent an immediate modify
...@@ -308,6 +311,7 @@ lock_sec_rec_read_check_and_lock( ...@@ -308,6 +311,7 @@ lock_sec_rec_read_check_and_lock(
which should be read or passed over by a read which should be read or passed over by a read
cursor */ cursor */
dict_index_t* index, /* in: secondary index */ dict_index_t* index, /* in: secondary index */
const ulint* offsets,/* in: rec_get_offsets(rec, index) */
ulint mode, /* in: mode of the lock which the read cursor ulint mode, /* in: mode of the lock which the read cursor
should set on records: LOCK_S or LOCK_X; the should set on records: LOCK_S or LOCK_X; the
latter is possible in SELECT FOR UPDATE */ latter is possible in SELECT FOR UPDATE */
...@@ -333,6 +337,7 @@ lock_clust_rec_read_check_and_lock( ...@@ -333,6 +337,7 @@ lock_clust_rec_read_check_and_lock(
which should be read or passed over by a read which should be read or passed over by a read
cursor */ cursor */
dict_index_t* index, /* in: clustered index */ dict_index_t* index, /* in: clustered index */
const ulint* offsets,/* in: rec_get_offsets(rec, index) */
ulint mode, /* in: mode of the lock which the read cursor ulint mode, /* in: mode of the lock which the read cursor
should set on records: LOCK_S or LOCK_X; the should set on records: LOCK_S or LOCK_X; the
latter is possible in SELECT FOR UPDATE */ latter is possible in SELECT FOR UPDATE */
...@@ -350,6 +355,7 @@ lock_clust_rec_cons_read_sees( ...@@ -350,6 +355,7 @@ lock_clust_rec_cons_read_sees(
rec_t* rec, /* in: user record which should be read or rec_t* rec, /* in: user record which should be read or
passed over by a read cursor */ passed over by a read cursor */
dict_index_t* index, /* in: clustered index */ dict_index_t* index, /* in: clustered index */
const ulint* offsets,/* in: rec_get_offsets(rec, index) */
read_view_t* view); /* in: consistent read view */ read_view_t* view); /* in: consistent read view */
/************************************************************************* /*************************************************************************
Checks that a non-clustered index record is seen in a consistent read. */ Checks that a non-clustered index record is seen in a consistent read. */
...@@ -499,6 +505,7 @@ lock_check_trx_id_sanity( ...@@ -499,6 +505,7 @@ lock_check_trx_id_sanity(
dulint trx_id, /* in: trx id */ dulint trx_id, /* in: trx id */
rec_t* rec, /* in: user record */ rec_t* rec, /* in: user record */
dict_index_t* index, /* in: clustered index */ dict_index_t* index, /* in: clustered index */
const ulint* offsets, /* in: rec_get_offsets(rec, index) */
ibool has_kernel_mutex);/* in: TRUE if the caller owns the ibool has_kernel_mutex);/* in: TRUE if the caller owns the
kernel mutex */ kernel mutex */
/************************************************************************* /*************************************************************************
...@@ -509,7 +516,8 @@ lock_rec_queue_validate( ...@@ -509,7 +516,8 @@ lock_rec_queue_validate(
/*====================*/ /*====================*/
/* out: TRUE if ok */ /* out: TRUE if ok */
rec_t* rec, /* in: record to look at */ rec_t* rec, /* in: record to look at */
dict_index_t* index); /* in: index, or NULL if not known */ dict_index_t* index, /* in: index, or NULL if not known */
const ulint* offsets);/* in: rec_get_offsets(rec, index) */
/************************************************************************* /*************************************************************************
Prints info of a table lock. */ Prints info of a table lock. */
......
...@@ -60,7 +60,8 @@ lock_clust_rec_some_has_impl( ...@@ -60,7 +60,8 @@ lock_clust_rec_some_has_impl(
/* out: transaction which has the x-lock, or /* out: transaction which has the x-lock, or
NULL */ NULL */
rec_t* rec, /* in: user record */ rec_t* rec, /* in: user record */
dict_index_t* index) /* in: clustered index */ dict_index_t* index, /* in: clustered index */
const ulint* offsets)/* in: rec_get_offsets(rec, index) */
{ {
dulint trx_id; dulint trx_id;
...@@ -70,7 +71,7 @@ lock_clust_rec_some_has_impl( ...@@ -70,7 +71,7 @@ lock_clust_rec_some_has_impl(
ut_ad(index->type & DICT_CLUSTERED); ut_ad(index->type & DICT_CLUSTERED);
ut_ad(page_rec_is_user_rec(rec)); ut_ad(page_rec_is_user_rec(rec));
trx_id = row_get_rec_trx_id(rec, index); trx_id = row_get_rec_trx_id(rec, index, offsets);
if (trx_is_active(trx_id)) { if (trx_is_active(trx_id)) {
/* The modifying or inserting transaction is active */ /* The modifying or inserting transaction is active */
......
...@@ -11,6 +11,7 @@ Created 12/7/1995 Heikki Tuuri ...@@ -11,6 +11,7 @@ Created 12/7/1995 Heikki Tuuri
#include "univ.i" #include "univ.i"
#include "mtr0mtr.h" #include "mtr0mtr.h"
#include "dict0types.h"
/************************************************************ /************************************************************
Writes 1 - 4 bytes to a file page buffered in the buffer pool. Writes 1 - 4 bytes to a file page buffered in the buffer pool.
...@@ -173,6 +174,38 @@ mlog_parse_string( ...@@ -173,6 +174,38 @@ mlog_parse_string(
byte* page); /* in: page where to apply the log record, or NULL */ byte* page); /* in: page where to apply the log record, or NULL */
/************************************************************
Opens a buffer for mlog, writes the initial log record and,
if needed, the field lengths of an index. Reserves space
for further log entries. The log entry must be closed with
mtr_close(). */
byte*
mlog_open_and_write_index(
/*======================*/
/* out: buffer, NULL if log mode
MTR_LOG_NONE */
mtr_t* mtr, /* in: mtr */
byte* rec, /* in: index record or page */
dict_index_t* index, /* in: record descriptor */
byte type, /* in: log item type */
ulint size); /* in: requested buffer size in bytes
(if 0, calls mlog_close() and returns NULL) */
/************************************************************
Parses a log record written by mlog_open_and_write_index. */
byte*
mlog_parse_index(
/*=============*/
/* out: parsed record end,
NULL if not a complete record */
byte* ptr, /* in: buffer */
byte* end_ptr,/* in: buffer end */
/* out: new value of log_ptr */
ibool comp, /* in: TRUE=compact record format */
dict_index_t** index); /* out, own: dummy index */
/* Insert, update, and maybe other functions may use this value to define an /* Insert, update, and maybe other functions may use this value to define an
extra mlog buffer size for variable size data */ extra mlog buffer size for variable size data */
#define MLOG_BUF_MARGIN 256 #define MLOG_BUF_MARGIN 256
......
...@@ -102,7 +102,31 @@ flag value must give the length also! */ ...@@ -102,7 +102,31 @@ flag value must give the length also! */
file rename */ file rename */
#define MLOG_FILE_DELETE ((byte)35) /* log record about an .ibd #define MLOG_FILE_DELETE ((byte)35) /* log record about an .ibd
file deletion */ file deletion */
#define MLOG_BIGGEST_TYPE ((byte)35) /* biggest value (used in #define MLOG_COMP_REC_MIN_MARK ((byte)36) /* mark a compact index record
as the predefined minimum
record */
#define MLOG_COMP_PAGE_CREATE ((byte)37) /* create a compact
index page */
#define MLOG_COMP_REC_INSERT ((byte)38) /* compact record insert */
#define MLOG_COMP_REC_CLUST_DELETE_MARK ((byte)39)
/* mark compact clustered index
record deleted */
#define MLOG_COMP_REC_SEC_DELETE_MARK ((byte)40)/* mark compact secondary index
record deleted */
#define MLOG_COMP_REC_UPDATE_IN_PLACE ((byte)41)/* update of a compact record,
preserves record field sizes */
#define MLOG_COMP_REC_DELETE ((byte)42) /* delete a compact record
from a page */
#define MLOG_COMP_LIST_END_DELETE ((byte)43) /* delete compact record list
end on index page */
#define MLOG_COMP_LIST_START_DELETE ((byte)44) /* delete compact record list
start on index page */
#define MLOG_COMP_LIST_END_COPY_CREATED ((byte)45)
/* copy compact record list end
to a new created index page */
#define MLOG_COMP_PAGE_REORGANIZE ((byte)46) /* reorganize an index page */
#define MLOG_BIGGEST_TYPE ((byte)46) /* biggest value (used in
asserts) */ asserts) */
/******************************************************************* /*******************************************************************
......
...@@ -129,6 +129,7 @@ page_cur_tuple_insert( ...@@ -129,6 +129,7 @@ page_cur_tuple_insert(
otherwise */ otherwise */
page_cur_t* cursor, /* in: a page cursor */ page_cur_t* cursor, /* in: a page cursor */
dtuple_t* tuple, /* in: pointer to a data tuple */ dtuple_t* tuple, /* in: pointer to a data tuple */
dict_index_t* index, /* in: record descriptor */
mtr_t* mtr); /* in: mini-transaction handle */ mtr_t* mtr); /* in: mini-transaction handle */
/*************************************************************** /***************************************************************
Inserts a record next to page cursor. Returns pointer to inserted record if Inserts a record next to page cursor. Returns pointer to inserted record if
...@@ -142,6 +143,7 @@ page_cur_rec_insert( ...@@ -142,6 +143,7 @@ page_cur_rec_insert(
otherwise */ otherwise */
page_cur_t* cursor, /* in: a page cursor */ page_cur_t* cursor, /* in: a page cursor */
rec_t* rec, /* in: record to insert */ rec_t* rec, /* in: record to insert */
dict_index_t* index, /* in: record descriptor */
mtr_t* mtr); /* in: mini-transaction handle */ mtr_t* mtr); /* in: mini-transaction handle */
/*************************************************************** /***************************************************************
Inserts a record next to page cursor. Returns pointer to inserted record if Inserts a record next to page cursor. Returns pointer to inserted record if
...@@ -156,7 +158,7 @@ page_cur_insert_rec_low( ...@@ -156,7 +158,7 @@ page_cur_insert_rec_low(
otherwise */ otherwise */
page_cur_t* cursor, /* in: a page cursor */ page_cur_t* cursor, /* in: a page cursor */
dtuple_t* tuple, /* in: pointer to a data tuple or NULL */ dtuple_t* tuple, /* in: pointer to a data tuple or NULL */
ulint data_size,/* in: data size of tuple */ dict_index_t* index, /* in: record descriptor */
rec_t* rec, /* in: pointer to a physical record or NULL */ rec_t* rec, /* in: pointer to a physical record or NULL */
mtr_t* mtr); /* in: mini-transaction handle */ mtr_t* mtr); /* in: mini-transaction handle */
/***************************************************************** /*****************************************************************
...@@ -169,6 +171,7 @@ page_copy_rec_list_end_to_created_page( ...@@ -169,6 +171,7 @@ page_copy_rec_list_end_to_created_page(
page_t* new_page, /* in: index page to copy to */ page_t* new_page, /* in: index page to copy to */
page_t* page, /* in: index page */ page_t* page, /* in: index page */
rec_t* rec, /* in: first record to copy */ rec_t* rec, /* in: first record to copy */
dict_index_t* index, /* in: record descriptor */
mtr_t* mtr); /* in: mtr */ mtr_t* mtr); /* in: mtr */
/*************************************************************** /***************************************************************
Deletes a record at the page cursor. The cursor is moved to the Deletes a record at the page cursor. The cursor is moved to the
...@@ -178,6 +181,7 @@ void ...@@ -178,6 +181,7 @@ void
page_cur_delete_rec( page_cur_delete_rec(
/*================*/ /*================*/
page_cur_t* cursor, /* in: a page cursor */ page_cur_t* cursor, /* in: a page cursor */
dict_index_t* index, /* in: record descriptor */
mtr_t* mtr); /* in: mini-transaction handle */ mtr_t* mtr); /* in: mini-transaction handle */
/******************************************************************** /********************************************************************
Searches the right position for a page cursor. */ Searches the right position for a page cursor. */
...@@ -187,6 +191,7 @@ page_cur_search( ...@@ -187,6 +191,7 @@ page_cur_search(
/*============*/ /*============*/
/* out: number of matched fields on the left */ /* out: number of matched fields on the left */
page_t* page, /* in: index page */ page_t* page, /* in: index page */
dict_index_t* index, /* in: record descriptor */
dtuple_t* tuple, /* in: data tuple */ dtuple_t* tuple, /* in: data tuple */
ulint mode, /* in: PAGE_CUR_L, PAGE_CUR_LE, PAGE_CUR_G, ulint mode, /* in: PAGE_CUR_L, PAGE_CUR_LE, PAGE_CUR_G,
or PAGE_CUR_GE */ or PAGE_CUR_GE */
...@@ -198,6 +203,7 @@ void ...@@ -198,6 +203,7 @@ void
page_cur_search_with_match( page_cur_search_with_match(
/*=======================*/ /*=======================*/
page_t* page, /* in: index page */ page_t* page, /* in: index page */
dict_index_t* index, /* in: record descriptor */
dtuple_t* tuple, /* in: data tuple */ dtuple_t* tuple, /* in: data tuple */
ulint mode, /* in: PAGE_CUR_L, PAGE_CUR_LE, PAGE_CUR_G, ulint mode, /* in: PAGE_CUR_L, PAGE_CUR_LE, PAGE_CUR_G,
or PAGE_CUR_GE */ or PAGE_CUR_GE */
...@@ -233,6 +239,7 @@ page_cur_parse_insert_rec( ...@@ -233,6 +239,7 @@ page_cur_parse_insert_rec(
ibool is_short,/* in: TRUE if short inserts */ ibool is_short,/* in: TRUE if short inserts */
byte* ptr, /* in: buffer */ byte* ptr, /* in: buffer */
byte* end_ptr,/* in: buffer end */ byte* end_ptr,/* in: buffer end */
dict_index_t* index, /* in: record descriptor */
page_t* page, /* in: page or NULL */ page_t* page, /* in: page or NULL */
mtr_t* mtr); /* in: mtr or NULL */ mtr_t* mtr); /* in: mtr or NULL */
/************************************************************** /**************************************************************
...@@ -244,6 +251,7 @@ page_parse_copy_rec_list_to_created_page( ...@@ -244,6 +251,7 @@ page_parse_copy_rec_list_to_created_page(
/* out: end of log record or NULL */ /* out: end of log record or NULL */
byte* ptr, /* in: buffer */ byte* ptr, /* in: buffer */
byte* end_ptr,/* in: buffer end */ byte* end_ptr,/* in: buffer end */
dict_index_t* index, /* in: record descriptor */
page_t* page, /* in: page or NULL */ page_t* page, /* in: page or NULL */
mtr_t* mtr); /* in: mtr or NULL */ mtr_t* mtr); /* in: mtr or NULL */
/*************************************************************** /***************************************************************
...@@ -255,6 +263,7 @@ page_cur_parse_delete_rec( ...@@ -255,6 +263,7 @@ page_cur_parse_delete_rec(
/* out: pointer to record end or NULL */ /* out: pointer to record end or NULL */
byte* ptr, /* in: buffer */ byte* ptr, /* in: buffer */
byte* end_ptr,/* in: buffer end */ byte* end_ptr,/* in: buffer end */
dict_index_t* index, /* in: record descriptor */
page_t* page, /* in: page or NULL */ page_t* page, /* in: page or NULL */
mtr_t* mtr); /* in: mtr or NULL */ mtr_t* mtr); /* in: mtr or NULL */
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -30,7 +30,8 @@ row_vers_impl_x_locked_off_kernel( ...@@ -30,7 +30,8 @@ row_vers_impl_x_locked_off_kernel(
transaction; NOTE that the kernel mutex is transaction; NOTE that the kernel mutex is
temporarily released! */ temporarily released! */
rec_t* rec, /* in: record in a secondary index */ rec_t* rec, /* in: record in a secondary index */
dict_index_t* index); /* in: the secondary index */ dict_index_t* index, /* in: the secondary index */
const ulint* offsets);/* in: rec_get_offsets(rec, index) */
/********************************************************************* /*********************************************************************
Finds out if we must preserve a delete marked earlier version of a clustered Finds out if we must preserve a delete marked earlier version of a clustered
index record, because it is >= the purge view. */ index record, because it is >= the purge view. */
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment