summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sql/ha_innodb.cc39
-rw-r--r--storage/innobase/Makefile.am3
-rw-r--r--storage/innobase/btr/btr0btr.c548
-rw-r--r--storage/innobase/btr/btr0cur.c677
-rw-r--r--storage/innobase/btr/btr0pcur.c94
-rw-r--r--storage/innobase/btr/btr0sea.c215
-rw-r--r--storage/innobase/buf/buf0buf.c458
-rw-r--r--storage/innobase/buf/buf0flu.c211
-rw-r--r--storage/innobase/buf/buf0lru.c153
-rw-r--r--storage/innobase/buf/buf0rea.c169
-rw-r--r--storage/innobase/data/data0data.c70
-rw-r--r--storage/innobase/data/data0type.c26
-rw-r--r--storage/innobase/dict/dict0boot.c84
-rw-r--r--storage/innobase/dict/dict0crea.c191
-rw-r--r--storage/innobase/dict/dict0dict.c590
-rw-r--r--storage/innobase/dict/dict0load.c213
-rw-r--r--storage/innobase/dict/dict0mem.c8
-rw-r--r--storage/innobase/eval/eval0eval.c31
-rw-r--r--storage/innobase/eval/eval0proc.c9
-rw-r--r--storage/innobase/fil/fil0fil.c797
-rw-r--r--storage/innobase/fsp/fsp0fsp.c663
-rw-r--r--storage/innobase/fut/fut0lst.c52
-rw-r--r--storage/innobase/ha/ha0ha.c8
-rw-r--r--storage/innobase/ibuf/ibuf0ibuf.c563
-rw-r--r--storage/innobase/include/btr0btr.ic19
-rw-r--r--storage/innobase/include/btr0cur.h8
-rw-r--r--storage/innobase/include/btr0cur.ic14
-rw-r--r--storage/innobase/include/btr0pcur.ic16
-rw-r--r--storage/innobase/include/buf0buf.h4
-rw-r--r--storage/innobase/include/buf0buf.ic56
-rw-r--r--storage/innobase/include/buf0flu.ic4
-rw-r--r--storage/innobase/include/buf0rea.h3
-rw-r--r--storage/innobase/include/data0data.h8
-rw-r--r--storage/innobase/include/data0data.ic14
-rw-r--r--storage/innobase/include/data0type.ic189
-rw-r--r--storage/innobase/include/dict0boot.h3
-rw-r--r--storage/innobase/include/dict0dict.ic18
-rw-r--r--storage/innobase/include/dict0mem.h2
-rw-r--r--storage/innobase/include/eval0eval.ic4
-rw-r--r--storage/innobase/include/fut0lst.ic8
-rw-r--r--storage/innobase/include/ibuf0ibuf.ic8
-rw-r--r--storage/innobase/include/lock0lock.ic2
-rw-r--r--storage/innobase/include/log0log.ic20
-rw-r--r--storage/innobase/include/log0recv.h26
-rw-r--r--storage/innobase/include/mach0data.ic36
-rw-r--r--storage/innobase/include/mem0mem.ic31
-rw-r--r--storage/innobase/include/mtr0log.ic8
-rw-r--r--storage/innobase/include/mtr0mtr.h3
-rw-r--r--storage/innobase/include/os0file.h6
-rw-r--r--storage/innobase/include/page0cur.ic12
-rw-r--r--storage/innobase/include/page0page.ic95
-rw-r--r--storage/innobase/include/que0que.ic8
-rw-r--r--storage/innobase/include/read0read.ic5
-rw-r--r--storage/innobase/include/rem0cmp.ic9
-rw-r--r--storage/innobase/include/rem0rec.ic102
-rw-r--r--storage/innobase/include/row0mysql.h7
-rw-r--r--storage/innobase/include/row0purge.h3
-rw-r--r--storage/innobase/include/row0row.h8
-rw-r--r--storage/innobase/include/row0row.ic10
-rw-r--r--storage/innobase/include/row0sel.h20
-rw-r--r--storage/innobase/include/row0sel.ic8
-rw-r--r--storage/innobase/include/row0undo.h3
-rw-r--r--storage/innobase/include/row0upd.ic6
-rw-r--r--storage/innobase/include/sync0rw.h4
-rw-r--r--storage/innobase/include/sync0rw.ic16
-rw-r--r--storage/innobase/include/sync0sync.h5
-rw-r--r--storage/innobase/include/sync0sync.ic73
-rw-r--r--storage/innobase/include/trx0rec.ic2
-rw-r--r--storage/innobase/include/trx0rseg.ic12
-rw-r--r--storage/innobase/include/trx0sys.ic32
-rw-r--r--storage/innobase/include/trx0trx.h8
-rw-r--r--storage/innobase/include/trx0trx.ic2
-rw-r--r--storage/innobase/include/trx0undo.h8
-rw-r--r--storage/innobase/include/trx0undo.ic8
-rw-r--r--storage/innobase/include/trx0xa.h3
-rw-r--r--storage/innobase/include/univ.i2
-rw-r--r--storage/innobase/include/ut0byte.ic2
-rw-r--r--storage/innobase/include/ut0rnd.ic7
-rw-r--r--storage/innobase/lock/lock0lock.c558
-rw-r--r--storage/innobase/log/log0log.c498
-rw-r--r--storage/innobase/log/log0recv.c1164
-rw-r--r--storage/innobase/mem/mem0dbg.c151
-rw-r--r--storage/innobase/mem/mem0mem.c4
-rw-r--r--storage/innobase/mem/mem0pool.c60
-rw-r--r--storage/innobase/mtr/mtr0log.c48
-rw-r--r--storage/innobase/mtr/mtr0mtr.c28
-rw-r--r--storage/innobase/os/os0file.c629
-rw-r--r--storage/innobase/os/os0proc.c231
-rw-r--r--storage/innobase/os/os0sync.c51
-rw-r--r--storage/innobase/os/os0thread.c36
-rw-r--r--storage/innobase/page/page0cur.c224
-rw-r--r--storage/innobase/page/page0page.c264
-rw-r--r--storage/innobase/pars/pars0opt.c116
-rw-r--r--storage/innobase/pars/pars0pars.c167
-rw-r--r--storage/innobase/que/que0que.c43
-rw-r--r--storage/innobase/read/read0read.c53
-rw-r--r--storage/innobase/rem/rem0cmp.c140
-rw-r--r--storage/innobase/rem/rem0rec.c153
-rw-r--r--storage/innobase/row/row0ins.c428
-rw-r--r--storage/innobase/row/row0mysql.c1223
-rw-r--r--storage/innobase/row/row0purge.c64
-rw-r--r--storage/innobase/row/row0row.c82
-rw-r--r--storage/innobase/row/row0sel.c861
-rw-r--r--storage/innobase/row/row0uins.c18
-rw-r--r--storage/innobase/row/row0umod.c112
-rw-r--r--storage/innobase/row/row0undo.c24
-rw-r--r--storage/innobase/row/row0upd.c258
-rw-r--r--storage/innobase/row/row0vers.c73
-rw-r--r--storage/innobase/srv/srv0srv.c410
-rw-r--r--storage/innobase/srv/srv0start.c642
-rw-r--r--storage/innobase/sync/sync0arr.c79
-rw-r--r--storage/innobase/sync/sync0rw.c87
-rw-r--r--storage/innobase/sync/sync0sync.c132
-rw-r--r--storage/innobase/thr/thr0loc.c10
-rw-r--r--storage/innobase/trx/trx0purge.c158
-rw-r--r--storage/innobase/trx/trx0rec.c155
-rw-r--r--storage/innobase/trx/trx0roll.c78
-rw-r--r--storage/innobase/trx/trx0rseg.c27
-rw-r--r--storage/innobase/trx/trx0sys.c384
-rw-r--r--storage/innobase/trx/trx0trx.c218
-rw-r--r--storage/innobase/trx/trx0undo.c198
-rw-r--r--storage/innobase/ut/ut0byte.c2
-rw-r--r--storage/innobase/ut/ut0dbg.c18
-rw-r--r--storage/innobase/ut/ut0mem.c92
-rw-r--r--storage/innobase/ut/ut0ut.c81
-rw-r--r--storage/innobase/ut/ut0vec.c2
-rw-r--r--storage/innobase/ut/ut0wqueue.c2
127 files changed, 9189 insertions, 8209 deletions
diff --git a/sql/ha_innodb.cc b/sql/ha_innodb.cc
index 6145b6518a8..a75fae4caf0 100644
--- a/sql/ha_innodb.cc
+++ b/sql/ha_innodb.cc
@@ -6787,19 +6787,17 @@ ha_innobase::store_lock(
row_prebuilt_t* prebuilt = (row_prebuilt_t*) innobase_prebuilt;
trx_t* trx;
- /* Call update_thd() to update prebuilt->trx to point to the trx
- object of thd! Failure to do this caused a serious memory
- corruption bug in 5.1.11. */
+ /* Note that trx in this function is NOT necessarily prebuilt->trx
+ because we call update_thd() later, in ::external_lock()! Failure to
+ understand this caused a serious memory corruption bug in 5.1.11. */
- update_thd(thd);
-
- trx = prebuilt->trx;
+ trx = check_trx_exists(thd);
- /* NOTE: MySQL can call this function with lock 'type' TL_IGNORE!
+ /* NOTE: MySQL can call this function with lock 'type' TL_IGNORE!
Be careful to ignore TL_IGNORE if we are going to do something with
only 'real' locks! */
- /* If no MySQL tables is use we need to set isolation level
+ /* If no MySQL table is in use, we need to set the isolation level
of the transaction. */
if (lock_type != TL_IGNORE
@@ -6809,7 +6807,13 @@ ha_innobase::store_lock(
thd->variables.tx_isolation);
}
- if ((lock_type == TL_READ && thd->in_lock_tables) ||
+ if (thd->lex->sql_command == SQLCOM_DROP_TABLE) {
+
+ /* MySQL calls this function in DROP TABLE though this table
+ handle may belong to another thd that is running a query. Let
+ us in that case skip any changes to the prebuilt struct. */
+
+ } else if ((lock_type == TL_READ && thd->in_lock_tables) ||
(lock_type == TL_READ_HIGH_PRIORITY && thd->in_lock_tables) ||
lock_type == TL_READ_WITH_SHARED_LOCKS ||
lock_type == TL_READ_NO_INSERT ||
@@ -7400,7 +7404,9 @@ innobase_xa_prepare(
int error = 0;
trx_t* trx = check_trx_exists(thd);
- if (thd->lex->sql_command != SQLCOM_XA_PREPARE) {
+ if (thd->lex->sql_command != SQLCOM_XA_PREPARE &&
+ (all || !(thd->options & (OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN))))
+ {
/* For ibbackup to work the order of transactions in binlog
and InnoDB must be the same. Consider the situation
@@ -7625,6 +7631,19 @@ SHOW_VAR innodb_status_variables_export[]= {
{NullS, NullS, SHOW_LONG}
};
+static int show_innodb_vars(THD *thd, SHOW_VAR *var, char *buff)
+{
+ innodb_export_status();
+ var->type= SHOW_ARRAY;
+ var->value= (char *) &innodb_status_variables;
+ return 0;
+}
+
+SHOW_VAR innodb_status_variables_export[]= {
+ {"Innodb", (char*) &show_innodb_vars, SHOW_FUNC},
+ {NullS, NullS, SHOW_LONG}
+};
+
struct st_mysql_storage_engine innobase_storage_engine=
{ MYSQL_HANDLERTON_INTERFACE_VERSION, &innobase_hton};
diff --git a/storage/innobase/Makefile.am b/storage/innobase/Makefile.am
index a5b84e0a908..a68dbbcc2e6 100644
--- a/storage/innobase/Makefile.am
+++ b/storage/innobase/Makefile.am
@@ -87,7 +87,8 @@ EXTRA_DIST = include/btr0btr.h include/btr0btr.ic include/btr0cur.h include/btr
include/ut0byte.h include/ut0byte.ic include/ut0dbg.h include/ut0lst.h \
include/ut0mem.h include/ut0mem.ic include/ut0rnd.h include/ut0rnd.ic \
include/ut0sort.h include/ut0ut.h include/ut0ut.ic include/ut0vec.h include/ut0vec.ic include/ha_prototypes.h \
- include/ut0list.h include/ut0list.ic include/ut0wqueue.h \
+ include/ut0list.h include/ut0list.ic \
+ include/ut0wqueue.h \
CMakeLists.txt
noinst_LIBRARIES = libinnobase.a
diff --git a/storage/innobase/btr/btr0btr.c b/storage/innobase/btr/btr0btr.c
index 57c6289e5f7..095ef6f02df 100644
--- a/storage/innobase/btr/btr0btr.c
+++ b/storage/innobase/btr/btr0btr.c
@@ -143,8 +143,8 @@ btr_root_get(
root_page_no = dict_tree_get_page(tree);
root = btr_page_get(space, root_page_no, RW_X_LATCH, mtr);
- ut_a((ibool)!!page_is_comp(root) ==
- dict_table_is_comp(tree->tree_index->table));
+ ut_a((ibool)!!page_is_comp(root)
+ == dict_table_is_comp(tree->tree_index->table));
return(root);
}
@@ -183,16 +183,16 @@ btr_get_prev_user_rec(
if (prev_page_no != FIL_NULL) {
prev_page = buf_page_get_with_no_latch(space, prev_page_no,
- mtr);
+ mtr);
/* The caller must already have a latch to the brother */
ut_ad((mtr_memo_contains(mtr, buf_block_align(prev_page),
- MTR_MEMO_PAGE_S_FIX))
- || (mtr_memo_contains(mtr, buf_block_align(prev_page),
- MTR_MEMO_PAGE_X_FIX)));
+ MTR_MEMO_PAGE_S_FIX))
+ || (mtr_memo_contains(mtr, buf_block_align(prev_page),
+ MTR_MEMO_PAGE_X_FIX)));
ut_a(page_is_comp(prev_page) == page_is_comp(page));
#ifdef UNIV_BTR_DEBUG
ut_a(btr_page_get_next(prev_page, mtr)
- == buf_frame_get_page_no(page));
+ == buf_frame_get_page_no(page));
#endif /* UNIV_BTR_DEBUG */
return(page_rec_get_prev(page_get_supremum_rec(prev_page)));
@@ -235,15 +235,15 @@ btr_get_next_user_rec(
if (next_page_no != FIL_NULL) {
next_page = buf_page_get_with_no_latch(space, next_page_no,
- mtr);
+ mtr);
/* The caller must already have a latch to the brother */
ut_ad((mtr_memo_contains(mtr, buf_block_align(next_page),
- MTR_MEMO_PAGE_S_FIX))
- || (mtr_memo_contains(mtr, buf_block_align(next_page),
- MTR_MEMO_PAGE_X_FIX)));
+ MTR_MEMO_PAGE_S_FIX))
+ || (mtr_memo_contains(mtr, buf_block_align(next_page),
+ MTR_MEMO_PAGE_X_FIX)));
#ifdef UNIV_BTR_DEBUG
ut_a(btr_page_get_prev(next_page, mtr)
- == buf_frame_get_page_no(page));
+ == buf_frame_get_page_no(page));
#endif /* UNIV_BTR_DEBUG */
ut_a(page_is_comp(next_page) == page_is_comp(page));
@@ -265,9 +265,9 @@ btr_page_create(
mtr_t* mtr) /* in: mtr */
{
ut_ad(mtr_memo_contains(mtr, buf_block_align(page),
- MTR_MEMO_PAGE_X_FIX));
+ MTR_MEMO_PAGE_X_FIX));
page_create(page, mtr,
- dict_table_is_comp(tree->tree_index->table));
+ dict_table_is_comp(tree->tree_index->table));
buf_block_align(page)->check_index_page_at_flush = TRUE;
btr_page_set_index_id(page, tree->id, mtr);
@@ -291,19 +291,20 @@ btr_page_alloc_for_ibuf(
root = btr_root_get(tree, mtr);
node_addr = flst_get_first(root + PAGE_HEADER
- + PAGE_BTR_IBUF_FREE_LIST, mtr);
+ + PAGE_BTR_IBUF_FREE_LIST, mtr);
ut_a(node_addr.page != FIL_NULL);
new_page = buf_page_get(dict_tree_get_space(tree), node_addr.page,
- RW_X_LATCH, mtr);
+ RW_X_LATCH, mtr);
#ifdef UNIV_SYNC_DEBUG
buf_page_dbg_add_level(new_page, SYNC_TREE_NODE_NEW);
#endif /* UNIV_SYNC_DEBUG */
flst_remove(root + PAGE_HEADER + PAGE_BTR_IBUF_FREE_LIST,
- new_page + PAGE_HEADER + PAGE_BTR_IBUF_FREE_LIST_NODE,
- mtr);
- ut_ad(flst_validate(root + PAGE_HEADER + PAGE_BTR_IBUF_FREE_LIST, mtr));
+ new_page + PAGE_HEADER + PAGE_BTR_IBUF_FREE_LIST_NODE,
+ mtr);
+ ut_ad(flst_validate(root + PAGE_HEADER + PAGE_BTR_IBUF_FREE_LIST,
+ mtr));
return(new_page);
}
@@ -348,14 +349,14 @@ btr_page_alloc(
be allocated: */
new_page_no = fseg_alloc_free_page_general(seg_header, hint_page_no,
- file_direction, TRUE, mtr);
+ file_direction, TRUE, mtr);
if (new_page_no == FIL_NULL) {
return(NULL);
}
new_page = buf_page_get(dict_tree_get_space(tree), new_page_no,
- RW_X_LATCH, mtr);
+ RW_X_LATCH, mtr);
#ifdef UNIV_SYNC_DEBUG
buf_page_dbg_add_level(new_page, SYNC_TREE_NODE_NEW);
#endif /* UNIV_SYNC_DEBUG */
@@ -421,14 +422,14 @@ btr_page_free_for_ibuf(
page_t* root;
ut_ad(mtr_memo_contains(mtr, buf_block_align(page),
- MTR_MEMO_PAGE_X_FIX));
+ MTR_MEMO_PAGE_X_FIX));
root = btr_root_get(tree, mtr);
flst_add_first(root + PAGE_HEADER + PAGE_BTR_IBUF_FREE_LIST,
- page + PAGE_HEADER + PAGE_BTR_IBUF_FREE_LIST_NODE, mtr);
+ page + PAGE_HEADER + PAGE_BTR_IBUF_FREE_LIST_NODE, mtr);
ut_ad(flst_validate(root + PAGE_HEADER + PAGE_BTR_IBUF_FREE_LIST,
- mtr));
+ mtr));
}
/******************************************************************
@@ -450,7 +451,7 @@ btr_page_free_low(
ulint page_no;
ut_ad(mtr_memo_contains(mtr, buf_block_align(page),
- MTR_MEMO_PAGE_X_FIX));
+ MTR_MEMO_PAGE_X_FIX));
/* The page gets invalid for optimistic searches: increment the frame
modify clock */
@@ -491,7 +492,7 @@ btr_page_free(
ulint level;
ut_ad(mtr_memo_contains(mtr, buf_block_align(page),
- MTR_MEMO_PAGE_X_FIX));
+ MTR_MEMO_PAGE_X_FIX));
level = btr_page_get_level(page, mtr);
btr_page_free_low(tree, page, level, mtr);
@@ -517,7 +518,7 @@ btr_node_ptr_set_child_page_no(
/* The child address is in the last field */
field = rec_get_nth_field(rec, offsets,
- rec_offs_n_fields(offsets) - 1, &len);
+ rec_offs_n_fields(offsets) - 1, &len);
ut_ad(len == 4);
@@ -573,7 +574,7 @@ btr_page_get_father_for_rec(
*offsets_ = (sizeof offsets_) / sizeof *offsets_;
ut_ad(mtr_memo_contains(mtr, dict_tree_get_lock(tree),
- MTR_MEMO_X_LOCK));
+ MTR_MEMO_X_LOCK));
ut_a(page_rec_is_user_rec(user_rec));
ut_ad(dict_tree_get_page(tree) != buf_frame_get_page_no(page));
@@ -588,16 +589,16 @@ btr_page_get_father_for_rec(
first parameter for btr_cur_search_to_nth_level. */
btr_cur_search_to_nth_level(index,
- btr_page_get_level(page, mtr) + 1,
- tuple, PAGE_CUR_LE,
- BTR_CONT_MODIFY_TREE, &cursor, 0, mtr);
+ btr_page_get_level(page, mtr) + 1,
+ tuple, PAGE_CUR_LE,
+ BTR_CONT_MODIFY_TREE, &cursor, 0, mtr);
node_ptr = btr_cur_get_rec(&cursor);
offsets = rec_get_offsets(node_ptr, index, offsets,
- ULINT_UNDEFINED, &heap);
+ ULINT_UNDEFINED, &heap);
- if (btr_node_ptr_get_child_page_no(node_ptr, offsets) !=
- buf_frame_get_page_no(page)) {
+ if (UNIV_UNLIKELY(btr_node_ptr_get_child_page_no(node_ptr, offsets)
+ != buf_frame_get_page_no(page))) {
rec_t* print_rec;
fputs("InnoDB: Dump of the child page:\n", stderr);
buf_page_print(buf_frame_align(page));
@@ -609,27 +610,30 @@ btr_page_get_father_for_rec(
fputs(", index ", stderr);
ut_print_name(stderr, NULL, FALSE, index->name);
fprintf(stderr, ",\n"
-"InnoDB: father ptr page no %lu, child page no %lu\n",
+ "InnoDB: father ptr page no %lu, child page no %lu\n",
(ulong)
btr_node_ptr_get_child_page_no(node_ptr, offsets),
(ulong) buf_frame_get_page_no(page));
print_rec = page_rec_get_next(page_get_infimum_rec(page));
offsets = rec_get_offsets(print_rec, index,
- offsets, ULINT_UNDEFINED, &heap);
+ offsets, ULINT_UNDEFINED, &heap);
page_rec_print(print_rec, offsets);
offsets = rec_get_offsets(node_ptr, index, offsets,
- ULINT_UNDEFINED, &heap);
+ ULINT_UNDEFINED, &heap);
page_rec_print(node_ptr, offsets);
- fputs(
-"InnoDB: You should dump + drop + reimport the table to fix the\n"
-"InnoDB: corruption. If the crash happens at the database startup, see\n"
-"InnoDB: http://dev.mysql.com/doc/refman/5.1/en/forcing-recovery.html about\n"
-"InnoDB: forcing recovery. Then dump + drop + reimport.\n", stderr);
+ fputs("InnoDB: You should dump + drop + reimport the table"
+ " to fix the\n"
+ "InnoDB: corruption. If the crash happens at "
+ "the database startup, see\n"
+ "InnoDB: http://dev.mysql.com/doc/refman/5.1/en/"
+ "forcing-recovery.html about\n"
+ "InnoDB: forcing recovery. "
+ "Then dump + drop + reimport.\n", stderr);
}
- ut_a(btr_node_ptr_get_child_page_no(node_ptr, offsets) ==
- buf_frame_get_page_no(page));
+ ut_a(btr_node_ptr_get_child_page_no(node_ptr, offsets)
+ == buf_frame_get_page_no(page));
mem_heap_free(heap);
return(node_ptr);
@@ -648,7 +652,8 @@ btr_page_get_father_node_ptr(
user record */
mtr_t* mtr) /* in: mtr */
{
- return(btr_page_get_father_for_rec(tree, page,
+ return(btr_page_get_father_for_rec
+ (tree, page,
page_rec_get_next(page_get_infimum_rec(page)), mtr));
}
@@ -678,27 +683,27 @@ btr_create(
if (type & DICT_IBUF) {
/* Allocate first the ibuf header page */
- ibuf_hdr_frame = fseg_create(space, 0,
- IBUF_HEADER + IBUF_TREE_SEG_HEADER, mtr);
+ ibuf_hdr_frame = fseg_create
+ (space, 0, IBUF_HEADER + IBUF_TREE_SEG_HEADER, mtr);
#ifdef UNIV_SYNC_DEBUG
buf_page_dbg_add_level(ibuf_hdr_frame, SYNC_TREE_NODE_NEW);
#endif /* UNIV_SYNC_DEBUG */
ut_ad(buf_frame_get_page_no(ibuf_hdr_frame)
- == IBUF_HEADER_PAGE_NO);
+ == IBUF_HEADER_PAGE_NO);
/* Allocate then the next page to the segment: it will be the
tree root page */
- page_no = fseg_alloc_free_page(
- ibuf_hdr_frame + IBUF_HEADER
- + IBUF_TREE_SEG_HEADER, IBUF_TREE_ROOT_PAGE_NO,
- FSP_UP, mtr);
+ page_no = fseg_alloc_free_page(ibuf_hdr_frame + IBUF_HEADER
+ + IBUF_TREE_SEG_HEADER,
+ IBUF_TREE_ROOT_PAGE_NO,
+ FSP_UP, mtr);
ut_ad(page_no == IBUF_TREE_ROOT_PAGE_NO);
frame = buf_page_get(space, page_no, RW_X_LATCH, mtr);
} else {
frame = fseg_create(space, 0, PAGE_HEADER + PAGE_BTR_SEG_TOP,
- mtr);
+ mtr);
}
if (frame == NULL) {
@@ -722,7 +727,7 @@ btr_create(
/* It is a non-ibuf tree: create a file segment for leaf
pages */
fseg_create(space, page_no, PAGE_HEADER + PAGE_BTR_SEG_LEAF,
- mtr);
+ mtr);
/* The fseg create acquires a second latch on the page,
therefore we must declare it: */
#ifdef UNIV_SYNC_DEBUG
@@ -781,8 +786,8 @@ leaf_loop:
/* NOTE: page hash indexes are dropped when a page is freed inside
fsp0fsp. */
- finished = fseg_free_step(
- root + PAGE_HEADER + PAGE_BTR_SEG_LEAF, &mtr);
+ finished = fseg_free_step
+ (root + PAGE_HEADER + PAGE_BTR_SEG_LEAF, &mtr);
mtr_commit(&mtr);
if (!finished) {
@@ -794,8 +799,8 @@ top_loop:
root = btr_page_get(space, root_page_no, RW_X_LATCH, &mtr);
- finished = fseg_free_step_not_header(
- root + PAGE_HEADER + PAGE_BTR_SEG_TOP, &mtr);
+ finished = fseg_free_step_not_header
+ (root + PAGE_HEADER + PAGE_BTR_SEG_TOP, &mtr);
mtr_commit(&mtr);
if (!finished) {
@@ -822,8 +827,8 @@ btr_free_root(
btr_search_drop_page_hash_index(root);
top_loop:
- finished = fseg_free_step(
- root + PAGE_HEADER + PAGE_BTR_SEG_TOP, mtr);
+ finished = fseg_free_step
+ (root + PAGE_HEADER + PAGE_BTR_SEG_TOP, mtr);
if (!finished) {
goto top_loop;
@@ -853,15 +858,15 @@ btr_page_reorganize_low(
ulint max_ins_size2;
ut_ad(mtr_memo_contains(mtr, buf_block_align(page),
- MTR_MEMO_PAGE_X_FIX));
+ MTR_MEMO_PAGE_X_FIX));
ut_ad(!!page_is_comp(page) == dict_table_is_comp(index->table));
data_size1 = page_get_data_size(page);
max_ins_size1 = page_get_max_insert_size_after_reorganize(page, 1);
/* Write the log record */
mlog_open_and_write_index(mtr, page, index, page_is_comp(page)
- ? MLOG_COMP_PAGE_REORGANIZE
- : MLOG_PAGE_REORGANIZE, 0);
+ ? MLOG_COMP_PAGE_REORGANIZE
+ : MLOG_PAGE_REORGANIZE, 0);
/* Turn logging off */
log_mode = mtr_set_log_mode(mtr, MTR_LOG_NONE);
@@ -885,7 +890,8 @@ btr_page_reorganize_low(
do not copy the lock bits yet */
page_copy_rec_list_end_no_locks(page, new_page,
- page_get_infimum_rec(new_page), index, mtr);
+ page_get_infimum_rec(new_page),
+ index, mtr);
/* Copy max trx id to recreated page */
page_set_max_trx_id(page, page_get_max_trx_id(new_page));
@@ -901,9 +907,12 @@ btr_page_reorganize_low(
buf_page_print(page);
buf_page_print(new_page);
fprintf(stderr,
-"InnoDB: Error: page old data size %lu new data size %lu\n"
-"InnoDB: Error: page old max ins size %lu new max ins size %lu\n"
-"InnoDB: Submit a detailed bug report to http://bugs.mysql.com\n",
+ "InnoDB: Error: page old data size %lu"
+ " new data size %lu\n"
+ "InnoDB: Error: page old max ins size %lu"
+ " new max ins size %lu\n"
+ "InnoDB: Submit a detailed bug report"
+ " to http://bugs.mysql.com\n",
(unsigned long) data_size1, (unsigned long) data_size2,
(unsigned long) max_ins_size1,
(unsigned long) max_ins_size2);
@@ -963,7 +972,7 @@ btr_page_empty(
mtr_t* mtr) /* in: mtr */
{
ut_ad(mtr_memo_contains(mtr, buf_block_align(page),
- MTR_MEMO_PAGE_X_FIX));
+ MTR_MEMO_PAGE_X_FIX));
btr_search_drop_page_hash_index(page);
/* Recreate the page: note that global data on page (possible
@@ -1007,9 +1016,9 @@ btr_root_raise_and_insert(
ut_ad(dict_tree_get_page(tree) == buf_frame_get_page_no(root));
ut_ad(mtr_memo_contains(mtr, dict_tree_get_lock(tree),
- MTR_MEMO_X_LOCK));
+ MTR_MEMO_X_LOCK));
ut_ad(mtr_memo_contains(mtr, buf_block_align(root),
- MTR_MEMO_PAGE_X_FIX));
+ MTR_MEMO_PAGE_X_FIX));
btr_search_drop_page_hash_index(root);
/* Allocate a new page to the tree. Root splitting is done by first
@@ -1034,7 +1043,7 @@ btr_root_raise_and_insert(
/* Move the records from root to the new page */
page_move_rec_list_end(new_page, root, page_get_infimum_rec(root),
- cursor->index, mtr);
+ cursor->index, mtr);
/* If this is a pessimistic insert which is actually done to
perform a pessimistic update then we have stored the lock
information of the record to be inserted on the infimum of the
@@ -1052,7 +1061,7 @@ btr_root_raise_and_insert(
child */
node_ptr = dict_tree_build_node_ptr(tree, rec, new_page_no, heap,
- level);
+ level);
/* Reorganize the root to get free space */
btr_page_reorganize(root, cursor->index, mtr);
@@ -1063,7 +1072,7 @@ btr_root_raise_and_insert(
page_cur_set_before_first(root, page_cursor);
node_ptr_rec = page_cur_tuple_insert(page_cursor, node_ptr,
- cursor->index, mtr);
+ cursor->index, mtr);
ut_ad(node_ptr_rec);
@@ -1078,13 +1087,15 @@ btr_root_raise_and_insert(
/* We play safe and reset the free bits for the new page */
-/* fprintf(stderr, "Root raise new page no %lu\n",
- buf_frame_get_page_no(new_page)); */
+#if 0
+ fprintf(stderr, "Root raise new page no %lu\n",
+ buf_frame_get_page_no(new_page));
+#endif
ibuf_reset_free_bits(tree->tree_index, new_page);
/* Reposition the cursor to the child node */
page_cur_search(new_page, cursor->index, tuple,
- PAGE_CUR_LE, page_cursor);
+ PAGE_CUR_LE, page_cursor);
/* Split the child and insert tuple */
return(btr_page_split_and_insert(cursor, tuple, mtr));
@@ -1112,7 +1123,7 @@ btr_page_get_split_rec_to_left(
insert_point = btr_cur_get_rec(cursor);
if (page_header_get_ptr(page, PAGE_LAST_INSERT)
- == page_rec_get_next(insert_point)) {
+ == page_rec_get_next(insert_point)) {
infimum = page_get_infimum_rec(page);
@@ -1122,7 +1133,7 @@ btr_page_get_split_rec_to_left(
lots of records smaller than the convergence point. */
if (infimum != insert_point
- && page_rec_get_next(infimum) != insert_point) {
+ && page_rec_get_next(infimum) != insert_point) {
*split_rec = insert_point;
} else {
@@ -1160,7 +1171,7 @@ btr_page_get_split_rec_to_right(
pattern of sequential inserts here. */
if (UNIV_LIKELY(page_header_get_ptr(page, PAGE_LAST_INSERT)
- == insert_point)) {
+ == insert_point)) {
rec_t* next_rec;
@@ -1265,17 +1276,18 @@ btr_page_get_sure_split_rec(
incl_data += insert_size;
} else {
offsets = rec_get_offsets(rec, cursor->index,
- offsets, ULINT_UNDEFINED, &heap);
+ offsets, ULINT_UNDEFINED,
+ &heap);
incl_data += rec_offs_size(offsets);
}
n++;
if (incl_data + page_dir_calc_reserved_space(n)
- >= total_space / 2) {
+ >= total_space / 2) {
if (incl_data + page_dir_calc_reserved_space(n)
- <= free_space) {
+ <= free_space) {
/* The next record will be the first on
the right half page if it is not the
supremum record of page */
@@ -1335,9 +1347,9 @@ btr_page_insert_fits(
ut_ad(!split_rec == !offsets);
ut_ad(!offsets
- || !page_is_comp(page) == !rec_offs_comp(offsets));
+ || !page_is_comp(page) == !rec_offs_comp(offsets));
ut_ad(!offsets
- || rec_offs_validate(split_rec, cursor->index, offsets));
+ || rec_offs_validate(split_rec, cursor->index, offsets));
insert_size = rec_get_converted_size(cursor->index, tuple);
free_space = page_get_free_space_of_empty(page_is_comp(page));
@@ -1365,7 +1377,7 @@ btr_page_insert_fits(
}
if (total_data + page_dir_calc_reserved_space(total_n_recs)
- <= free_space) {
+ <= free_space) {
/* Ok, there will be enough available space on the
half page where the tuple is inserted */
@@ -1380,13 +1392,13 @@ btr_page_insert_fits(
space after rec is removed from page. */
offs = rec_get_offsets(rec, cursor->index, offs,
- ULINT_UNDEFINED, &heap);
+ ULINT_UNDEFINED, &heap);
total_data -= rec_offs_size(offs);
total_n_recs--;
if (total_data + page_dir_calc_reserved_space(total_n_recs)
- <= free_space) {
+ <= free_space) {
/* Ok, there will be enough available space on the
half page where the tuple is inserted */
@@ -1423,12 +1435,15 @@ btr_insert_on_non_leaf_level(
first parameter for btr_cur_search_to_nth_level. */
btr_cur_search_to_nth_level(tree->tree_index,
- level, tuple, PAGE_CUR_LE, BTR_CONT_MODIFY_TREE,
- &cursor, 0, mtr);
+ level, tuple, PAGE_CUR_LE,
+ BTR_CONT_MODIFY_TREE,
+ &cursor, 0, mtr);
err = btr_cur_pessimistic_insert(BTR_NO_LOCKING_FLAG
- | BTR_KEEP_SYS_FLAG | BTR_NO_UNDO_LOG_FLAG,
- &cursor, tuple, &rec, &dummy_big_rec, NULL, mtr);
+ | BTR_KEEP_SYS_FLAG
+ | BTR_NO_UNDO_LOG_FLAG,
+ &cursor, tuple, &rec,
+ &dummy_big_rec, NULL, mtr);
ut_a(err == DB_SUCCESS);
}
@@ -1462,9 +1477,9 @@ btr_attach_half_pages(
mem_heap_t* heap;
ut_ad(mtr_memo_contains(mtr, buf_block_align(page),
- MTR_MEMO_PAGE_X_FIX));
+ MTR_MEMO_PAGE_X_FIX));
ut_ad(mtr_memo_contains(mtr, buf_block_align(new_page),
- MTR_MEMO_PAGE_X_FIX));
+ MTR_MEMO_PAGE_X_FIX));
ut_a(page_is_comp(page) == page_is_comp(new_page));
/* Create a memory heap where the data tuple is stored */
@@ -1484,11 +1499,10 @@ btr_attach_half_pages(
/* Replace the address of the old child node (= page) with the
address of the new lower half */
- btr_node_ptr_set_child_page_no(node_ptr,
- rec_get_offsets(node_ptr,
- tree->tree_index,
- NULL, ULINT_UNDEFINED, &heap),
- lower_page_no, mtr);
+ btr_node_ptr_set_child_page_no(node_ptr, rec_get_offsets
+ (node_ptr, tree->tree_index,
+ NULL, ULINT_UNDEFINED, &heap),
+ lower_page_no, mtr);
mem_heap_empty(heap);
} else {
lower_page_no = buf_frame_get_page_no(page);
@@ -1504,7 +1518,7 @@ btr_attach_half_pages(
half */
node_ptr_upper = dict_tree_build_node_ptr(tree, split_rec,
- upper_page_no, heap, level);
+ upper_page_no, heap, level);
/* Insert it next to the pointer to the lower half. Note that this
may generate recursion leading to a split on the higher level. */
@@ -1528,7 +1542,7 @@ btr_attach_half_pages(
ut_a(page_is_comp(prev_page) == page_is_comp(page));
#ifdef UNIV_BTR_DEBUG
ut_a(btr_page_get_next(prev_page, mtr)
- == buf_frame_get_page_no(page));
+ == buf_frame_get_page_no(page));
#endif /* UNIV_BTR_DEBUG */
btr_page_set_next(prev_page, lower_page_no, mtr);
@@ -1600,7 +1614,7 @@ func_start:
tree = btr_cur_get_tree(cursor);
ut_ad(mtr_memo_contains(mtr, dict_tree_get_lock(tree),
- MTR_MEMO_X_LOCK));
+ MTR_MEMO_X_LOCK));
#ifdef UNIV_SYNC_DEBUG
ut_ad(rw_lock_own(dict_tree_get_lock(tree), RW_LOCK_EX));
#endif /* UNIV_SYNC_DEBUG */
@@ -1608,7 +1622,7 @@ func_start:
page = btr_cur_get_page(cursor);
ut_ad(mtr_memo_contains(mtr, buf_block_align(page),
- MTR_MEMO_PAGE_X_FIX));
+ MTR_MEMO_PAGE_X_FIX));
ut_ad(page_get_n_recs(page) >= 2);
page_no = buf_frame_get_page_no(page);
@@ -1637,7 +1651,7 @@ func_start:
/* 2. Allocate a new page to the tree */
new_page = btr_page_alloc(tree, hint_page_no, direction,
- btr_page_get_level(page, mtr), mtr);
+ btr_page_get_level(page, mtr), mtr);
btr_page_create(new_page, tree, mtr);
/* 3. Calculate the first record on the upper half-page, and the
@@ -1651,7 +1665,7 @@ func_start:
buf = mem_alloc(rec_get_converted_size(cursor->index, tuple));
first_rec = rec_convert_dtuple_to_rec(buf,
- cursor->index, tuple);
+ cursor->index, tuple);
move_limit = page_rec_get_next(btr_cur_get_rec(cursor));
}
@@ -1670,36 +1684,38 @@ func_start:
if (split_rec) {
offsets = rec_get_offsets(split_rec, cursor->index, offsets,
- n_uniq, &heap);
+ n_uniq, &heap);
insert_will_fit = btr_page_insert_fits(cursor,
- split_rec, offsets, tuple, heap);
+ split_rec, offsets,
+ tuple, heap);
} else {
insert_will_fit = btr_page_insert_fits(cursor,
- NULL, NULL, tuple, heap);
+ NULL, NULL,
+ tuple, heap);
}
if (insert_will_fit && (btr_page_get_level(page, mtr) == 0)) {
mtr_memo_release(mtr, dict_tree_get_lock(tree),
- MTR_MEMO_X_LOCK);
+ MTR_MEMO_X_LOCK);
}
/* 5. Move then the records to the new page */
if (direction == FSP_DOWN) {
-/* fputs("Split left\n", stderr); */
+ /* fputs("Split left\n", stderr); */
page_move_rec_list_start(new_page, page, move_limit,
- cursor->index, mtr);
+ cursor->index, mtr);
left_page = new_page;
right_page = page;
lock_update_split_left(right_page, left_page);
} else {
-/* fputs("Split right\n", stderr); */
+ /* fputs("Split right\n", stderr); */
page_move_rec_list_end(new_page, page, move_limit,
- cursor->index, mtr);
+ cursor->index, mtr);
left_page = page;
right_page = new_page;
@@ -1714,7 +1730,7 @@ func_start:
} else {
offsets = rec_get_offsets(first_rec, cursor->index,
- offsets, n_uniq, &heap);
+ offsets, n_uniq, &heap);
if (cmp_dtuple_rec(tuple, first_rec, offsets) >= 0) {
@@ -1728,7 +1744,7 @@ func_start:
page_cursor = btr_cur_get_page_cur(cursor);
page_cur_search(insert_page, cursor->index, tuple,
- PAGE_CUR_LE, page_cursor);
+ PAGE_CUR_LE, page_cursor);
rec = page_cur_tuple_insert(page_cursor, tuple, cursor->index, mtr);
@@ -1740,8 +1756,8 @@ func_start:
left_page,
right_page, mtr);
/* fprintf(stderr, "Split and insert done %lu %lu\n",
- buf_frame_get_page_no(left_page),
- buf_frame_get_page_no(right_page)); */
+ buf_frame_get_page_no(left_page),
+ buf_frame_get_page_no(right_page)); */
mem_heap_free(heap);
return(rec);
}
@@ -1751,7 +1767,7 @@ func_start:
btr_page_reorganize(insert_page, cursor->index, mtr);
page_cur_search(insert_page, cursor->index, tuple,
- PAGE_CUR_LE, page_cursor);
+ PAGE_CUR_LE, page_cursor);
rec = page_cur_tuple_insert(page_cursor, tuple, cursor->index, mtr);
if (rec == NULL) {
@@ -1762,7 +1778,7 @@ func_start:
ibuf_reset_free_bits(cursor->index, new_page);
/* fprintf(stderr, "Split second round %lu\n",
- buf_frame_get_page_no(page)); */
+ buf_frame_get_page_no(page)); */
n_iterations++;
ut_ad(n_iterations < 2);
ut_ad(!insert_will_fit);
@@ -1774,10 +1790,12 @@ func_start:
left and right pages in the same mtr */
ibuf_update_free_bits_for_two_pages_low(cursor->index, left_page,
- right_page, mtr);
- /* fprintf(stderr, "Split and insert done %lu %lu\n",
- buf_frame_get_page_no(left_page),
- buf_frame_get_page_no(right_page)); */
+ right_page, mtr);
+#if 0
+ fprintf(stderr, "Split and insert done %lu %lu\n",
+ buf_frame_get_page_no(left_page),
+ buf_frame_get_page_no(right_page));
+#endif
ut_ad(page_validate(left_page, tree->tree_index));
ut_ad(page_validate(right_page, tree->tree_index));
@@ -1804,7 +1822,7 @@ btr_level_list_remove(
ut_ad(tree && page && mtr);
ut_ad(mtr_memo_contains(mtr, buf_block_align(page),
- MTR_MEMO_PAGE_X_FIX));
+ MTR_MEMO_PAGE_X_FIX));
/* Get the previous and next page numbers of page */
prev_page_no = btr_page_get_prev(page, mtr);
@@ -1819,7 +1837,7 @@ btr_level_list_remove(
ut_a(page_is_comp(prev_page) == page_is_comp(page));
#ifdef UNIV_BTR_DEBUG
ut_a(btr_page_get_next(prev_page, mtr)
- == buf_frame_get_page_no(page));
+ == buf_frame_get_page_no(page));
#endif /* UNIV_BTR_DEBUG */
btr_page_set_next(prev_page, next_page_no, mtr);
@@ -1831,7 +1849,7 @@ btr_level_list_remove(
ut_a(page_is_comp(next_page) == page_is_comp(page));
#ifdef UNIV_BTR_DEBUG
ut_a(btr_page_get_prev(next_page, mtr)
- == buf_frame_get_page_no(page));
+ == buf_frame_get_page_no(page));
#endif /* UNIV_BTR_DEBUG */
btr_page_set_prev(next_page, prev_page_no, mtr);
@@ -1849,12 +1867,12 @@ btr_set_min_rec_mark_log(
ulint comp, /* nonzero=compact record format */
mtr_t* mtr) /* in: mtr */
{
- mlog_write_initial_log_record(rec,
- comp ? MLOG_COMP_REC_MIN_MARK : MLOG_REC_MIN_MARK, mtr);
+ mlog_write_initial_log_record
+ (rec, comp ? MLOG_COMP_REC_MIN_MARK : MLOG_REC_MIN_MARK, mtr);
/* Write rec offset as a 2-byte ulint */
mlog_catenate_ulint(mtr, ut_align_offset(rec, UNIV_PAGE_SIZE),
- MLOG_2BYTES);
+ MLOG_2BYTES);
}
/********************************************************************
@@ -1924,14 +1942,14 @@ btr_node_ptr_delete(
ulint err;
ut_ad(mtr_memo_contains(mtr, buf_block_align(page),
- MTR_MEMO_PAGE_X_FIX));
+ MTR_MEMO_PAGE_X_FIX));
/* Delete node pointer on father page */
node_ptr = btr_page_get_father_node_ptr(tree, page, mtr);
btr_cur_position(tree->tree_index, node_ptr, &cursor);
compressed = btr_cur_pessimistic_delete(&err, TRUE, &cursor, FALSE,
- mtr);
+ mtr);
ut_a(err == DB_SUCCESS);
if (!compressed) {
@@ -1960,9 +1978,9 @@ btr_lift_page_up(
ut_ad(btr_page_get_prev(page, mtr) == FIL_NULL);
ut_ad(btr_page_get_next(page, mtr) == FIL_NULL);
ut_ad(mtr_memo_contains(mtr, buf_block_align(page),
- MTR_MEMO_PAGE_X_FIX));
- father_page = buf_frame_align(
- btr_page_get_father_node_ptr(tree, page, mtr));
+ MTR_MEMO_PAGE_X_FIX));
+ father_page = buf_frame_align
+ (btr_page_get_father_node_ptr(tree, page, mtr));
page_level = btr_page_get_level(page, mtr);
index = tree->tree_index;
@@ -1974,7 +1992,7 @@ btr_lift_page_up(
/* Move records to the father */
page_copy_rec_list_end(father_page, page, page_get_infimum_rec(page),
- index, mtr);
+ index, mtr);
lock_update_copy_and_discard(father_page, page);
btr_page_set_level(father_page, page_level, mtr);
@@ -2032,17 +2050,19 @@ btr_compress(
ut_a((ibool)!!comp == dict_table_is_comp(cursor->index->table));
ut_ad(mtr_memo_contains(mtr, dict_tree_get_lock(tree),
- MTR_MEMO_X_LOCK));
+ MTR_MEMO_X_LOCK));
ut_ad(mtr_memo_contains(mtr, buf_block_align(page),
- MTR_MEMO_PAGE_X_FIX));
+ MTR_MEMO_PAGE_X_FIX));
level = btr_page_get_level(page, mtr);
space = dict_tree_get_space(tree);
left_page_no = btr_page_get_prev(page, mtr);
right_page_no = btr_page_get_next(page, mtr);
-/* fprintf(stderr, "Merge left page %lu right %lu \n", left_page_no,
- right_page_no); */
+#if 0
+ fprintf(stderr, "Merge left page %lu right %lu \n",
+ left_page_no, right_page_no);
+#endif
node_ptr = btr_page_get_father_node_ptr(tree, page, mtr);
ut_ad(!comp || rec_get_status(node_ptr) == REC_STATUS_NODE_PTR);
@@ -2057,18 +2077,18 @@ btr_compress(
if (is_left) {
merge_page = btr_page_get(space, left_page_no, RW_X_LATCH,
- mtr);
+ mtr);
#ifdef UNIV_BTR_DEBUG
ut_a(btr_page_get_next(merge_page, mtr)
- == buf_frame_get_page_no(page));
+ == buf_frame_get_page_no(page));
#endif /* UNIV_BTR_DEBUG */
} else if (right_page_no != FIL_NULL) {
merge_page = btr_page_get(space, right_page_no, RW_X_LATCH,
- mtr);
+ mtr);
#ifdef UNIV_BTR_DEBUG
ut_a(btr_page_get_prev(merge_page, mtr)
- == buf_frame_get_page_no(page));
+ == buf_frame_get_page_no(page));
#endif /* UNIV_BTR_DEBUG */
} else {
/* The page is the only one on the level, lift the records
@@ -2082,8 +2102,8 @@ btr_compress(
data_size = page_get_data_size(page);
ut_a(page_is_comp(merge_page) == comp);
- max_ins_size_reorg = page_get_max_insert_size_after_reorganize(
- merge_page, n_recs);
+ max_ins_size_reorg = page_get_max_insert_size_after_reorganize
+ (merge_page, n_recs);
if (data_size > max_ins_size_reorg) {
/* No space for merge */
@@ -2105,7 +2125,7 @@ btr_compress(
ut_ad(page_validate(merge_page, cursor->index));
ut_ad(page_get_max_insert_size(merge_page, n_recs)
- == max_ins_size_reorg);
+ == max_ins_size_reorg);
}
if (data_size > max_ins_size) {
@@ -2129,10 +2149,11 @@ btr_compress(
/* Replace the address of the old child node (= page) with the
address of the merge page to the right */
- btr_node_ptr_set_child_page_no(node_ptr,
- rec_get_offsets(node_ptr, cursor->index,
- offsets_, ULINT_UNDEFINED, &heap),
- right_page_no, mtr);
+ btr_node_ptr_set_child_page_no(node_ptr, rec_get_offsets
+ (node_ptr, cursor->index,
+ offsets_, ULINT_UNDEFINED,
+ &heap),
+ right_page_no, mtr);
if (UNIV_LIKELY_NULL(heap)) {
mem_heap_free(heap);
}
@@ -2141,24 +2162,26 @@ btr_compress(
/* Move records to the merge page */
if (is_left) {
- orig_pred = page_rec_get_prev(
- page_get_supremum_rec(merge_page));
+ orig_pred = page_rec_get_prev
+ (page_get_supremum_rec(merge_page));
page_copy_rec_list_start(merge_page, page,
- page_get_supremum_rec(page), cursor->index, mtr);
+ page_get_supremum_rec(page),
+ cursor->index, mtr);
lock_update_merge_left(merge_page, orig_pred, page);
} else {
- orig_succ = page_rec_get_next(
- page_get_infimum_rec(merge_page));
+ orig_succ = page_rec_get_next
+ (page_get_infimum_rec(merge_page));
page_copy_rec_list_end(merge_page, page,
- page_get_infimum_rec(page), cursor->index, mtr);
+ page_get_infimum_rec(page),
+ cursor->index, mtr);
lock_update_merge_right(orig_succ, page);
}
/* We have added new records to merge_page: update its free bits */
ibuf_update_free_bits_if_full(cursor->index, merge_page,
- UNIV_PAGE_SIZE, ULINT_UNDEFINED);
+ UNIV_PAGE_SIZE, ULINT_UNDEFINED);
ut_ad(page_validate(merge_page, cursor->index));
@@ -2185,7 +2208,7 @@ btr_discard_only_page_on_level(
ut_ad(btr_page_get_prev(page, mtr) == FIL_NULL);
ut_ad(btr_page_get_next(page, mtr) == FIL_NULL);
ut_ad(mtr_memo_contains(mtr, buf_block_align(page),
- MTR_MEMO_PAGE_X_FIX));
+ MTR_MEMO_PAGE_X_FIX));
btr_search_drop_page_hash_index(page);
node_ptr = btr_page_get_father_node_ptr(tree, page, mtr);
@@ -2239,9 +2262,9 @@ btr_discard_page(
ut_ad(dict_tree_get_page(tree) != buf_frame_get_page_no(page));
ut_ad(mtr_memo_contains(mtr, dict_tree_get_lock(tree),
- MTR_MEMO_X_LOCK));
+ MTR_MEMO_X_LOCK));
ut_ad(mtr_memo_contains(mtr, buf_block_align(page),
- MTR_MEMO_PAGE_X_FIX));
+ MTR_MEMO_PAGE_X_FIX));
space = dict_tree_get_space(tree);
/* Decide the page which will inherit the locks */
@@ -2251,17 +2274,17 @@ btr_discard_page(
if (left_page_no != FIL_NULL) {
merge_page = btr_page_get(space, left_page_no, RW_X_LATCH,
- mtr);
+ mtr);
#ifdef UNIV_BTR_DEBUG
ut_a(btr_page_get_next(merge_page, mtr)
- == buf_frame_get_page_no(page));
+ == buf_frame_get_page_no(page));
#endif /* UNIV_BTR_DEBUG */
} else if (right_page_no != FIL_NULL) {
merge_page = btr_page_get(space, right_page_no, RW_X_LATCH,
- mtr);
+ mtr);
#ifdef UNIV_BTR_DEBUG
ut_a(btr_page_get_prev(merge_page, mtr)
- == buf_frame_get_page_no(page));
+ == buf_frame_get_page_no(page));
#endif /* UNIV_BTR_DEBUG */
} else {
btr_discard_only_page_on_level(tree, page, mtr);
@@ -2292,8 +2315,8 @@ btr_discard_page(
if (left_page_no != FIL_NULL) {
lock_update_discard(page_get_supremum_rec(merge_page), page);
} else {
- lock_update_discard(page_rec_get_next(
- page_get_infimum_rec(merge_page)), page);
+ lock_update_discard(page_rec_get_next
+ (page_get_infimum_rec(merge_page)), page);
}
/* Free the file page */
@@ -2316,9 +2339,8 @@ btr_print_size(
mtr_t mtr;
if (tree->type & DICT_IBUF) {
- fputs(
- "Sorry, cannot print info of an ibuf tree: use ibuf functions\n",
- stderr);
+ fputs("Sorry, cannot print info of an ibuf tree:"
+ " use ibuf functions\n", stderr);
return;
}
@@ -2366,7 +2388,7 @@ btr_print_recursive(
dict_index_t* index;
ut_ad(mtr_memo_contains(mtr, buf_block_align(page),
- MTR_MEMO_PAGE_X_FIX));
+ MTR_MEMO_PAGE_X_FIX));
fprintf(stderr, "NODE ON LEVEL %lu page number %lu\n",
(ulong) btr_page_get_level(page, mtr),
(ulong) buf_frame_get_page_no(page));
@@ -2392,11 +2414,11 @@ btr_print_recursive(
node_ptr = page_cur_get_rec(&cursor);
*offsets = rec_get_offsets(node_ptr, index, *offsets,
- ULINT_UNDEFINED, heap);
+ ULINT_UNDEFINED, heap);
child = btr_node_ptr_get_child(node_ptr,
- *offsets, &mtr2);
+ *offsets, &mtr2);
btr_print_recursive(tree, child, width,
- heap, offsets, &mtr2);
+ heap, offsets, &mtr2);
mtr_commit(&mtr2);
}
@@ -2423,7 +2445,7 @@ btr_print_tree(
*offsets_ = (sizeof offsets_) / sizeof *offsets_;
fputs("--------------------------\n"
- "INDEX TREE PRINT\n", stderr);
+ "INDEX TREE PRINT\n", stderr);
mtr_start(&mtr);
@@ -2457,7 +2479,7 @@ btr_check_node_ptr(
dtuple_t* node_ptr_tuple;
ut_ad(mtr_memo_contains(mtr, buf_block_align(page),
- MTR_MEMO_PAGE_X_FIX));
+ MTR_MEMO_PAGE_X_FIX));
if (dict_tree_get_page(tree) == buf_frame_get_page_no(page)) {
return(TRUE);
@@ -2472,15 +2494,13 @@ btr_check_node_ptr(
heap = mem_heap_create(256);
- node_ptr_tuple = dict_tree_build_node_ptr(
- tree,
- page_rec_get_next(page_get_infimum_rec(page)),
- 0, heap, btr_page_get_level(page, mtr));
+ node_ptr_tuple = dict_tree_build_node_ptr
+ (tree, page_rec_get_next(page_get_infimum_rec(page)),
+ 0, heap, btr_page_get_level(page, mtr));
- ut_a(cmp_dtuple_rec(node_ptr_tuple, node_ptr,
- rec_get_offsets(node_ptr,
- tree->tree_index,
- NULL, ULINT_UNDEFINED, &heap)) == 0);
+ ut_a(!cmp_dtuple_rec(node_ptr_tuple, node_ptr,
+ rec_get_offsets(node_ptr, tree->tree_index,
+ NULL, ULINT_UNDEFINED, &heap)));
mem_heap_free(heap);
@@ -2538,7 +2558,7 @@ btr_index_rec_validate(
}
if (UNIV_UNLIKELY((ibool)!!page_is_comp(page)
- != dict_table_is_comp(index->table))) {
+ != dict_table_is_comp(index->table))) {
btr_index_rec_validate_report(page, rec, index);
fprintf(stderr, "InnoDB: compact flag=%lu, should be %lu\n",
(ulong) !!page_is_comp(page),
@@ -2550,7 +2570,7 @@ btr_index_rec_validate(
n = dict_index_get_n_fields(index);
if (!page_is_comp(page)
- && UNIV_UNLIKELY(rec_get_n_fields_old(rec) != n)) {
+ && UNIV_UNLIKELY(rec_get_n_fields_old(rec) != n)) {
btr_index_rec_validate_report(page, rec, index);
fprintf(stderr, "InnoDB: has %lu fields, should have %lu\n",
(ulong) rec_get_n_fields_old(rec), (ulong) n);
@@ -2577,18 +2597,19 @@ btr_index_rec_validate(
their type is CHAR. */
if ((dict_index_get_nth_field(index, i)->prefix_len == 0
- && len != UNIV_SQL_NULL && fixed_size
- && len != fixed_size)
- ||
- (dict_index_get_nth_field(index, i)->prefix_len > 0
- && len != UNIV_SQL_NULL
- && len >
- dict_index_get_nth_field(index, i)->prefix_len)) {
+ && len != UNIV_SQL_NULL && fixed_size
+ && len != fixed_size)
+ || (dict_index_get_nth_field(index, i)->prefix_len > 0
+ && len != UNIV_SQL_NULL
+ && len
+ > dict_index_get_nth_field(index, i)->prefix_len)) {
btr_index_rec_validate_report(page, rec, index);
fprintf(stderr,
-"InnoDB: field %lu len is %lu, should be %lu\n",
- (ulong) i, (ulong) len, (ulong) dtype_get_fixed_size(type));
+ "InnoDB: field %lu len is %lu,"
+ " should be %lu\n",
+ (ulong) i, (ulong) len,
+ (ulong) dtype_get_fixed_size(type));
if (dump_on_error) {
buf_page_print(page);
@@ -2733,7 +2754,7 @@ btr_validate_level(
node_ptr = page_cur_get_rec(&cursor);
offsets = rec_get_offsets(node_ptr, index, offsets,
- ULINT_UNDEFINED, &heap);
+ ULINT_UNDEFINED, &heap);
page = btr_node_ptr_get_child(node_ptr, offsets, &mtr);
}
@@ -2771,18 +2792,19 @@ loop:
left_page_no = btr_page_get_prev(page, &mtr);
ut_a((page_get_n_recs(page) > 0)
- || ((level == 0) &&
- (buf_frame_get_page_no(page) == dict_tree_get_page(tree))));
+ || ((level == 0)
+ && (buf_frame_get_page_no(page)
+ == dict_tree_get_page(tree))));
if (right_page_no != FIL_NULL) {
rec_t* right_rec;
right_page = btr_page_get(space, right_page_no, RW_X_LATCH,
- &mtr);
+ &mtr);
if (UNIV_UNLIKELY(btr_page_get_prev(right_page, &mtr)
- != buf_frame_get_page_no(page))) {
+ != buf_frame_get_page_no(page))) {
btr_validate_report2(index, level, page, right_page);
fputs("InnoDB: broken FIL_PAGE_NEXT"
- " or FIL_PAGE_PREV links\n", stderr);
+ " or FIL_PAGE_PREV links\n", stderr);
buf_page_print(page);
buf_page_print(right_page);
@@ -2790,7 +2812,7 @@ loop:
}
if (UNIV_UNLIKELY(page_is_comp(right_page)
- != page_is_comp(page))) {
+ != page_is_comp(page))) {
btr_validate_report2(index, level, page, right_page);
fputs("InnoDB: 'compact' flag mismatch\n", stderr);
buf_page_print(page);
@@ -2802,19 +2824,20 @@ loop:
}
rec = page_rec_get_prev(page_get_supremum_rec(page));
- right_rec = page_rec_get_next(
- page_get_infimum_rec(right_page));
+ right_rec = page_rec_get_next(page_get_infimum_rec
+ (right_page));
offsets = rec_get_offsets(rec, index,
- offsets, ULINT_UNDEFINED, &heap);
+ offsets, ULINT_UNDEFINED, &heap);
offsets2 = rec_get_offsets(right_rec, index,
- offsets2, ULINT_UNDEFINED, &heap);
+ offsets2, ULINT_UNDEFINED, &heap);
if (UNIV_UNLIKELY(cmp_rec_rec(rec, right_rec,
- offsets, offsets2, index) >= 0)) {
+ offsets, offsets2,
+ index) >= 0)) {
btr_validate_report2(index, level, page, right_page);
fputs("InnoDB: records in wrong order"
- " on adjacent pages\n", stderr);
+ " on adjacent pages\n", stderr);
buf_page_print(page);
buf_page_print(right_page);
@@ -2824,8 +2847,8 @@ loop:
rec_print(stderr, rec, index);
putc('\n', stderr);
fputs("InnoDB: record ", stderr);
- rec = page_rec_get_next(page_get_infimum_rec(
- right_page));
+ rec = page_rec_get_next
+ (page_get_infimum_rec(right_page));
rec_print(stderr, rec, index);
putc('\n', stderr);
@@ -2834,9 +2857,9 @@ loop:
}
if (level > 0 && left_page_no == FIL_NULL) {
- ut_a(REC_INFO_MIN_REC_FLAG & rec_get_info_bits(
- page_rec_get_next(page_get_infimum_rec(page)),
- page_is_comp(page)));
+ ut_a(REC_INFO_MIN_REC_FLAG & rec_get_info_bits
+ (page_rec_get_next(page_get_infimum_rec(page)),
+ page_is_comp(page)));
}
if (buf_frame_get_page_no(page) != dict_tree_get_page(tree)) {
@@ -2846,17 +2869,17 @@ loop:
node_ptr = btr_page_get_father_node_ptr(tree, page, &mtr);
father_page = buf_frame_align(node_ptr);
offsets = rec_get_offsets(node_ptr, index,
- offsets, ULINT_UNDEFINED, &heap);
+ offsets, ULINT_UNDEFINED, &heap);
- if (btr_node_ptr_get_child_page_no(node_ptr, offsets) !=
- buf_frame_get_page_no(page)
- || node_ptr != btr_page_get_father_for_rec(tree, page,
- page_rec_get_prev(page_get_supremum_rec(page)),
- &mtr)) {
+ if (btr_node_ptr_get_child_page_no(node_ptr, offsets)
+ != buf_frame_get_page_no(page)
+ || node_ptr != btr_page_get_father_for_rec
+ (tree, page,
+ page_rec_get_prev(page_get_supremum_rec(page)), &mtr)) {
btr_validate_report1(index, level, page);
fputs("InnoDB: node pointer to the page is wrong\n",
- stderr);
+ stderr);
buf_page_print(father_page);
buf_page_print(page);
@@ -2866,13 +2889,13 @@ loop:
fprintf(stderr, "\n"
"InnoDB: node ptr child page n:o %lu\n",
- (unsigned long) btr_node_ptr_get_child_page_no(
- node_ptr, offsets));
+ (unsigned long) btr_node_ptr_get_child_page_no
+ (node_ptr, offsets));
fputs("InnoDB: record on page ", stderr);
- rec = btr_page_get_father_for_rec(tree, page,
- page_rec_get_prev(page_get_supremum_rec(page)),
- &mtr);
+ rec = btr_page_get_father_for_rec
+ (tree, page, page_rec_get_prev
+ (page_get_supremum_rec(page)), &mtr);
rec_print(stderr, rec, index);
putc('\n', stderr);
ret = FALSE;
@@ -2882,19 +2905,18 @@ loop:
if (btr_page_get_level(page, &mtr) > 0) {
offsets = rec_get_offsets(node_ptr, index,
- offsets, ULINT_UNDEFINED, &heap);
+ offsets, ULINT_UNDEFINED,
+ &heap);
- node_ptr_tuple = dict_tree_build_node_ptr(
- tree,
- page_rec_get_next(
- page_get_infimum_rec(page)),
- 0, heap,
- btr_page_get_level(page, &mtr));
+ node_ptr_tuple = dict_tree_build_node_ptr
+ (tree,
+ page_rec_get_next(page_get_infimum_rec(page)),
+ 0, heap, btr_page_get_level(page, &mtr));
if (cmp_dtuple_rec(node_ptr_tuple, node_ptr,
- offsets)) {
- rec_t* first_rec = page_rec_get_next(
- page_get_infimum_rec(page));
+ offsets)) {
+ rec_t* first_rec = page_rec_get_next
+ (page_get_infimum_rec(page));
btr_validate_report1(index, level, page);
@@ -2902,8 +2924,8 @@ loop:
buf_page_print(page);
fputs("InnoDB: Error: node ptrs differ"
- " on levels > 0\n"
- "InnoDB: node ptr ", stderr);
+ " on levels > 0\n"
+ "InnoDB: node ptr ", stderr);
rec_print_new(stderr, node_ptr, offsets);
fputs("InnoDB: first rec ", stderr);
rec_print(stderr, first_rec, index);
@@ -2915,49 +2937,49 @@ loop:
}
if (left_page_no == FIL_NULL) {
- ut_a(node_ptr == page_rec_get_next(
- page_get_infimum_rec(father_page)));
+ ut_a(node_ptr == page_rec_get_next
+ (page_get_infimum_rec(father_page)));
ut_a(btr_page_get_prev(father_page, &mtr) == FIL_NULL);
}
if (right_page_no == FIL_NULL) {
- ut_a(node_ptr == page_rec_get_prev(
- page_get_supremum_rec(father_page)));
+ ut_a(node_ptr == page_rec_get_prev
+ (page_get_supremum_rec(father_page)));
ut_a(btr_page_get_next(father_page, &mtr) == FIL_NULL);
} else {
- right_node_ptr = btr_page_get_father_node_ptr(tree,
- right_page, &mtr);
- if (page_rec_get_next(node_ptr) !=
- page_get_supremum_rec(father_page)) {
+ right_node_ptr = btr_page_get_father_node_ptr
+ (tree, right_page, &mtr);
+ if (page_rec_get_next(node_ptr)
+ != page_get_supremum_rec(father_page)) {
- if (right_node_ptr !=
- page_rec_get_next(node_ptr)) {
+ if (right_node_ptr
+ != page_rec_get_next(node_ptr)) {
ret = FALSE;
- fputs(
- "InnoDB: node pointer to the right page is wrong\n",
- stderr);
+ fputs("InnoDB: node pointer to"
+ " the right page is wrong\n",
+ stderr);
btr_validate_report1(index, level,
- page);
+ page);
buf_page_print(father_page);
buf_page_print(page);
buf_page_print(right_page);
}
} else {
- right_father_page = buf_frame_align(
- right_node_ptr);
+ right_father_page = buf_frame_align
+ (right_node_ptr);
- if (right_node_ptr != page_rec_get_next(
- page_get_infimum_rec(
- right_father_page))) {
+ if (right_node_ptr != page_rec_get_next
+ (page_get_infimum_rec
+ (right_father_page))) {
ret = FALSE;
- fputs(
- "InnoDB: node pointer 2 to the right page is wrong\n",
- stderr);
+ fputs("InnoDB: node pointer 2 to"
+ " the right page is wrong\n",
+ stderr);
btr_validate_report1(index, level,
- page);
+ page);
buf_page_print(father_page);
buf_page_print(right_father_page);
@@ -2966,15 +2988,15 @@ loop:
}
if (buf_frame_get_page_no(right_father_page)
- != btr_page_get_next(father_page, &mtr)) {
+ != btr_page_get_next(father_page, &mtr)) {
ret = FALSE;
- fputs(
- "InnoDB: node pointer 3 to the right page is wrong\n",
- stderr);
+ fputs("InnoDB: node pointer 3 to"
+ " the right page is wrong\n",
+ stderr);
btr_validate_report1(index, level,
- page);
+ page);
buf_page_print(father_page);
buf_page_print(right_father_page);
diff --git a/storage/innobase/btr/btr0cur.c b/storage/innobase/btr/btr0cur.c
index 7d62571284f..8fbc25c9e79 100644
--- a/storage/innobase/btr/btr0cur.c
+++ b/storage/innobase/btr/btr0cur.c
@@ -156,14 +156,14 @@ btr_cur_latch_leaves(
if (left_page_no != FIL_NULL) {
get_page = btr_page_get(space, left_page_no,
- RW_X_LATCH, mtr);
+ RW_X_LATCH, mtr);
#ifdef UNIV_BTR_DEBUG
ut_a(btr_page_get_next(get_page, mtr)
- == buf_frame_get_page_no(page));
+ == buf_frame_get_page_no(page));
#endif /* UNIV_BTR_DEBUG */
ut_a(page_is_comp(get_page) == page_is_comp(page));
- buf_block_align(get_page)->check_index_page_at_flush =
- TRUE;
+ buf_block_align(get_page)->check_index_page_at_flush
+ = TRUE;
}
get_page = btr_page_get(space, page_no, RW_X_LATCH, mtr);
@@ -174,13 +174,13 @@ btr_cur_latch_leaves(
if (right_page_no != FIL_NULL) {
get_page = btr_page_get(space, right_page_no,
- RW_X_LATCH, mtr);
+ RW_X_LATCH, mtr);
#ifdef UNIV_BTR_DEBUG
ut_a(btr_page_get_prev(get_page, mtr)
- == buf_frame_get_page_no(page));
+ == buf_frame_get_page_no(page));
#endif /* UNIV_BTR_DEBUG */
- buf_block_align(get_page)->check_index_page_at_flush =
- TRUE;
+ buf_block_align(get_page)->check_index_page_at_flush
+ = TRUE;
}
} else if (latch_mode == BTR_SEARCH_PREV) {
@@ -190,15 +190,15 @@ btr_cur_latch_leaves(
if (left_page_no != FIL_NULL) {
cursor->left_page = btr_page_get(space, left_page_no,
- RW_S_LATCH, mtr);
+ RW_S_LATCH, mtr);
#ifdef UNIV_BTR_DEBUG
ut_a(btr_page_get_next(cursor->left_page, mtr)
- == buf_frame_get_page_no(page));
+ == buf_frame_get_page_no(page));
#endif /* UNIV_BTR_DEBUG */
- ut_a(page_is_comp(cursor->left_page) ==
- page_is_comp(page));
- buf_block_align(
- cursor->left_page)->check_index_page_at_flush = TRUE;
+ ut_a(page_is_comp(cursor->left_page)
+ == page_is_comp(page));
+ buf_block_align(cursor->left_page)
+ ->check_index_page_at_flush = TRUE;
}
get_page = btr_page_get(space, page_no, RW_S_LATCH, mtr);
@@ -212,15 +212,15 @@ btr_cur_latch_leaves(
if (left_page_no != FIL_NULL) {
cursor->left_page = btr_page_get(space, left_page_no,
- RW_X_LATCH, mtr);
+ RW_X_LATCH, mtr);
#ifdef UNIV_BTR_DEBUG
ut_a(btr_page_get_next(cursor->left_page, mtr)
- == buf_frame_get_page_no(page));
+ == buf_frame_get_page_no(page));
#endif /* UNIV_BTR_DEBUG */
- ut_a(page_is_comp(cursor->left_page) ==
- page_is_comp(page));
- buf_block_align(
- cursor->left_page)->check_index_page_at_flush = TRUE;
+ ut_a(page_is_comp(cursor->left_page)
+ == page_is_comp(page));
+ buf_block_align(cursor->left_page)
+ ->check_index_page_at_flush = TRUE;
}
get_page = btr_page_get(space, page_no, RW_X_LATCH, mtr);
@@ -237,7 +237,12 @@ NOTE: n_fields_cmp in tuple must be set so that it cannot be compared
to node pointer page number fields on the upper levels of the tree!
Note that if mode is PAGE_CUR_LE, which is used in inserts, then
cursor->up_match and cursor->low_match both will have sensible values.
-If mode is PAGE_CUR_GE, then up_match will a have a sensible value. */
+If mode is PAGE_CUR_GE, then up_match will a have a sensible value.
+
+If mode is PAGE_CUR_LE , cursor is left at the place where an insert of the
+search tuple should be performed in the B-tree. InnoDB does an insert
+immediately after the cursor. Thus, the cursor may end up on a user record,
+or on a page infimum record. */
void
btr_cur_search_to_nth_level(
@@ -310,7 +315,7 @@ btr_cur_search_to_nth_level(
estimate = latch_mode & BTR_ESTIMATE;
ignore_sec_unique = latch_mode & BTR_IGNORE_SEC_UNIQUE;
latch_mode = latch_mode & ~(BTR_INSERT | BTR_ESTIMATE
- | BTR_IGNORE_SEC_UNIQUE);
+ | BTR_IGNORE_SEC_UNIQUE);
ut_ad(!insert_planned || (mode == PAGE_CUR_LE));
@@ -330,24 +335,24 @@ btr_cur_search_to_nth_level(
info->n_searches++;
#endif
if (btr_search_latch.writer == RW_LOCK_NOT_LOCKED
- && latch_mode <= BTR_MODIFY_LEAF && info->last_hash_succ
- && !estimate
+ && latch_mode <= BTR_MODIFY_LEAF && info->last_hash_succ
+ && !estimate
#ifdef PAGE_CUR_LE_OR_EXTENDS
- && mode != PAGE_CUR_LE_OR_EXTENDS
+ && mode != PAGE_CUR_LE_OR_EXTENDS
#endif /* PAGE_CUR_LE_OR_EXTENDS */
- && srv_use_adaptive_hash_indexes
- && btr_search_guess_on_hash(index, info, tuple, mode,
- latch_mode, cursor,
- has_search_latch, mtr)) {
+ && srv_use_adaptive_hash_indexes
+ && btr_search_guess_on_hash(index, info, tuple, mode,
+ latch_mode, cursor,
+ has_search_latch, mtr)) {
/* Search using the hash index succeeded */
ut_ad(cursor->up_match != ULINT_UNDEFINED
- || mode != PAGE_CUR_GE);
+ || mode != PAGE_CUR_GE);
ut_ad(cursor->up_match != ULINT_UNDEFINED
- || mode != PAGE_CUR_LE);
+ || mode != PAGE_CUR_LE);
ut_ad(cursor->low_match != ULINT_UNDEFINED
- || mode != PAGE_CUR_LE);
+ || mode != PAGE_CUR_LE);
btr_cur_n_sea++;
return;
@@ -377,7 +382,7 @@ btr_cur_search_to_nth_level(
} else if (latch_mode == BTR_CONT_MODIFY_TREE) {
/* Do nothing */
ut_ad(mtr_memo_contains(mtr, dict_tree_get_lock(tree),
- MTR_MEMO_X_LOCK));
+ MTR_MEMO_X_LOCK));
} else {
mtr_s_lock(dict_tree_get_lock(tree), mtr);
}
@@ -410,7 +415,7 @@ btr_cur_search_to_nth_level(
default:
#ifdef PAGE_CUR_LE_OR_EXTENDS
ut_ad(mode == PAGE_CUR_L || mode == PAGE_CUR_LE
- || mode == PAGE_CUR_LE_OR_EXTENDS);
+ || mode == PAGE_CUR_LE_OR_EXTENDS);
#else /* PAGE_CUR_LE_OR_EXTENDS */
ut_ad(mode == PAGE_CUR_L || mode == PAGE_CUR_LE);
#endif /* PAGE_CUR_LE_OR_EXTENDS */
@@ -425,8 +430,8 @@ btr_cur_search_to_nth_level(
rw_latch = latch_mode;
- if (insert_planned && ibuf_should_try(index,
- ignore_sec_unique)) {
+ if (insert_planned
+ && ibuf_should_try(index, ignore_sec_unique)) {
/* Try insert to the insert buffer if the
page is not in the buffer pool */
@@ -447,9 +452,9 @@ retry_page_get:
ut_ad(insert_planned);
ut_ad(cursor->thr);
- if (ibuf_should_try(index, ignore_sec_unique) &&
- ibuf_insert(tuple, index, space, page_no,
- cursor->thr)) {
+ if (ibuf_should_try(index, ignore_sec_unique)
+ && ibuf_insert(tuple, index, space, page_no,
+ cursor->thr)) {
/* Insertion to the insert buffer succeeded */
cursor->flag = BTR_CUR_INSERT_TO_IBUF;
if (UNIV_LIKELY_NULL(heap)) {
@@ -474,7 +479,7 @@ retry_page_get:
}
#endif
ut_ad(0 == ut_dulint_cmp(tree->id,
- btr_page_get_index_id(page)));
+ btr_page_get_index_id(page)));
if (height == ULINT_UNDEFINED) {
/* We are in the root node */
@@ -493,43 +498,44 @@ retry_page_get:
if (rw_latch == RW_NO_LATCH) {
btr_cur_latch_leaves(page, space,
- page_no, latch_mode, cursor,
- mtr);
+ page_no, latch_mode,
+ cursor, mtr);
}
if ((latch_mode != BTR_MODIFY_TREE)
- && (latch_mode != BTR_CONT_MODIFY_TREE)) {
+ && (latch_mode != BTR_CONT_MODIFY_TREE)) {
/* Release the tree s-latch */
- mtr_release_s_latch_at_savepoint(
- mtr, savepoint,
- dict_tree_get_lock(tree));
+ mtr_release_s_latch_at_savepoint
+ (mtr, savepoint,
+ dict_tree_get_lock(tree));
}
page_mode = mode;
}
page_cur_search_with_match(page, index, tuple, page_mode,
- &up_match, &up_bytes,
- &low_match, &low_bytes, page_cursor);
+ &up_match, &up_bytes,
+ &low_match, &low_bytes,
+ page_cursor);
if (estimate) {
btr_cur_add_path_info(cursor, height, root_height);
}
/* If this is the desired level, leave the loop */
- ut_ad(height
- == btr_page_get_level(page_cur_get_page(page_cursor), mtr));
+ ut_ad(height == btr_page_get_level
+ (page_cur_get_page(page_cursor), mtr));
if (level == height) {
if (level > 0) {
/* x-latch the page */
page = btr_page_get(space,
- page_no, RW_X_LATCH, mtr);
+ page_no, RW_X_LATCH, mtr);
ut_a((ibool)!!page_is_comp(page)
- == dict_table_is_comp(index->table));
+ == dict_table_is_comp(index->table));
}
break;
@@ -542,7 +548,7 @@ retry_page_get:
node_ptr = page_cur_get_rec(page_cursor);
offsets = rec_get_offsets(node_ptr, cursor->index, offsets,
- ULINT_UNDEFINED, &heap);
+ ULINT_UNDEFINED, &heap);
/* Go to the child node */
page_no = btr_node_ptr_get_child_page_no(node_ptr, offsets);
}
@@ -564,11 +570,11 @@ retry_page_get:
}
#endif
ut_ad(cursor->up_match != ULINT_UNDEFINED
- || mode != PAGE_CUR_GE);
+ || mode != PAGE_CUR_GE);
ut_ad(cursor->up_match != ULINT_UNDEFINED
- || mode != PAGE_CUR_LE);
+ || mode != PAGE_CUR_LE);
ut_ad(cursor->low_match != ULINT_UNDEFINED
- || mode != PAGE_CUR_LE);
+ || mode != PAGE_CUR_LE);
}
func_exit:
@@ -636,7 +642,7 @@ btr_cur_open_at_index_side(
__FILE__, __LINE__,
mtr);
ut_ad(0 == ut_dulint_cmp(tree->id,
- btr_page_get_index_id(page)));
+ btr_page_get_index_id(page)));
buf_block_align(page)->check_index_page_at_flush = TRUE;
@@ -649,7 +655,7 @@ btr_cur_open_at_index_side(
if (height == 0) {
btr_cur_latch_leaves(page, space, page_no,
- latch_mode, cursor, mtr);
+ latch_mode, cursor, mtr);
/* In versions <= 3.23.52 we had forgotten to
release the tree latch here. If in an index scan
@@ -658,13 +664,13 @@ btr_cur_open_at_index_side(
waiting for the tree latch. */
if ((latch_mode != BTR_MODIFY_TREE)
- && (latch_mode != BTR_CONT_MODIFY_TREE)) {
+ && (latch_mode != BTR_CONT_MODIFY_TREE)) {
/* Release the tree s-latch */
- mtr_release_s_latch_at_savepoint(
- mtr, savepoint,
- dict_tree_get_lock(tree));
+ mtr_release_s_latch_at_savepoint
+ (mtr, savepoint,
+ dict_tree_get_lock(tree));
}
}
@@ -677,7 +683,7 @@ btr_cur_open_at_index_side(
if (height == 0) {
if (estimate) {
btr_cur_add_path_info(cursor, height,
- root_height);
+ root_height);
}
break;
@@ -699,7 +705,7 @@ btr_cur_open_at_index_side(
node_ptr = page_cur_get_rec(page_cursor);
offsets = rec_get_offsets(node_ptr, cursor->index, offsets,
- ULINT_UNDEFINED, &heap);
+ ULINT_UNDEFINED, &heap);
/* Go to the child node */
page_no = btr_node_ptr_get_child_page_no(node_ptr, offsets);
}
@@ -754,7 +760,7 @@ btr_cur_open_at_rnd_pos(
__FILE__, __LINE__,
mtr);
ut_ad(0 == ut_dulint_cmp(tree->id,
- btr_page_get_index_id(page)));
+ btr_page_get_index_id(page)));
if (height == ULINT_UNDEFINED) {
/* We are in the root node */
@@ -764,7 +770,7 @@ btr_cur_open_at_rnd_pos(
if (height == 0) {
btr_cur_latch_leaves(page, space, page_no,
- latch_mode, cursor, mtr);
+ latch_mode, cursor, mtr);
}
page_cur_open_on_rnd_user_rec(page, page_cursor);
@@ -780,7 +786,7 @@ btr_cur_open_at_rnd_pos(
node_ptr = page_cur_get_rec(page_cursor);
offsets = rec_get_offsets(node_ptr, cursor->index, offsets,
- ULINT_UNDEFINED, &heap);
+ ULINT_UNDEFINED, &heap);
/* Go to the child node */
page_no = btr_node_ptr_get_child_page_no(node_ptr, offsets);
}
@@ -821,7 +827,7 @@ btr_cur_insert_if_possible(
page = btr_cur_get_page(cursor);
ut_ad(mtr_memo_contains(mtr, buf_block_align(page),
- MTR_MEMO_PAGE_X_FIX));
+ MTR_MEMO_PAGE_X_FIX));
page_cursor = btr_cur_get_page_cur(cursor);
/* Now, try the insert */
@@ -835,10 +841,10 @@ btr_cur_insert_if_possible(
*reorg = TRUE;
page_cur_search(page, cursor->index, tuple,
- PAGE_CUR_LE, page_cursor);
+ PAGE_CUR_LE, page_cursor);
rec = page_cur_tuple_insert(page_cursor, tuple,
- cursor->index, mtr);
+ cursor->index, mtr);
}
return(rec);
@@ -883,8 +889,9 @@ btr_cur_ins_lock_and_undo(
if ((index->type & DICT_CLUSTERED) && !(index->type & DICT_IBUF)) {
err = trx_undo_report_row_operation(flags, TRX_UNDO_INSERT_OP,
- thr, index, entry, NULL, 0, NULL,
- &roll_ptr);
+ thr, index, entry,
+ NULL, 0, NULL,
+ &roll_ptr);
if (err != DB_SUCCESS) {
return(err);
@@ -895,7 +902,7 @@ btr_cur_ins_lock_and_undo(
if (!(flags & BTR_KEEP_SYS_FLAG)) {
row_upd_index_entry_sys_field(entry, index,
- DATA_ROLL_PTR, roll_ptr);
+ DATA_ROLL_PTR, roll_ptr);
}
}
@@ -978,7 +985,7 @@ btr_cur_optimistic_insert(
#endif /* UNIV_DEBUG */
ut_ad(mtr_memo_contains(mtr, buf_block_align(page),
- MTR_MEMO_PAGE_X_FIX));
+ MTR_MEMO_PAGE_X_FIX));
max_size = page_get_max_insert_size_after_reorganize(page, 1);
level = btr_page_get_level(page, mtr);
@@ -986,9 +993,9 @@ calculate_sizes_again:
/* Calculate the record size when entry is converted to a record */
rec_size = rec_get_converted_size(index, entry);
- if (rec_size >=
- ut_min(page_get_free_space_of_empty(page_is_comp(page)) / 2,
- REC_MAX_DATA_SIZE)) {
+ if (rec_size
+ >= ut_min(page_get_free_space_of_empty(page_is_comp(page)) / 2,
+ REC_MAX_DATA_SIZE)) {
/* The record is so big that we have to store some fields
externally on separate database pages */
@@ -1010,11 +1017,11 @@ calculate_sizes_again:
type = index->type;
if ((type & DICT_CLUSTERED)
- && (dict_tree_get_space_reserve(index->tree) + rec_size > max_size)
- && (page_get_n_recs(page) >= 2)
- && (0 == level)
- && (btr_page_get_split_rec_to_right(cursor, &dummy_rec)
- || btr_page_get_split_rec_to_left(cursor, &dummy_rec))) {
+ && (dict_tree_get_space_reserve(index->tree) + rec_size > max_size)
+ && (page_get_n_recs(page) >= 2)
+ && (0 == level)
+ && (btr_page_get_split_rec_to_right(cursor, &dummy_rec)
+ || btr_page_get_split_rec_to_left(cursor, &dummy_rec))) {
if (big_rec_vec) {
dtuple_convert_back_big_rec(index, entry, big_rec_vec);
@@ -1024,9 +1031,9 @@ calculate_sizes_again:
}
if (!(((max_size >= rec_size)
- && (max_size >= BTR_CUR_PAGE_REORGANIZE_LIMIT))
- || (page_get_max_insert_size(page, 1) >= rec_size)
- || (page_get_n_recs(page) <= 1))) {
+ && (max_size >= BTR_CUR_PAGE_REORGANIZE_LIMIT))
+ || (page_get_max_insert_size(page, 1) >= rec_size)
+ || (page_get_n_recs(page) <= 1))) {
if (big_rec_vec) {
dtuple_convert_back_big_rec(index, entry, big_rec_vec);
@@ -1052,7 +1059,7 @@ calculate_sizes_again:
/* Now, try the insert */
*rec = page_cur_insert_rec_low(page_cursor, entry, index,
- NULL, NULL, mtr);
+ NULL, NULL, mtr);
if (UNIV_UNLIKELY(!(*rec))) {
/* If the record did not fit, reorganize */
btr_page_reorganize(page, index, mtr);
@@ -1089,15 +1096,16 @@ calculate_sizes_again:
lock_update_insert(*rec);
}
-/* fprintf(stderr, "Insert into page %lu, max ins size %lu,"
+#if 0
+ fprintf(stderr, "Insert into page %lu, max ins size %lu,"
" rec %lu ind type %lu\n",
- buf_frame_get_page_no(page), max_size,
- rec_size + PAGE_DIR_SLOT_SIZE, type);
-*/
+ buf_frame_get_page_no(page), max_size,
+ rec_size + PAGE_DIR_SLOT_SIZE, type);
+#endif
if (!(type & DICT_CLUSTERED)) {
/* We have added a record to page: update its free bits */
ibuf_update_free_bits_if_full(cursor->index, page, max_size,
- rec_size + PAGE_DIR_SLOT_SIZE);
+ rec_size + PAGE_DIR_SLOT_SIZE);
}
*big_rec = big_rec_vec;
@@ -1149,9 +1157,9 @@ btr_cur_pessimistic_insert(
ut_ad(mtr_memo_contains(mtr,
dict_tree_get_lock(btr_cur_get_tree(cursor)),
- MTR_MEMO_X_LOCK));
+ MTR_MEMO_X_LOCK));
ut_ad(mtr_memo_contains(mtr, buf_block_align(page),
- MTR_MEMO_PAGE_X_FIX));
+ MTR_MEMO_PAGE_X_FIX));
/* Try first an optimistic insert; reset the cursor flag: we do not
assume anything of how it was positioned */
@@ -1159,7 +1167,7 @@ btr_cur_pessimistic_insert(
cursor->flag = BTR_CUR_BINARY;
err = btr_cur_optimistic_insert(flags, cursor, entry, rec, big_rec,
- thr, mtr);
+ thr, mtr);
if (err != DB_FAIL) {
return(err);
@@ -1183,7 +1191,7 @@ btr_cur_pessimistic_insert(
n_extents = cursor->tree_height / 16 + 3;
success = fsp_reserve_free_extents(&n_reserved, index->space,
- n_extents, FSP_NORMAL, mtr);
+ n_extents, FSP_NORMAL, mtr);
if (!success) {
err = DB_OUT_OF_FILE_SPACE;
@@ -1191,9 +1199,9 @@ btr_cur_pessimistic_insert(
}
}
- if (rec_get_converted_size(index, entry) >=
- ut_min(page_get_free_space_of_empty(page_is_comp(page)) / 2,
- REC_MAX_DATA_SIZE)) {
+ if (rec_get_converted_size(index, entry)
+ >= ut_min(page_get_free_space_of_empty(page_is_comp(page)) / 2,
+ REC_MAX_DATA_SIZE)) {
/* The record is so big that we have to store some fields
externally on separate database pages */
@@ -1204,14 +1212,14 @@ btr_cur_pessimistic_insert(
if (n_extents > 0) {
fil_space_release_free_extents(index->space,
- n_reserved);
+ n_reserved);
}
return(DB_TOO_BIG_RECORD);
}
}
if (dict_tree_get_page(index->tree)
- == buf_frame_get_page_no(page)) {
+ == buf_frame_get_page_no(page)) {
/* The page is the root page */
*rec = btr_root_raise_and_insert(cursor, entry, mtr);
@@ -1271,7 +1279,7 @@ btr_cur_upd_lock_and_undo(
/* We do undo logging only when we update a clustered index
record */
return(lock_sec_rec_modify_check_and_lock(flags, rec, index,
- thr));
+ thr));
}
/* Check if we have to wait for a lock: enqueue an explicit lock
@@ -1284,9 +1292,10 @@ btr_cur_upd_lock_and_undo(
ulint offsets_[REC_OFFS_NORMAL_SIZE];
*offsets_ = (sizeof offsets_) / sizeof *offsets_;
- err = lock_clust_rec_modify_check_and_lock(flags, rec, index,
- rec_get_offsets(rec, index, offsets_,
- ULINT_UNDEFINED, &heap), thr);
+ err = lock_clust_rec_modify_check_and_lock
+ (flags, rec, index,
+ rec_get_offsets(rec, index, offsets_,
+ ULINT_UNDEFINED, &heap), thr);
if (UNIV_LIKELY_NULL(heap)) {
mem_heap_free(heap);
}
@@ -1299,8 +1308,8 @@ btr_cur_upd_lock_and_undo(
/* Append the info about the update in the undo log */
err = trx_undo_report_row_operation(flags, TRX_UNDO_MODIFY_OP, thr,
- index, NULL, update,
- cmpl_info, rec, roll_ptr);
+ index, NULL, update,
+ cmpl_info, rec, roll_ptr);
return(err);
}
@@ -1324,9 +1333,10 @@ btr_cur_update_in_place_log(
ut_ad(!!page_is_comp(page) == dict_table_is_comp(index->table));
log_ptr = mlog_open_and_write_index(mtr, rec, index, page_is_comp(page)
- ? MLOG_COMP_REC_UPDATE_IN_PLACE
- : MLOG_REC_UPDATE_IN_PLACE,
- 1 + DATA_ROLL_PTR_LEN + 14 + 2 + MLOG_BUF_MARGIN);
+ ? MLOG_COMP_REC_UPDATE_IN_PLACE
+ : MLOG_REC_UPDATE_IN_PLACE,
+ 1 + DATA_ROLL_PTR_LEN + 14 + 2
+ + MLOG_BUF_MARGIN);
if (!log_ptr) {
/* Logging in mtr is switched off during crash recovery */
@@ -1344,7 +1354,7 @@ btr_cur_update_in_place_log(
log_ptr++;
log_ptr = row_upd_write_sys_vals_to_log(index, trx, roll_ptr, log_ptr,
- mtr);
+ mtr);
mach_write_to_2(log_ptr, ut_align_offset(rec, UNIV_PAGE_SIZE));
log_ptr += 2;
@@ -1417,7 +1427,7 @@ btr_cur_parse_update_in_place(
if (!(flags & BTR_KEEP_SYS_FLAG)) {
row_upd_rec_sys_fields_in_recovery(rec, offsets,
- pos, trx_id, roll_ptr);
+ pos, trx_id, roll_ptr);
}
row_upd_rec_in_place(rec, offsets, update);
@@ -1472,7 +1482,7 @@ btr_cur_update_in_place(
/* Do lock checking and undo logging */
err = btr_cur_upd_lock_and_undo(flags, cursor, update, cmpl_info,
- thr, &roll_ptr);
+ thr, &roll_ptr);
if (UNIV_UNLIKELY(err != DB_SUCCESS)) {
if (UNIV_LIKELY_NULL(heap)) {
@@ -1483,7 +1493,7 @@ btr_cur_update_in_place(
block = buf_block_align(rec);
ut_ad(!!page_is_comp(buf_block_get_frame(block))
- == dict_table_is_comp(index->table));
+ == dict_table_is_comp(index->table));
if (block->is_hashed) {
/* The function row_upd_changes_ord_field_binary works only
@@ -1491,7 +1501,7 @@ btr_cur_update_in_place(
NOT call it if index is secondary */
if (!(index->type & DICT_CLUSTERED)
- || row_upd_changes_ord_field_binary(NULL, index, update)) {
+ || row_upd_changes_ord_field_binary(NULL, index, update)) {
/* Remove possible hash index pointer to this record */
btr_search_update_hash_on_delete(cursor);
@@ -1507,8 +1517,8 @@ btr_cur_update_in_place(
/* FIXME: in a mixed tree, all records may not have enough ordering
fields for btr search: */
- was_delete_marked = rec_get_deleted_flag(rec,
- page_is_comp(buf_block_get_frame(block)));
+ was_delete_marked = rec_get_deleted_flag
+ (rec, page_is_comp(buf_block_get_frame(block)));
row_upd_rec_in_place(rec, offsets, update);
@@ -1517,9 +1527,10 @@ btr_cur_update_in_place(
}
btr_cur_update_in_place_log(flags, rec, index, update, trx, roll_ptr,
- mtr);
- if (was_delete_marked && !rec_get_deleted_flag(rec,
- page_is_comp(buf_block_get_frame(block)))) {
+ mtr);
+ if (was_delete_marked
+ && !rec_get_deleted_flag(rec, page_is_comp
+ (buf_block_get_frame(block)))) {
/* The new updated record owns its possible externally
stored fields */
@@ -1588,7 +1599,7 @@ btr_cur_optimistic_update(
#endif /* UNIV_DEBUG */
ut_ad(mtr_memo_contains(mtr, buf_block_align(page),
- MTR_MEMO_PAGE_X_FIX));
+ MTR_MEMO_PAGE_X_FIX));
if (!row_upd_changes_field_size_or_external(index, offsets, update)) {
/* The simplest and the most common case: the update does not
@@ -1596,7 +1607,7 @@ btr_cur_optimistic_update(
externally stored in rec or update */
mem_heap_free(heap);
return(btr_cur_update_in_place(flags, cursor, update,
- cmpl_info, thr, mtr));
+ cmpl_info, thr, mtr));
}
for (i = 0; i < upd_get_n_fields(update); i++) {
@@ -1623,12 +1634,13 @@ btr_cur_optimistic_update(
new_entry = row_rec_to_index_entry(ROW_COPY_DATA, index, rec, heap);
row_upd_index_replace_new_col_vals_index_pos(new_entry, index, update,
- FALSE, NULL);
+ FALSE, NULL);
old_rec_size = rec_offs_size(offsets);
new_rec_size = rec_get_converted_size(index, new_entry);
- if (UNIV_UNLIKELY(new_rec_size >= page_get_free_space_of_empty(
- page_is_comp(page)) / 2)) {
+ if (UNIV_UNLIKELY(new_rec_size
+ >= (page_get_free_space_of_empty(page_is_comp(page))
+ / 2))) {
mem_heap_free(heap);
@@ -1636,11 +1648,11 @@ btr_cur_optimistic_update(
}
max_size = old_rec_size
- + page_get_max_insert_size_after_reorganize(page, 1);
+ + page_get_max_insert_size_after_reorganize(page, 1);
if (UNIV_UNLIKELY(page_get_data_size(page)
- - old_rec_size + new_rec_size
- < BTR_CUR_PAGE_COMPRESS_LIMIT)) {
+ - old_rec_size + new_rec_size
+ < BTR_CUR_PAGE_COMPRESS_LIMIT)) {
/* The page would become too empty */
@@ -1650,8 +1662,8 @@ btr_cur_optimistic_update(
}
if (!(((max_size >= BTR_CUR_PAGE_REORGANIZE_LIMIT)
- && (max_size >= new_rec_size))
- || (page_get_n_recs(page) <= 1))) {
+ && (max_size >= new_rec_size))
+ || (page_get_n_recs(page) <= 1))) {
/* There was not enough space, or it did not pay to
reorganize: for simplicity, we decide what to do assuming a
@@ -1664,7 +1676,7 @@ btr_cur_optimistic_update(
/* Do lock checking and undo logging */
err = btr_cur_upd_lock_and_undo(flags, cursor, update, cmpl_info, thr,
- &roll_ptr);
+ &roll_ptr);
if (err != DB_SUCCESS) {
mem_heap_free(heap);
@@ -1688,9 +1700,9 @@ btr_cur_optimistic_update(
if (!(flags & BTR_KEEP_SYS_FLAG)) {
row_upd_index_entry_sys_field(new_entry, index, DATA_ROLL_PTR,
- roll_ptr);
+ roll_ptr);
row_upd_index_entry_sys_field(new_entry, index, DATA_TRX_ID,
- trx->id);
+ trx->id);
}
rec = btr_cur_insert_if_possible(cursor, new_entry, &reorganized, mtr);
@@ -1702,7 +1714,7 @@ btr_cur_optimistic_update(
stored fields */
offsets = rec_get_offsets(rec, index, offsets,
- ULINT_UNDEFINED, &heap);
+ ULINT_UNDEFINED, &heap);
btr_cur_unmark_extern_fields(rec, mtr, offsets);
}
@@ -1750,15 +1762,15 @@ btr_cur_pess_upd_restore_supremum(
prev_page = buf_page_get_with_no_latch(space, prev_page_no, mtr);
#ifdef UNIV_BTR_DEBUG
ut_a(btr_page_get_next(prev_page, mtr)
- == buf_frame_get_page_no(page));
+ == buf_frame_get_page_no(page));
#endif /* UNIV_BTR_DEBUG */
/* We must already have an x-latch to prev_page! */
ut_ad(mtr_memo_contains(mtr, buf_block_align(prev_page),
- MTR_MEMO_PAGE_X_FIX));
+ MTR_MEMO_PAGE_X_FIX));
lock_rec_reset_and_inherit_gap_locks(page_get_supremum_rec(prev_page),
- rec);
+ rec);
}
/*****************************************************************
@@ -1816,12 +1828,12 @@ btr_cur_pessimistic_update(
tree = index->tree;
ut_ad(mtr_memo_contains(mtr, dict_tree_get_lock(tree),
- MTR_MEMO_X_LOCK));
+ MTR_MEMO_X_LOCK));
ut_ad(mtr_memo_contains(mtr, buf_block_align(page),
- MTR_MEMO_PAGE_X_FIX));
+ MTR_MEMO_PAGE_X_FIX));
optim_err = btr_cur_optimistic_update(flags, cursor, update,
- cmpl_info, thr, mtr);
+ cmpl_info, thr, mtr);
if (optim_err != DB_UNDERFLOW && optim_err != DB_OVERFLOW) {
@@ -1830,7 +1842,7 @@ btr_cur_pessimistic_update(
/* Do lock checking and undo logging */
err = btr_cur_upd_lock_and_undo(flags, cursor, update, cmpl_info,
- thr, &roll_ptr);
+ thr, &roll_ptr);
if (err != DB_SUCCESS) {
return(err);
@@ -1849,9 +1861,9 @@ btr_cur_pessimistic_update(
reserve_flag = FSP_NORMAL;
}
- success = fsp_reserve_free_extents(&n_reserved,
- index->space,
- n_extents, reserve_flag, mtr);
+ success = fsp_reserve_free_extents(&n_reserved, index->space,
+ n_extents,
+ reserve_flag, mtr);
if (!success) {
err = DB_OUT_OF_FILE_SPACE;
@@ -1867,12 +1879,12 @@ btr_cur_pessimistic_update(
new_entry = row_rec_to_index_entry(ROW_COPY_DATA, index, rec, heap);
row_upd_index_replace_new_col_vals_index_pos(new_entry, index, update,
- FALSE, heap);
+ FALSE, heap);
if (!(flags & BTR_KEEP_SYS_FLAG)) {
row_upd_index_entry_sys_field(new_entry, index, DATA_ROLL_PTR,
- roll_ptr);
+ roll_ptr);
row_upd_index_entry_sys_field(new_entry, index, DATA_TRX_ID,
- trx->id);
+ trx->id);
}
if (flags & BTR_NO_UNDO_LOG_FLAG) {
@@ -1886,25 +1898,26 @@ btr_cur_pessimistic_update(
ut_a(big_rec_vec == NULL);
btr_rec_free_updated_extern_fields(index, rec, offsets,
- update, TRUE, mtr);
+ update, TRUE, mtr);
}
/* We have to set appropriate extern storage bits in the new
record to be inserted: we have to remember which fields were such */
ext_vect = mem_heap_alloc(heap, sizeof(ulint)
- * dict_index_get_n_fields(index));
+ * dict_index_get_n_fields(index));
ut_ad(!page_is_comp(page) || !rec_get_node_ptr_flag(rec));
offsets = rec_get_offsets(rec, index, offsets,
- ULINT_UNDEFINED, &heap);
+ ULINT_UNDEFINED, &heap);
n_ext_vect = btr_push_update_extern_fields(ext_vect, offsets, update);
- if (UNIV_UNLIKELY(rec_get_converted_size(index, new_entry) >=
- ut_min(page_get_free_space_of_empty(page_is_comp(page)) / 2,
- REC_MAX_DATA_SIZE))) {
+ if (UNIV_UNLIKELY(rec_get_converted_size(index, new_entry)
+ >= ut_min(page_get_free_space_of_empty
+ (page_is_comp(page)) / 2,
+ REC_MAX_DATA_SIZE))) {
big_rec_vec = dtuple_convert_big_rec(index, new_entry,
- ext_vect, n_ext_vect);
+ ext_vect, n_ext_vect);
if (big_rec_vec == NULL) {
err = DB_TOO_BIG_RECORD;
@@ -1932,16 +1945,16 @@ btr_cur_pessimistic_update(
page_cur_move_to_prev(page_cursor);
rec = btr_cur_insert_if_possible(cursor, new_entry,
- &dummy_reorganized, mtr);
+ &dummy_reorganized, mtr);
ut_a(rec || optim_err != DB_UNDERFLOW);
if (rec) {
lock_rec_restore_from_page_infimum(rec, page);
rec_set_field_extern_bits(rec, index,
- ext_vect, n_ext_vect, mtr);
+ ext_vect, n_ext_vect, mtr);
offsets = rec_get_offsets(rec, index, offsets,
- ULINT_UNDEFINED, &heap);
+ ULINT_UNDEFINED, &heap);
if (!rec_get_deleted_flag(rec, rec_offs_comp(offsets))) {
/* The new inserted record owns its possible externally
@@ -1968,10 +1981,10 @@ btr_cur_pessimistic_update(
is made in the insert */
err = btr_cur_pessimistic_insert(BTR_NO_UNDO_LOG_FLAG
- | BTR_NO_LOCKING_FLAG
- | BTR_KEEP_SYS_FLAG,
- cursor, new_entry, &rec,
- &dummy_big_rec, NULL, mtr);
+ | BTR_NO_LOCKING_FLAG
+ | BTR_KEEP_SYS_FLAG,
+ cursor, new_entry, &rec,
+ &dummy_big_rec, NULL, mtr);
ut_a(rec);
ut_a(err == DB_SUCCESS);
ut_a(dummy_big_rec == NULL);
@@ -2033,10 +2046,11 @@ btr_cur_del_mark_set_clust_rec_log(
ut_ad(!!page_rec_is_comp(rec) == dict_table_is_comp(index->table));
log_ptr = mlog_open_and_write_index(mtr, rec, index,
- page_rec_is_comp(rec)
- ? MLOG_COMP_REC_CLUST_DELETE_MARK
- : MLOG_REC_CLUST_DELETE_MARK,
- 1 + 1 + DATA_ROLL_PTR_LEN + 14 + 2);
+ page_rec_is_comp(rec)
+ ? MLOG_COMP_REC_CLUST_DELETE_MARK
+ : MLOG_REC_CLUST_DELETE_MARK,
+ 1 + 1 + DATA_ROLL_PTR_LEN
+ + 14 + 2);
if (!log_ptr) {
/* Logging in mtr is switched off during crash recovery */
@@ -2049,7 +2063,7 @@ btr_cur_del_mark_set_clust_rec_log(
log_ptr++;
log_ptr = row_upd_write_sys_vals_to_log(index, trx, roll_ptr, log_ptr,
- mtr);
+ mtr);
mach_write_to_2(log_ptr, ut_align_offset(rec, UNIV_PAGE_SIZE));
log_ptr += 2;
@@ -2078,7 +2092,7 @@ btr_cur_parse_del_mark_set_clust_rec(
rec_t* rec;
ut_ad(!page
- || !!page_is_comp(page) == dict_table_is_comp(index->table));
+ || !!page_is_comp(page) == dict_table_is_comp(index->table));
if (end_ptr < ptr + 2) {
@@ -2115,10 +2129,10 @@ btr_cur_parse_del_mark_set_clust_rec(
ulint offsets_[REC_OFFS_NORMAL_SIZE];
*offsets_ = (sizeof offsets_) / sizeof *offsets_;
- row_upd_rec_sys_fields_in_recovery(rec,
- rec_get_offsets(rec, index, offsets_,
- ULINT_UNDEFINED, &heap),
- pos, trx_id, roll_ptr);
+ row_upd_rec_sys_fields_in_recovery
+ (rec, rec_get_offsets(rec, index, offsets_,
+ ULINT_UNDEFINED, &heap),
+ pos, trx_id, roll_ptr);
if (UNIV_LIKELY_NULL(heap)) {
mem_heap_free(heap);
}
@@ -2178,7 +2192,7 @@ btr_cur_del_mark_set_clust_rec(
ut_ad(!rec_get_deleted_flag(rec, rec_offs_comp(offsets)));
err = lock_clust_rec_modify_check_and_lock(flags,
- rec, index, offsets, thr);
+ rec, index, offsets, thr);
if (err != DB_SUCCESS) {
@@ -2189,8 +2203,8 @@ btr_cur_del_mark_set_clust_rec(
}
err = trx_undo_report_row_operation(flags, TRX_UNDO_MODIFY_OP, thr,
- index, NULL, NULL, 0, rec,
- &roll_ptr);
+ index, NULL, NULL, 0, rec,
+ &roll_ptr);
if (err != DB_SUCCESS) {
if (UNIV_LIKELY_NULL(heap)) {
@@ -2218,7 +2232,7 @@ btr_cur_del_mark_set_clust_rec(
}
btr_cur_del_mark_set_clust_rec_log(flags, rec, index, val, trx,
- roll_ptr, mtr);
+ roll_ptr, mtr);
if (UNIV_LIKELY_NULL(heap)) {
mem_heap_free(heap);
}
@@ -2247,8 +2261,8 @@ btr_cur_del_mark_set_sec_rec_log(
return;
}
- log_ptr = mlog_write_initial_log_record_fast(
- rec, MLOG_REC_SEC_DELETE_MARK, log_ptr, mtr);
+ log_ptr = mlog_write_initial_log_record_fast
+ (rec, MLOG_REC_SEC_DELETE_MARK, log_ptr, mtr);
mach_write_to_1(log_ptr, val);
log_ptr++;
@@ -2323,13 +2337,13 @@ btr_cur_del_mark_set_sec_rec(
#ifdef UNIV_DEBUG
if (btr_cur_print_record_ops && thr) {
btr_cur_trx_report(thr_get_trx(thr), cursor->index,
- "del mark ");
+ "del mark ");
rec_print(stderr, rec, cursor->index);
}
#endif /* UNIV_DEBUG */
err = lock_sec_rec_modify_check_and_lock(flags, rec, cursor->index,
- thr);
+ thr);
if (err != DB_SUCCESS) {
return(err);
@@ -2337,14 +2351,14 @@ btr_cur_del_mark_set_sec_rec(
block = buf_block_align(rec);
ut_ad(!!page_is_comp(buf_block_get_frame(block))
- == dict_table_is_comp(cursor->index->table));
+ == dict_table_is_comp(cursor->index->table));
if (block->is_hashed) {
rw_lock_x_lock(&btr_search_latch);
}
rec_set_deleted_flag(rec, page_is_comp(buf_block_get_frame(block)),
- val);
+ val);
if (block->is_hashed) {
rw_lock_x_unlock(&btr_search_latch);
@@ -2391,7 +2405,7 @@ btr_cur_compress(
{
ut_ad(mtr_memo_contains(mtr,
dict_tree_get_lock(btr_cur_get_tree(cursor)),
- MTR_MEMO_X_LOCK));
+ MTR_MEMO_X_LOCK));
ut_ad(mtr_memo_contains(mtr, buf_block_align(btr_cur_get_rec(cursor)),
MTR_MEMO_PAGE_X_FIX));
ut_ad(btr_page_get_level(btr_cur_get_page(cursor), mtr) == 0);
@@ -2417,7 +2431,7 @@ btr_cur_compress_if_useful(
{
ut_ad(mtr_memo_contains(mtr,
dict_tree_get_lock(btr_cur_get_tree(cursor)),
- MTR_MEMO_X_LOCK));
+ MTR_MEMO_X_LOCK));
ut_ad(mtr_memo_contains(mtr, buf_block_align(btr_cur_get_rec(cursor)),
MTR_MEMO_PAGE_X_FIX));
@@ -2457,7 +2471,7 @@ btr_cur_optimistic_delete(
*offsets_ = (sizeof offsets_) / sizeof *offsets_;
ut_ad(mtr_memo_contains(mtr, buf_block_align(btr_cur_get_rec(cursor)),
- MTR_MEMO_PAGE_X_FIX));
+ MTR_MEMO_PAGE_X_FIX));
/* This is intended only for leaf page deletions */
page = btr_cur_get_page(cursor);
@@ -2466,11 +2480,11 @@ btr_cur_optimistic_delete(
rec = btr_cur_get_rec(cursor);
offsets = rec_get_offsets(rec, cursor->index, offsets,
- ULINT_UNDEFINED, &heap);
+ ULINT_UNDEFINED, &heap);
no_compress_needed = !rec_offs_any_extern(offsets)
- && btr_cur_can_delete_without_compress(
- cursor, rec_offs_size(offsets), mtr);
+ && btr_cur_can_delete_without_compress
+ (cursor, rec_offs_size(offsets), mtr);
if (no_compress_needed) {
@@ -2478,13 +2492,13 @@ btr_cur_optimistic_delete(
btr_search_update_hash_on_delete(cursor);
- max_ins_size = page_get_max_insert_size_after_reorganize(page,
- 1);
+ max_ins_size = page_get_max_insert_size_after_reorganize
+ (page, 1);
page_cur_delete_rec(btr_cur_get_page_cur(cursor),
- cursor->index, offsets, mtr);
+ cursor->index, offsets, mtr);
ibuf_update_free_bits_low(cursor->index, page, max_ins_size,
- mtr);
+ mtr);
}
if (UNIV_LIKELY_NULL(heap)) {
@@ -2538,9 +2552,9 @@ btr_cur_pessimistic_delete(
tree = btr_cur_get_tree(cursor);
ut_ad(mtr_memo_contains(mtr, dict_tree_get_lock(tree),
- MTR_MEMO_X_LOCK));
+ MTR_MEMO_X_LOCK));
ut_ad(mtr_memo_contains(mtr, buf_block_align(page),
- MTR_MEMO_PAGE_X_FIX));
+ MTR_MEMO_PAGE_X_FIX));
if (!has_reserved_extents) {
/* First reserve enough free space for the file segments
of the index tree, so that the node pointer updates will
@@ -2549,8 +2563,9 @@ btr_cur_pessimistic_delete(
n_extents = cursor->tree_height / 32 + 1;
success = fsp_reserve_free_extents(&n_reserved,
- cursor->index->space,
- n_extents, FSP_CLEANING, mtr);
+ cursor->index->space,
+ n_extents,
+ FSP_CLEANING, mtr);
if (!success) {
*err = DB_OUT_OF_FILE_SPACE;
@@ -2562,21 +2577,22 @@ btr_cur_pessimistic_delete(
rec = btr_cur_get_rec(cursor);
offsets = rec_get_offsets(rec, cursor->index,
- NULL, ULINT_UNDEFINED, &heap);
+ NULL, ULINT_UNDEFINED, &heap);
/* Free externally stored fields if the record is neither
a node pointer nor in two-byte format.
This avoids an unnecessary loop. */
if (page_is_comp(page)
- ? !rec_get_node_ptr_flag(rec)
- : !rec_get_1byte_offs_flag(rec)) {
+ ? !rec_get_node_ptr_flag(rec)
+ : !rec_get_1byte_offs_flag(rec)) {
btr_rec_free_externally_stored_fields(cursor->index,
- rec, offsets, in_rollback, mtr);
+ rec, offsets,
+ in_rollback, mtr);
}
if (UNIV_UNLIKELY(page_get_n_recs(page) < 2)
- && UNIV_UNLIKELY(dict_tree_get_page(btr_cur_get_tree(cursor))
- != buf_frame_get_page_no(page))) {
+ && UNIV_UNLIKELY(dict_tree_get_page(btr_cur_get_tree(cursor))
+ != buf_frame_get_page_no(page))) {
/* If there is only one record, drop the whole page in
btr_discard_page, if this is not the root page */
@@ -2593,8 +2609,8 @@ btr_cur_pessimistic_delete(
level = btr_page_get_level(page, mtr);
if (level > 0
- && UNIV_UNLIKELY(rec == page_rec_get_next(
- page_get_infimum_rec(page)))) {
+ && UNIV_UNLIKELY(rec == page_rec_get_next
+ (page_get_infimum_rec(page)))) {
rec_t* next_rec = page_rec_get_next(rec);
@@ -2605,7 +2621,7 @@ btr_cur_pessimistic_delete(
pointer as the predefined minimum record */
btr_set_min_rec_mark(next_rec, page_is_comp(page),
- mtr);
+ mtr);
} else {
/* Otherwise, if we delete the leftmost node pointer
on a page, we have to change the father node pointer
@@ -2614,20 +2630,19 @@ btr_cur_pessimistic_delete(
btr_node_ptr_delete(tree, page, mtr);
- node_ptr = dict_tree_build_node_ptr(
- tree, next_rec,
- buf_frame_get_page_no(page),
- heap, level);
+ node_ptr = dict_tree_build_node_ptr
+ (tree, next_rec, buf_frame_get_page_no(page),
+ heap, level);
btr_insert_on_non_leaf_level(tree,
- level + 1, node_ptr, mtr);
+ level + 1, node_ptr, mtr);
}
}
btr_search_update_hash_on_delete(cursor);
page_cur_delete_rec(btr_cur_get_page_cur(cursor), cursor->index,
- offsets, mtr);
+ offsets, mtr);
ut_ad(btr_check_node_ptr(tree, page, mtr));
@@ -2642,7 +2657,7 @@ return_after_reservations:
if (n_extents > 0) {
fil_space_release_free_extents(cursor->index->space,
- n_reserved);
+ n_reserved);
}
return(ret);
@@ -2720,12 +2735,12 @@ btr_estimate_n_rows_in_range(
if (dtuple_get_n_fields(tuple1) > 0) {
btr_cur_search_to_nth_level(index, 0, tuple1, mode1,
- BTR_SEARCH_LEAF | BTR_ESTIMATE,
- &cursor, 0, &mtr);
+ BTR_SEARCH_LEAF | BTR_ESTIMATE,
+ &cursor, 0, &mtr);
} else {
btr_cur_open_at_index_side(TRUE, index,
- BTR_SEARCH_LEAF | BTR_ESTIMATE,
- &cursor, &mtr);
+ BTR_SEARCH_LEAF | BTR_ESTIMATE,
+ &cursor, &mtr);
}
mtr_commit(&mtr);
@@ -2737,12 +2752,12 @@ btr_estimate_n_rows_in_range(
if (dtuple_get_n_fields(tuple2) > 0) {
btr_cur_search_to_nth_level(index, 0, tuple2, mode2,
- BTR_SEARCH_LEAF | BTR_ESTIMATE,
- &cursor, 0, &mtr);
+ BTR_SEARCH_LEAF | BTR_ESTIMATE,
+ &cursor, 0, &mtr);
} else {
btr_cur_open_at_index_side(FALSE, index,
- BTR_SEARCH_LEAF | BTR_ESTIMATE,
- &cursor, &mtr);
+ BTR_SEARCH_LEAF | BTR_ESTIMATE,
+ &cursor, &mtr);
}
mtr_commit(&mtr);
@@ -2751,11 +2766,11 @@ btr_estimate_n_rows_in_range(
n_rows = 1;
diverged = FALSE; /* This becomes true when the path is not
- the same any more */
+ the same any more */
diverged_lot = FALSE; /* This becomes true when the paths are
- not the same or adjacent any more */
+ not the same or adjacent any more */
divergence_level = 1000000; /* This is the level where paths diverged
- a lot */
+ a lot */
for (i = 0; ; i++) {
ut_ad(i < BTR_PATH_ARRAY_N_SLOTS);
@@ -2763,7 +2778,7 @@ btr_estimate_n_rows_in_range(
slot2 = path2 + i;
if (slot1->nth_rec == ULINT_UNDEFINED
- || slot2->nth_rec == ULINT_UNDEFINED) {
+ || slot2->nth_rec == ULINT_UNDEFINED) {
if (i > divergence_level + 1) {
/* In trees whose height is > 1 our algorithm
@@ -2799,8 +2814,8 @@ btr_estimate_n_rows_in_range(
n_rows = slot2->nth_rec - slot1->nth_rec;
if (n_rows > 1) {
- diverged_lot = TRUE;
- divergence_level = i;
+ diverged_lot = TRUE;
+ divergence_level = i;
}
} else {
/* Maybe the tree has changed between
@@ -2812,7 +2827,7 @@ btr_estimate_n_rows_in_range(
} else if (diverged && !diverged_lot) {
if (slot1->nth_rec < slot1->n_recs
- || slot2->nth_rec > 1) {
+ || slot2->nth_rec > 1) {
diverged_lot = TRUE;
divergence_level = i;
@@ -2831,7 +2846,7 @@ btr_estimate_n_rows_in_range(
} else if (diverged_lot) {
n_rows = (n_rows * (slot1->n_recs + slot2->n_recs))
- / 2;
+ / 2;
}
}
}
@@ -2865,8 +2880,8 @@ btr_estimate_number_of_different_key_vals(
ulint* offsets_rec = offsets_rec_;
ulint* offsets_next_rec= offsets_next_rec_;
*offsets_rec_ = (sizeof offsets_rec_) / sizeof *offsets_rec_;
- *offsets_next_rec_ =
- (sizeof offsets_next_rec_) / sizeof *offsets_next_rec_;
+ *offsets_next_rec_
+ = (sizeof offsets_next_rec_) / sizeof *offsets_next_rec_;
n_cols = dict_index_get_n_unique(index);
@@ -2896,7 +2911,7 @@ btr_estimate_number_of_different_key_vals(
if (rec != supremum) {
not_empty_flag = 1;
offsets_rec = rec_get_offsets(rec, index, offsets_rec,
- ULINT_UNDEFINED, &heap);
+ ULINT_UNDEFINED, &heap);
}
while (rec != supremum) {
@@ -2908,13 +2923,13 @@ btr_estimate_number_of_different_key_vals(
matched_fields = 0;
matched_bytes = 0;
offsets_next_rec = rec_get_offsets(next_rec, index,
- offsets_next_rec,
- n_cols, &heap);
+ offsets_next_rec,
+ n_cols, &heap);
cmp_rec_rec_with_match(rec, next_rec,
- offsets_rec, offsets_next_rec,
- index, &matched_fields,
- &matched_bytes);
+ offsets_rec, offsets_next_rec,
+ index, &matched_fields,
+ &matched_bytes);
for (j = matched_fields + 1; j <= n_cols; j++) {
/* We add one if this index record has
@@ -2923,9 +2938,9 @@ btr_estimate_number_of_different_key_vals(
n_diff[j]++;
}
- total_external_size +=
- btr_rec_get_externally_stored_len(
- rec, offsets_rec);
+ total_external_size
+ += btr_rec_get_externally_stored_len
+ (rec, offsets_rec);
rec = next_rec;
/* Initialize offsets_rec for the next round
@@ -2951,17 +2966,16 @@ btr_estimate_number_of_different_key_vals(
in the table. */
if (btr_page_get_prev(page, &mtr) != FIL_NULL
- || btr_page_get_next(page, &mtr) != FIL_NULL) {
+ || btr_page_get_next(page, &mtr) != FIL_NULL) {
n_diff[n_cols]++;
}
}
offsets_rec = rec_get_offsets(rec, index, offsets_rec,
- ULINT_UNDEFINED, &heap);
- total_external_size +=
- btr_rec_get_externally_stored_len(rec,
- offsets_rec);
+ ULINT_UNDEFINED, &heap);
+ total_external_size += btr_rec_get_externally_stored_len
+ (rec, offsets_rec);
mtr_commit(&mtr);
}
@@ -2974,16 +2988,16 @@ btr_estimate_number_of_different_key_vals(
included in index->stat_n_leaf_pages) */
for (j = 0; j <= n_cols; j++) {
- index->stat_n_diff_key_vals[j] =
- (n_diff[j]
- * (ib_longlong)index->stat_n_leaf_pages
- + BTR_KEY_VAL_ESTIMATE_N_PAGES - 1
- + total_external_size
- + not_empty_flag)
- / (BTR_KEY_VAL_ESTIMATE_N_PAGES
- + total_external_size);
-
- /* If the tree is small, smaller than <
+ index->stat_n_diff_key_vals[j]
+ = ((n_diff[j]
+ * (ib_longlong)index->stat_n_leaf_pages
+ + BTR_KEY_VAL_ESTIMATE_N_PAGES - 1
+ + total_external_size
+ + not_empty_flag)
+ / (BTR_KEY_VAL_ESTIMATE_N_PAGES
+ + total_external_size));
+
+ /* If the tree is small, smaller than
10 * BTR_KEY_VAL_ESTIMATE_N_PAGES + total_external_size, then
the above estimate is ok. For bigger trees it is common that we
do not see any borders between key values in the few pages
@@ -2991,8 +3005,9 @@ btr_estimate_number_of_different_key_vals(
different key values, or even more. Let us try to approximate
that: */
- add_on = index->stat_n_leaf_pages /
- (10 * (BTR_KEY_VAL_ESTIMATE_N_PAGES + total_external_size));
+ add_on = index->stat_n_leaf_pages
+ / (10 * (BTR_KEY_VAL_ESTIMATE_N_PAGES
+ + total_external_size));
if (add_on > BTR_KEY_VAL_ESTIMATE_N_PAGES) {
add_on = BTR_KEY_VAL_ESTIMATE_N_PAGES;
@@ -3038,10 +3053,10 @@ btr_rec_get_externally_stored_len(
local_len -= BTR_EXTERN_FIELD_REF_SIZE;
extern_len = mach_read_from_4(data + local_len
- + BTR_EXTERN_LEN + 4);
+ + BTR_EXTERN_LEN + 4);
total_extern_len += ut_calc_align(extern_len,
- UNIV_PAGE_SIZE);
+ UNIV_PAGE_SIZE);
}
}
@@ -3079,7 +3094,7 @@ btr_cur_set_ownership_of_extern_field(
}
mlog_write_ulint(data + local_len + BTR_EXTERN_LEN, byte_val,
- MLOG_1BYTE, mtr);
+ MLOG_1BYTE, mtr);
}
/***********************************************************************
@@ -3113,17 +3128,17 @@ btr_cur_mark_extern_inherited_fields(
if (update) {
for (j = 0; j < upd_get_n_fields(update);
- j++) {
+ j++) {
if (upd_get_nth_field(update, j)
- ->field_no == i) {
+ ->field_no == i) {
is_updated = TRUE;
}
}
}
if (!is_updated) {
- btr_cur_set_ownership_of_extern_field(rec,
- offsets, i, FALSE, mtr);
+ btr_cur_set_ownership_of_extern_field
+ (rec, offsets, i, FALSE, mtr);
}
}
}
@@ -3164,7 +3179,7 @@ btr_cur_mark_dtuple_inherited_extern(
for (j = 0; j < upd_get_n_fields(update); j++) {
if (upd_get_nth_field(update, j)->field_no
- == ext_vec[i]) {
+ == ext_vec[i]) {
is_updated = TRUE;
}
}
@@ -3178,7 +3193,7 @@ btr_cur_mark_dtuple_inherited_extern(
len -= BTR_EXTERN_FIELD_REF_SIZE;
byte_val = mach_read_from_1(data + len
- + BTR_EXTERN_LEN);
+ + BTR_EXTERN_LEN);
byte_val = byte_val | BTR_EXTERN_INHERITED_FLAG;
@@ -3209,7 +3224,7 @@ btr_cur_unmark_extern_fields(
if (rec_offs_nth_extern(offsets, i)) {
btr_cur_set_ownership_of_extern_field(rec, offsets, i,
- TRUE, mtr);
+ TRUE, mtr);
}
}
}
@@ -3276,8 +3291,8 @@ btr_push_update_extern_fields(
if (upd_get_nth_field(update, i)->extern_storage) {
- ext_vect[n_pushed] =
- upd_get_nth_field(update, i)->field_no;
+ ext_vect[n_pushed] = upd_get_nth_field
+ (update, i)->field_no;
n_pushed++;
}
@@ -3294,9 +3309,9 @@ btr_push_update_extern_fields(
if (update) {
for (j = 0; j < upd_get_n_fields(update);
- j++) {
+ j++) {
if (upd_get_nth_field(update, j)
- ->field_no == i) {
+ ->field_no == i) {
is_updated = TRUE;
}
}
@@ -3375,9 +3390,9 @@ btr_store_big_rec_extern_fields(
ut_ad(rec_offs_validate(rec, index, offsets));
ut_ad(mtr_memo_contains(local_mtr, dict_tree_get_lock(index->tree),
- MTR_MEMO_X_LOCK));
+ MTR_MEMO_X_LOCK));
ut_ad(mtr_memo_contains(local_mtr, buf_block_align(rec),
- MTR_MEMO_PAGE_X_FIX));
+ MTR_MEMO_PAGE_X_FIX));
ut_a(index->type & DICT_CLUSTERED);
space_id = buf_frame_get_space_id(rec);
@@ -3388,7 +3403,8 @@ btr_store_big_rec_extern_fields(
for (i = 0; i < big_rec_vec->n_fields; i++) {
data = rec_get_nth_field(rec, offsets,
- big_rec_vec->fields[i].field_no, &local_len);
+ big_rec_vec->fields[i].field_no,
+ &local_len);
ut_a(local_len >= BTR_EXTERN_FIELD_REF_SIZE);
local_len -= BTR_EXTERN_FIELD_REF_SIZE;
extern_len = big_rec_vec->fields[i].len;
@@ -3407,7 +3423,7 @@ btr_store_big_rec_extern_fields(
}
page = btr_page_alloc(index->tree, hint_page_no,
- FSP_NO_DIR, 0, &mtr);
+ FSP_NO_DIR, 0, &mtr);
if (page == NULL) {
mtr_commit(&mtr);
@@ -3416,85 +3432,87 @@ btr_store_big_rec_extern_fields(
}
mlog_write_ulint(page + FIL_PAGE_TYPE,
- FIL_PAGE_TYPE_BLOB, MLOG_2BYTES, &mtr);
+ FIL_PAGE_TYPE_BLOB,
+ MLOG_2BYTES, &mtr);
page_no = buf_frame_get_page_no(page);
if (prev_page_no != FIL_NULL) {
prev_page = buf_page_get(space_id,
- prev_page_no,
- RW_X_LATCH, &mtr);
+ prev_page_no,
+ RW_X_LATCH, &mtr);
#ifdef UNIV_SYNC_DEBUG
buf_page_dbg_add_level(prev_page,
- SYNC_EXTERN_STORAGE);
+ SYNC_EXTERN_STORAGE);
#endif /* UNIV_SYNC_DEBUG */
mlog_write_ulint(prev_page + FIL_PAGE_DATA
- + BTR_BLOB_HDR_NEXT_PAGE_NO,
- page_no, MLOG_4BYTES, &mtr);
+ + BTR_BLOB_HDR_NEXT_PAGE_NO,
+ page_no, MLOG_4BYTES, &mtr);
}
if (extern_len > (UNIV_PAGE_SIZE - FIL_PAGE_DATA
- - BTR_BLOB_HDR_SIZE
- - FIL_PAGE_DATA_END)) {
+ - BTR_BLOB_HDR_SIZE
+ - FIL_PAGE_DATA_END)) {
store_len = UNIV_PAGE_SIZE - FIL_PAGE_DATA
- - BTR_BLOB_HDR_SIZE
- - FIL_PAGE_DATA_END;
+ - BTR_BLOB_HDR_SIZE
+ - FIL_PAGE_DATA_END;
} else {
store_len = extern_len;
}
mlog_write_string(page + FIL_PAGE_DATA
- + BTR_BLOB_HDR_SIZE,
- big_rec_vec->fields[i].data
- + big_rec_vec->fields[i].len
- - extern_len,
- store_len, &mtr);
+ + BTR_BLOB_HDR_SIZE,
+ big_rec_vec->fields[i].data
+ + big_rec_vec->fields[i].len
+ - extern_len,
+ store_len, &mtr);
mlog_write_ulint(page + FIL_PAGE_DATA
- + BTR_BLOB_HDR_PART_LEN,
- store_len, MLOG_4BYTES, &mtr);
+ + BTR_BLOB_HDR_PART_LEN,
+ store_len, MLOG_4BYTES, &mtr);
mlog_write_ulint(page + FIL_PAGE_DATA
- + BTR_BLOB_HDR_NEXT_PAGE_NO,
- FIL_NULL, MLOG_4BYTES, &mtr);
+ + BTR_BLOB_HDR_NEXT_PAGE_NO,
+ FIL_NULL, MLOG_4BYTES, &mtr);
extern_len -= store_len;
rec_page = buf_page_get(space_id,
buf_frame_get_page_no(data),
- RW_X_LATCH, &mtr);
+ RW_X_LATCH, &mtr);
#ifdef UNIV_SYNC_DEBUG
buf_page_dbg_add_level(rec_page, SYNC_NO_ORDER_CHECK);
#endif /* UNIV_SYNC_DEBUG */
mlog_write_ulint(data + local_len + BTR_EXTERN_LEN, 0,
- MLOG_4BYTES, &mtr);
+ MLOG_4BYTES, &mtr);
mlog_write_ulint(data + local_len + BTR_EXTERN_LEN + 4,
- big_rec_vec->fields[i].len
- - extern_len,
- MLOG_4BYTES, &mtr);
+ big_rec_vec->fields[i].len
+ - extern_len,
+ MLOG_4BYTES, &mtr);
if (prev_page_no == FIL_NULL) {
mlog_write_ulint(data + local_len
- + BTR_EXTERN_SPACE_ID,
- space_id,
- MLOG_4BYTES, &mtr);
+ + BTR_EXTERN_SPACE_ID,
+ space_id,
+ MLOG_4BYTES, &mtr);
mlog_write_ulint(data + local_len
- + BTR_EXTERN_PAGE_NO,
- page_no,
- MLOG_4BYTES, &mtr);
+ + BTR_EXTERN_PAGE_NO,
+ page_no,
+ MLOG_4BYTES, &mtr);
mlog_write_ulint(data + local_len
- + BTR_EXTERN_OFFSET,
- FIL_PAGE_DATA,
- MLOG_4BYTES, &mtr);
+ + BTR_EXTERN_OFFSET,
+ FIL_PAGE_DATA,
+ MLOG_4BYTES, &mtr);
/* Set the bit denoting that this field
in rec is stored externally */
- rec_set_nth_field_extern_bit(rec, index,
- big_rec_vec->fields[i].field_no,
- TRUE, &mtr);
+ rec_set_nth_field_extern_bit
+ (rec, index,
+ big_rec_vec->fields[i].field_no,
+ TRUE, &mtr);
}
prev_page_no = page_no;
@@ -3546,9 +3564,9 @@ btr_free_externally_stored_field(
ut_a(local_len >= BTR_EXTERN_FIELD_REF_SIZE);
ut_ad(mtr_memo_contains(local_mtr, dict_tree_get_lock(index->tree),
- MTR_MEMO_X_LOCK));
+ MTR_MEMO_X_LOCK));
ut_ad(mtr_memo_contains(local_mtr, buf_block_align(data),
- MTR_MEMO_PAGE_X_FIX));
+ MTR_MEMO_PAGE_X_FIX));
ut_a(local_len >= BTR_EXTERN_FIELD_REF_SIZE);
local_len -= BTR_EXTERN_FIELD_REF_SIZE;
@@ -3556,20 +3574,21 @@ btr_free_externally_stored_field(
mtr_start(&mtr);
rec_page = buf_page_get(buf_frame_get_space_id(data),
- buf_frame_get_page_no(data), RW_X_LATCH, &mtr);
+ buf_frame_get_page_no(data),
+ RW_X_LATCH, &mtr);
#ifdef UNIV_SYNC_DEBUG
buf_page_dbg_add_level(rec_page, SYNC_NO_ORDER_CHECK);
#endif /* UNIV_SYNC_DEBUG */
space_id = mach_read_from_4(data + local_len
- + BTR_EXTERN_SPACE_ID);
+ + BTR_EXTERN_SPACE_ID);
page_no = mach_read_from_4(data + local_len
- + BTR_EXTERN_PAGE_NO);
+ + BTR_EXTERN_PAGE_NO);
offset = mach_read_from_4(data + local_len
- + BTR_EXTERN_OFFSET);
+ + BTR_EXTERN_OFFSET);
extern_len = mach_read_from_4(data + local_len
- + BTR_EXTERN_LEN + 4);
+ + BTR_EXTERN_LEN + 4);
/* If extern len is 0, then there is no external storage data
at all */
@@ -3582,7 +3601,7 @@ btr_free_externally_stored_field(
}
if (mach_read_from_1(data + local_len + BTR_EXTERN_LEN)
- & BTR_EXTERN_OWNER_FLAG) {
+ & BTR_EXTERN_OWNER_FLAG) {
/* This field does not own the externally
stored field: do not free! */
@@ -3592,8 +3611,8 @@ btr_free_externally_stored_field(
}
if (do_not_free_inherited
- && mach_read_from_1(data + local_len + BTR_EXTERN_LEN)
- & BTR_EXTERN_INHERITED_FLAG) {
+ && mach_read_from_1(data + local_len + BTR_EXTERN_LEN)
+ & BTR_EXTERN_INHERITED_FLAG) {
/* Rollback and inherited field: do not free! */
mtr_commit(&mtr);
@@ -3619,11 +3638,11 @@ btr_free_externally_stored_field(
btr_page_free_low(index->tree, page, 0, &mtr);
mlog_write_ulint(data + local_len + BTR_EXTERN_PAGE_NO,
- next_page_no,
- MLOG_4BYTES, &mtr);
+ next_page_no,
+ MLOG_4BYTES, &mtr);
mlog_write_ulint(data + local_len + BTR_EXTERN_LEN + 4,
- extern_len - part_len,
- MLOG_4BYTES, &mtr);
+ extern_len - part_len,
+ MLOG_4BYTES, &mtr);
if (next_page_no == FIL_NULL) {
ut_a(extern_len - part_len == 0);
}
@@ -3660,7 +3679,7 @@ btr_rec_free_externally_stored_fields(
ut_ad(rec_offs_validate(rec, index, offsets));
ut_ad(mtr_memo_contains(mtr, buf_block_align(rec),
- MTR_MEMO_PAGE_X_FIX));
+ MTR_MEMO_PAGE_X_FIX));
/* Free possible externally stored fields in the record */
ut_ad(dict_table_is_comp(index->table) == !!rec_offs_comp(offsets));
@@ -3671,7 +3690,8 @@ btr_rec_free_externally_stored_fields(
data = rec_get_nth_field(rec, offsets, i, &len);
btr_free_externally_stored_field(index, data, len,
- do_not_free_inherited, mtr);
+ do_not_free_inherited,
+ mtr);
}
}
}
@@ -3702,7 +3722,7 @@ btr_rec_free_updated_extern_fields(
ut_ad(rec_offs_validate(rec, index, offsets));
ut_ad(mtr_memo_contains(mtr, buf_block_align(rec),
- MTR_MEMO_PAGE_X_FIX));
+ MTR_MEMO_PAGE_X_FIX));
/* Free possible externally stored fields in the record */
@@ -3714,9 +3734,10 @@ btr_rec_free_updated_extern_fields(
if (rec_offs_nth_extern(offsets, ufield->field_no)) {
data = rec_get_nth_field(rec, offsets,
- ufield->field_no, &len);
+ ufield->field_no, &len);
btr_free_externally_stored_field(index, data, len,
- do_not_free_inherited, mtr);
+ do_not_free_inherited,
+ mtr);
}
}
}
@@ -3787,7 +3808,7 @@ btr_copy_externally_stored_field(
part_len = btr_blob_get_part_len(blob_header);
ut_memcpy(buf + copied_len, blob_header + BTR_BLOB_HDR_SIZE,
- part_len);
+ part_len);
copied_len += part_len;
page_no = btr_blob_get_next_page_no(blob_header);
diff --git a/storage/innobase/btr/btr0pcur.c b/storage/innobase/btr/btr0pcur.c
index c739930ce04..a8d8b2f072a 100644
--- a/storage/innobase/btr/btr0pcur.c
+++ b/storage/innobase/btr/btr0pcur.c
@@ -92,9 +92,9 @@ btr_pcur_store_position(
offs = ut_align_offset(rec, UNIV_PAGE_SIZE);
ut_ad(mtr_memo_contains(mtr, buf_block_align(page),
- MTR_MEMO_PAGE_S_FIX)
- || mtr_memo_contains(mtr, buf_block_align(page),
- MTR_MEMO_PAGE_X_FIX));
+ MTR_MEMO_PAGE_S_FIX)
+ || mtr_memo_contains(mtr, buf_block_align(page),
+ MTR_MEMO_PAGE_X_FIX));
ut_a(cursor->latch_mode != BTR_NO_LATCHES);
if (UNIV_UNLIKELY(page_get_n_recs(page) == 0)) {
@@ -133,14 +133,13 @@ btr_pcur_store_position(
}
cursor->old_stored = BTR_PCUR_OLD_STORED;
- cursor->old_rec = dict_tree_copy_rec_order_prefix(tree, rec,
- &cursor->old_n_fields,
- &cursor->old_rec_buf,
- &cursor->buf_size);
+ cursor->old_rec = dict_tree_copy_rec_order_prefix
+ (tree, rec, &cursor->old_n_fields,
+ &cursor->old_rec_buf, &cursor->buf_size);
cursor->block_when_stored = buf_block_align(page);
- cursor->modify_clock = buf_block_get_modify_clock(
- cursor->block_when_stored);
+ cursor->modify_clock = buf_block_get_modify_clock
+ (cursor->block_when_stored);
}
/******************************************************************
@@ -165,7 +164,7 @@ btr_pcur_copy_stored_position(
pcur_receive->old_rec_buf = mem_alloc(pcur_donate->buf_size);
ut_memcpy(pcur_receive->old_rec_buf, pcur_donate->old_rec_buf,
- pcur_donate->buf_size);
+ pcur_donate->buf_size);
pcur_receive->old_rec = pcur_receive->old_rec_buf
+ (pcur_donate->old_rec - pcur_donate->old_rec_buf);
}
@@ -206,8 +205,8 @@ btr_pcur_restore_position(
mem_heap_t* heap;
if (UNIV_UNLIKELY(cursor->old_stored != BTR_PCUR_OLD_STORED)
- || UNIV_UNLIKELY(cursor->pos_state != BTR_PCUR_WAS_POSITIONED
- && cursor->pos_state != BTR_PCUR_IS_POSITIONED)) {
+ || UNIV_UNLIKELY(cursor->pos_state != BTR_PCUR_WAS_POSITIONED
+ && cursor->pos_state != BTR_PCUR_IS_POSITIONED)) {
ut_print_buf(stderr, cursor, sizeof(btr_pcur_t));
if (cursor->trx_if_known) {
trx_print(stderr, cursor->trx_if_known, 0);
@@ -216,19 +215,20 @@ btr_pcur_restore_position(
ut_error;
}
- if (UNIV_UNLIKELY(cursor->rel_pos == BTR_PCUR_AFTER_LAST_IN_TREE
- || cursor->rel_pos == BTR_PCUR_BEFORE_FIRST_IN_TREE)) {
+ if (UNIV_UNLIKELY
+ (cursor->rel_pos == BTR_PCUR_AFTER_LAST_IN_TREE
+ || cursor->rel_pos == BTR_PCUR_BEFORE_FIRST_IN_TREE)) {
/* In these cases we do not try an optimistic restoration,
but always do a search */
- btr_cur_open_at_index_side(
- cursor->rel_pos == BTR_PCUR_BEFORE_FIRST_IN_TREE,
- btr_pcur_get_btr_cur(cursor)->index, latch_mode,
- btr_pcur_get_btr_cur(cursor), mtr);
+ btr_cur_open_at_index_side
+ (cursor->rel_pos == BTR_PCUR_BEFORE_FIRST_IN_TREE,
+ btr_pcur_get_btr_cur(cursor)->index, latch_mode,
+ btr_pcur_get_btr_cur(cursor), mtr);
- cursor->block_when_stored =
- buf_block_align(btr_pcur_get_page(cursor));
+ cursor->block_when_stored
+ = buf_block_align(btr_pcur_get_page(cursor));
return(FALSE);
}
@@ -239,12 +239,13 @@ btr_pcur_restore_position(
page = btr_cur_get_page(btr_pcur_get_btr_cur(cursor));
if (UNIV_LIKELY(latch_mode == BTR_SEARCH_LEAF)
- || UNIV_LIKELY(latch_mode == BTR_MODIFY_LEAF)) {
+ || UNIV_LIKELY(latch_mode == BTR_MODIFY_LEAF)) {
/* Try optimistic restoration */
- if (UNIV_LIKELY(buf_page_optimistic_get(latch_mode,
- cursor->block_when_stored, page,
- cursor->modify_clock, mtr))) {
+ if (UNIV_LIKELY
+ (buf_page_optimistic_get(latch_mode,
+ cursor->block_when_stored, page,
+ cursor->modify_clock, mtr))) {
cursor->pos_state = BTR_PCUR_IS_POSITIONED;
#ifdef UNIV_SYNC_DEBUG
buf_page_dbg_add_level(page, SYNC_TREE_NODE);
@@ -262,14 +263,16 @@ btr_pcur_restore_position(
index = btr_pcur_get_btr_cur(cursor)->index;
heap = mem_heap_create(256);
- offsets1 = rec_get_offsets(cursor->old_rec,
- index, NULL,
- cursor->old_n_fields, &heap);
- offsets2 = rec_get_offsets(rec, index, NULL,
- cursor->old_n_fields, &heap);
-
- ut_ad(cmp_rec_rec(cursor->old_rec,
- rec, offsets1, offsets2, index) == 0);
+ offsets1 = rec_get_offsets
+ (cursor->old_rec, index, NULL,
+ cursor->old_n_fields, &heap);
+ offsets2 = rec_get_offsets
+ (rec, index, NULL,
+ cursor->old_n_fields, &heap);
+
+ ut_ad(!cmp_rec_rec(cursor->old_rec,
+ rec, offsets1, offsets2,
+ index));
mem_heap_free(heap);
#endif /* UNIV_DEBUG */
return(TRUE);
@@ -285,7 +288,7 @@ btr_pcur_restore_position(
tree = btr_cur_get_tree(btr_pcur_get_btr_cur(cursor));
tuple = dict_tree_build_data_tuple(tree, cursor->old_rec,
- cursor->old_n_fields, heap);
+ cursor->old_n_fields, heap);
/* Save the old search mode of the cursor */
old_mode = cursor->search_mode;
@@ -300,26 +303,27 @@ btr_pcur_restore_position(
}
btr_pcur_open_with_no_init(btr_pcur_get_btr_cur(cursor)->index, tuple,
- mode, latch_mode, cursor, 0, mtr);
+ mode, latch_mode, cursor, 0, mtr);
/* Restore the old search mode */
cursor->search_mode = old_mode;
if (cursor->rel_pos == BTR_PCUR_ON
- && btr_pcur_is_on_user_rec(cursor, mtr)
- && 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,
- NULL, ULINT_UNDEFINED, &heap))) {
+ && btr_pcur_is_on_user_rec(cursor, mtr)
+ && 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,
+ NULL, ULINT_UNDEFINED, &heap))) {
/* 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 value of old_rec */
- cursor->block_when_stored =
- buf_block_align(btr_pcur_get_page(cursor));
- cursor->modify_clock =
- buf_block_get_modify_clock(cursor->block_when_stored);
+ cursor->block_when_stored = buf_block_align
+ (btr_pcur_get_page(cursor));
+ cursor->modify_clock = buf_block_get_modify_clock
+ (cursor->block_when_stored);
cursor->old_stored = BTR_PCUR_OLD_STORED;
mem_heap_free(heap);
@@ -467,14 +471,14 @@ btr_pcur_move_backward_from_page(
space = buf_frame_get_space_id(page);
if (btr_pcur_is_before_first_on_page(cursor, mtr)
- && (prev_page_no != FIL_NULL)) {
+ && (prev_page_no != FIL_NULL)) {
prev_page = btr_pcur_get_btr_cur(cursor)->left_page;
btr_leaf_page_release(page, latch_mode, mtr);
page_cur_set_after_last(prev_page,
- btr_pcur_get_page_cur(cursor));
+ btr_pcur_get_page_cur(cursor));
} else if (prev_page_no != FIL_NULL) {
/* The repositioned cursor did not end on an infimum record on
diff --git a/storage/innobase/btr/btr0sea.c b/storage/innobase/btr/btr0sea.c
index 2f2102379ab..bb089c4c417 100644
--- a/storage/innobase/btr/btr0sea.c
+++ b/storage/innobase/btr/btr0sea.c
@@ -231,19 +231,19 @@ btr_search_info_update_hash(
}
cmp = ut_pair_cmp(info->n_fields, info->n_bytes,
- cursor->low_match, cursor->low_bytes);
+ cursor->low_match, cursor->low_bytes);
if ((info->side == BTR_SEARCH_LEFT_SIDE && cmp <= 0)
- || (info->side == BTR_SEARCH_RIGHT_SIDE && cmp > 0)) {
+ || (info->side == BTR_SEARCH_RIGHT_SIDE && cmp > 0)) {
goto set_new_recomm;
}
cmp = ut_pair_cmp(info->n_fields, info->n_bytes,
- cursor->up_match, cursor->up_bytes);
+ cursor->up_match, cursor->up_bytes);
if ((info->side == BTR_SEARCH_LEFT_SIDE && cmp > 0)
- || (info->side == BTR_SEARCH_RIGHT_SIDE && cmp <= 0)) {
+ || (info->side == BTR_SEARCH_RIGHT_SIDE && cmp <= 0)) {
goto set_new_recomm;
}
@@ -260,7 +260,7 @@ set_new_recomm:
info->hash_analysis = 0;
cmp = ut_pair_cmp(cursor->up_match, cursor->up_bytes,
- cursor->low_match, cursor->low_bytes);
+ cursor->low_match, cursor->low_bytes);
if (cmp == 0) {
info->n_hash_potential = 0;
@@ -328,7 +328,7 @@ btr_search_update_block_hash_info(
ut_ad(!rw_lock_own(&btr_search_latch, RW_LOCK_SHARED));
ut_ad(!rw_lock_own(&btr_search_latch, RW_LOCK_EX));
ut_ad(rw_lock_own(&((buf_block_t*) block)->lock, RW_LOCK_SHARED)
- || rw_lock_own(&((buf_block_t*) block)->lock, RW_LOCK_EX));
+ || rw_lock_own(&((buf_block_t*) block)->lock, RW_LOCK_EX));
#endif /* UNIV_SYNC_DEBUG */
ut_ad(cursor);
@@ -338,15 +338,15 @@ btr_search_update_block_hash_info(
ut_a(info->magic_n == BTR_SEARCH_MAGIC_N);
if ((block->n_hash_helps > 0)
- && (info->n_hash_potential > 0)
- && (block->n_fields == info->n_fields)
- && (block->n_bytes == info->n_bytes)
- && (block->side == info->side)) {
+ && (info->n_hash_potential > 0)
+ && (block->n_fields == info->n_fields)
+ && (block->n_bytes == info->n_bytes)
+ && (block->side == info->side)) {
if ((block->is_hashed)
- && (block->curr_n_fields == info->n_fields)
- && (block->curr_n_bytes == info->n_bytes)
- && (block->curr_side == info->side)) {
+ && (block->curr_n_fields == info->n_fields)
+ && (block->curr_n_bytes == info->n_bytes)
+ && (block->curr_side == info->side)) {
/* The search would presumably have succeeded using
the hash index */
@@ -367,15 +367,15 @@ btr_search_update_block_hash_info(
}
if ((block->n_hash_helps > page_get_n_recs(block->frame)
- / BTR_SEARCH_PAGE_BUILD_LIMIT)
- && (info->n_hash_potential >= BTR_SEARCH_BUILD_LIMIT)) {
+ / BTR_SEARCH_PAGE_BUILD_LIMIT)
+ && (info->n_hash_potential >= BTR_SEARCH_BUILD_LIMIT)) {
if ((!block->is_hashed)
- || (block->n_hash_helps
- > 2 * page_get_n_recs(block->frame))
- || (block->n_fields != block->curr_n_fields)
- || (block->n_bytes != block->curr_n_bytes)
- || (block->side != block->curr_side)) {
+ || (block->n_hash_helps
+ > 2 * page_get_n_recs(block->frame))
+ || (block->n_fields != block->curr_n_fields)
+ || (block->n_bytes != block->curr_n_bytes)
+ || (block->side != block->curr_side)) {
/* Build a new hash index on the page */
@@ -410,16 +410,16 @@ btr_search_update_hash_ref(
#ifdef UNIV_SYNC_DEBUG
ut_ad(rw_lock_own(&btr_search_latch, RW_LOCK_EX));
ut_ad(rw_lock_own(&(block->lock), RW_LOCK_SHARED)
- || rw_lock_own(&(block->lock), RW_LOCK_EX));
+ || rw_lock_own(&(block->lock), RW_LOCK_EX));
#endif /* UNIV_SYNC_DEBUG */
ut_ad(buf_block_align(btr_cur_get_rec(cursor)) == block);
ut_a(!block->is_hashed || block->index == cursor->index);
if (block->is_hashed
- && (info->n_hash_potential > 0)
- && (block->curr_n_fields == info->n_fields)
- && (block->curr_n_bytes == info->n_bytes)
- && (block->curr_side == info->side)) {
+ && (info->n_hash_potential > 0)
+ && (block->curr_n_fields == info->n_fields)
+ && (block->curr_n_bytes == info->n_bytes)
+ && (block->curr_side == info->side)) {
mem_heap_t* heap = NULL;
ulint offsets_[REC_OFFS_NORMAL_SIZE];
*offsets_ = (sizeof offsets_) / sizeof *offsets_;
@@ -432,8 +432,9 @@ btr_search_update_hash_ref(
}
tree_id = ((cursor->index)->tree)->id;
- fold = rec_fold(rec, rec_get_offsets(rec, cursor->index,
- offsets_, ULINT_UNDEFINED, &heap),
+ fold = rec_fold(rec,
+ rec_get_offsets(rec, cursor->index, offsets_,
+ ULINT_UNDEFINED, &heap),
block->curr_n_fields,
block->curr_n_bytes, tree_id);
if (UNIV_LIKELY_NULL(heap)) {
@@ -516,10 +517,10 @@ btr_search_info_update_slow(
params2 = params + btr_search_this_is_zero;
btr_search_build_page_hash_index(cursor->index,
- block->frame,
- params2[0],
- params2[1],
- params2[2]);
+ block->frame,
+ params2[0],
+ params2[1],
+ params2[2]);
mem_free(params);
}
}
@@ -568,9 +569,9 @@ btr_search_check_guess(
bytes = 0;
offsets = rec_get_offsets(rec, cursor->index, offsets,
- n_unique, &heap);
+ n_unique, &heap);
cmp = page_cmp_dtuple_rec_with_match(tuple, rec,
- offsets, &match, &bytes);
+ offsets, &match, &bytes);
if (mode == PAGE_CUR_GE) {
if (cmp == 1) {
@@ -617,16 +618,16 @@ btr_search_check_guess(
prev_rec = page_rec_get_prev(rec);
if (page_rec_is_infimum(prev_rec)) {
- success = btr_page_get_prev(
- buf_frame_align(prev_rec), mtr) == FIL_NULL;
+ success = btr_page_get_prev
+ (buf_frame_align(prev_rec), mtr) == FIL_NULL;
goto exit_func;
}
offsets = rec_get_offsets(prev_rec, cursor->index, offsets,
- n_unique, &heap);
+ n_unique, &heap);
cmp = page_cmp_dtuple_rec_with_match(tuple, prev_rec,
- offsets, &match, &bytes);
+ offsets, &match, &bytes);
if (mode == PAGE_CUR_GE) {
success = cmp == 1;
} else {
@@ -642,8 +643,8 @@ btr_search_check_guess(
next_rec = page_rec_get_next(rec);
if (page_rec_is_supremum(next_rec)) {
- if (btr_page_get_next(
- buf_frame_align(next_rec), mtr) == FIL_NULL) {
+ if (btr_page_get_next
+ (buf_frame_align(next_rec), mtr) == FIL_NULL) {
cursor->up_match = 0;
success = TRUE;
@@ -653,9 +654,9 @@ btr_search_check_guess(
}
offsets = rec_get_offsets(next_rec, cursor->index, offsets,
- n_unique, &heap);
+ n_unique, &heap);
cmp = page_cmp_dtuple_rec_with_match(tuple, next_rec,
- offsets, &match, &bytes);
+ offsets, &match, &bytes);
if (mode == PAGE_CUR_LE) {
success = cmp == -1;
cursor->up_match = match;
@@ -709,7 +710,7 @@ btr_search_guess_on_hash(
#endif
ut_ad(index && info && tuple && cursor && mtr);
ut_ad((latch_mode == BTR_SEARCH_LEAF)
- || (latch_mode == BTR_MODIFY_LEAF));
+ || (latch_mode == BTR_MODIFY_LEAF));
/* Note that, for efficiency, the struct info may not be protected by
any latch here! */
@@ -730,7 +731,7 @@ btr_search_guess_on_hash(
}
if (UNIV_UNLIKELY(tuple_n_fields == cursor->n_fields)
- && (cursor->n_bytes > 0)) {
+ && (cursor->n_bytes > 0)) {
return(FALSE);
}
@@ -762,10 +763,10 @@ btr_search_guess_on_hash(
if (UNIV_LIKELY(!has_search_latch)) {
- if (UNIV_UNLIKELY(!buf_page_get_known_nowait(latch_mode, page,
+ if (UNIV_UNLIKELY
+ (!buf_page_get_known_nowait(latch_mode, page,
BUF_MAKE_YOUNG,
- __FILE__, __LINE__,
- mtr))) {
+ __FILE__, __LINE__, mtr))) {
goto failure_unlock;
}
@@ -801,10 +802,11 @@ btr_search_guess_on_hash(
record to determine if our guess for the cursor position is
right. */
if (UNIV_EXPECT(ut_dulint_cmp(tree_id, btr_page_get_index_id(page)), 0)
- || !btr_search_check_guess(cursor,
- can_only_compare_to_cursor_rec, tuple, mode, mtr)) {
+ || !btr_search_check_guess(cursor,
+ can_only_compare_to_cursor_rec,
+ tuple, mode, mtr)) {
if (UNIV_LIKELY(!has_search_latch)) {
- btr_leaf_page_release(page, latch_mode, mtr);
+ btr_leaf_page_release(page, latch_mode, mtr);
}
goto failure;
@@ -827,9 +829,9 @@ btr_search_guess_on_hash(
btr_leaf_page_release(page, latch_mode, mtr);
btr_cur_search_to_nth_level(index, 0, tuple, mode, latch_mode,
- &cursor2, 0, mtr);
+ &cursor2, 0, mtr);
if (mode == PAGE_CUR_GE
- && page_rec_is_supremum(btr_cur_get_rec(&cursor2))) {
+ && page_rec_is_supremum(btr_cur_get_rec(&cursor2))) {
/* If mode is PAGE_CUR_GE, then the binary search
in the index tree may actually take us to the supremum
@@ -838,7 +840,7 @@ btr_search_guess_on_hash(
info->last_hash_succ = FALSE;
btr_pcur_open_on_user_rec(index, tuple, mode, latch_mode,
- &pcur, mtr);
+ &pcur, mtr);
ut_ad(btr_pcur_get_rec(&pcur) == btr_cur_get_rec(cursor));
} else {
ut_ad(btr_cur_get_rec(&cursor2) == btr_cur_get_rec(cursor));
@@ -854,7 +856,7 @@ btr_search_guess_on_hash(
btr_search_n_succ++;
#endif
if (UNIV_LIKELY(!has_search_latch)
- && buf_block_peek_if_too_old(block)) {
+ && buf_block_peek_if_too_old(block)) {
buf_page_make_young(page);
}
@@ -931,8 +933,8 @@ retry:
#ifdef UNIV_SYNC_DEBUG
ut_ad(rw_lock_own(&(block->lock), RW_LOCK_SHARED)
- || rw_lock_own(&(block->lock), RW_LOCK_EX)
- || (block->buf_fix_count == 0));
+ || rw_lock_own(&(block->lock), RW_LOCK_EX)
+ || (block->buf_fix_count == 0));
#endif /* UNIV_SYNC_DEBUG */
n_fields = block->curr_n_fields;
@@ -972,7 +974,7 @@ retry:
/* FIXME: in a mixed tree, not all records may have enough
ordering fields: */
offsets = rec_get_offsets(rec, index, offsets,
- n_fields + (n_bytes > 0), &heap);
+ n_fields + (n_bytes > 0), &heap);
ut_a(rec_offs_n_fields(offsets) == n_fields + (n_bytes > 0));
fold = rec_fold(rec, offsets, n_fields, n_bytes, tree_id);
@@ -1006,7 +1008,7 @@ next_rec:
ut_a(block->index == index);
if (UNIV_UNLIKELY(block->curr_n_fields != n_fields)
- || UNIV_UNLIKELY(block->curr_n_bytes != n_bytes)) {
+ || UNIV_UNLIKELY(block->curr_n_bytes != n_bytes)) {
/* Someone else has meanwhile built a new hash index on the
page, with different parameters */
@@ -1029,8 +1031,10 @@ cleanup:
/* Corruption */
ut_print_timestamp(stderr);
fprintf(stderr,
-" InnoDB: Corruption of adaptive hash index. After dropping\n"
-"InnoDB: the hash index to a page of %s, still %lu hash nodes remain.\n",
+ " InnoDB: Corruption of adaptive hash index."
+ " After dropping\n"
+ "InnoDB: the hash index to a page of %s,"
+ " still %lu hash nodes remain.\n",
index->name, (ulong) block->n_pointers);
rw_lock_x_unlock(&btr_search_latch);
@@ -1124,14 +1128,14 @@ btr_search_build_page_hash_index(
#ifdef UNIV_SYNC_DEBUG
ut_ad(!rw_lock_own(&btr_search_latch, RW_LOCK_EX));
ut_ad(rw_lock_own(&(block->lock), RW_LOCK_SHARED)
- || rw_lock_own(&(block->lock), RW_LOCK_EX));
+ || rw_lock_own(&(block->lock), RW_LOCK_EX));
#endif /* UNIV_SYNC_DEBUG */
rw_lock_s_lock(&btr_search_latch);
if (block->is_hashed && ((block->curr_n_fields != n_fields)
- || (block->curr_n_bytes != n_bytes)
- || (block->curr_side != side))) {
+ || (block->curr_n_bytes != n_bytes)
+ || (block->curr_side != side))) {
rw_lock_s_unlock(&btr_search_latch);
@@ -1155,8 +1159,8 @@ btr_search_build_page_hash_index(
}
if (dict_index_get_n_unique_in_tree(index) < n_fields
- || (dict_index_get_n_unique_in_tree(index) == n_fields
- && n_bytes > 0)) {
+ || (dict_index_get_n_unique_in_tree(index) == n_fields
+ && n_bytes > 0)) {
return;
}
@@ -1174,7 +1178,7 @@ btr_search_build_page_hash_index(
rec = page_rec_get_next(rec);
offsets = rec_get_offsets(rec, index, offsets,
- n_fields + (n_bytes > 0), &heap);
+ n_fields + (n_bytes > 0), &heap);
if (!page_rec_is_supremum(rec)) {
ut_a(n_fields <= rec_offs_n_fields(offsets));
@@ -1211,9 +1215,9 @@ btr_search_build_page_hash_index(
}
offsets = rec_get_offsets(next_rec, index, offsets,
- n_fields + (n_bytes > 0), &heap);
+ n_fields + (n_bytes > 0), &heap);
next_fold = rec_fold(next_rec, offsets, n_fields,
- n_bytes, tree_id);
+ n_bytes, tree_id);
if (fold != next_fold) {
/* Insert an entry into the hash index */
@@ -1239,8 +1243,8 @@ btr_search_build_page_hash_index(
rw_lock_x_lock(&btr_search_latch);
if (block->is_hashed && ((block->curr_n_fields != n_fields)
- || (block->curr_n_bytes != n_bytes)
- || (block->curr_side != side))) {
+ || (block->curr_n_bytes != n_bytes)
+ || (block->curr_side != side))) {
goto exit_func;
}
@@ -1327,7 +1331,7 @@ btr_search_move_or_delete_hash_entries(
ut_a(n_fields + n_bytes > 0);
btr_search_build_page_hash_index(index, new_page, n_fields,
- n_bytes, side);
+ n_bytes, side);
ut_a(n_fields == block->curr_n_fields);
ut_a(n_bytes == block->curr_n_bytes);
ut_a(side == block->curr_side);
@@ -1378,8 +1382,8 @@ btr_search_update_hash_on_delete(
tree_id = cursor->index->tree->id;
fold = rec_fold(rec, rec_get_offsets(rec, cursor->index, offsets_,
- ULINT_UNDEFINED, &heap), block->curr_n_fields,
- block->curr_n_bytes, tree_id);
+ ULINT_UNDEFINED, &heap),
+ block->curr_n_fields, block->curr_n_bytes, tree_id);
if (UNIV_LIKELY_NULL(heap)) {
mem_heap_free(heap);
}
@@ -1423,14 +1427,14 @@ btr_search_update_hash_node_on_insert(
rw_lock_x_lock(&btr_search_latch);
if ((cursor->flag == BTR_CUR_HASH)
- && (cursor->n_fields == block->curr_n_fields)
- && (cursor->n_bytes == block->curr_n_bytes)
- && (block->curr_side == BTR_SEARCH_RIGHT_SIDE)) {
+ && (cursor->n_fields == block->curr_n_fields)
+ && (cursor->n_bytes == block->curr_n_bytes)
+ && (block->curr_side == BTR_SEARCH_RIGHT_SIDE)) {
table = btr_search_sys->hash_index;
ha_search_and_update_if_found(table, cursor->fold, rec,
- page_rec_get_next(rec));
+ page_rec_get_next(rec));
rw_lock_x_unlock(&btr_search_latch);
} else {
@@ -1498,19 +1502,19 @@ btr_search_update_hash_on_insert(
next_rec = page_rec_get_next(ins_rec);
offsets = rec_get_offsets(ins_rec, cursor->index, offsets,
- ULINT_UNDEFINED, &heap);
+ ULINT_UNDEFINED, &heap);
ins_fold = rec_fold(ins_rec, offsets, n_fields, n_bytes, tree_id);
if (!page_rec_is_supremum(next_rec)) {
offsets = rec_get_offsets(next_rec, cursor->index, offsets,
- n_fields + (n_bytes > 0), &heap);
+ n_fields + (n_bytes > 0), &heap);
next_fold = rec_fold(next_rec, offsets, n_fields,
- n_bytes, tree_id);
+ n_bytes, tree_id);
}
if (!page_rec_is_infimum(rec)) {
offsets = rec_get_offsets(rec, cursor->index, offsets,
- n_fields + (n_bytes > 0), &heap);
+ n_fields + (n_bytes > 0), &heap);
fold = rec_fold(rec, offsets, n_fields, n_bytes, tree_id);
} else {
if (side == BTR_SEARCH_LEFT_SIDE) {
@@ -1570,11 +1574,11 @@ check_next_rec:
if (side == BTR_SEARCH_RIGHT_SIDE) {
ha_insert_for_fold(table, ins_fold, ins_rec);
-/*
+ /*
fputs("Hash insert for ", stderr);
dict_index_name_print(stderr, cursor->index);
fprintf(stderr, " fold %lu\n", ins_fold);
-*/
+ */
} else {
ha_insert_for_fold(table, next_fold, next_rec);
}
@@ -1633,12 +1637,13 @@ btr_search_validate(void)
block = buf_block_align(node->data);
page = buf_frame_align(node->data);
offsets = rec_get_offsets((rec_t*) node->data,
- block->index, offsets,
- block->curr_n_fields
- + (block->curr_n_bytes > 0), &heap);
+ block->index, offsets,
+ block->curr_n_fields
+ + (block->curr_n_bytes > 0),
+ &heap);
- if (!block->is_hashed
- || node->fold != rec_fold((rec_t*)(node->data),
+ if (!block->is_hashed || node->fold
+ != rec_fold((rec_t*)(node->data),
offsets,
block->curr_n_fields,
block->curr_n_bytes,
@@ -1647,28 +1652,36 @@ btr_search_validate(void)
ut_print_timestamp(stderr);
fprintf(stderr,
-" InnoDB: Error in an adaptive hash index pointer to page %lu\n"
-"ptr mem address %p index id %lu %lu, node fold %lu, rec fold %lu\n",
+ " InnoDB: Error in an adaptive hash"
+ " index pointer to page %lu\n"
+ "InnoDB: ptr mem address %p"
+ " index id %lu %lu,"
+ " node fold %lu, rec fold %lu\n",
(ulong) buf_frame_get_page_no(page),
node->data,
- (ulong) ut_dulint_get_high(btr_page_get_index_id(page)),
- (ulong) ut_dulint_get_low(btr_page_get_index_id(page)),
+ (ulong) ut_dulint_get_high
+ (btr_page_get_index_id(page)),
+ (ulong) ut_dulint_get_low
+ (btr_page_get_index_id(page)),
(ulong) node->fold,
(ulong) rec_fold((rec_t*)(node->data),
- offsets,
- block->curr_n_fields,
- block->curr_n_bytes,
- btr_page_get_index_id(page)));
+ offsets,
+ block->curr_n_fields,
+ block->curr_n_bytes,
+ btr_page_get_index_id
+ (page)));
fputs("InnoDB: Record ", stderr);
rec_print_new(stderr, (rec_t*)node->data,
- offsets);
+ offsets);
fprintf(stderr, "\nInnoDB: on that page."
-"Page mem address %p, is hashed %lu, n fields %lu, n bytes %lu\n"
-"side %lu\n",
- page, (ulong) block->is_hashed,
- (ulong) block->curr_n_fields,
- (ulong) block->curr_n_bytes, (ulong) block->curr_side);
+ " Page mem address %p, is hashed %lu,"
+ " n fields %lu, n bytes %lu\n"
+ "InnoDB: side %lu\n",
+ (void*) page, (ulong) block->is_hashed,
+ (ulong) block->curr_n_fields,
+ (ulong) block->curr_n_bytes,
+ (ulong) block->curr_side);
if (n_page_dumps < 20) {
buf_page_print(page);
diff --git a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c
index ad23da4af93..4e8cd97c9a8 100644
--- a/storage/innobase/buf/buf0buf.c
+++ b/storage/innobase/buf/buf0buf.c
@@ -160,8 +160,8 @@ and the io-operation for loading the page is queued. The io-handler thread
releases the X-lock on the frame and resets the io_fix field
when the io operation completes.
-A thread may request the above operation using the buf_page_get-
-function. It may then continue to request a lock on the frame.
+A thread may request the above operation using the function
+buf_page_get(). It may then continue to request a lock on the frame.
The lock is granted when the io-handler releases the x-lock.
Read-ahead
@@ -253,10 +253,10 @@ buf_calc_page_new_checksum(
there we store the old formula checksum. */
checksum = ut_fold_binary(page + FIL_PAGE_OFFSET,
- FIL_PAGE_FILE_FLUSH_LSN - FIL_PAGE_OFFSET)
- + ut_fold_binary(page + FIL_PAGE_DATA,
- UNIV_PAGE_SIZE - FIL_PAGE_DATA
- - FIL_PAGE_END_LSN_OLD_CHKSUM);
+ FIL_PAGE_FILE_FLUSH_LSN - FIL_PAGE_OFFSET)
+ + ut_fold_binary(page + FIL_PAGE_DATA,
+ UNIV_PAGE_SIZE - FIL_PAGE_DATA
+ - FIL_PAGE_END_LSN_OLD_CHKSUM);
checksum = checksum & 0xFFFFFFFFUL;
return(checksum);
@@ -302,11 +302,11 @@ buf_page_is_corrupted(
dulint current_lsn;
#endif
if (mach_read_from_4(read_buf + FIL_PAGE_LSN + 4)
- != mach_read_from_4(read_buf + UNIV_PAGE_SIZE
- - FIL_PAGE_END_LSN_OLD_CHKSUM + 4)) {
+ != mach_read_from_4(read_buf + UNIV_PAGE_SIZE
+ - FIL_PAGE_END_LSN_OLD_CHKSUM + 4)) {
/* Stored log sequence numbers at the start and the end
- of page do not match */
+ of page do not match */
return(TRUE);
}
@@ -314,22 +314,28 @@ buf_page_is_corrupted(
#ifndef UNIV_HOTBACKUP
if (recv_lsn_checks_on && log_peek_lsn(&current_lsn)) {
if (ut_dulint_cmp(current_lsn,
- mach_read_from_8(read_buf + FIL_PAGE_LSN))
- < 0) {
+ mach_read_from_8(read_buf + FIL_PAGE_LSN))
+ < 0) {
ut_print_timestamp(stderr);
fprintf(stderr,
-" InnoDB: Error: page %lu log sequence number %lu %lu\n"
-"InnoDB: is in the future! Current system log sequence number %lu %lu.\n"
-"InnoDB: Your database may be corrupt or you may have copied the InnoDB\n"
-"InnoDB: tablespace but not the InnoDB log files. See\n"
-"InnoDB: http://dev.mysql.com/doc/refman/5.1/en/forcing-recovery.html\n"
-"InnoDB: for more information.\n",
- (ulong) mach_read_from_4(read_buf + FIL_PAGE_OFFSET),
- (ulong) ut_dulint_get_high(
- mach_read_from_8(read_buf + FIL_PAGE_LSN)),
- (ulong) ut_dulint_get_low(
- mach_read_from_8(read_buf + FIL_PAGE_LSN)),
+ " InnoDB: Error: page %lu log sequence number"
+ " %lu %lu\n"
+ "InnoDB: is in the future! Current system "
+ "log sequence number %lu %lu.\n"
+ "InnoDB: Your database may be corrupt or "
+ "you may have copied the InnoDB\n"
+ "InnoDB: tablespace but not the InnoDB "
+ "log files. See\n"
+ "InnoDB: http://dev.mysql.com/doc/refman/"
+ "5.1/en/forcing-recovery.html\n"
+ "InnoDB: for more information.\n",
+ (ulong) mach_read_from_4(read_buf
+ + FIL_PAGE_OFFSET),
+ (ulong) ut_dulint_get_high
+ (mach_read_from_8(read_buf + FIL_PAGE_LSN)),
+ (ulong) ut_dulint_get_low
+ (mach_read_from_8(read_buf + FIL_PAGE_LSN)),
(ulong) ut_dulint_get_high(current_lsn),
(ulong) ut_dulint_get_low(current_lsn));
}
@@ -344,8 +350,9 @@ buf_page_is_corrupted(
if (srv_use_checksums) {
old_checksum = buf_calc_page_old_checksum(read_buf);
- old_checksum_field = mach_read_from_4(read_buf + UNIV_PAGE_SIZE
- - FIL_PAGE_END_LSN_OLD_CHKSUM);
+ old_checksum_field = mach_read_from_4
+ (read_buf + UNIV_PAGE_SIZE
+ - FIL_PAGE_END_LSN_OLD_CHKSUM);
/* There are 2 valid formulas for old_checksum_field:
@@ -356,22 +363,22 @@ buf_page_is_corrupted(
there. */
if (old_checksum_field != mach_read_from_4(read_buf
- + FIL_PAGE_LSN)
- && old_checksum_field != old_checksum
- && old_checksum_field != BUF_NO_CHECKSUM_MAGIC) {
+ + FIL_PAGE_LSN)
+ && old_checksum_field != old_checksum
+ && old_checksum_field != BUF_NO_CHECKSUM_MAGIC) {
return(TRUE);
}
checksum = buf_calc_page_new_checksum(read_buf);
- checksum_field = mach_read_from_4(read_buf +
- FIL_PAGE_SPACE_OR_CHKSUM);
+ checksum_field = mach_read_from_4(read_buf
+ + FIL_PAGE_SPACE_OR_CHKSUM);
/* InnoDB versions < 4.0.14 and < 4.1.1 stored the space id
(always equal to 0), to FIL_PAGE_SPACE_SPACE_OR_CHKSUM */
if (checksum_field != 0 && checksum_field != checksum
- && checksum_field != BUF_NO_CHECKSUM_MAGIC) {
+ && checksum_field != BUF_NO_CHECKSUM_MAGIC) {
return(TRUE);
}
@@ -398,37 +405,41 @@ buf_page_print(
ut_print_buf(stderr, read_buf, UNIV_PAGE_SIZE);
fputs("InnoDB: End of page dump\n", stderr);
- checksum = srv_use_checksums ?
- buf_calc_page_new_checksum(read_buf) : BUF_NO_CHECKSUM_MAGIC;
- old_checksum = srv_use_checksums ?
- buf_calc_page_old_checksum(read_buf) : BUF_NO_CHECKSUM_MAGIC;
+ checksum = srv_use_checksums
+ ? buf_calc_page_new_checksum(read_buf) : BUF_NO_CHECKSUM_MAGIC;
+ old_checksum = srv_use_checksums
+ ? buf_calc_page_old_checksum(read_buf) : BUF_NO_CHECKSUM_MAGIC;
ut_print_timestamp(stderr);
fprintf(stderr,
-" InnoDB: Page checksum %lu, prior-to-4.0.14-form checksum %lu\n"
-"InnoDB: stored checksum %lu, prior-to-4.0.14-form stored checksum %lu\n",
- (ulong) checksum, (ulong) old_checksum,
- (ulong) mach_read_from_4(read_buf + FIL_PAGE_SPACE_OR_CHKSUM),
- (ulong) mach_read_from_4(read_buf + UNIV_PAGE_SIZE
- - FIL_PAGE_END_LSN_OLD_CHKSUM));
- fprintf(stderr,
-"InnoDB: Page lsn %lu %lu, low 4 bytes of lsn at page end %lu\n"
-"InnoDB: Page number (if stored to page already) %lu,\n"
-"InnoDB: space id (if created with >= MySQL-4.1.1 and stored already) %lu\n",
+ " InnoDB: Page checksum %lu, prior-to-4.0.14-form"
+ " checksum %lu\n"
+ "InnoDB: stored checksum %lu, prior-to-4.0.14-form"
+ " stored checksum %lu\n"
+ "InnoDB: Page lsn %lu %lu, low 4 bytes of lsn"
+ " at page end %lu\n"
+ "InnoDB: Page number (if stored to page already) %lu,\n"
+ "InnoDB: space id (if created with >= MySQL-4.1.1"
+ " and stored already) %lu\n",
+ (ulong) checksum, (ulong) old_checksum,
+ (ulong) mach_read_from_4(read_buf + FIL_PAGE_SPACE_OR_CHKSUM),
+ (ulong) mach_read_from_4(read_buf + UNIV_PAGE_SIZE
+ - FIL_PAGE_END_LSN_OLD_CHKSUM),
(ulong) mach_read_from_4(read_buf + FIL_PAGE_LSN),
(ulong) mach_read_from_4(read_buf + FIL_PAGE_LSN + 4),
(ulong) mach_read_from_4(read_buf + UNIV_PAGE_SIZE
- - FIL_PAGE_END_LSN_OLD_CHKSUM + 4),
+ - FIL_PAGE_END_LSN_OLD_CHKSUM + 4),
(ulong) mach_read_from_4(read_buf + FIL_PAGE_OFFSET),
- (ulong) mach_read_from_4(read_buf + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID));
+ (ulong) mach_read_from_4(read_buf
+ + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID));
if (mach_read_from_2(read_buf + TRX_UNDO_PAGE_HDR + TRX_UNDO_PAGE_TYPE)
- == TRX_UNDO_INSERT) {
+ == TRX_UNDO_INSERT) {
fprintf(stderr,
"InnoDB: Page may be an insert undo log page\n");
} else if (mach_read_from_2(read_buf + TRX_UNDO_PAGE_HDR
- + TRX_UNDO_PAGE_TYPE)
- == TRX_UNDO_UPDATE) {
+ + TRX_UNDO_PAGE_TYPE)
+ == TRX_UNDO_UPDATE) {
fprintf(stderr,
"InnoDB: Page may be an update undo log page\n");
}
@@ -436,17 +447,20 @@ buf_page_print(
switch (fil_page_get_type(read_buf)) {
case FIL_PAGE_INDEX:
fprintf(stderr,
-"InnoDB: Page may be an index page where index id is %lu %lu\n",
- (ulong) ut_dulint_get_high(btr_page_get_index_id(read_buf)),
- (ulong) ut_dulint_get_low(btr_page_get_index_id(read_buf)));
+ "InnoDB: Page may be an index page where"
+ " index id is %lu %lu\n",
+ (ulong) ut_dulint_get_high
+ (btr_page_get_index_id(read_buf)),
+ (ulong) ut_dulint_get_low
+ (btr_page_get_index_id(read_buf)));
/* If the code is in ibbackup, dict_sys may be uninitialized,
i.e., NULL */
if (dict_sys != NULL) {
- index = dict_index_find_on_id_low(
- btr_page_get_index_id(read_buf));
+ index = dict_index_find_on_id_low
+ (btr_page_get_index_id(read_buf));
if (index) {
fputs("InnoDB: (", stderr);
dict_index_name_print(stderr, NULL, index);
@@ -459,35 +473,35 @@ buf_page_print(
break;
case FIL_PAGE_IBUF_FREE_LIST:
fputs("InnoDB: Page may be an insert buffer free list page\n",
- stderr);
+ stderr);
break;
case FIL_PAGE_TYPE_ALLOCATED:
fputs("InnoDB: Page may be a freshly allocated page\n",
- stderr);
+ stderr);
break;
case FIL_PAGE_IBUF_BITMAP:
fputs("InnoDB: Page may be an insert buffer bitmap page\n",
- stderr);
+ stderr);
break;
case FIL_PAGE_TYPE_SYS:
fputs("InnoDB: Page may be a system page\n",
- stderr);
+ stderr);
break;
case FIL_PAGE_TYPE_TRX_SYS:
fputs("InnoDB: Page may be a transaction system page\n",
- stderr);
+ stderr);
break;
case FIL_PAGE_TYPE_FSP_HDR:
fputs("InnoDB: Page may be a file space header page\n",
- stderr);
+ stderr);
break;
case FIL_PAGE_TYPE_XDES:
fputs("InnoDB: Page may be an extent descriptor page\n",
- stderr);
+ stderr);
break;
case FIL_PAGE_TYPE_BLOB:
fputs("InnoDB: Page may be a BLOB page\n",
- stderr);
+ stderr);
break;
}
}
@@ -561,9 +575,12 @@ buf_pool_init(
if (n_frames > curr_size) {
fprintf(stderr,
-"InnoDB: AWE: Error: you must specify in my.cnf .._awe_mem_mb larger\n"
-"InnoDB: than .._buffer_pool_size. Now the former is %lu pages,\n"
-"InnoDB: the latter %lu pages.\n", (ulong) curr_size, (ulong) n_frames);
+ "InnoDB: AWE: Error: you must specify in my.cnf"
+ " .._awe_mem_mb larger\n"
+ "InnoDB: than .._buffer_pool_size. Now the former"
+ " is %lu pages,\n"
+ "InnoDB: the latter %lu pages.\n",
+ (ulong) curr_size, (ulong) n_frames);
return(NULL);
}
@@ -571,7 +588,7 @@ buf_pool_init(
buf_pool = mem_alloc(sizeof(buf_pool_t));
/* 1. Initialize general fields
- ---------------------------- */
+ ---------------------------- */
mutex_create(&buf_pool->mutex, SYNC_BUF_POOL);
mutex_enter(&(buf_pool->mutex));
@@ -581,8 +598,8 @@ buf_pool_init(
/* Allocate the virtual address space window, i.e., the
buffer pool frames */
- buf_pool->frame_mem = os_awe_allocate_virtual_mem_window(
- UNIV_PAGE_SIZE * (n_frames + 1));
+ buf_pool->frame_mem = os_awe_allocate_virtual_mem_window
+ (UNIV_PAGE_SIZE * (n_frames + 1));
/* Allocate the physical memory for AWE and the AWE info array
for buf_pool */
@@ -590,23 +607,26 @@ buf_pool_init(
if ((curr_size % ((1024 * 1024) / UNIV_PAGE_SIZE)) != 0) {
fprintf(stderr,
-"InnoDB: AWE: Error: physical memory must be allocated in full megabytes.\n"
-"InnoDB: Trying to allocate %lu database pages.\n",
- (ulong) curr_size);
+ "InnoDB: AWE: Error: physical memory must be"
+ " allocated in full megabytes.\n"
+ "InnoDB: Trying to allocate %lu"
+ " database pages.\n",
+ (ulong) curr_size);
return(NULL);
}
if (!os_awe_allocate_physical_mem(&(buf_pool->awe_info),
- curr_size / ((1024 * 1024) / UNIV_PAGE_SIZE))) {
+ curr_size
+ / ((1024 * 1024)
+ / UNIV_PAGE_SIZE))) {
return(NULL);
}
/*----------------------------------------*/
} else {
- buf_pool->frame_mem = os_mem_alloc_large(
- UNIV_PAGE_SIZE * (n_frames + 1),
- TRUE, FALSE);
+ buf_pool->frame_mem = os_mem_alloc_large
+ (UNIV_PAGE_SIZE * (n_frames + 1), TRUE, FALSE);
}
if (buf_pool->frame_mem == NULL) {
@@ -639,9 +659,10 @@ buf_pool_init(
the window */
os_awe_map_physical_mem_to_window(buf_pool->frame_zero,
- n_frames *
- (UNIV_PAGE_SIZE / OS_AWE_X86_PAGE_SIZE),
- buf_pool->awe_info);
+ n_frames
+ * (UNIV_PAGE_SIZE
+ / OS_AWE_X86_PAGE_SIZE),
+ buf_pool->awe_info);
/*----------------------------------------*/
}
@@ -697,7 +718,7 @@ buf_pool_init(
buf_pool->n_pages_awe_remapped_old = 0;
/* 2. Initialize flushing fields
- ---------------------------- */
+ ---------------------------- */
UT_LIST_INIT(buf_pool->flush_list);
for (i = BUF_FLUSH_LRU; i <= BUF_FLUSH_LIST; i++) {
@@ -712,7 +733,7 @@ buf_pool_init(
buf_pool->freed_page_clock = 0;
/* 3. Initialize LRU fields
- ---------------------------- */
+ ---------------------------- */
UT_LIST_INIT(buf_pool->LRU);
buf_pool->LRU_old = NULL;
@@ -738,7 +759,8 @@ buf_pool_init(
frames */
UT_LIST_ADD_LAST(awe_LRU_free_mapped,
- buf_pool->awe_LRU_free_mapped, block);
+ buf_pool->awe_LRU_free_mapped,
+ block);
}
}
@@ -749,8 +771,8 @@ buf_pool_init(
mutex_exit(&(buf_pool->mutex));
if (srv_use_adaptive_hash_indexes) {
- btr_search_sys_create(
- curr_size * UNIV_PAGE_SIZE / sizeof(void*) / 64);
+ btr_search_sys_create(curr_size * UNIV_PAGE_SIZE
+ / sizeof(void*) / 64);
} else {
/* Create only a small dummy system */
btr_search_sys_create(1000);
@@ -792,35 +814,36 @@ buf_awe_map_page_to_frame(
while (bck) {
if (bck->state == BUF_BLOCK_FILE_PAGE
- && (bck->buf_fix_count != 0 || bck->io_fix != 0)) {
+ && (bck->buf_fix_count != 0 || bck->io_fix != 0)) {
/* We have to skip this */
bck = UT_LIST_GET_PREV(awe_LRU_free_mapped, bck);
} else {
/* We can map block to the frame of bck */
- os_awe_map_physical_mem_to_window(
- bck->frame,
- UNIV_PAGE_SIZE / OS_AWE_X86_PAGE_SIZE,
- block->awe_info);
+ os_awe_map_physical_mem_to_window
+ (bck->frame,
+ UNIV_PAGE_SIZE / OS_AWE_X86_PAGE_SIZE,
+ block->awe_info);
block->frame = bck->frame;
*(buf_pool->blocks_of_frames
- + (((ulint)(block->frame
- - buf_pool->frame_zero))
- >> UNIV_PAGE_SIZE_SHIFT))
+ + (((ulint)(block->frame
+ - buf_pool->frame_zero))
+ >> UNIV_PAGE_SIZE_SHIFT))
= block;
bck->frame = NULL;
UT_LIST_REMOVE(awe_LRU_free_mapped,
- buf_pool->awe_LRU_free_mapped,
- bck);
+ buf_pool->awe_LRU_free_mapped,
+ bck);
if (add_to_mapped_list) {
- UT_LIST_ADD_FIRST(awe_LRU_free_mapped,
- buf_pool->awe_LRU_free_mapped,
- block);
+ UT_LIST_ADD_FIRST
+ (awe_LRU_free_mapped,
+ buf_pool->awe_LRU_free_mapped,
+ block);
}
buf_pool->n_pages_awe_remapped++;
@@ -830,8 +853,8 @@ buf_awe_map_page_to_frame(
}
fprintf(stderr,
-"InnoDB: AWE: Fatal error: cannot find a page to unmap\n"
-"InnoDB: awe_LRU_free_mapped list length %lu\n",
+ "InnoDB: AWE: Fatal error: cannot find a page to unmap\n"
+ "InnoDB: awe_LRU_free_mapped list length %lu\n",
(ulong) UT_LIST_GET_LEN(buf_pool->awe_LRU_free_mapped));
ut_a(0);
@@ -864,7 +887,7 @@ buf_block_make_young(
buf_block_t* block) /* in: block to make younger */
{
if (buf_pool->freed_page_clock >= block->freed_page_clock
- + 1 + (buf_pool->curr_size / 1024)) {
+ + 1 + (buf_pool->curr_size / 1024)) {
/* There has been freeing activity in the LRU list:
best to move to the head of the LRU list */
@@ -1118,11 +1141,11 @@ buf_page_get_gen(
ut_ad(mtr);
ut_ad((rw_latch == RW_S_LATCH)
- || (rw_latch == RW_X_LATCH)
- || (rw_latch == RW_NO_LATCH));
+ || (rw_latch == RW_X_LATCH)
+ || (rw_latch == RW_NO_LATCH));
ut_ad((mode != BUF_GET_NO_LATCH) || (rw_latch == RW_NO_LATCH));
ut_ad((mode == BUF_GET) || (mode == BUF_GET_IF_IN_POOL)
- || (mode == BUF_GET_NO_LATCH) || (mode == BUF_GET_NOWAIT));
+ || (mode == BUF_GET_NO_LATCH) || (mode == BUF_GET_NOWAIT));
#ifndef UNIV_LOG_DEBUG
ut_ad(!ibuf_inside() || ibuf_page(space, offset));
#endif
@@ -1136,7 +1159,7 @@ loop:
block = buf_block_align(guess);
if ((offset != block->offset) || (space != block->space)
- || (block->state != BUF_BLOCK_FILE_PAGE)) {
+ || (block->state != BUF_BLOCK_FILE_PAGE)) {
block = NULL;
}
@@ -1229,12 +1252,12 @@ loop:
if (mode == BUF_GET_NOWAIT) {
if (rw_latch == RW_S_LATCH) {
success = rw_lock_s_lock_func_nowait(&(block->lock),
- file, line);
+ file, line);
fix_type = MTR_MEMO_PAGE_S_FIX;
} else {
ut_ad(rw_latch == RW_X_LATCH);
success = rw_lock_x_lock_func_nowait(&(block->lock),
- file, line);
+ file, line);
fix_type = MTR_MEMO_PAGE_X_FIX;
}
@@ -1331,8 +1354,8 @@ buf_page_optimistic_get_func(
/* If AWE is used, block may have a different frame now, e.g., NULL */
if (UNIV_UNLIKELY(block->state != BUF_BLOCK_FILE_PAGE)
- || UNIV_UNLIKELY(block->frame != guess)) {
- exit_func:
+ || UNIV_UNLIKELY(block->frame != guess)) {
+exit_func:
mutex_exit(&(buf_pool->mutex));
return(FALSE);
@@ -1357,11 +1380,11 @@ buf_page_optimistic_get_func(
if (rw_latch == RW_S_LATCH) {
success = rw_lock_s_lock_func_nowait(&(block->lock),
- file, line);
+ file, line);
fix_type = MTR_MEMO_PAGE_S_FIX;
} else {
success = rw_lock_x_lock_func_nowait(&(block->lock),
- file, line);
+ file, line);
fix_type = MTR_MEMO_PAGE_X_FIX;
}
@@ -1414,7 +1437,7 @@ buf_page_optimistic_get_func(
read-ahead */
buf_read_ahead_linear(buf_frame_get_space_id(guess),
- buf_frame_get_page_no(guess));
+ buf_frame_get_page_no(guess));
}
#ifdef UNIV_IBUF_DEBUG
@@ -1482,11 +1505,11 @@ buf_page_get_known_nowait(
if (rw_latch == RW_S_LATCH) {
success = rw_lock_s_lock_func_nowait(&(block->lock),
- file, line);
+ file, line);
fix_type = MTR_MEMO_PAGE_S_FIX;
} else {
success = rw_lock_x_lock_func_nowait(&(block->lock),
- file, line);
+ file, line);
fix_type = MTR_MEMO_PAGE_X_FIX;
}
@@ -1519,7 +1542,7 @@ buf_page_get_known_nowait(
#ifdef UNIV_IBUF_DEBUG
ut_a((mode == BUF_KEEP_OLD)
- || (ibuf_count_get(block->space, block->offset) == 0));
+ || (ibuf_count_get(block->space, block->offset) == 0));
#endif
buf_pool->n_page_gets++;
@@ -1598,7 +1621,8 @@ buf_page_init(
if (buf_page_hash_get(space, offset)) {
fprintf(stderr,
-"InnoDB: Error: page %lu %lu already found from the hash table\n",
+ "InnoDB: Error: page %lu %lu already found"
+ " in the hash table\n",
(ulong) space,
(ulong) offset);
#ifdef UNIV_DEBUG
@@ -1611,7 +1635,7 @@ buf_page_init(
}
HASH_INSERT(buf_block_t, hash, buf_pool->page_hash,
- buf_page_address_fold(space, offset), block);
+ buf_page_address_fold(space, offset), block);
block->freed_page_clock = 0;
@@ -1686,27 +1710,28 @@ buf_page_init_for_read(
mutex_enter(&(buf_pool->mutex));
- if (fil_tablespace_deleted_or_being_deleted_in_mem(space,
- tablespace_version)) {
+ if (fil_tablespace_deleted_or_being_deleted_in_mem
+ (space, tablespace_version)) {
*err = DB_TABLESPACE_DELETED;
}
if (*err == DB_TABLESPACE_DELETED
- || NULL != buf_page_hash_get(space, offset)) {
+ || NULL != buf_page_hash_get(space, offset)) {
- /* The page belongs to a space which has been deleted or is
- being deleted, or the page is already in buf_pool, return */
+ /* The page belongs to a space which has been
+ deleted or is being deleted, or the page is
+ already in buf_pool, return */
- mutex_exit(&(buf_pool->mutex));
- buf_block_free(block);
+ mutex_exit(&(buf_pool->mutex));
+ buf_block_free(block);
- if (mode == BUF_READ_IBUF_PAGES_ONLY) {
+ if (mode == BUF_READ_IBUF_PAGES_ONLY) {
- mtr_commit(&mtr);
- }
+ mtr_commit(&mtr);
+ }
- return(NULL);
- }
+ return(NULL);
+ }
ut_ad(block);
@@ -1866,23 +1891,24 @@ buf_page_io_complete(
/* If this page is not uninitialized and not in the
doublewrite buffer, then the page number and space id
should be the same as in block. */
- ulint read_page_no = mach_read_from_4((block->frame)
- + FIL_PAGE_OFFSET);
- ulint read_space_id = mach_read_from_4((block->frame)
- + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID);
+ ulint read_page_no = mach_read_from_4
+ (block->frame + FIL_PAGE_OFFSET);
+ ulint read_space_id = mach_read_from_4
+ (block->frame + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID);
- if (!block->space && trx_doublewrite_page_inside(
- block->offset)) {
+ if (!block->space
+ && trx_doublewrite_page_inside(block->offset)) {
ut_print_timestamp(stderr);
fprintf(stderr,
-" InnoDB: Error: reading page %lu\n"
-"InnoDB: which is in the doublewrite buffer!\n",
+ " InnoDB: Error: reading page %lu\n"
+ "InnoDB: which is in the"
+ " doublewrite buffer!\n",
(ulong) block->offset);
} else if (!read_space_id && !read_page_no) {
/* This is likely an uninitialized page. */
} else if ((block->space && block->space != read_space_id)
- || block->offset != read_page_no) {
+ || block->offset != read_page_no) {
/* We did not compare space_id to read_space_id
if block->space == 0, because the field on the
page may contain garbage in MySQL < 4.1.1,
@@ -1890,59 +1916,73 @@ buf_page_io_complete(
ut_print_timestamp(stderr);
fprintf(stderr,
-" InnoDB: Error: space id and page n:o stored in the page\n"
-"InnoDB: read in are %lu:%lu, should be %lu:%lu!\n",
+ " InnoDB: Error: space id and page n:o"
+ " stored in the page\n"
+ "InnoDB: read in are %lu:%lu,"
+ " should be %lu:%lu!\n",
(ulong) read_space_id, (ulong) read_page_no,
(ulong) block->space, (ulong) block->offset);
}
/* From version 3.23.38 up we store the page checksum
- to the 4 first bytes of the page end lsn field */
+ to the 4 first bytes of the page end lsn field */
if (buf_page_is_corrupted(block->frame)) {
fprintf(stderr,
- "InnoDB: Database page corruption on disk or a failed\n"
- "InnoDB: file read of page %lu.\n", (ulong) block->offset);
+ "InnoDB: Database page corruption on disk"
+ " or a failed\n"
+ "InnoDB: file read of page %lu.\n",
+ (ulong) block->offset);
- fputs(
- "InnoDB: You may have to recover from a backup.\n", stderr);
+ fputs("InnoDB: You may have to recover"
+ " from a backup.\n", stderr);
buf_page_print(block->frame);
fprintf(stderr,
- "InnoDB: Database page corruption on disk or a failed\n"
- "InnoDB: file read of page %lu.\n", (ulong) block->offset);
- fputs(
- "InnoDB: You may have to recover from a backup.\n", stderr);
- fputs(
- "InnoDB: It is also possible that your operating\n"
- "InnoDB: system has corrupted its own file cache\n"
- "InnoDB: and rebooting your computer removes the\n"
- "InnoDB: error.\n"
- "InnoDB: If the corrupt page is an index page\n"
- "InnoDB: you can also try to fix the corruption\n"
- "InnoDB: by dumping, dropping, and reimporting\n"
- "InnoDB: the corrupt table. You can use CHECK\n"
- "InnoDB: TABLE to scan your table for corruption.\n"
- "InnoDB: See also "
-"InnoDB: http://dev.mysql.com/doc/refman/5.1/en/forcing-recovery.html\n"
- "InnoDB: about forcing recovery.\n", stderr);
+ "InnoDB: Database page corruption on disk"
+ " or a failed\n"
+ "InnoDB: file read of page %lu.\n",
+ (ulong) block->offset);
+ fputs("InnoDB: You may have to recover"
+ " from a backup.\n", stderr);
+ fputs("InnoDB: It is also possible that"
+ " your operating\n"
+ "InnoDB: system has corrupted its"
+ " own file cache\n"
+ "InnoDB: and rebooting your computer"
+ " removes the\n"
+ "InnoDB: error.\n"
+ "InnoDB: If the corrupt page is an index page\n"
+ "InnoDB: you can also try to"
+ " fix the corruption\n"
+ "InnoDB: by dumping, dropping,"
+ " and reimporting\n"
+ "InnoDB: the corrupt table."
+ " You can use CHECK\n"
+ "InnoDB: TABLE to scan your"
+ " table for corruption.\n"
+ "InnoDB: See also"
+ " http://dev.mysql.com/doc/refman/5.1/en/"
+ "forcing-recovery.html\n"
+ "InnoDB: about forcing recovery.\n", stderr);
if (srv_force_recovery < SRV_FORCE_IGNORE_CORRUPT) {
- fputs(
- "InnoDB: Ending processing because of a corrupt database page.\n",
- stderr);
+ fputs("InnoDB: Ending processing because of"
+ " a corrupt database page.\n",
+ stderr);
exit(1);
}
}
if (recv_recovery_is_on()) {
recv_recover_page(FALSE, TRUE, block->frame,
- block->space, block->offset);
+ block->space, block->offset);
}
if (!recv_no_ibuf_operations) {
- ibuf_merge_or_delete_for_page(block->frame,
- block->space, block->offset, TRUE);
+ ibuf_merge_or_delete_for_page
+ (block->frame, block->space,
+ block->offset, TRUE);
}
}
@@ -2058,25 +2098,25 @@ buf_validate(void)
if (block->state == BUF_BLOCK_FILE_PAGE) {
ut_a(buf_page_hash_get(block->space,
- block->offset) == block);
+ block->offset) == block);
n_page++;
#ifdef UNIV_IBUF_DEBUG
ut_a((block->io_fix == BUF_IO_READ)
- || ibuf_count_get(block->space, block->offset)
- == 0);
+ || ibuf_count_get(block->space, block->offset)
+ == 0);
#endif
if (block->io_fix == BUF_IO_WRITE) {
if (block->flush_type == BUF_FLUSH_LRU) {
n_lru_flush++;
- ut_a(rw_lock_is_locked(&(block->lock),
- RW_LOCK_SHARED));
- } else if (block->flush_type ==
- BUF_FLUSH_LIST) {
+ ut_a(rw_lock_is_locked
+ (&block->lock, RW_LOCK_SHARED));
+ } else if (block->flush_type
+ == BUF_FLUSH_LIST) {
n_list_flush++;
- } else if (block->flush_type ==
- BUF_FLUSH_SINGLE_PAGE) {
+ } else if (block->flush_type
+ == BUF_FLUSH_SINGLE_PAGE) {
n_single_flush++;
} else {
ut_error;
@@ -2085,14 +2125,14 @@ buf_validate(void)
} else if (block->io_fix == BUF_IO_READ) {
ut_a(rw_lock_is_locked(&(block->lock),
- RW_LOCK_EX));
+ RW_LOCK_EX));
}
n_lru++;
if (ut_dulint_cmp(block->oldest_modification,
- ut_dulint_zero) > 0) {
- n_flush++;
+ ut_dulint_zero) > 0) {
+ n_flush++;
}
} else if (block->state == BUF_BLOCK_NOT_USED) {
@@ -2101,14 +2141,16 @@ buf_validate(void)
}
if (n_lru + n_free > buf_pool->curr_size) {
- fprintf(stderr, "n LRU %lu, n free %lu\n", (ulong) n_lru, (ulong) n_free);
+ fprintf(stderr, "n LRU %lu, n free %lu\n",
+ (ulong) n_lru, (ulong) n_free);
ut_error;
}
ut_a(UT_LIST_GET_LEN(buf_pool->LRU) == n_lru);
if (UT_LIST_GET_LEN(buf_pool->free) != n_free) {
fprintf(stderr, "Free list len %lu, free blocks %lu\n",
- (ulong) UT_LIST_GET_LEN(buf_pool->free), (ulong) n_free);
+ (ulong) UT_LIST_GET_LEN(buf_pool->free),
+ (ulong) n_free);
ut_error;
}
ut_a(UT_LIST_GET_LEN(buf_pool->flush_list) == n_flush);
@@ -2233,9 +2275,9 @@ Returns the number of latched pages in the buffer pool. */
ulint
buf_get_latched_pages_number(void)
{
- buf_block_t* block;
- ulint i;
- ulint fixed_pages_number = 0;
+ buf_block_t* block;
+ ulint i;
+ ulint fixed_pages_number = 0;
mutex_enter(&(buf_pool->mutex));
@@ -2243,9 +2285,10 @@ buf_get_latched_pages_number(void)
block = buf_pool_get_nth_block(buf_pool, i);
- if (((block->buf_fix_count != 0) || (block->io_fix != 0)) &&
- block->magic_n == BUF_BLOCK_MAGIC_N )
+ if (((block->buf_fix_count != 0) || (block->io_fix != 0))
+ && block->magic_n == BUF_BLOCK_MAGIC_N) {
fixed_pages_number++;
+ }
}
mutex_exit(&(buf_pool->mutex));
@@ -2261,9 +2304,9 @@ buf_get_n_pending_ios(void)
/*=======================*/
{
return(buf_pool->n_pend_reads
- + buf_pool->n_flush[BUF_FLUSH_LRU]
- + buf_pool->n_flush[BUF_FLUSH_LIST]
- + buf_pool->n_flush[BUF_FLUSH_SINGLE_PAGE]);
+ + buf_pool->n_flush[BUF_FLUSH_LRU]
+ + buf_pool->n_flush[BUF_FLUSH_LIST]
+ + buf_pool->n_flush[BUF_FLUSH_SINGLE_PAGE]);
}
/*************************************************************************
@@ -2280,7 +2323,7 @@ buf_get_modified_ratio_pct(void)
ratio = (100 * UT_LIST_GET_LEN(buf_pool->flush_list))
/ (1 + UT_LIST_GET_LEN(buf_pool->LRU)
- + UT_LIST_GET_LEN(buf_pool->free));
+ + UT_LIST_GET_LEN(buf_pool->free));
/* 1 + is there to avoid division by zero */
@@ -2308,12 +2351,14 @@ buf_print_io(
if (srv_use_awe) {
fprintf(stderr,
- "AWE: Buffer pool memory frames %lu\n",
- (ulong) buf_pool->n_frames);
+ "AWE: Buffer pool memory frames %lu\n",
+ (ulong) buf_pool->n_frames);
fprintf(stderr,
- "AWE: Database pages and free buffers mapped in frames %lu\n",
- (ulong) UT_LIST_GET_LEN(buf_pool->awe_LRU_free_mapped));
+ "AWE: Database pages and free buffers"
+ " mapped in frames %lu\n",
+ (ulong)
+ UT_LIST_GET_LEN(buf_pool->awe_LRU_free_mapped));
}
fprintf(file,
"Buffer pool size %lu\n"
@@ -2328,14 +2373,14 @@ buf_print_io(
(ulong) UT_LIST_GET_LEN(buf_pool->flush_list),
(ulong) buf_pool->n_pend_reads,
(ulong) buf_pool->n_flush[BUF_FLUSH_LRU]
- + buf_pool->init_flush[BUF_FLUSH_LRU],
+ + buf_pool->init_flush[BUF_FLUSH_LRU],
(ulong) buf_pool->n_flush[BUF_FLUSH_LIST]
- + buf_pool->init_flush[BUF_FLUSH_LIST],
+ + buf_pool->init_flush[BUF_FLUSH_LIST],
(ulong) buf_pool->n_flush[BUF_FLUSH_SINGLE_PAGE]);
current_time = time(NULL);
time_elapsed = 0.001 + difftime(current_time,
- buf_pool->last_printout_time);
+ buf_pool->last_printout_time);
buf_pool->last_printout_time = current_time;
fprintf(file,
@@ -2353,19 +2398,21 @@ buf_print_io(
if (srv_use_awe) {
fprintf(file, "AWE: %.2f page remaps/s\n",
- (buf_pool->n_pages_awe_remapped
- - buf_pool->n_pages_awe_remapped_old)
+ (buf_pool->n_pages_awe_remapped
+ - buf_pool->n_pages_awe_remapped_old)
/ time_elapsed);
}
if (buf_pool->n_page_gets > buf_pool->n_page_gets_old) {
fprintf(file, "Buffer pool hit rate %lu / 1000\n",
- (ulong) (1000 -
- ((1000 * (buf_pool->n_pages_read - buf_pool->n_pages_read_old))
- / (buf_pool->n_page_gets - buf_pool->n_page_gets_old))));
+ (ulong)
+ (1000 - ((1000 * (buf_pool->n_pages_read
+ - buf_pool->n_pages_read_old))
+ / (buf_pool->n_page_gets
+ - buf_pool->n_page_gets_old))));
} else {
fputs("No buffer pool page gets since the last printout\n",
- file);
+ file);
}
buf_pool->n_page_gets_old = buf_pool->n_page_gets;
@@ -2416,7 +2463,8 @@ buf_all_freed(void)
fprintf(stderr,
"Page %lu %lu still fixed or dirty\n",
- (ulong) block->space, (ulong) block->offset);
+ (ulong) block->space,
+ (ulong) block->offset);
ut_error;
}
}
@@ -2441,8 +2489,8 @@ buf_pool_check_no_pending_io(void)
mutex_enter(&(buf_pool->mutex));
if (buf_pool->n_pend_reads + buf_pool->n_flush[BUF_FLUSH_LRU]
- + buf_pool->n_flush[BUF_FLUSH_LIST]
- + buf_pool->n_flush[BUF_FLUSH_SINGLE_PAGE]) {
+ + buf_pool->n_flush[BUF_FLUSH_LIST]
+ + buf_pool->n_flush[BUF_FLUSH_SINGLE_PAGE]) {
ret = FALSE;
} else {
ret = TRUE;
diff --git a/storage/innobase/buf/buf0flu.c b/storage/innobase/buf/buf0flu.c
index 9bfbeb1b456..9274b67a555 100644
--- a/storage/innobase/buf/buf0flu.c
+++ b/storage/innobase/buf/buf0flu.c
@@ -55,10 +55,9 @@ buf_flush_insert_into_flush_list(
ut_a(block->state == BUF_BLOCK_FILE_PAGE);
ut_ad((UT_LIST_GET_FIRST(buf_pool->flush_list) == NULL)
- || (ut_dulint_cmp(
- (UT_LIST_GET_FIRST(buf_pool->flush_list))
- ->oldest_modification,
- block->oldest_modification) <= 0));
+ || (ut_dulint_cmp((UT_LIST_GET_FIRST(buf_pool->flush_list))
+ ->oldest_modification,
+ block->oldest_modification) <= 0));
UT_LIST_ADD_FIRST(flush_list, buf_pool->flush_list, block);
@@ -86,7 +85,7 @@ buf_flush_insert_sorted_into_flush_list(
b = UT_LIST_GET_FIRST(buf_pool->flush_list);
while (b && (ut_dulint_cmp(b->oldest_modification,
- block->oldest_modification) > 0)) {
+ block->oldest_modification) > 0)) {
prev_b = b;
b = UT_LIST_GET_NEXT(flush_list, b);
}
@@ -95,7 +94,7 @@ buf_flush_insert_sorted_into_flush_list(
UT_LIST_ADD_FIRST(flush_list, buf_pool->flush_list, block);
} else {
UT_LIST_INSERT_AFTER(flush_list, buf_pool->flush_list, prev_b,
- block);
+ block);
}
ut_ad(buf_flush_validate_low());
@@ -118,7 +117,8 @@ buf_flush_ready_for_replace(
if (block->state != BUF_BLOCK_FILE_PAGE) {
ut_print_timestamp(stderr);
fprintf(stderr,
-" InnoDB: Error: buffer block state %lu in the LRU list!\n",
+ " InnoDB: Error: buffer block state %lu"
+ " in the LRU list!\n",
(ulong)block->state);
ut_print_buf(stderr, block, sizeof(buf_block_t));
@@ -126,8 +126,8 @@ buf_flush_ready_for_replace(
}
if ((ut_dulint_cmp(block->oldest_modification, ut_dulint_zero) > 0)
- || (block->buf_fix_count != 0)
- || (block->io_fix != 0)) {
+ || (block->buf_fix_count != 0)
+ || (block->io_fix != 0)) {
return(FALSE);
}
@@ -152,7 +152,7 @@ buf_flush_ready_for_flush(
ut_a(block->state == BUF_BLOCK_FILE_PAGE);
if ((ut_dulint_cmp(block->oldest_modification, ut_dulint_zero) > 0)
- && (block->io_fix == 0)) {
+ && (block->io_fix == 0)) {
if (flush_type != BUF_FLUSH_LRU) {
return(TRUE);
@@ -202,10 +202,10 @@ buf_flush_write_complete(
}
/* fprintf(stderr, "n pending flush %lu\n",
- buf_pool->n_flush[block->flush_type]); */
+ buf_pool->n_flush[block->flush_type]); */
if ((buf_pool->n_flush[block->flush_type] == 0)
- && (buf_pool->init_flush[block->flush_type] == FALSE)) {
+ && (buf_pool->init_flush[block->flush_type] == FALSE)) {
/* The running flush batch has ended */
@@ -255,27 +255,33 @@ buf_flush_buffered_writes(void)
ut_a(block->state == BUF_BLOCK_FILE_PAGE);
if (mach_read_from_4(block->frame + FIL_PAGE_LSN + 4)
- != mach_read_from_4(block->frame + UNIV_PAGE_SIZE
- - FIL_PAGE_END_LSN_OLD_CHKSUM + 4)) {
- ut_print_timestamp(stderr);
- fprintf(stderr,
-" InnoDB: ERROR: The page to be written seems corrupt!\n"
-"InnoDB: The lsn fields do not match! Noticed in the buffer pool\n"
-"InnoDB: before posting to the doublewrite buffer.\n");
+ != mach_read_from_4(block->frame + UNIV_PAGE_SIZE
+ - FIL_PAGE_END_LSN_OLD_CHKSUM + 4)) {
+ ut_print_timestamp(stderr);
+ fprintf(stderr,
+ " InnoDB: ERROR: The page to be written"
+ " seems corrupt!\n"
+ "InnoDB: The lsn fields do not match!"
+ " Noticed in the buffer pool\n"
+ "InnoDB: before posting to the"
+ " doublewrite buffer.\n");
}
if (block->check_index_page_at_flush
- && !page_simple_validate(block->frame)) {
+ && !page_simple_validate(block->frame)) {
buf_page_print(block->frame);
ut_print_timestamp(stderr);
fprintf(stderr,
- " InnoDB: Apparent corruption of an index page n:o %lu in space %lu\n"
- "InnoDB: to be written to data file. We intentionally crash server\n"
- "InnoDB: to prevent corrupt data from ending up in data\n"
- "InnoDB: files.\n",
- (ulong) block->offset, (ulong) block->space);
+ " InnoDB: Apparent corruption of an"
+ " index page n:o %lu in space %lu\n"
+ "InnoDB: to be written to data file."
+ " We intentionally crash server\n"
+ "InnoDB: to prevent corrupt data"
+ " from ending up in data\n"
+ "InnoDB: files.\n",
+ (ulong) block->offset, (ulong) block->space);
ut_error;
}
@@ -292,47 +298,54 @@ buf_flush_buffered_writes(void)
}
fil_io(OS_FILE_WRITE,
- TRUE, TRX_SYS_SPACE,
- trx_doublewrite->block1, 0, len,
- (void*)trx_doublewrite->write_buf, NULL);
+ TRUE, TRX_SYS_SPACE,
+ trx_doublewrite->block1, 0, len,
+ (void*)trx_doublewrite->write_buf, NULL);
write_buf = trx_doublewrite->write_buf;
for (len2 = 0; len2 + UNIV_PAGE_SIZE <= len; len2 += UNIV_PAGE_SIZE) {
if (mach_read_from_4(write_buf + len2 + FIL_PAGE_LSN + 4)
- != mach_read_from_4(write_buf + len2 + UNIV_PAGE_SIZE
- - FIL_PAGE_END_LSN_OLD_CHKSUM + 4)) {
+ != mach_read_from_4(write_buf + len2 + UNIV_PAGE_SIZE
+ - FIL_PAGE_END_LSN_OLD_CHKSUM + 4)) {
ut_print_timestamp(stderr);
fprintf(stderr,
-" InnoDB: ERROR: The page to be written seems corrupt!\n"
-"InnoDB: The lsn fields do not match! Noticed in the doublewrite block1.\n");
+ " InnoDB: ERROR: The page to be written"
+ " seems corrupt!\n"
+ "InnoDB: The lsn fields do not match!"
+ " Noticed in the doublewrite block1.\n");
}
}
if (trx_doublewrite->first_free > TRX_SYS_DOUBLEWRITE_BLOCK_SIZE) {
len = (trx_doublewrite->first_free
- - TRX_SYS_DOUBLEWRITE_BLOCK_SIZE) * UNIV_PAGE_SIZE;
+ - TRX_SYS_DOUBLEWRITE_BLOCK_SIZE) * UNIV_PAGE_SIZE;
fil_io(OS_FILE_WRITE,
- TRUE, TRX_SYS_SPACE,
- trx_doublewrite->block2, 0, len,
- (void*)(trx_doublewrite->write_buf
- + TRX_SYS_DOUBLEWRITE_BLOCK_SIZE * UNIV_PAGE_SIZE),
- NULL);
+ TRUE, TRX_SYS_SPACE,
+ trx_doublewrite->block2, 0, len,
+ (void*)(trx_doublewrite->write_buf
+ + TRX_SYS_DOUBLEWRITE_BLOCK_SIZE
+ * UNIV_PAGE_SIZE),
+ NULL);
write_buf = trx_doublewrite->write_buf
- + TRX_SYS_DOUBLEWRITE_BLOCK_SIZE * UNIV_PAGE_SIZE;
+ + TRX_SYS_DOUBLEWRITE_BLOCK_SIZE * UNIV_PAGE_SIZE;
for (len2 = 0; len2 + UNIV_PAGE_SIZE <= len;
- len2 += UNIV_PAGE_SIZE) {
+ len2 += UNIV_PAGE_SIZE) {
if (mach_read_from_4(write_buf + len2
- + FIL_PAGE_LSN + 4)
- != mach_read_from_4(write_buf + len2
- + UNIV_PAGE_SIZE
- - FIL_PAGE_END_LSN_OLD_CHKSUM + 4)) {
+ + FIL_PAGE_LSN + 4)
+ != mach_read_from_4(write_buf + len2
+ + UNIV_PAGE_SIZE
+ - FIL_PAGE_END_LSN_OLD_CHKSUM
+ + 4)) {
ut_print_timestamp(stderr);
fprintf(stderr,
-" InnoDB: ERROR: The page to be written seems corrupt!\n"
-"InnoDB: The lsn fields do not match! Noticed in the doublewrite block2.\n");
+ " InnoDB: ERROR: The page to be"
+ " written seems corrupt!\n"
+ "InnoDB: The lsn fields do not match!"
+ " Noticed in"
+ " the doublewrite block2.\n");
}
}
}
@@ -349,14 +362,18 @@ buf_flush_buffered_writes(void)
block = trx_doublewrite->buf_block_arr[i];
if (mach_read_from_4(block->frame + FIL_PAGE_LSN + 4)
- != mach_read_from_4(block->frame + UNIV_PAGE_SIZE
- - FIL_PAGE_END_LSN_OLD_CHKSUM + 4)) {
+ != mach_read_from_4(block->frame + UNIV_PAGE_SIZE
+ - FIL_PAGE_END_LSN_OLD_CHKSUM + 4)) {
ut_print_timestamp(stderr);
fprintf(stderr,
-" InnoDB: ERROR: The page to be written seems corrupt!\n"
-"InnoDB: The lsn fields do not match! Noticed in the buffer pool\n"
-"InnoDB: after posting and flushing the doublewrite buffer.\n"
-"InnoDB: Page buf fix count %lu, io fix %lu, state %lu\n",
+ " InnoDB: ERROR: The page to be written"
+ " seems corrupt!\n"
+ "InnoDB: The lsn fields do not match!"
+ " Noticed in the buffer pool\n"
+ "InnoDB: after posting and flushing"
+ " the doublewrite buffer.\n"
+ "InnoDB: Page buf fix count %lu,"
+ " io fix %lu, state %lu\n",
(ulong)block->buf_fix_count,
(ulong)block->io_fix,
(ulong)block->state);
@@ -364,8 +381,8 @@ buf_flush_buffered_writes(void)
ut_a(block->state == BUF_BLOCK_FILE_PAGE);
fil_io(OS_FILE_WRITE | OS_AIO_SIMULATED_WAKE_LATER,
- FALSE, block->space, block->offset, 0, UNIV_PAGE_SIZE,
- (void*)block->frame, (void*)block);
+ FALSE, block->space, block->offset, 0, UNIV_PAGE_SIZE,
+ (void*)block->frame, (void*)block);
}
/* Wake possible simulated aio thread to actually post the
@@ -405,7 +422,7 @@ try_again:
ut_a(block->state == BUF_BLOCK_FILE_PAGE);
if (trx_doublewrite->first_free
- >= 2 * TRX_SYS_DOUBLEWRITE_BLOCK_SIZE) {
+ >= 2 * TRX_SYS_DOUBLEWRITE_BLOCK_SIZE) {
mutex_exit(&(trx_doublewrite->mutex));
buf_flush_buffered_writes();
@@ -414,15 +431,15 @@ try_again:
}
ut_memcpy(trx_doublewrite->write_buf
- + UNIV_PAGE_SIZE * trx_doublewrite->first_free,
- block->frame, UNIV_PAGE_SIZE);
+ + UNIV_PAGE_SIZE * trx_doublewrite->first_free,
+ block->frame, UNIV_PAGE_SIZE);
trx_doublewrite->buf_block_arr[trx_doublewrite->first_free] = block;
trx_doublewrite->first_free++;
if (trx_doublewrite->first_free
- >= 2 * TRX_SYS_DOUBLEWRITE_BLOCK_SIZE) {
+ >= 2 * TRX_SYS_DOUBLEWRITE_BLOCK_SIZE) {
mutex_exit(&(trx_doublewrite->mutex));
buf_flush_buffered_writes();
@@ -448,7 +465,7 @@ buf_flush_init_for_writing(
mach_write_to_8(page + FIL_PAGE_LSN, newest_lsn);
mach_write_to_8(page + UNIV_PAGE_SIZE - FIL_PAGE_END_LSN_OLD_CHKSUM,
- newest_lsn);
+ newest_lsn);
/* Write the page number and the space id */
mach_write_to_4(page + FIL_PAGE_OFFSET, page_no);
@@ -457,8 +474,9 @@ buf_flush_init_for_writing(
/* Store the new formula checksum */
mach_write_to_4(page + FIL_PAGE_SPACE_OR_CHKSUM,
- srv_use_checksums ?
- buf_calc_page_new_checksum(page) : BUF_NO_CHECKSUM_MAGIC);
+ srv_use_checksums
+ ? buf_calc_page_new_checksum(page)
+ : BUF_NO_CHECKSUM_MAGIC);
/* We overwrite the first 4 bytes of the end lsn field to store
the old formula checksum. Since it depends also on the field
@@ -466,8 +484,9 @@ buf_flush_init_for_writing(
new formula checksum. */
mach_write_to_4(page + UNIV_PAGE_SIZE - FIL_PAGE_END_LSN_OLD_CHKSUM,
- srv_use_checksums ?
- buf_calc_page_old_checksum(page) : BUF_NO_CHECKSUM_MAGIC);
+ srv_use_checksums
+ ? buf_calc_page_old_checksum(page)
+ : BUF_NO_CHECKSUM_MAGIC);
}
/************************************************************************
@@ -493,21 +512,21 @@ buf_flush_write_block_low(
#ifdef UNIV_LOG_DEBUG
if (!univ_log_debug_warned) {
univ_log_debug_warned = TRUE;
- fputs(
- "Warning: cannot force log to disk if UNIV_LOG_DEBUG is defined!\n"
- "Crash recovery will not work!\n",
- stderr);
+ fputs("Warning: cannot force log to disk if"
+ " UNIV_LOG_DEBUG is defined!\n"
+ "Crash recovery will not work!\n",
+ stderr);
}
#else
/* Force the log to the disk before writing the modified block */
log_write_up_to(block->newest_modification, LOG_WAIT_ALL_GROUPS, TRUE);
#endif
buf_flush_init_for_writing(block->frame, block->newest_modification,
- block->space, block->offset);
+ block->space, block->offset);
if (!srv_use_doublewrite_buf || !trx_doublewrite) {
fil_io(OS_FILE_WRITE | OS_AIO_SIMULATED_WAKE_LATER,
- FALSE, block->space, block->offset, 0, UNIV_PAGE_SIZE,
- (void*)block->frame, (void*)block);
+ FALSE, block->space, block->offset, 0, UNIV_PAGE_SIZE,
+ (void*)block->frame, (void*)block);
} else {
buf_flush_post_to_doublewrite_buf(block);
}
@@ -532,7 +551,7 @@ buf_flush_try_page(
ibool locked;
ut_ad(flush_type == BUF_FLUSH_LRU || flush_type == BUF_FLUSH_LIST
- || flush_type == BUF_FLUSH_SINGLE_PAGE);
+ || flush_type == BUF_FLUSH_SINGLE_PAGE);
mutex_enter(&(buf_pool->mutex));
@@ -541,7 +560,7 @@ buf_flush_try_page(
ut_a(!block || block->state == BUF_BLOCK_FILE_PAGE);
if (flush_type == BUF_FLUSH_LIST
- && block && buf_flush_ready_for_flush(block, flush_type)) {
+ && block && buf_flush_ready_for_flush(block, flush_type)) {
block->io_fix = BUF_IO_WRITE;
@@ -600,7 +619,7 @@ buf_flush_try_page(
return(1);
} else if (flush_type == BUF_FLUSH_LRU && block
- && buf_flush_ready_for_flush(block, flush_type)) {
+ && buf_flush_ready_for_flush(block, flush_type)) {
/* VERY IMPORTANT:
Because any thread may call the LRU flush, even when owning
@@ -647,7 +666,7 @@ buf_flush_try_page(
return(1);
} else if (flush_type == BUF_FLUSH_SINGLE_PAGE && block
- && buf_flush_ready_for_flush(block, flush_type)) {
+ && buf_flush_ready_for_flush(block, flush_type)) {
block->io_fix = BUF_IO_WRITE;
@@ -680,9 +699,10 @@ buf_flush_try_page(
#ifdef UNIV_DEBUG
if (buf_debug_prints) {
fprintf(stderr,
- "Flushing single page space %lu, page no %lu \n",
- (ulong) block->space,
- (ulong) block->offset);
+ "Flushing single page space %lu,"
+ " page no %lu \n",
+ (ulong) block->space,
+ (ulong) block->offset);
}
#endif /* UNIV_DEBUG */
@@ -739,7 +759,7 @@ buf_flush_try_neighbors(
ut_a(!block || block->state == BUF_BLOCK_FILE_PAGE);
if (block && flush_type == BUF_FLUSH_LRU && i != offset
- && !block->old) {
+ && !block->old) {
/* We avoid flushing 'non-old' blocks in an LRU flush,
because the flushed blocks are soon freed */
@@ -748,7 +768,7 @@ buf_flush_try_neighbors(
}
if (block && buf_flush_ready_for_flush(block, flush_type)
- && (i == offset || block->buf_fix_count == 0)) {
+ && (i == offset || block->buf_fix_count == 0)) {
/* We only try to flush those neighbors != offset
where the buf fix count is zero, as we then know that
we probably can latch the page without a semaphore
@@ -806,13 +826,13 @@ buf_flush_batch(
ibool found;
ut_ad((flush_type == BUF_FLUSH_LRU)
- || (flush_type == BUF_FLUSH_LIST));
+ || (flush_type == BUF_FLUSH_LIST));
ut_ad((flush_type != BUF_FLUSH_LIST)
- || sync_thread_levels_empty_gen(TRUE));
+ || sync_thread_levels_empty_gen(TRUE));
mutex_enter(&(buf_pool->mutex));
if ((buf_pool->n_flush[flush_type] > 0)
- || (buf_pool->init_flush[flush_type] == TRUE)) {
+ || (buf_pool->init_flush[flush_type] == TRUE)) {
/* There is already a flush batch of the same type running */
@@ -840,8 +860,8 @@ buf_flush_batch(
block = UT_LIST_GET_LAST(buf_pool->flush_list);
if (!block
- || (ut_dulint_cmp(block->oldest_modification,
- lsn_limit) >= 0)) {
+ || (ut_dulint_cmp(block->oldest_modification,
+ lsn_limit) >= 0)) {
/* We have flushed enough */
break;
@@ -870,9 +890,8 @@ buf_flush_batch(
old_page_count = page_count;
/* Try to flush also all the neighbors */
- page_count +=
- buf_flush_try_neighbors(space, offset,
- flush_type);
+ page_count += buf_flush_try_neighbors
+ (space, offset, flush_type);
/* fprintf(stderr,
"Flush type %lu, page no %lu, neighb %lu\n",
flush_type, offset,
@@ -900,7 +919,7 @@ buf_flush_batch(
(buf_pool->init_flush)[flush_type] = FALSE;
if ((buf_pool->n_flush[flush_type] == 0)
- && (buf_pool->init_flush[flush_type] == FALSE)) {
+ && (buf_pool->init_flush[flush_type] == FALSE)) {
/* The running flush batch has ended */
@@ -914,7 +933,7 @@ buf_flush_batch(
#ifdef UNIV_DEBUG
if (buf_debug_prints && page_count > 0) {
ut_a(flush_type == BUF_FLUSH_LRU
- || flush_type == BUF_FLUSH_LIST);
+ || flush_type == BUF_FLUSH_LIST);
fprintf(stderr, flush_type == BUF_FLUSH_LRU
? "Flushed %lu pages in LRU flush\n"
: "Flushed %lu pages in flush list flush\n",
@@ -923,7 +942,7 @@ buf_flush_batch(
#endif /* UNIV_DEBUG */
if (page_count != ULINT_UNDEFINED)
- srv_buf_pool_flushed+= page_count;
+ srv_buf_pool_flushed+= page_count;
return(page_count);
}
@@ -963,9 +982,9 @@ buf_flush_LRU_recommendation(void)
block = UT_LIST_GET_LAST(buf_pool->LRU);
while ((block != NULL)
- && (n_replaceable < BUF_FLUSH_FREE_BLOCK_MARGIN
- + BUF_FLUSH_EXTRA_MARGIN)
- && (distance < BUF_LRU_FREE_SEARCH_LEN)) {
+ && (n_replaceable < BUF_FLUSH_FREE_BLOCK_MARGIN
+ + BUF_FLUSH_EXTRA_MARGIN)
+ && (distance < BUF_LRU_FREE_SEARCH_LEN)) {
if (buf_flush_ready_for_replace(block)) {
n_replaceable++;
@@ -984,7 +1003,7 @@ buf_flush_LRU_recommendation(void)
}
return(BUF_FLUSH_FREE_BLOCK_MARGIN + BUF_FLUSH_EXTRA_MARGIN
- - n_replaceable);
+ - n_replaceable);
}
/*************************************************************************
@@ -1005,7 +1024,7 @@ buf_flush_free_margin(void)
if (n_to_flush > 0) {
n_flushed = buf_flush_batch(BUF_FLUSH_LRU, n_to_flush,
- ut_dulint_zero);
+ ut_dulint_zero);
if (n_flushed == ULINT_UNDEFINED) {
/* There was an LRU type flush batch already running;
let us wait for it to end */
@@ -1039,7 +1058,7 @@ buf_flush_validate_low(void)
if (block) {
ut_a(ut_dulint_cmp(om, block->oldest_modification)
- >= 0);
+ >= 0);
}
}
diff --git a/storage/innobase/buf/buf0lru.c b/storage/innobase/buf/buf0lru.c
index 08be5811a4b..f0264f2e323 100644
--- a/storage/innobase/buf/buf0lru.c
+++ b/storage/innobase/buf/buf0lru.c
@@ -89,7 +89,7 @@ scan_again:
ut_a(block->state == BUF_BLOCK_FILE_PAGE);
if (block->space == id
- && (block->buf_fix_count > 0 || block->io_fix != 0)) {
+ && (block->buf_fix_count > 0 || block->io_fix != 0)) {
/* We cannot remove this page during this scan yet;
maybe the system is currently reading it in, or
@@ -103,8 +103,8 @@ scan_again:
if (block->space == id) {
#ifdef UNIV_DEBUG
if (buf_debug_prints) {
- printf(
- "Dropping space %lu page %lu\n",
+ fprintf(stderr,
+ "Dropping space %lu page %lu\n",
(ulong) block->space,
(ulong) block->offset);
}
@@ -118,19 +118,19 @@ scan_again:
an S-latch on the page */
btr_search_drop_page_hash_when_freed(id,
- page_no);
+ page_no);
goto scan_again;
}
if (0 != ut_dulint_cmp(block->oldest_modification,
- ut_dulint_zero)) {
+ ut_dulint_zero)) {
/* Remove from the flush list of modified
blocks */
block->oldest_modification = ut_dulint_zero;
UT_LIST_REMOVE(flush_list,
- buf_pool->flush_list, block);
+ buf_pool->flush_list, block);
}
/* Remove from the LRU list */
@@ -216,7 +216,8 @@ buf_LRU_search_and_free_block(
#ifdef UNIV_DEBUG
if (buf_debug_prints) {
fprintf(stderr,
- "Putting space %lu page %lu to free list\n",
+ "Putting space %lu page %lu"
+ " to free list\n",
(ulong) block->space,
(ulong) block->offset);
}
@@ -246,8 +247,8 @@ buf_LRU_search_and_free_block(
distance++;
if (!freed && n_iterations <= 10
- && distance > 100 + (n_iterations * buf_pool->curr_size)
- / 10) {
+ && distance > 100 + (n_iterations * buf_pool->curr_size)
+ / 10) {
buf_pool->LRU_flush_ended = 0;
mutex_exit(&(buf_pool->mutex));
@@ -309,7 +310,7 @@ buf_LRU_buf_pool_running_out(void)
mutex_enter(&(buf_pool->mutex));
if (!recv_recovery_on && UT_LIST_GET_LEN(buf_pool->free)
- + UT_LIST_GET_LEN(buf_pool->LRU) < buf_pool->max_size / 4) {
+ + UT_LIST_GET_LEN(buf_pool->LRU) < buf_pool->max_size / 4) {
ret = TRUE;
}
@@ -340,23 +341,28 @@ loop:
mutex_enter(&(buf_pool->mutex));
if (!recv_recovery_on && UT_LIST_GET_LEN(buf_pool->free)
- + UT_LIST_GET_LEN(buf_pool->LRU) < buf_pool->max_size / 20) {
+ + UT_LIST_GET_LEN(buf_pool->LRU) < buf_pool->max_size / 20) {
ut_print_timestamp(stderr);
fprintf(stderr,
-" InnoDB: ERROR: over 95 percent of the buffer pool is occupied by\n"
-"InnoDB: lock heaps or the adaptive hash index! Check that your\n"
-"InnoDB: transactions do not set too many row locks.\n"
-"InnoDB: Your buffer pool size is %lu MB. Maybe you should make\n"
-"InnoDB: the buffer pool bigger?\n"
-"InnoDB: We intentionally generate a seg fault to print a stack trace\n"
-"InnoDB: on Linux!\n",
- (ulong)(buf_pool->curr_size / (1024 * 1024 / UNIV_PAGE_SIZE)));
+ " InnoDB: ERROR: over 95 percent of the buffer pool"
+ " is occupied by\n"
+ "InnoDB: lock heaps or the adaptive hash index!"
+ " Check that your\n"
+ "InnoDB: transactions do not set too many row locks.\n"
+ "InnoDB: Your buffer pool size is %lu MB."
+ " Maybe you should make\n"
+ "InnoDB: the buffer pool bigger?\n"
+ "InnoDB: We intentionally generate a seg fault"
+ " to print a stack trace\n"
+ "InnoDB: on Linux!\n",
+ (ulong) (buf_pool->curr_size
+ / (1024 * 1024 / UNIV_PAGE_SIZE)));
ut_error;
} else if (!recv_recovery_on && UT_LIST_GET_LEN(buf_pool->free)
- + UT_LIST_GET_LEN(buf_pool->LRU) < buf_pool->max_size / 3) {
+ + UT_LIST_GET_LEN(buf_pool->LRU) < buf_pool->max_size / 3) {
if (!buf_lru_switched_on_innodb_mon) {
@@ -366,14 +372,20 @@ loop:
ut_print_timestamp(stderr);
fprintf(stderr,
-" InnoDB: WARNING: over 67 percent of the buffer pool is occupied by\n"
-"InnoDB: lock heaps or the adaptive hash index! Check that your\n"
-"InnoDB: transactions do not set too many row locks.\n"
-"InnoDB: Your buffer pool size is %lu MB. Maybe you should make\n"
-"InnoDB: the buffer pool bigger?\n"
-"InnoDB: Starting the InnoDB Monitor to print diagnostics, including\n"
-"InnoDB: lock heap and hash index sizes.\n",
- (ulong) (buf_pool->curr_size / (1024 * 1024 / UNIV_PAGE_SIZE)));
+ " InnoDB: WARNING: over 67 percent of"
+ " the buffer pool is occupied by\n"
+ "InnoDB: lock heaps or the adaptive"
+ " hash index! Check that your\n"
+ "InnoDB: transactions do not set too many"
+ " row locks.\n"
+ "InnoDB: Your buffer pool size is %lu MB."
+ " Maybe you should make\n"
+ "InnoDB: the buffer pool bigger?\n"
+ "InnoDB: Starting the InnoDB Monitor to print"
+ " diagnostics, including\n"
+ "InnoDB: lock heap and hash index sizes.\n",
+ (ulong) (buf_pool->curr_size
+ / (1024 * 1024 / UNIV_PAGE_SIZE)));
buf_lru_switched_on_innodb_mon = TRUE;
srv_print_innodb_monitor = TRUE;
@@ -405,7 +417,8 @@ loop:
/* Remove from the list of mapped pages */
UT_LIST_REMOVE(awe_LRU_free_mapped,
- buf_pool->awe_LRU_free_mapped, block);
+ buf_pool->awe_LRU_free_mapped,
+ block);
} else {
/* We map the page to a frame; second param
FALSE below because we do not want it to be
@@ -440,18 +453,25 @@ loop:
if (n_iterations > 30) {
ut_print_timestamp(stderr);
fprintf(stderr,
- "InnoDB: Warning: difficult to find free blocks from\n"
- "InnoDB: the buffer pool (%lu search iterations)! Consider\n"
- "InnoDB: increasing the buffer pool size.\n"
- "InnoDB: It is also possible that in your Unix version\n"
- "InnoDB: fsync is very slow, or completely frozen inside\n"
- "InnoDB: the OS kernel. Then upgrading to a newer version\n"
- "InnoDB: of your operating system may help. Look at the\n"
- "InnoDB: number of fsyncs in diagnostic info below.\n"
- "InnoDB: Pending flushes (fsync) log: %lu; buffer pool: %lu\n"
- "InnoDB: %lu OS file reads, %lu OS file writes, %lu OS fsyncs\n"
- "InnoDB: Starting InnoDB Monitor to print further\n"
- "InnoDB: diagnostics to the standard output.\n",
+ "InnoDB: Warning: difficult to find free blocks from\n"
+ "InnoDB: the buffer pool (%lu search iterations)!"
+ " Consider\n"
+ "InnoDB: increasing the buffer pool size.\n"
+ "InnoDB: It is also possible that"
+ " in your Unix version\n"
+ "InnoDB: fsync is very slow, or"
+ " completely frozen inside\n"
+ "InnoDB: the OS kernel. Then upgrading to"
+ " a newer version\n"
+ "InnoDB: of your operating system may help."
+ " Look at the\n"
+ "InnoDB: number of fsyncs in diagnostic info below.\n"
+ "InnoDB: Pending flushes (fsync) log: %lu;"
+ " buffer pool: %lu\n"
+ "InnoDB: %lu OS file reads, %lu OS file writes,"
+ " %lu OS fsyncs\n"
+ "InnoDB: Starting InnoDB Monitor to print further\n"
+ "InnoDB: diagnostics to the standard output.\n",
(ulong) n_iterations,
(ulong) fil_n_pending_log_flushes,
(ulong) fil_n_pending_tablespace_flushes,
@@ -522,20 +542,20 @@ buf_LRU_old_adjust_len(void)
if (old_len < new_len - BUF_LRU_OLD_TOLERANCE) {
- buf_pool->LRU_old = UT_LIST_GET_PREV(LRU,
- buf_pool->LRU_old);
+ buf_pool->LRU_old = UT_LIST_GET_PREV
+ (LRU, buf_pool->LRU_old);
(buf_pool->LRU_old)->old = TRUE;
buf_pool->LRU_old_len++;
} else if (old_len > new_len + BUF_LRU_OLD_TOLERANCE) {
(buf_pool->LRU_old)->old = FALSE;
- buf_pool->LRU_old = UT_LIST_GET_NEXT(LRU,
- buf_pool->LRU_old);
+ buf_pool->LRU_old = UT_LIST_GET_NEXT
+ (LRU, buf_pool->LRU_old);
buf_pool->LRU_old_len--;
} else {
ut_a(buf_pool->LRU_old); /* Check that we did not
- fall out of the LRU list */
+ fall out of the LRU list */
return;
}
}
@@ -613,7 +633,7 @@ buf_LRU_remove_block(
/* Remove from the list of mapped pages */
UT_LIST_REMOVE(awe_LRU_free_mapped,
- buf_pool->awe_LRU_free_mapped, block);
+ buf_pool->awe_LRU_free_mapped, block);
}
/* If the LRU list is so short that LRU_old not defined, return */
@@ -672,7 +692,7 @@ buf_LRU_add_block_to_end_low(
/* Add to the list of mapped pages */
UT_LIST_ADD_LAST(awe_LRU_free_mapped,
- buf_pool->awe_LRU_free_mapped, block);
+ buf_pool->awe_LRU_free_mapped, block);
}
if (UT_LIST_GET_LEN(buf_pool->LRU) >= BUF_LRU_OLD_MIN_LEN) {
@@ -729,7 +749,7 @@ buf_LRU_add_block_low(
TRUE */
UT_LIST_ADD_FIRST(awe_LRU_free_mapped,
- buf_pool->awe_LRU_free_mapped, block);
+ buf_pool->awe_LRU_free_mapped, block);
}
if (!old || (UT_LIST_GET_LEN(buf_pool->LRU) < BUF_LRU_OLD_MIN_LEN)) {
@@ -740,7 +760,7 @@ buf_LRU_add_block_low(
block->freed_page_clock = buf_pool->freed_page_clock;
} else {
UT_LIST_INSERT_AFTER(LRU, buf_pool->LRU, buf_pool->LRU_old,
- block);
+ block);
buf_pool->LRU_old_len++;
/* We copy the LRU position field of the previous block
@@ -822,7 +842,7 @@ buf_LRU_block_free_non_file_page(
ut_ad(block);
ut_a((block->state == BUF_BLOCK_MEMORY)
- || (block->state == BUF_BLOCK_READY_FOR_USE));
+ || (block->state == BUF_BLOCK_READY_FOR_USE));
ut_a(block->n_pointers == 0);
ut_a(!block->in_free_list);
@@ -840,7 +860,7 @@ buf_LRU_block_free_non_file_page(
/* Add to the list of mapped pages */
UT_LIST_ADD_FIRST(awe_LRU_free_mapped,
- buf_pool->awe_LRU_free_mapped, block);
+ buf_pool->awe_LRU_free_mapped, block);
}
}
@@ -875,16 +895,21 @@ buf_LRU_block_remove_hashed_page(
if (block != buf_page_hash_get(block->space, block->offset)) {
fprintf(stderr,
-"InnoDB: Error: page %lu %lu not found from the hash table\n",
+ "InnoDB: Error: page %lu %lu not found"
+ " in the hash table\n",
(ulong) block->space,
(ulong) block->offset);
if (buf_page_hash_get(block->space, block->offset)) {
fprintf(stderr,
-"InnoDB: From hash table we find block %p of %lu %lu which is not %p\n",
- (void*) buf_page_hash_get(block->space, block->offset),
- (ulong) buf_page_hash_get(block->space, block->offset)->space,
- (ulong) buf_page_hash_get(block->space, block->offset)->offset,
- (void*) block);
+ "InnoDB: In hash table we find block"
+ " %p of %lu %lu which is not %p\n",
+ (void*) buf_page_hash_get
+ (block->space, block->offset),
+ (ulong) buf_page_hash_get
+ (block->space, block->offset)->space,
+ (ulong) buf_page_hash_get
+ (block->space, block->offset)->offset,
+ (void*) block);
}
#ifdef UNIV_DEBUG
@@ -897,8 +922,8 @@ buf_LRU_block_remove_hashed_page(
}
HASH_DELETE(buf_block_t, hash, buf_pool->page_hash,
- buf_page_address_fold(block->space, block->offset),
- block);
+ buf_page_address_fold(block->space, block->offset),
+ block);
block->state = BUF_BLOCK_REMOVE_HASH;
}
@@ -1009,7 +1034,8 @@ buf_LRU_print(void)
ut_ad(buf_pool);
mutex_enter(&(buf_pool->mutex));
- fprintf(stderr, "Pool ulint clock %lu\n", (ulong) buf_pool->ulint_clock);
+ fprintf(stderr, "Pool ulint clock %lu\n",
+ (ulong) buf_pool->ulint_clock);
block = UT_LIST_GET_FIRST(buf_pool->LRU);
@@ -1033,7 +1059,7 @@ buf_LRU_print(void)
}
if (ut_dulint_cmp(block->oldest_modification,
- ut_dulint_zero) > 0) {
+ ut_dulint_zero) > 0) {
fputs("modif. ", stderr);
}
@@ -1042,7 +1068,8 @@ buf_LRU_print(void)
fprintf(stderr, "LRU pos %lu type %lu index id %lu ",
(ulong) block->LRU_position,
(ulong) fil_page_get_type(frame),
- (ulong) ut_dulint_get_low(btr_page_get_index_id(frame)));
+ (ulong) ut_dulint_get_low
+ (btr_page_get_index_id(frame)));
block = UT_LIST_GET_NEXT(LRU, block);
if (++len == 10) {
diff --git a/storage/innobase/buf/buf0rea.c b/storage/innobase/buf/buf0rea.c
index d9864aae360..cf7aa97191f 100644
--- a/storage/innobase/buf/buf0rea.c
+++ b/storage/innobase/buf/buf0rea.c
@@ -81,32 +81,21 @@ buf_read_page_low(
mode = mode & ~OS_AIO_SIMULATED_WAKE_LATER;
if (trx_doublewrite && space == TRX_SYS_SPACE
- && ( (offset >= trx_doublewrite->block1
- && offset < trx_doublewrite->block1
- + TRX_SYS_DOUBLEWRITE_BLOCK_SIZE)
- || (offset >= trx_doublewrite->block2
- && offset < trx_doublewrite->block2
- + TRX_SYS_DOUBLEWRITE_BLOCK_SIZE))) {
+ && ( (offset >= trx_doublewrite->block1
+ && offset < trx_doublewrite->block1
+ + TRX_SYS_DOUBLEWRITE_BLOCK_SIZE)
+ || (offset >= trx_doublewrite->block2
+ && offset < trx_doublewrite->block2
+ + TRX_SYS_DOUBLEWRITE_BLOCK_SIZE))) {
ut_print_timestamp(stderr);
fprintf(stderr,
-" InnoDB: Warning: trying to read doublewrite buffer page %lu\n",
+ " InnoDB: Warning: trying to read"
+ " doublewrite buffer page %lu\n",
(ulong) offset);
return(0);
}
-#ifdef UNIV_LOG_DEBUG
- if (space % 2 == 1) {
- /* We are updating a replicate space while holding the
- log mutex: the read must be handled before other reads
- which might incur ibuf operations and thus write to the log */
-
- fputs("Log debug: reading replicate page in sync mode\n",
- stderr);
-
- sync = TRUE;
- }
-#endif
if (ibuf_bitmap_page(offset) || trx_sys_hdr_page(space, offset)) {
/* Trx sys header is so low in the latching order that we play
@@ -123,7 +112,7 @@ buf_read_page_low(
pool for read, then DISCARD cannot proceed until the read has
completed */
block = buf_page_init_for_read(err, mode, space, tablespace_version,
- offset);
+ offset);
if (block == NULL) {
return(0);
@@ -133,17 +122,17 @@ buf_read_page_low(
if (buf_debug_prints) {
fprintf(stderr,
"Posting read request for page %lu, sync %lu\n",
- (ulong) offset,
- (ulong) sync);
+ (ulong) offset,
+ (ulong) sync);
}
#endif
ut_a(block->state == BUF_BLOCK_FILE_PAGE);
*err = fil_io(OS_FILE_READ | wake_later,
- sync, space,
- offset, 0, UNIV_PAGE_SIZE,
- (void*)block->frame, (void*)block);
+ sync, space,
+ offset, 0, UNIV_PAGE_SIZE,
+ (void*)block->frame, (void*)block);
ut_a(*err == DB_SUCCESS);
if (sync) {
@@ -208,9 +197,9 @@ buf_read_ahead_random(
tablespace_version = fil_space_get_version(space);
low = (offset / BUF_READ_AHEAD_RANDOM_AREA)
- * BUF_READ_AHEAD_RANDOM_AREA;
+ * BUF_READ_AHEAD_RANDOM_AREA;
high = (offset / BUF_READ_AHEAD_RANDOM_AREA + 1)
- * BUF_READ_AHEAD_RANDOM_AREA;
+ * BUF_READ_AHEAD_RANDOM_AREA;
if (high > fil_space_get_size(space)) {
high = fil_space_get_size(space);
@@ -224,8 +213,8 @@ buf_read_ahead_random(
mutex_enter(&(buf_pool->mutex));
- if (buf_pool->n_pend_reads >
- buf_pool->curr_size / BUF_READ_AHEAD_PEND_LIMIT) {
+ if (buf_pool->n_pend_reads
+ > buf_pool->curr_size / BUF_READ_AHEAD_PEND_LIMIT) {
mutex_exit(&(buf_pool->mutex));
return(0);
@@ -238,8 +227,8 @@ buf_read_ahead_random(
block = buf_page_hash_get(space, i);
if ((block)
- && (block->LRU_position > LRU_recent_limit)
- && block->accessed) {
+ && (block->LRU_position > LRU_recent_limit)
+ && block->accessed) {
recent_blocks++;
}
@@ -268,15 +257,18 @@ buf_read_ahead_random(
mode: hence FALSE as the first parameter */
if (!ibuf_bitmap_page(i)) {
- count += buf_read_page_low(&err, FALSE, ibuf_mode
- | OS_AIO_SIMULATED_WAKE_LATER,
- space, tablespace_version, i);
+ count += buf_read_page_low
+ (&err, FALSE,
+ ibuf_mode | OS_AIO_SIMULATED_WAKE_LATER,
+ space, tablespace_version, i);
if (err == DB_TABLESPACE_DELETED) {
ut_print_timestamp(stderr);
fprintf(stderr,
-" InnoDB: Warning: in random readahead trying to access tablespace\n"
-"InnoDB: %lu page no. %lu,\n"
-"InnoDB: but the tablespace does not exist or is just being dropped.\n",
+ " InnoDB: Warning: in random"
+ " readahead trying to access\n"
+ "InnoDB: tablespace %lu page %lu,\n"
+ "InnoDB: but the tablespace does not"
+ " exist or is just being dropped.\n",
(ulong) space, (ulong) i);
}
}
@@ -292,8 +284,8 @@ buf_read_ahead_random(
if (buf_debug_prints && (count > 0)) {
fprintf(stderr,
"Random read-ahead space %lu offset %lu pages %lu\n",
- (ulong) space, (ulong) offset,
- (ulong) count);
+ (ulong) space, (ulong) offset,
+ (ulong) count);
}
#endif /* UNIV_DEBUG */
@@ -329,14 +321,16 @@ buf_read_page(
switches: hence TRUE */
count2 = buf_read_page_low(&err, TRUE, BUF_READ_ANY_PAGE, space,
- tablespace_version, offset);
+ tablespace_version, offset);
srv_buf_pool_reads+= count2;
if (err == DB_TABLESPACE_DELETED) {
ut_print_timestamp(stderr);
fprintf(stderr,
-" InnoDB: Error: trying to access tablespace %lu page no. %lu,\n"
-"InnoDB: but the tablespace does not exist or is just being dropped.\n",
- (ulong) space, (ulong) offset);
+ " InnoDB: Error: trying to access"
+ " tablespace %lu page no. %lu,\n"
+ "InnoDB: but the tablespace does not exist"
+ " or is just being dropped.\n",
+ (ulong) space, (ulong) offset);
}
/* Flush pages from the end of the LRU list if necessary */
@@ -407,9 +401,9 @@ buf_read_ahead_linear(
}
low = (offset / BUF_READ_AHEAD_LINEAR_AREA)
- * BUF_READ_AHEAD_LINEAR_AREA;
+ * BUF_READ_AHEAD_LINEAR_AREA;
high = (offset / BUF_READ_AHEAD_LINEAR_AREA + 1)
- * BUF_READ_AHEAD_LINEAR_AREA;
+ * BUF_READ_AHEAD_LINEAR_AREA;
if ((offset != low) && (offset != high - 1)) {
/* This is not a border page of the area: return */
@@ -432,8 +426,8 @@ buf_read_ahead_linear(
return(0);
}
- if (buf_pool->n_pend_reads >
- buf_pool->curr_size / BUF_READ_AHEAD_PEND_LIMIT) {
+ if (buf_pool->n_pend_reads
+ > buf_pool->curr_size / BUF_READ_AHEAD_PEND_LIMIT) {
mutex_exit(&(buf_pool->mutex));
return(0);
@@ -459,9 +453,9 @@ buf_read_ahead_linear(
fail_count++;
} else if (pred_block
- && (ut_ulint_cmp(block->LRU_position,
- pred_block->LRU_position)
- != asc_or_desc)) {
+ && (ut_ulint_cmp(block->LRU_position,
+ pred_block->LRU_position)
+ != asc_or_desc)) {
/* Accesses not in the right order */
fail_count++;
@@ -469,8 +463,8 @@ buf_read_ahead_linear(
}
}
- if (fail_count > BUF_READ_AHEAD_LINEAR_AREA -
- BUF_READ_AHEAD_LINEAR_THRESHOLD) {
+ if (fail_count > BUF_READ_AHEAD_LINEAR_AREA
+ - BUF_READ_AHEAD_LINEAR_THRESHOLD) {
/* Too many failures: return */
mutex_exit(&(buf_pool->mutex));
@@ -518,9 +512,9 @@ buf_read_ahead_linear(
}
low = (new_offset / BUF_READ_AHEAD_LINEAR_AREA)
- * BUF_READ_AHEAD_LINEAR_AREA;
+ * BUF_READ_AHEAD_LINEAR_AREA;
high = (new_offset / BUF_READ_AHEAD_LINEAR_AREA + 1)
- * BUF_READ_AHEAD_LINEAR_AREA;
+ * BUF_READ_AHEAD_LINEAR_AREA;
if ((new_offset != low) && (new_offset != high - 1)) {
/* This is not a border page of the area: return */
@@ -555,16 +549,19 @@ buf_read_ahead_linear(
aio mode: hence FALSE as the first parameter */
if (!ibuf_bitmap_page(i)) {
- count += buf_read_page_low(&err, FALSE, ibuf_mode
- | OS_AIO_SIMULATED_WAKE_LATER,
- space, tablespace_version, i);
+ count += buf_read_page_low
+ (&err, FALSE,
+ ibuf_mode | OS_AIO_SIMULATED_WAKE_LATER,
+ space, tablespace_version, i);
if (err == DB_TABLESPACE_DELETED) {
ut_print_timestamp(stderr);
fprintf(stderr,
-" InnoDB: Warning: in linear readahead trying to access tablespace\n"
-"InnoDB: %lu page no. %lu,\n"
-"InnoDB: but the tablespace does not exist or is just being dropped.\n",
- (ulong) space, (ulong) i);
+ " InnoDB: Warning: in"
+ " linear readahead trying to access\n"
+ "InnoDB: tablespace %lu page %lu,\n"
+ "InnoDB: but the tablespace does not"
+ " exist or is just being dropped.\n",
+ (ulong) space, (ulong) i);
}
}
}
@@ -581,8 +578,8 @@ buf_read_ahead_linear(
#ifdef UNIV_DEBUG
if (buf_debug_prints && (count > 0)) {
fprintf(stderr,
- "LINEAR read-ahead space %lu offset %lu pages %lu\n",
- (ulong) space, (ulong) offset, (ulong) count);
+ "LINEAR read-ahead space %lu offset %lu pages %lu\n",
+ (ulong) space, (ulong) offset, (ulong) count);
}
#endif /* UNIV_DEBUG */
@@ -618,26 +615,24 @@ buf_read_ibuf_merge_pages(
#ifdef UNIV_IBUF_DEBUG
ut_a(n_stored < UNIV_PAGE_SIZE);
#endif
- while (buf_pool->n_pend_reads >
- buf_pool->curr_size / BUF_READ_AHEAD_PEND_LIMIT) {
+ while (buf_pool->n_pend_reads
+ > buf_pool->curr_size / BUF_READ_AHEAD_PEND_LIMIT) {
os_thread_sleep(500000);
}
for (i = 0; i < n_stored; i++) {
- if ((i + 1 == n_stored) && sync) {
- buf_read_page_low(&err, TRUE, BUF_READ_ANY_PAGE,
- space_ids[i], space_versions[i], page_nos[i]);
- } else {
- buf_read_page_low(&err, FALSE, BUF_READ_ANY_PAGE,
- space_ids[i], space_versions[i], page_nos[i]);
- }
+ buf_read_page_low(&err,
+ (i + 1 == n_stored) && sync,
+ BUF_READ_ANY_PAGE,
+ space_ids[i], space_versions[i],
+ page_nos[i]);
if (err == DB_TABLESPACE_DELETED) {
/* We have deleted or are deleting the single-table
tablespace: remove the entries for that page */
ibuf_merge_or_delete_for_page(NULL, space_ids[i],
- page_nos[i], FALSE);
+ page_nos[i], FALSE);
}
}
@@ -650,7 +645,7 @@ buf_read_ibuf_merge_pages(
if (buf_debug_prints) {
fprintf(stderr,
"Ibuf merge read-ahead space %lu pages %lu\n",
- (ulong) space_ids[0], (ulong) n_stored);
+ (ulong) space_ids[0], (ulong) n_stored);
}
#endif /* UNIV_DEBUG */
}
@@ -691,11 +686,14 @@ buf_read_recv_pages(
if (count > 100) {
fprintf(stderr,
-"InnoDB: Error: InnoDB has waited for 50 seconds for pending\n"
-"InnoDB: reads to the buffer pool to be finished.\n"
-"InnoDB: Number of pending reads %lu, pending pread calls %lu\n",
- (ulong) buf_pool->n_pend_reads,
- (ulong)os_file_n_pending_preads);
+ "InnoDB: Error: InnoDB has waited for"
+ " 50 seconds for pending\n"
+ "InnoDB: reads to the buffer pool to"
+ " be finished.\n"
+ "InnoDB: Number of pending reads %lu,"
+ " pending pread calls %lu\n",
+ (ulong) buf_pool->n_pend_reads,
+ (ulong)os_file_n_pending_preads);
os_aio_print_debug = TRUE;
}
@@ -704,12 +702,14 @@ buf_read_recv_pages(
os_aio_print_debug = FALSE;
if ((i + 1 == n_stored) && sync) {
- buf_read_page_low(&err, TRUE, BUF_READ_ANY_PAGE, space,
- tablespace_version, page_nos[i]);
+ buf_read_page_low(&err, TRUE, BUF_READ_ANY_PAGE,
+ space, tablespace_version,
+ page_nos[i]);
} else {
buf_read_page_low(&err, FALSE, BUF_READ_ANY_PAGE
- | OS_AIO_SIMULATED_WAKE_LATER,
- space, tablespace_version, page_nos[i]);
+ | OS_AIO_SIMULATED_WAKE_LATER,
+ space, tablespace_version,
+ page_nos[i]);
}
}
@@ -721,7 +721,8 @@ buf_read_recv_pages(
#ifdef UNIV_DEBUG
if (buf_debug_prints) {
fprintf(stderr,
- "Recovery applies read-ahead pages %lu\n", (ulong) n_stored);
+ "Recovery applies read-ahead pages %lu\n",
+ (ulong) n_stored);
}
#endif /* UNIV_DEBUG */
}
diff --git a/storage/innobase/data/data0data.c b/storage/innobase/data/data0data.c
index b2c8408e901..804d02e8f59 100644
--- a/storage/innobase/data/data0data.c
+++ b/storage/innobase/data/data0data.c
@@ -189,10 +189,10 @@ dfield_check_typed_no_assert(
dfield_t* field) /* in: data field */
{
if (dfield_get_type(field)->mtype > DATA_MYSQL
- || dfield_get_type(field)->mtype < DATA_VARCHAR) {
+ || dfield_get_type(field)->mtype < DATA_VARCHAR) {
fprintf(stderr,
-"InnoDB: Error: data field type %lu, len %lu\n",
+ "InnoDB: Error: data field type %lu, len %lu\n",
(ulong) dfield_get_type(field)->mtype,
(ulong) dfield_get_len(field));
return(FALSE);
@@ -215,9 +215,9 @@ dtuple_check_typed_no_assert(
if (dtuple_get_n_fields(tuple) > REC_MAX_N_FIELDS) {
fprintf(stderr,
-"InnoDB: Error: index entry has %lu fields\n",
+ "InnoDB: Error: index entry has %lu fields\n",
(ulong) dtuple_get_n_fields(tuple));
- dump:
+dump:
fputs("InnoDB: Tuple contents: ", stderr);
dtuple_print(stderr, tuple);
putc('\n', stderr);
@@ -247,10 +247,10 @@ dfield_check_typed(
dfield_t* field) /* in: data field */
{
if (dfield_get_type(field)->mtype > DATA_MYSQL
- || dfield_get_type(field)->mtype < DATA_VARCHAR) {
+ || dfield_get_type(field)->mtype < DATA_VARCHAR) {
fprintf(stderr,
-"InnoDB: Error: data field type %lu, len %lu\n",
+ "InnoDB: Error: data field type %lu, len %lu\n",
(ulong) dfield_get_type(field)->mtype,
(ulong) dfield_get_len(field));
@@ -319,8 +319,8 @@ dtuple_validate(
for (j = 0; j < len; j++) {
data_dummy += *data; /* fool the compiler not
- to optimize out this
- code */
+ to optimize out this
+ code */
data++;
}
}
@@ -433,15 +433,20 @@ dfield_print_also_hex(
/*****************************************************************
Print a dfield value using ut_print_buf. */
-
+static
void
dfield_print_raw(
/*=============*/
FILE* f, /* in: output stream */
dfield_t* dfield) /* in: dfield */
{
- if (dfield->len != UNIV_SQL_NULL) {
- ut_print_buf(f, dfield->data, dfield->len);
+ ulint len = dfield->len;
+ if (len != UNIV_SQL_NULL) {
+ ulint print_len = ut_min(len, 1000);
+ ut_print_buf(f, dfield->data, print_len);
+ if (len != print_len) {
+ fprintf(f, "(total %lu bytes)", (ulong) len);
+ }
} else {
fputs(" SQL NULL", f);
}
@@ -513,14 +518,15 @@ dtuple_convert_big_rec(
if (UNIV_UNLIKELY(size > 1000000000)) {
fprintf(stderr,
-"InnoDB: Warning: tuple size very big: %lu\n", (ulong) size);
+ "InnoDB: Warning: tuple size very big: %lu\n",
+ (ulong) size);
fputs("InnoDB: Tuple contents: ", stderr);
dtuple_print(stderr, entry);
putc('\n', stderr);
}
heap = mem_heap_create(size + dtuple_get_n_fields(entry)
- * sizeof(big_rec_field_t) + 1000);
+ * sizeof(big_rec_field_t) + 1000);
vector = mem_heap_alloc(heap, sizeof(big_rec_t));
@@ -534,13 +540,13 @@ dtuple_convert_big_rec(
n_fields = 0;
while (rec_get_converted_size(index, entry)
- >= ut_min(page_get_free_space_of_empty(
- dict_table_is_comp(index->table)) / 2,
- REC_MAX_DATA_SIZE)) {
+ >= ut_min(page_get_free_space_of_empty
+ (dict_table_is_comp(index->table)) / 2,
+ REC_MAX_DATA_SIZE)) {
longest = 0;
for (i = dict_index_get_n_unique_in_tree(index);
- i < dtuple_get_n_fields(entry); i++) {
+ i < dtuple_get_n_fields(entry); i++) {
/* Skip over fields which already are externally
stored */
@@ -559,8 +565,8 @@ dtuple_convert_big_rec(
dfield = dtuple_get_nth_field(entry, i);
- if (dfield->len != UNIV_SQL_NULL &&
- dfield->len > longest) {
+ if (dfield->len != UNIV_SQL_NULL
+ && dfield->len > longest) {
longest = dfield->len;
@@ -577,7 +583,7 @@ dtuple_convert_big_rec(
#endif
if (longest < BTR_EXTERN_FIELD_REF_SIZE + 10
- + DICT_MAX_INDEX_COL_LEN) {
+ + DICT_MAX_INDEX_COL_LEN) {
/* Cannot shorten more */
mem_heap_free(heap);
@@ -602,24 +608,24 @@ dtuple_convert_big_rec(
ut_a(dfield->len > DICT_MAX_INDEX_COL_LEN);
vector->fields[n_fields].len = dfield->len
- - DICT_MAX_INDEX_COL_LEN;
+ - DICT_MAX_INDEX_COL_LEN;
- vector->fields[n_fields].data = mem_heap_alloc(heap,
- vector->fields[n_fields].len);
+ vector->fields[n_fields].data = mem_heap_alloc
+ (heap, vector->fields[n_fields].len);
/* Copy data (from the end of field) to big rec vector */
ut_memcpy(vector->fields[n_fields].data,
- ((byte*)dfield->data) + dfield->len
- - vector->fields[n_fields].len,
- vector->fields[n_fields].len);
+ ((byte*)dfield->data) + dfield->len
+ - vector->fields[n_fields].len,
+ vector->fields[n_fields].len);
dfield->len = dfield->len - vector->fields[n_fields].len
- + BTR_EXTERN_FIELD_REF_SIZE;
+ + BTR_EXTERN_FIELD_REF_SIZE;
/* Set the extern field reference in dfield to zero */
memset(((byte*)dfield->data)
- + dfield->len - BTR_EXTERN_FIELD_REF_SIZE,
- 0, BTR_EXTERN_FIELD_REF_SIZE);
+ + dfield->len - BTR_EXTERN_FIELD_REF_SIZE,
+ 0, BTR_EXTERN_FIELD_REF_SIZE);
n_fields++;
}
@@ -646,15 +652,15 @@ dtuple_convert_back_big_rec(
for (i = 0; i < vector->n_fields; i++) {
dfield = dtuple_get_nth_field(entry,
- vector->fields[i].field_no);
+ vector->fields[i].field_no);
/* Copy data from big rec vector */
ut_memcpy(((byte*)dfield->data)
- + dfield->len - BTR_EXTERN_FIELD_REF_SIZE,
+ + dfield->len - BTR_EXTERN_FIELD_REF_SIZE,
vector->fields[i].data,
vector->fields[i].len);
dfield->len = dfield->len + vector->fields[i].len
- - BTR_EXTERN_FIELD_REF_SIZE;
+ - BTR_EXTERN_FIELD_REF_SIZE;
}
mem_heap_free(vector->heap);
diff --git a/storage/innobase/data/data0type.c b/storage/innobase/data/data0type.c
index 5b7b9c9aefb..43fc8c55e35 100644
--- a/storage/innobase/data/data0type.c
+++ b/storage/innobase/data/data0type.c
@@ -67,9 +67,9 @@ dtype_get_at_most_n_mbchars(
if (dtype->mbminlen != dtype->mbmaxlen) {
ut_a(!(prefix_len % dtype->mbmaxlen));
- return(innobase_get_at_most_n_mbchars(
- dtype_get_charset_coll(dtype->prtype),
- prefix_len, data_len, str));
+ return(innobase_get_at_most_n_mbchars
+ (dtype_get_charset_coll(dtype->prtype),
+ prefix_len, data_len, str));
}
if (prefix_len < data_len) {
@@ -98,8 +98,8 @@ dtype_is_string_type(
ulint mtype) /* in: InnoDB main data type code: DATA_CHAR, ... */
{
if (mtype <= DATA_BLOB
- || mtype == DATA_MYSQL
- || mtype == DATA_VARMYSQL) {
+ || mtype == DATA_MYSQL
+ || mtype == DATA_VARMYSQL) {
return(TRUE);
}
@@ -120,8 +120,8 @@ dtype_is_binary_string_type(
ulint prtype) /* in: precise type */
{
if ((mtype == DATA_FIXBINARY)
- || (mtype == DATA_BINARY)
- || (mtype == DATA_BLOB && (prtype & DATA_BINARY_TYPE))) {
+ || (mtype == DATA_BINARY)
+ || (mtype == DATA_BLOB && (prtype & DATA_BINARY_TYPE))) {
return(TRUE);
}
@@ -143,7 +143,7 @@ dtype_is_non_binary_string_type(
ulint prtype) /* in: precise type */
{
if (dtype_is_string_type(mtype) == TRUE
- && dtype_is_binary_string_type(mtype, prtype) == FALSE) {
+ && dtype_is_binary_string_type(mtype, prtype) == FALSE) {
return(TRUE);
}
@@ -258,9 +258,9 @@ dtype_print(
len = type->len;
if ((type->mtype == DATA_SYS)
- || (type->mtype == DATA_VARCHAR)
- || (type->mtype == DATA_CHAR)) {
- putc(' ', stderr);
+ || (type->mtype == DATA_VARCHAR)
+ || (type->mtype == DATA_CHAR)) {
+ putc(' ', stderr);
if (prtype == DATA_ROW_ID) {
fputs("DATA_ROW_ID", stderr);
len = DATA_ROW_ID_LEN;
@@ -317,9 +317,9 @@ dtype_get_max_size(
case DATA_BINARY:
case DATA_DECIMAL:
case DATA_VARMYSQL:
- return(type->len);
+ return(type->len);
case DATA_BLOB:
- return(ULINT_MAX);
+ return(ULINT_MAX);
default:
ut_error;
}
diff --git a/storage/innobase/dict/dict0boot.c b/storage/innobase/dict/dict0boot.c
index 9c98338e603..0515adb9a8f 100644
--- a/storage/innobase/dict/dict0boot.c
+++ b/storage/innobase/dict/dict0boot.c
@@ -38,7 +38,7 @@ dict_hdr_get(
ut_ad(mtr);
header = DICT_HDR + buf_page_get(DICT_HDR_SPACE, DICT_HDR_PAGE_NO,
- RW_X_LATCH, mtr);
+ RW_X_LATCH, mtr);
#ifdef UNIV_SYNC_DEBUG
buf_page_dbg_add_level(header, SYNC_DICT_HEADER);
#endif /* UNIV_SYNC_DEBUG */
@@ -59,7 +59,7 @@ dict_hdr_get_new_id(
mtr_t mtr;
ut_ad((type == DICT_HDR_TABLE_ID) || (type == DICT_HDR_INDEX_ID)
- || (type == DICT_HDR_MIX_ID));
+ || (type == DICT_HDR_MIX_ID));
mtr_start(&mtr);
@@ -122,7 +122,7 @@ dict_hdr_create(
/* Create the dictionary header file block in a new, allocated file
segment in the system tablespace */
page = fseg_create(DICT_HDR_SPACE, 0,
- DICT_HDR + DICT_HDR_FSEG_HEADER, mtr);
+ DICT_HDR + DICT_HDR_FSEG_HEADER, mtr);
hdr_page_no = buf_frame_get_page_no(page);
@@ -133,70 +133,70 @@ dict_hdr_create(
/* Start counting row, table, index, and tree ids from
DICT_HDR_FIRST_ID */
mlog_write_dulint(dict_header + DICT_HDR_ROW_ID,
- ut_dulint_create(0, DICT_HDR_FIRST_ID), mtr);
+ ut_dulint_create(0, DICT_HDR_FIRST_ID), mtr);
mlog_write_dulint(dict_header + DICT_HDR_TABLE_ID,
- ut_dulint_create(0, DICT_HDR_FIRST_ID), mtr);
+ ut_dulint_create(0, DICT_HDR_FIRST_ID), mtr);
mlog_write_dulint(dict_header + DICT_HDR_INDEX_ID,
- ut_dulint_create(0, DICT_HDR_FIRST_ID), mtr);
+ ut_dulint_create(0, DICT_HDR_FIRST_ID), mtr);
mlog_write_dulint(dict_header + DICT_HDR_MIX_ID,
- ut_dulint_create(0, DICT_HDR_FIRST_ID), mtr);
+ ut_dulint_create(0, DICT_HDR_FIRST_ID), mtr);
/* Create the B-tree roots for the clustered indexes of the basic
system tables */
/*--------------------------*/
root_page_no = btr_create(DICT_CLUSTERED | DICT_UNIQUE,
- DICT_HDR_SPACE, DICT_TABLES_ID, FALSE, mtr);
+ DICT_HDR_SPACE, DICT_TABLES_ID, FALSE, mtr);
if (root_page_no == FIL_NULL) {
return(FALSE);
}
mlog_write_ulint(dict_header + DICT_HDR_TABLES, root_page_no,
- MLOG_4BYTES, mtr);
+ MLOG_4BYTES, mtr);
/*--------------------------*/
root_page_no = btr_create(DICT_UNIQUE, DICT_HDR_SPACE,
- DICT_TABLE_IDS_ID, FALSE, mtr);
+ DICT_TABLE_IDS_ID, FALSE, mtr);
if (root_page_no == FIL_NULL) {
return(FALSE);
}
mlog_write_ulint(dict_header + DICT_HDR_TABLE_IDS, root_page_no,
- MLOG_4BYTES, mtr);
+ MLOG_4BYTES, mtr);
/*--------------------------*/
root_page_no = btr_create(DICT_CLUSTERED | DICT_UNIQUE,
- DICT_HDR_SPACE, DICT_COLUMNS_ID, FALSE, mtr);
+ DICT_HDR_SPACE, DICT_COLUMNS_ID, FALSE, mtr);
if (root_page_no == FIL_NULL) {
return(FALSE);
}
mlog_write_ulint(dict_header + DICT_HDR_COLUMNS, root_page_no,
- MLOG_4BYTES, mtr);
+ MLOG_4BYTES, mtr);
/*--------------------------*/
root_page_no = btr_create(DICT_CLUSTERED | DICT_UNIQUE,
- DICT_HDR_SPACE, DICT_INDEXES_ID, FALSE, mtr);
+ DICT_HDR_SPACE, DICT_INDEXES_ID, FALSE, mtr);
if (root_page_no == FIL_NULL) {
return(FALSE);
}
mlog_write_ulint(dict_header + DICT_HDR_INDEXES, root_page_no,
- MLOG_4BYTES, mtr);
+ MLOG_4BYTES, mtr);
/*--------------------------*/
root_page_no = btr_create(DICT_CLUSTERED | DICT_UNIQUE,
- DICT_HDR_SPACE, DICT_FIELDS_ID, FALSE, mtr);
+ DICT_HDR_SPACE, DICT_FIELDS_ID, FALSE, mtr);
if (root_page_no == FIL_NULL) {
return(FALSE);
}
mlog_write_ulint(dict_header + DICT_HDR_FIELDS, root_page_no,
- MLOG_4BYTES, mtr);
+ MLOG_4BYTES, mtr);
/*--------------------------*/
return(TRUE);
@@ -236,11 +236,11 @@ dict_boot(void)
..._MARGIN, it will immediately be updated to the disk-based
header. */
- dict_sys->row_id = ut_dulint_add(
- ut_dulint_align_up(
- mtr_read_dulint(dict_hdr + DICT_HDR_ROW_ID, &mtr),
- DICT_HDR_ROW_ID_WRITE_MARGIN),
- DICT_HDR_ROW_ID_WRITE_MARGIN);
+ dict_sys->row_id = ut_dulint_add
+ (ut_dulint_align_up(mtr_read_dulint
+ (dict_hdr + DICT_HDR_ROW_ID, &mtr),
+ DICT_HDR_ROW_ID_WRITE_MARGIN),
+ DICT_HDR_ROW_ID_WRITE_MARGIN);
/* Insert into the dictionary cache the descriptions of the basic
system tables */
@@ -262,23 +262,27 @@ dict_boot(void)
dict_sys->sys_tables = table;
index = dict_mem_index_create("SYS_TABLES", "CLUST_IND",
- DICT_HDR_SPACE, DICT_UNIQUE | DICT_CLUSTERED, 1);
+ DICT_HDR_SPACE,
+ DICT_UNIQUE | DICT_CLUSTERED, 1);
dict_mem_index_add_field(index, "NAME", 0);
index->id = DICT_TABLES_ID;
- success = dict_index_add_to_cache(table, index, mtr_read_ulint(
- dict_hdr + DICT_HDR_TABLES, MLOG_4BYTES, &mtr));
+ success = dict_index_add_to_cache(table, index, mtr_read_ulint
+ (dict_hdr + DICT_HDR_TABLES,
+ MLOG_4BYTES, &mtr));
ut_a(success);
/*-------------------------*/
index = dict_mem_index_create("SYS_TABLES", "ID_IND",
- DICT_HDR_SPACE, DICT_UNIQUE, 1);
+ DICT_HDR_SPACE, DICT_UNIQUE, 1);
dict_mem_index_add_field(index, "ID", 0);
index->id = DICT_TABLE_IDS_ID;
- success = dict_index_add_to_cache(table, index, mtr_read_ulint(
- dict_hdr + DICT_HDR_TABLE_IDS, MLOG_4BYTES, &mtr));
+ success = dict_index_add_to_cache(table, index,
+ mtr_read_ulint
+ (dict_hdr + DICT_HDR_TABLE_IDS,
+ MLOG_4BYTES, &mtr));
ut_a(success);
/*-------------------------*/
table = dict_mem_table_create("SYS_COLUMNS", DICT_HDR_SPACE, 7, 0);
@@ -297,14 +301,16 @@ dict_boot(void)
dict_sys->sys_columns = table;
index = dict_mem_index_create("SYS_COLUMNS", "CLUST_IND",
- DICT_HDR_SPACE, DICT_UNIQUE | DICT_CLUSTERED, 2);
+ DICT_HDR_SPACE,
+ DICT_UNIQUE | DICT_CLUSTERED, 2);
dict_mem_index_add_field(index, "TABLE_ID", 0);
dict_mem_index_add_field(index, "POS", 0);
index->id = DICT_COLUMNS_ID;
- success = dict_index_add_to_cache(table, index, mtr_read_ulint(
- dict_hdr + DICT_HDR_COLUMNS, MLOG_4BYTES, &mtr));
+ success = dict_index_add_to_cache(table, index, mtr_read_ulint
+ (dict_hdr + DICT_HDR_COLUMNS,
+ MLOG_4BYTES, &mtr));
ut_a(success);
/*-------------------------*/
table = dict_mem_table_create("SYS_INDEXES", DICT_HDR_SPACE, 7, 0);
@@ -333,14 +339,16 @@ dict_boot(void)
dict_sys->sys_indexes = table;
index = dict_mem_index_create("SYS_INDEXES", "CLUST_IND",
- DICT_HDR_SPACE, DICT_UNIQUE | DICT_CLUSTERED, 2);
+ DICT_HDR_SPACE,
+ DICT_UNIQUE | DICT_CLUSTERED, 2);
dict_mem_index_add_field(index, "TABLE_ID", 0);
dict_mem_index_add_field(index, "ID", 0);
index->id = DICT_INDEXES_ID;
- success = dict_index_add_to_cache(table, index, mtr_read_ulint(
- dict_hdr + DICT_HDR_INDEXES, MLOG_4BYTES, &mtr));
+ success = dict_index_add_to_cache(table, index, mtr_read_ulint
+ (dict_hdr + DICT_HDR_INDEXES,
+ MLOG_4BYTES, &mtr));
ut_a(success);
/*-------------------------*/
table = dict_mem_table_create("SYS_FIELDS", DICT_HDR_SPACE, 3, 0);
@@ -354,14 +362,16 @@ dict_boot(void)
dict_sys->sys_fields = table;
index = dict_mem_index_create("SYS_FIELDS", "CLUST_IND",
- DICT_HDR_SPACE, DICT_UNIQUE | DICT_CLUSTERED, 2);
+ DICT_HDR_SPACE,
+ DICT_UNIQUE | DICT_CLUSTERED, 2);
dict_mem_index_add_field(index, "INDEX_ID", 0);
dict_mem_index_add_field(index, "POS", 0);
index->id = DICT_FIELDS_ID;
- success = dict_index_add_to_cache(table, index, mtr_read_ulint(
- dict_hdr + DICT_HDR_FIELDS, MLOG_4BYTES, &mtr));
+ success = dict_index_add_to_cache(table, index, mtr_read_ulint
+ (dict_hdr + DICT_HDR_FIELDS,
+ MLOG_4BYTES, &mtr));
ut_a(success);
mtr_commit(&mtr);
diff --git a/storage/innobase/dict/dict0crea.c b/storage/innobase/dict/dict0crea.c
index dd2e205a735..c912ea0fd1a 100644
--- a/storage/innobase/dict/dict0crea.c
+++ b/storage/innobase/dict/dict0crea.c
@@ -69,7 +69,7 @@ dict_create_sys_tables_tuple(
ptr = mem_heap_alloc(heap, 4);
mach_write_to_4(ptr, table->n_def
- | ((table->flags & DICT_TF_COMPACT) << 31));
+ | ((table->flags & DICT_TF_COMPACT) << 31));
dfield_set_data(dfield, ptr, 4);
/* 5: TYPE -----------------------------*/
dfield = dtuple_get_nth_field(entry, 3);
@@ -222,8 +222,8 @@ dict_build_table_def_step(
row_len = 0;
for (i = 0; i < table->n_def; i++) {
- row_len += dtype_get_min_size(dict_col_get_type(
- &table->cols[i]));
+ row_len += dtype_get_min_size(dict_col_get_type
+ (&table->cols[i]));
}
if (row_len > BTR_PAGE_MAX_REC_SIZE) {
return(DB_TOO_BIG_RECORD);
@@ -236,7 +236,7 @@ dict_build_table_def_step(
- page 1 is an ibuf bitmap page,
- page 2 is the first inode page,
- page 3 will contain the root of the clustered index of the
- table we create here. */
+ table we create here. */
table->space = 0; /* reset to zero for the call below */
@@ -251,9 +251,9 @@ dict_build_table_def_step(
is_path = FALSE;
}
- error = fil_create_new_single_table_tablespace(
- &(table->space), path_or_name, is_path,
- FIL_IBD_FILE_INITIAL_SIZE);
+ error = fil_create_new_single_table_tablespace
+ (&table->space, path_or_name, is_path,
+ FIL_IBD_FILE_INITIAL_SIZE);
if (error != DB_SUCCESS) {
return(error);
@@ -285,7 +285,7 @@ dict_build_col_def_step(
dtuple_t* row;
row = dict_create_sys_columns_tuple(node->table, node->col_no,
- node->heap);
+ node->heap);
ins_node_set_new_row(node->col_def, row);
return(DB_SUCCESS);
@@ -450,7 +450,7 @@ dict_create_sys_fields_tuple(
dfield = dtuple_get_nth_field(entry, 2);
dfield_set_data(dfield, field->name,
- ut_strlen(field->name));
+ ut_strlen(field->name));
/*---------------------------------*/
dict_table_copy_types(entry, sys_fields);
@@ -528,7 +528,7 @@ dict_build_index_def_step(
node->table = table;
ut_ad((UT_LIST_GET_LEN(table->indexes) > 0)
- || (index->type & DICT_CLUSTERED));
+ || (index->type & DICT_CLUSTERED));
index->id = dict_hdr_get_new_id(DICT_HDR_INDEX_ID);
@@ -600,19 +600,19 @@ dict_create_index_tree_step(
search_tuple = dict_create_search_tuple(node->ind_row, node->heap);
btr_pcur_open(UT_LIST_GET_FIRST(sys_indexes->indexes),
- search_tuple, PAGE_CUR_L, BTR_MODIFY_LEAF,
- &pcur, &mtr);
+ search_tuple, PAGE_CUR_L, BTR_MODIFY_LEAF,
+ &pcur, &mtr);
btr_pcur_move_to_next_user_rec(&pcur, &mtr);
node->page_no = btr_create(index->type, index->space, index->id,
- dict_table_is_comp(table), &mtr);
+ dict_table_is_comp(table), &mtr);
/* printf("Created a new index tree in space %lu root page %lu\n",
- index->space, index->page_no); */
+ index->space, index->page_no); */
page_rec_write_index_page_no(btr_pcur_get_rec(&pcur),
- DICT_SYS_INDEXES_PAGE_NO_FIELD,
- node->page_no, &mtr);
+ DICT_SYS_INDEXES_PAGE_NO_FIELD,
+ node->page_no, &mtr);
btr_pcur_close(&pcur);
mtr_commit(&mtr);
@@ -657,7 +657,7 @@ dict_drop_index_tree(
}
ptr = rec_get_nth_field_old(rec,
- DICT_SYS_INDEXES_SPACE_NO_FIELD, &len);
+ DICT_SYS_INDEXES_SPACE_NO_FIELD, &len);
ut_ad(len == 4);
@@ -680,11 +680,12 @@ dict_drop_index_tree(
record: this mini-transaction marks the B-tree totally freed */
/* printf("Dropping index tree in space %lu root page %lu\n", space,
- root_page_no); */
+ root_page_no); */
btr_free_root(space, root_page_no, mtr);
page_rec_write_index_page_no(rec,
- DICT_SYS_INDEXES_PAGE_NO_FIELD, FIL_NULL, mtr);
+ DICT_SYS_INDEXES_PAGE_NO_FIELD,
+ FIL_NULL, mtr);
}
/***********************************************************************
@@ -732,7 +733,7 @@ dict_truncate_index_tree(
}
ptr = rec_get_nth_field_old(rec,
- DICT_SYS_INDEXES_SPACE_NO_FIELD, &len);
+ DICT_SYS_INDEXES_SPACE_NO_FIELD, &len);
ut_ad(len == 4);
@@ -749,7 +750,7 @@ dict_truncate_index_tree(
}
ptr = rec_get_nth_field_old(rec,
- DICT_SYS_INDEXES_TYPE_FIELD, &len);
+ DICT_SYS_INDEXES_TYPE_FIELD, &len);
ut_ad(len == 4);
type = mach_read_from_4(ptr);
@@ -767,8 +768,8 @@ dict_truncate_index_tree(
appropriate field in the SYS_INDEXES record: this mini-transaction
marks the B-tree totally truncated */
- comp = page_is_comp(btr_page_get(
- space, root_page_no, RW_X_LATCH, mtr));
+ comp = page_is_comp(btr_page_get
+ (space, root_page_no, RW_X_LATCH, mtr));
btr_free_root(space, root_page_no, mtr);
/* We will temporarily write FIL_NULL to the PAGE_NO field
@@ -776,7 +777,7 @@ dict_truncate_index_tree(
inconsistent state in case it crashes between the mtr_commit()
below and the following mtr_commit() call. */
page_rec_write_index_page_no(rec, DICT_SYS_INDEXES_PAGE_NO_FIELD,
- FIL_NULL, mtr);
+ FIL_NULL, mtr);
/* We will need to commit the mini-transaction in order to avoid
deadlocks in the btr_create() call, because otherwise we would
@@ -788,8 +789,8 @@ dict_truncate_index_tree(
/* Find the index corresponding to this SYS_INDEXES record. */
for (index = UT_LIST_GET_FIRST(table->indexes);
- index;
- index = UT_LIST_GET_NEXT(indexes, index)) {
+ index;
+ index = UT_LIST_GET_NEXT(indexes, index)) {
if (!ut_dulint_cmp(index->id, index_id)) {
break;
}
@@ -834,11 +835,11 @@ tab_create_graph_create(
node->heap = mem_heap_create(256);
node->tab_def = ins_node_create(INS_DIRECT, dict_sys->sys_tables,
- heap);
+ heap);
node->tab_def->common.parent = node;
node->col_def = ins_node_create(INS_DIRECT, dict_sys->sys_columns,
- heap);
+ heap);
node->col_def->common.parent = node;
node->commit_node = commit_node_create(heap);
@@ -871,11 +872,11 @@ ind_create_graph_create(
node->heap = mem_heap_create(256);
node->ind_def = ins_node_create(INS_DIRECT,
- dict_sys->sys_indexes, heap);
+ dict_sys->sys_indexes, heap);
node->ind_def->common.parent = node;
node->field_def = ins_node_create(INS_DIRECT,
- dict_sys->sys_fields, heap);
+ dict_sys->sys_fields, heap);
node->field_def->common.parent = node;
node->commit_node = commit_node_create(heap);
@@ -1088,7 +1089,7 @@ dict_create_index_step(
if (node->state == INDEX_ADD_TO_CACHE) {
success = dict_index_add_to_cache(node->table, node->index,
- node->page_no);
+ node->page_no);
ut_a(success);
@@ -1136,8 +1137,8 @@ dict_create_or_check_foreign_constraint_tables(void)
table2 = dict_table_get_low("SYS_FOREIGN_COLS");
if (table1 && table2
- && UT_LIST_GET_LEN(table1->indexes) == 3
- && UT_LIST_GET_LEN(table2->indexes) == 1) {
+ && UT_LIST_GET_LEN(table1->indexes) == 3
+ && UT_LIST_GET_LEN(table2->indexes) == 1) {
/* Foreign constraint system tables have already been
created, and they are ok */
@@ -1157,13 +1158,15 @@ dict_create_or_check_foreign_constraint_tables(void)
if (table1) {
fprintf(stderr,
- "InnoDB: dropping incompletely created SYS_FOREIGN table\n");
+ "InnoDB: dropping incompletely created"
+ " SYS_FOREIGN table\n");
row_drop_table_for_mysql("SYS_FOREIGN", trx, TRUE);
}
if (table2) {
fprintf(stderr,
- "InnoDB: dropping incompletely created SYS_FOREIGN_COLS table\n");
+ "InnoDB: dropping incompletely created"
+ " SYS_FOREIGN_COLS table\n");
row_drop_table_for_mysql("SYS_FOREIGN_COLS", trx, TRUE);
}
@@ -1181,19 +1184,25 @@ dict_create_or_check_foreign_constraint_tables(void)
design. */
error = que_eval_sql(NULL,
- "PROCEDURE CREATE_FOREIGN_SYS_TABLES_PROC () IS\n"
- "BEGIN\n"
- "CREATE TABLE\n"
- "SYS_FOREIGN(ID CHAR, FOR_NAME CHAR, REF_NAME CHAR, N_COLS INT);\n"
- "CREATE UNIQUE CLUSTERED INDEX ID_IND ON SYS_FOREIGN (ID);\n"
- "CREATE INDEX FOR_IND ON SYS_FOREIGN (FOR_NAME);\n"
- "CREATE INDEX REF_IND ON SYS_FOREIGN (REF_NAME);\n"
- "CREATE TABLE\n"
- "SYS_FOREIGN_COLS(ID CHAR, POS INT, FOR_COL_NAME CHAR, REF_COL_NAME CHAR);\n"
- "CREATE UNIQUE CLUSTERED INDEX ID_IND ON SYS_FOREIGN_COLS (ID, POS);\n"
- "COMMIT WORK;\n"
- "END;\n"
- , FALSE, trx);
+ "PROCEDURE CREATE_FOREIGN_SYS_TABLES_PROC () IS\n"
+ "BEGIN\n"
+ "CREATE TABLE\n"
+ "SYS_FOREIGN(ID CHAR, FOR_NAME CHAR,"
+ " REF_NAME CHAR, N_COLS INT);\n"
+ "CREATE UNIQUE CLUSTERED INDEX ID_IND"
+ " ON SYS_FOREIGN (ID);\n"
+ "CREATE INDEX FOR_IND"
+ " ON SYS_FOREIGN (FOR_NAME);\n"
+ "CREATE INDEX REF_IND"
+ " ON SYS_FOREIGN (REF_NAME);\n"
+ "CREATE TABLE\n"
+ "SYS_FOREIGN_COLS(ID CHAR, POS INT,"
+ " FOR_COL_NAME CHAR, REF_COL_NAME CHAR);\n"
+ "CREATE UNIQUE CLUSTERED INDEX ID_IND"
+ " ON SYS_FOREIGN_COLS (ID, POS);\n"
+ "COMMIT WORK;\n"
+ "END;\n"
+ , FALSE, trx);
if (error != DB_SUCCESS) {
fprintf(stderr, "InnoDB: error %lu in creation\n",
@@ -1201,10 +1210,11 @@ dict_create_or_check_foreign_constraint_tables(void)
ut_a(error == DB_OUT_OF_FILE_SPACE);
- fprintf(stderr, "InnoDB: creation failed\n");
- fprintf(stderr, "InnoDB: tablespace is full\n");
fprintf(stderr,
- "InnoDB: dropping incompletely created SYS_FOREIGN tables\n");
+ "InnoDB: creation failed\n"
+ "InnoDB: tablespace is full\n"
+ "InnoDB: dropping incompletely created"
+ " SYS_FOREIGN tables\n");
row_drop_table_for_mysql("SYS_FOREIGN", trx, TRUE);
row_drop_table_for_mysql("SYS_FOREIGN_COLS", trx, TRUE);
@@ -1220,7 +1230,8 @@ dict_create_or_check_foreign_constraint_tables(void)
if (error == DB_SUCCESS) {
fprintf(stderr,
- "InnoDB: Foreign key constraint system tables created\n");
+ "InnoDB: Foreign key constraint system tables"
+ " created\n");
}
return(error);
@@ -1249,22 +1260,22 @@ dict_foreign_eval_sql(
rewind(ef);
ut_print_timestamp(ef);
fputs(" Error in foreign key constraint creation for table ",
- ef);
+ ef);
ut_print_name(ef, trx, TRUE, table->name);
fputs(".\nA foreign key constraint of name ", ef);
ut_print_name(ef, trx, FALSE, foreign->id);
fputs("\nalready exists."
- " (Note that internally InnoDB adds 'databasename/'\n"
- "in front of the user-defined constraint name).\n",
- ef);
+ " (Note that internally InnoDB adds 'databasename/'\n"
+ "in front of the user-defined constraint name).\n",
+ ef);
fputs("Note that InnoDB's FOREIGN KEY system tables store\n"
- "constraint names as case-insensitive, with the\n"
- "MySQL standard latin1_swedish_ci collation. If you\n"
- "create tables or databases whose names differ only in\n"
- "the character case, then collisions in constraint\n"
- "names can occur. Workaround: name your constraints\n"
- "explicitly with unique names.\n",
- ef);
+ "constraint names as case-insensitive, with the\n"
+ "MySQL standard latin1_swedish_ci collation. If you\n"
+ "create tables or databases whose names differ only in\n"
+ "the character case, then collisions in constraint\n"
+ "names can occur. Workaround: name your constraints\n"
+ "explicitly with unique names.\n",
+ ef);
mutex_exit(&dict_foreign_err_mutex);
@@ -1279,10 +1290,11 @@ dict_foreign_eval_sql(
mutex_enter(&dict_foreign_err_mutex);
ut_print_timestamp(ef);
fputs(" Internal error in foreign key constraint creation"
- " for table ", ef);
+ " for table ", ef);
ut_print_name(ef, trx, TRUE, table->name);
fputs(".\n"
- "See the MySQL .err log in the datadir for more information.\n", ef);
+ "See the MySQL .err log in the datadir"
+ " for more information.\n", ef);
mutex_exit(&dict_foreign_err_mutex);
return(error);
@@ -1311,18 +1323,18 @@ dict_create_add_foreign_field_to_dictionary(
pars_info_add_int4_literal(info, "pos", field_nr);
pars_info_add_str_literal(info, "for_col_name",
- foreign->foreign_col_names[field_nr]);
+ foreign->foreign_col_names[field_nr]);
pars_info_add_str_literal(info, "ref_col_name",
- foreign->referenced_col_names[field_nr]);
+ foreign->referenced_col_names[field_nr]);
- return dict_foreign_eval_sql(info,
- "PROCEDURE P () IS\n"
+ return(dict_foreign_eval_sql
+ (info, "PROCEDURE P () IS\n"
"BEGIN\n"
"INSERT INTO SYS_FOREIGN_COLS VALUES"
"(:id, :pos, :for_col_name, :ref_col_name);\n"
- "END;\n"
- , table, foreign, trx);
+ "END;\n",
+ table, foreign, trx));
}
/************************************************************************
@@ -1362,18 +1374,18 @@ dict_create_add_foreign_to_dictionary(
pars_info_add_str_literal(info, "for_name", table->name);
pars_info_add_str_literal(info, "ref_name",
- foreign->referenced_table_name);
+ foreign->referenced_table_name);
pars_info_add_int4_literal(info, "n_cols",
- foreign->n_fields + (foreign->type << 24));
+ foreign->n_fields + (foreign->type << 24));
error = dict_foreign_eval_sql(info,
- "PROCEDURE P () IS\n"
- "BEGIN\n"
- "INSERT INTO SYS_FOREIGN VALUES"
- "(:id, :for_name, :ref_name, :n_cols);\n"
- "END;\n"
- , table, foreign, trx);
+ "PROCEDURE P () IS\n"
+ "BEGIN\n"
+ "INSERT INTO SYS_FOREIGN VALUES"
+ "(:id, :for_name, :ref_name, :n_cols);\n"
+ "END;\n"
+ , table, foreign, trx);
if (error != DB_SUCCESS) {
@@ -1381,8 +1393,8 @@ dict_create_add_foreign_to_dictionary(
}
for (i = 0; i < foreign->n_fields; i++) {
- error = dict_create_add_foreign_field_to_dictionary(i,
- table, foreign, trx);
+ error = dict_create_add_foreign_field_to_dictionary
+ (i, table, foreign, trx);
if (error != DB_SUCCESS) {
@@ -1391,11 +1403,11 @@ dict_create_add_foreign_to_dictionary(
}
error = dict_foreign_eval_sql(NULL,
- "PROCEDURE P () IS\n"
- "BEGIN\n"
- "COMMIT WORK;\n"
- "END;\n"
- , table, foreign, trx);
+ "PROCEDURE P () IS\n"
+ "BEGIN\n"
+ "COMMIT WORK;\n"
+ "END;\n"
+ , table, foreign, trx);
return(error);
}
@@ -1428,7 +1440,8 @@ dict_create_add_foreigns_to_dictionary(
if (NULL == dict_table_get_low("SYS_FOREIGN")) {
fprintf(stderr,
-"InnoDB: table SYS_FOREIGN not found from internal data dictionary\n");
+ "InnoDB: table SYS_FOREIGN not found"
+ " in internal data dictionary\n");
return(DB_ERROR);
}
@@ -1437,8 +1450,8 @@ dict_create_add_foreigns_to_dictionary(
foreign;
foreign = UT_LIST_GET_NEXT(foreign_list, foreign)) {
- error = dict_create_add_foreign_to_dictionary(&number,
- table, foreign, trx);
+ error = dict_create_add_foreign_to_dictionary
+ (&number, table, foreign, trx);
if (error != DB_SUCCESS) {
diff --git a/storage/innobase/dict/dict0dict.c b/storage/innobase/dict/dict0dict.c
index 3470b19ed71..f98898a44a0 100644
--- a/storage/innobase/dict/dict0dict.c
+++ b/storage/innobase/dict/dict0dict.c
@@ -645,9 +645,9 @@ dict_index_get_nth_field_pos(
field = dict_index_get_nth_field(index, pos);
if (field->col == field2->col
- && (field->prefix_len == 0
+ && (field->prefix_len == 0
|| (field->prefix_len >= field2->prefix_len
- && field2->prefix_len != 0))) {
+ && field2->prefix_len != 0))) {
return(pos);
}
@@ -669,7 +669,7 @@ dict_table_get_on_id(
dict_table_t* table;
if (ut_dulint_cmp(table_id, DICT_FIELDS_ID) <= 0
- || trx->dict_operation_lock_mode == RW_X_LATCH) {
+ || trx->dict_operation_lock_mode == RW_X_LATCH) {
/* It is a system table which will always exist in the table
cache: we avoid acquiring the dictionary mutex, because
if we are doing a rollback to handle an error in TABLE
@@ -703,7 +703,7 @@ dict_table_get_nth_col_pos(
ulint n) /* in: column number */
{
return(dict_index_get_nth_col_pos(dict_table_get_first_index(table),
- n));
+ n));
}
/************************************************************************
@@ -768,15 +768,15 @@ dict_init(void)
mutex_create(&dict_sys->mutex, SYNC_DICT);
- dict_sys->table_hash = hash_create(buf_pool_get_max_size() /
- (DICT_POOL_PER_TABLE_HASH *
- UNIV_WORD_SIZE));
- dict_sys->table_id_hash = hash_create(buf_pool_get_max_size() /
- (DICT_POOL_PER_TABLE_HASH *
- UNIV_WORD_SIZE));
- dict_sys->col_hash = hash_create(buf_pool_get_max_size() /
- (DICT_POOL_PER_COL_HASH *
- UNIV_WORD_SIZE));
+ dict_sys->table_hash = hash_create(buf_pool_get_max_size()
+ / (DICT_POOL_PER_TABLE_HASH
+ * UNIV_WORD_SIZE));
+ dict_sys->table_id_hash = hash_create(buf_pool_get_max_size()
+ / (DICT_POOL_PER_TABLE_HASH
+ * UNIV_WORD_SIZE));
+ dict_sys->col_hash = hash_create(buf_pool_get_max_size()
+ / (DICT_POOL_PER_COL_HASH
+ * UNIV_WORD_SIZE));
dict_sys->size = 0;
UT_LIST_INIT(dict_sys->table_LRU);
@@ -883,22 +883,26 @@ dict_table_add_to_cache(
system columns. */
dict_mem_table_add_col(table, "DB_ROW_ID", DATA_SYS,
- DATA_ROW_ID | DATA_NOT_NULL, DATA_ROW_ID_LEN, 0);
+ DATA_ROW_ID | DATA_NOT_NULL,
+ DATA_ROW_ID_LEN, 0);
#if DATA_ROW_ID != 0
#error "DATA_ROW_ID != 0"
#endif
dict_mem_table_add_col(table, "DB_TRX_ID", DATA_SYS,
- DATA_TRX_ID | DATA_NOT_NULL, DATA_TRX_ID_LEN, 0);
+ DATA_TRX_ID | DATA_NOT_NULL,
+ DATA_TRX_ID_LEN, 0);
#if DATA_TRX_ID != 1
#error "DATA_TRX_ID != 1"
#endif
dict_mem_table_add_col(table, "DB_ROLL_PTR", DATA_SYS,
- DATA_ROLL_PTR | DATA_NOT_NULL, DATA_ROLL_PTR_LEN, 0);
+ DATA_ROLL_PTR | DATA_NOT_NULL,
+ DATA_ROLL_PTR_LEN, 0);
#if DATA_ROLL_PTR != 2
#error "DATA_ROLL_PTR != 2"
#endif
dict_mem_table_add_col(table, "DB_MIX_ID", DATA_SYS,
- DATA_MIX_ID | DATA_NOT_NULL, DATA_MIX_ID_LEN, 0);
+ DATA_MIX_ID | DATA_NOT_NULL,
+ DATA_MIX_ID_LEN, 0);
#if DATA_MIX_ID != 3
#error "DATA_MIX_ID != 3"
#endif
@@ -911,8 +915,8 @@ dict_table_add_to_cache(
row_len = 0;
for (i = 0; i < table->n_def; i++) {
- ulint col_len = dtype_get_max_size(
- dict_col_get_type(dict_table_get_nth_col(table, i)));
+ ulint col_len = dtype_get_max_size
+ (dict_col_get_type(dict_table_get_nth_col(table, i)));
/* If we have a single unbounded field, or several gigantic
fields, mark the maximum row size as ULINT_MAX. */
@@ -931,7 +935,7 @@ dict_table_add_to_cache(
{
dict_table_t* table2;
HASH_SEARCH(name_hash, dict_sys->table_hash, fold, table2,
- (ut_strcmp(table2->name, table->name) == 0));
+ (ut_strcmp(table2->name, table->name) == 0));
ut_a(table2 == NULL);
}
@@ -939,7 +943,7 @@ dict_table_add_to_cache(
{
dict_table_t* table2;
HASH_SEARCH(id_hash, dict_sys->table_id_hash, id_fold, table2,
- (ut_dulint_cmp(table2->id, table->id) == 0));
+ (ut_dulint_cmp(table2->id, table->id) == 0));
ut_a(table2 == NULL);
}
@@ -950,11 +954,11 @@ dict_table_add_to_cache(
/* Add table to hash table of tables */
HASH_INSERT(dict_table_t, name_hash, dict_sys->table_hash, fold,
- table);
+ table);
/* Add table to hash table of tables based on table id */
HASH_INSERT(dict_table_t, id_hash, dict_sys->table_id_hash, id_fold,
- table);
+ table);
/* Add table to LRU list of tables */
UT_LIST_ADD_FIRST(table_LRU, dict_sys->table_LRU, table);
@@ -1030,10 +1034,11 @@ dict_table_rename_in_cache(
{
dict_table_t* table2;
HASH_SEARCH(name_hash, dict_sys->table_hash, fold, table2,
- (ut_strcmp(table2->name, new_name) == 0));
+ (ut_strcmp(table2->name, new_name) == 0));
if (table2) {
fprintf(stderr,
-"InnoDB: Error: dictionary cache already contains a table of name %s\n",
+ "InnoDB: Error: dictionary cache"
+ " already contains a table of name %s\n",
new_name);
return(FALSE);
}
@@ -1045,12 +1050,14 @@ dict_table_rename_in_cache(
if (table->space != 0) {
if (table->dir_path_of_temp_table != NULL) {
fprintf(stderr,
-"InnoDB: Error: trying to rename a table %s (%s) created with CREATE\n"
-"InnoDB: TEMPORARY TABLE\n", table->name, table->dir_path_of_temp_table);
+ "InnoDB: Error: trying to rename a table"
+ " %s (%s) created with CREATE\n"
+ "InnoDB: TEMPORARY TABLE\n",
+ table->name, table->dir_path_of_temp_table);
success = FALSE;
} else {
- success = fil_rename_tablespace(table->name,
- table->space, new_name);
+ success = fil_rename_tablespace
+ (table->name, table->space, new_name);
}
if (!success) {
@@ -1064,18 +1071,19 @@ dict_table_rename_in_cache(
for (i = 0; i < table->n_cols; i++) {
dict_col_reposition_in_cache(table,
- dict_table_get_nth_col(table, i), new_name);
+ dict_table_get_nth_col(table, i),
+ new_name);
}
/* Remove table from the hash tables of tables */
HASH_DELETE(dict_table_t, name_hash, dict_sys->table_hash,
- ut_fold_string(table->name), table);
+ ut_fold_string(table->name), table);
old_name = mem_heap_strdup(table->heap, table->name);
table->name = mem_heap_strdup(table->heap, new_name);
/* Add table to hash table of tables */
HASH_INSERT(dict_table_t, name_hash, dict_sys->table_hash, fold,
- table);
+ table);
dict_sys->size += (mem_heap_get_size(table->heap) - old_size);
/* Update the table_name field in indexes */
@@ -1129,14 +1137,14 @@ dict_table_rename_in_cache(
foreign = UT_LIST_GET_FIRST(table->foreign_list);
while (foreign != NULL) {
- if (ut_strlen(foreign->foreign_table_name) <
- ut_strlen(table->name)) {
+ if (ut_strlen(foreign->foreign_table_name)
+ < ut_strlen(table->name)) {
/* Allocate a longer name buffer;
TODO: store buf len to save memory */
- foreign->foreign_table_name = mem_heap_alloc(
- foreign->heap,
- ut_strlen(table->name) + 1);
+ foreign->foreign_table_name
+ = mem_heap_alloc(foreign->heap,
+ ut_strlen(table->name) + 1);
}
strcpy(foreign->foreign_table_name, table->name);
@@ -1150,38 +1158,37 @@ dict_table_rename_in_cache(
old_id = mem_strdup(foreign->id);
if (ut_strlen(foreign->id) > ut_strlen(old_name)
- + ((sizeof dict_ibfk) - 1)
- && 0 == ut_memcmp(foreign->id, old_name,
- ut_strlen(old_name))
- && 0 == ut_memcmp(
- foreign->id + ut_strlen(old_name),
- dict_ibfk, (sizeof dict_ibfk) - 1)) {
+ + ((sizeof dict_ibfk) - 1)
+ && !memcmp(foreign->id, old_name,
+ ut_strlen(old_name))
+ && !memcmp(foreign->id + ut_strlen(old_name),
+ dict_ibfk, (sizeof dict_ibfk) - 1)) {
/* This is a generated >= 4.0.18 format id */
- if (ut_strlen(table->name) > ut_strlen(old_name)) {
- foreign->id = mem_heap_alloc(
- foreign->heap,
- ut_strlen(table->name)
- + ut_strlen(old_id) + 1);
+ if (strlen(table->name) > strlen(old_name)) {
+ foreign->id = mem_heap_alloc
+ (foreign->heap,
+ strlen(table->name)
+ + strlen(old_id) + 1);
}
/* Replace the prefix 'databasename/tablename'
with the new names */
strcpy(foreign->id, table->name);
strcat(foreign->id,
- old_id + ut_strlen(old_name));
+ old_id + ut_strlen(old_name));
} else {
/* This is a >= 4.0.18 format id where the user
gave the id name */
db_len = dict_get_db_name_len(table->name) + 1;
if (dict_get_db_name_len(table->name)
- > dict_get_db_name_len(foreign->id)) {
+ > dict_get_db_name_len(foreign->id)) {
- foreign->id = mem_heap_alloc(
- foreign->heap,
- db_len + ut_strlen(old_id) + 1);
+ foreign->id = mem_heap_alloc
+ (foreign->heap,
+ db_len + strlen(old_id) + 1);
}
/* Replace the database prefix in id with the
@@ -1190,7 +1197,7 @@ dict_table_rename_in_cache(
ut_memcpy(foreign->id, table->name, db_len);
strcpy(foreign->id + db_len,
- dict_remove_db_name(old_id));
+ dict_remove_db_name(old_id));
}
mem_free(old_id);
@@ -1202,14 +1209,13 @@ dict_table_rename_in_cache(
foreign = UT_LIST_GET_FIRST(table->referenced_list);
while (foreign != NULL) {
- if (ut_strlen(foreign->referenced_table_name) <
- ut_strlen(table->name)) {
+ if (ut_strlen(foreign->referenced_table_name)
+ < ut_strlen(table->name)) {
/* Allocate a longer name buffer;
TODO: store buf len to save memory */
- foreign->referenced_table_name = mem_heap_alloc(
- foreign->heap,
- ut_strlen(table->name) + 1);
+ foreign->referenced_table_name = mem_heap_alloc
+ (foreign->heap, strlen(table->name) + 1);
}
strcpy(foreign->referenced_table_name, table->name);
@@ -1239,12 +1245,12 @@ dict_table_change_id_in_cache(
/* Remove the table from the hash table of id's */
HASH_DELETE(dict_table_t, id_hash, dict_sys->table_id_hash,
- ut_fold_dulint(table->id), table);
+ ut_fold_dulint(table->id), table);
table->id = new_id;
/* Add the table back to the hash table */
HASH_INSERT(dict_table_t, id_hash, dict_sys->table_id_hash,
- ut_fold_dulint(table->id), table);
+ ut_fold_dulint(table->id), table);
}
/**************************************************************************
@@ -1307,9 +1313,9 @@ dict_table_remove_from_cache(
/* Remove table from the hash tables of tables */
HASH_DELETE(dict_table_t, name_hash, dict_sys->table_hash,
- ut_fold_string(table->name), table);
+ ut_fold_string(table->name), table);
HASH_DELETE(dict_table_t, id_hash, dict_sys->table_id_hash,
- ut_fold_dulint(table->id), table);
+ ut_fold_dulint(table->id), table);
/* Remove table from LRU list of tables */
UT_LIST_REMOVE(table_LRU, dict_sys->table_LRU, table);
@@ -1347,9 +1353,9 @@ dict_col_add_to_cache(
{
dict_col_t* col2;
HASH_SEARCH(hash, dict_sys->col_hash, fold, col2,
- (ut_strcmp(col->name, col2->name) == 0)
- && (ut_strcmp((col2->table)->name, table->name)
- == 0));
+ (ut_strcmp(col->name, col2->name) == 0)
+ && (ut_strcmp((col2->table)->name, table->name)
+ == 0));
ut_a(col2 == NULL);
}
@@ -1483,7 +1489,7 @@ dict_index_add_to_cache(
#endif /* UNIV_DEBUG */
ut_a(!(index->type & DICT_CLUSTERED)
- || UT_LIST_GET_LEN(table->indexes) == 0);
+ || UT_LIST_GET_LEN(table->indexes) == 0);
success = dict_index_find_cols(table, index);
@@ -1538,10 +1544,10 @@ dict_index_add_to_cache(
if (!UNIV_UNLIKELY(new_index->type & DICT_UNIVERSAL)) {
- new_index->stat_n_diff_key_vals =
- mem_heap_alloc(new_index->heap,
- (1 + dict_index_get_n_unique(new_index))
- * sizeof(ib_longlong));
+ new_index->stat_n_diff_key_vals = mem_heap_alloc
+ (new_index->heap,
+ (1 + dict_index_get_n_unique(new_index))
+ * sizeof(ib_longlong));
/* Give some sensible values to stat_n_... in case we do
not calculate statistics quickly enough */
@@ -1631,12 +1637,12 @@ dict_index_find_cols(
field = dict_index_get_nth_field(index, i);
fold = ut_fold_ulint_pair(ut_fold_string(table->name),
- ut_fold_string(field->name));
+ ut_fold_string(field->name));
HASH_SEARCH(hash, dict_sys->col_hash, fold, col,
- (ut_strcmp(col->name, field->name) == 0)
- && (ut_strcmp((col->table)->name, table->name)
- == 0));
+ (ut_strcmp(col->name, field->name) == 0)
+ && (ut_strcmp((col->table)->name, table->name)
+ == 0));
if (col == NULL) {
return(FALSE);
@@ -1729,8 +1735,8 @@ dict_index_copy_types(
for (i = 0; i < n_fields; i++) {
dfield_type = dfield_get_type(dtuple_get_nth_field(tuple, i));
- type = dict_col_get_type(dict_field_get_col(
- dict_index_get_nth_field(index, i)));
+ type = dict_col_get_type(dict_field_get_col
+ (dict_index_get_nth_field(index, i)));
*dfield_type = *type;
}
}
@@ -1776,6 +1782,7 @@ dict_index_build_internal_clust(
ulint fixed_size;
ulint trx_id_pos;
ulint i;
+ ibool* indexed;
ut_ad(table && index);
ut_ad(index->type & DICT_CLUSTERED);
@@ -1786,8 +1793,9 @@ dict_index_build_internal_clust(
/* Create a new index object with certainly enough fields */
new_index = dict_mem_index_create(table->name,
- index->name, table->space, index->type,
- index->n_fields + table->n_cols);
+ index->name, table->space,
+ index->type,
+ index->n_fields + table->n_cols);
/* Copy other relevant data from the old index struct to the new
struct: it inherits the values */
@@ -1833,20 +1841,23 @@ dict_index_build_internal_clust(
if (!(index->type & DICT_UNIQUE)) {
dict_index_add_col(new_index,
- dict_table_get_sys_col(table, DATA_ROW_ID), 0);
+ dict_table_get_sys_col
+ (table, DATA_ROW_ID), 0);
trx_id_pos++;
}
dict_index_add_col(new_index,
- dict_table_get_sys_col(table, DATA_TRX_ID), 0);
+ dict_table_get_sys_col
+ (table, DATA_TRX_ID), 0);
dict_index_add_col(new_index,
- dict_table_get_sys_col(table, DATA_ROLL_PTR), 0);
+ dict_table_get_sys_col
+ (table, DATA_ROLL_PTR), 0);
for (i = 0; i < trx_id_pos; i++) {
- fixed_size = dtype_get_fixed_size(
- dict_index_get_nth_type(new_index, i));
+ fixed_size = dtype_get_fixed_size
+ (dict_index_get_nth_type(new_index, i));
if (fixed_size == 0) {
new_index->trx_id_offset = 0;
@@ -1855,7 +1866,7 @@ dict_index_build_internal_clust(
}
if (dict_index_get_nth_field(new_index, i)->prefix_len
- > 0) {
+ > 0) {
new_index->trx_id_offset = 0;
break;
@@ -1866,12 +1877,9 @@ dict_index_build_internal_clust(
}
- /* Set auxiliary variables in table columns as undefined */
- for (i = 0; i < table->n_cols; i++) {
-
- col = dict_table_get_nth_col(table, i);
- col->aux = ULINT_UNDEFINED;
- }
+ /* Remember the table columns already contained in new_index */
+ indexed = mem_alloc(table->n_cols * sizeof *indexed);
+ memset(indexed, 0, table->n_cols * sizeof *indexed);
/* Mark with 0 the table columns already contained in new_index */
for (i = 0; i < new_index->n_def; i++) {
@@ -1883,7 +1891,7 @@ dict_index_build_internal_clust(
if (field->prefix_len == 0) {
- field->col->aux = 0;
+ indexed[field->col->ind] = TRUE;
}
}
@@ -1894,13 +1902,15 @@ dict_index_build_internal_clust(
col = dict_table_get_nth_col(table, i);
ut_ad(col->type.mtype != DATA_SYS);
- if (col->aux == ULINT_UNDEFINED) {
+ if (!indexed[col->ind]) {
dict_index_add_col(new_index, col, 0);
}
}
+ mem_free(indexed);
+
ut_ad((index->type & DICT_IBUF)
- || (UT_LIST_GET_LEN(table->indexes) == 0));
+ || (UT_LIST_GET_LEN(table->indexes) == 0));
/* Store to the column structs the position of the table columns
in the clustered index */
@@ -1936,6 +1946,7 @@ dict_index_build_internal_non_clust(
dict_index_t* new_index;
dict_index_t* clust_index;
ulint i;
+ ibool* indexed;
ut_ad(table && index);
ut_ad(0 == (index->type & DICT_CLUSTERED));
@@ -1952,9 +1963,9 @@ dict_index_build_internal_non_clust(
ut_ad(!(clust_index->type & DICT_UNIVERSAL));
/* Create a new index */
- new_index = dict_mem_index_create(table->name,
- index->name, index->space, index->type,
- index->n_fields + 1 + clust_index->n_uniq);
+ new_index = dict_mem_index_create
+ (table->name, index->name, index->space, index->type,
+ index->n_fields + 1 + clust_index->n_uniq);
/* Copy other relevant data from the old index
struct to the new struct: it inherits the values */
@@ -1966,13 +1977,9 @@ dict_index_build_internal_non_clust(
/* Copy fields from index to new_index */
dict_index_copy(new_index, index, 0, index->n_fields);
- /* Set the auxiliary variables in the clust_index unique columns
- as undefined */
- for (i = 0; i < clust_index->n_uniq; i++) {
-
- field = dict_index_get_nth_field(clust_index, i);
- field->col->aux = ULINT_UNDEFINED;
- }
+ /* Remember the table columns already contained in new_index */
+ indexed = mem_alloc(table->n_cols * sizeof *indexed);
+ memset(indexed, 0, table->n_cols * sizeof *indexed);
/* Mark with 0 table columns already contained in new_index */
for (i = 0; i < new_index->n_def; i++) {
@@ -1984,7 +1991,7 @@ dict_index_build_internal_non_clust(
if (field->prefix_len == 0) {
- field->col->aux = 0;
+ indexed[field->col->ind] = TRUE;
}
}
@@ -1995,12 +2002,14 @@ dict_index_build_internal_non_clust(
field = dict_index_get_nth_field(clust_index, i);
- if (field->col->aux == ULINT_UNDEFINED) {
+ if (!indexed[field->col->ind]) {
dict_index_add_col(new_index, field->col,
- field->prefix_len);
+ field->prefix_len);
}
}
+ mem_free(indexed);
+
if ((index->type) & DICT_UNIQUE) {
new_index->n_uniq = index->n_fields;
} else {
@@ -2063,12 +2072,14 @@ dict_foreign_remove_from_cache(
if (foreign->referenced_table) {
UT_LIST_REMOVE(referenced_list,
- foreign->referenced_table->referenced_list, foreign);
+ foreign->referenced_table->referenced_list,
+ foreign);
}
if (foreign->foreign_table) {
UT_LIST_REMOVE(foreign_list,
- foreign->foreign_table->foreign_list, foreign);
+ foreign->foreign_table->foreign_list,
+ foreign);
}
dict_foreign_free(foreign);
@@ -2130,9 +2141,9 @@ dict_foreign_find_index(
ulint n_cols, /* in: number of columns */
dict_index_t* types_idx, /* in: NULL or an index to whose types the
column types must match */
- ibool check_charsets) /* in: whether to check charsets.
- only has an effect if types_idx !=
- NULL. */
+ ibool check_charsets)
+ /* in: whether to check charsets.
+ only has an effect if types_idx != NULL */
{
dict_index_t* index;
const char* col_name;
@@ -2145,9 +2156,9 @@ dict_foreign_find_index(
for (i = 0; i < n_cols; i++) {
col_name = dict_index_get_nth_field(index, i)
- ->col->name;
+ ->col->name;
if (dict_index_get_nth_field(index, i)
- ->prefix_len != 0) {
+ ->prefix_len != 0) {
/* We do not accept column prefix
indexes here */
@@ -2155,14 +2166,14 @@ dict_foreign_find_index(
}
if (0 != innobase_strcasecmp(columns[i],
- col_name)) {
+ col_name)) {
break;
}
- if (types_idx && !cmp_types_are_equal(
- dict_index_get_nth_type(index, i),
- dict_index_get_nth_type(types_idx, i),
- check_charsets)) {
+ if (types_idx && !cmp_types_are_equal
+ (dict_index_get_nth_type(index, i),
+ dict_index_get_nth_type(types_idx, i),
+ check_charsets)) {
break;
}
@@ -2216,9 +2227,10 @@ dict_foreign_error_report(
fputs("The index in the foreign key in table is ", file);
ut_print_name(file, NULL, FALSE, fk->foreign_index->name);
fputs("\n"
-"See http://dev.mysql.com/doc/refman/5.1/en/innodb-foreign-key-constraints.html\n"
-"for correct foreign key definition.\n",
- file);
+ "See http://dev.mysql.com/doc/refman/5.1/en/"
+ "innodb-foreign-key-constraints.html\n"
+ "for correct foreign key definition.\n",
+ file);
}
mutex_exit(&dict_foreign_err_mutex);
}
@@ -2248,11 +2260,11 @@ dict_foreign_add_to_cache(
ut_ad(mutex_own(&(dict_sys->mutex)));
#endif /* UNIV_SYNC_DEBUG */
- for_table = dict_table_check_if_in_cache_low(
- foreign->foreign_table_name);
+ for_table = dict_table_check_if_in_cache_low
+ (foreign->foreign_table_name);
- ref_table = dict_table_check_if_in_cache_low(
- foreign->referenced_table_name);
+ ref_table = dict_table_check_if_in_cache_low
+ (foreign->referenced_table_name);
ut_a(for_table || ref_table);
if (for_table) {
@@ -2271,16 +2283,21 @@ dict_foreign_add_to_cache(
}
if (for_in_cache->referenced_table == NULL && ref_table) {
- index = dict_foreign_find_index(ref_table,
- (const char**) for_in_cache->referenced_col_names,
- for_in_cache->n_fields,
- for_in_cache->foreign_index, check_charsets);
+ index = dict_foreign_find_index
+ (ref_table,
+ (const char**) for_in_cache->referenced_col_names,
+ for_in_cache->n_fields,
+ for_in_cache->foreign_index, check_charsets);
if (index == NULL) {
- dict_foreign_error_report(ef, for_in_cache,
-"there is no index in referenced table which would contain\n"
-"the columns as the first columns, or the data types in the\n"
-"referenced table do not match to the ones in table.");
+ dict_foreign_error_report
+ (ef, for_in_cache,
+ "there is no index in referenced table"
+ " which would contain\n"
+ "the columns as the first columns,"
+ " or the data types in the\n"
+ "referenced table do not match"
+ " the ones in table.");
if (for_in_cache == foreign) {
mem_heap_free(foreign->heap);
@@ -2292,28 +2309,34 @@ dict_foreign_add_to_cache(
for_in_cache->referenced_table = ref_table;
for_in_cache->referenced_index = index;
UT_LIST_ADD_LAST(referenced_list,
- ref_table->referenced_list,
- for_in_cache);
+ ref_table->referenced_list,
+ for_in_cache);
added_to_referenced_list = TRUE;
}
if (for_in_cache->foreign_table == NULL && for_table) {
- index = dict_foreign_find_index(for_table,
- (const char**) for_in_cache->foreign_col_names,
- for_in_cache->n_fields,
- for_in_cache->referenced_index, check_charsets);
+ index = dict_foreign_find_index
+ (for_table,
+ (const char**) for_in_cache->foreign_col_names,
+ for_in_cache->n_fields,
+ for_in_cache->referenced_index, check_charsets);
if (index == NULL) {
- dict_foreign_error_report(ef, for_in_cache,
-"there is no index in the table which would contain\n"
-"the columns as the first columns, or the data types in the\n"
-"table do not match to the ones in the referenced table.");
+ dict_foreign_error_report
+ (ef, for_in_cache,
+ "there is no index in the table"
+ " which would contain\n"
+ "the columns as the first columns,"
+ " or the data types in the\n"
+ "table do not match"
+ " the ones in the referenced table.");
if (for_in_cache == foreign) {
if (added_to_referenced_list) {
- UT_LIST_REMOVE(referenced_list,
- ref_table->referenced_list,
- for_in_cache);
+ UT_LIST_REMOVE
+ (referenced_list,
+ ref_table->referenced_list,
+ for_in_cache);
}
mem_heap_free(foreign->heap);
@@ -2325,8 +2348,8 @@ dict_foreign_add_to_cache(
for_in_cache->foreign_table = for_table;
for_in_cache->foreign_index = index;
UT_LIST_ADD_LAST(foreign_list,
- for_table->foreign_list,
- for_in_cache);
+ for_table->foreign_list,
+ for_in_cache);
}
return(DB_SUCCESS);
@@ -2361,13 +2384,13 @@ dict_scan_to(
ulint i;
for (i = 0; string[i]; i++) {
if (toupper((int)(unsigned char)(ptr[i]))
- != toupper((int)(unsigned char)
- (string[i]))) {
+ != toupper((int)(unsigned char)
+ (string[i]))) {
goto nomatch;
}
}
break;
- nomatch:
+nomatch:
;
}
}
@@ -2473,8 +2496,8 @@ dict_scan_id(
}
} else {
while (!my_isspace(cs, *ptr) && *ptr != '(' && *ptr != ')'
- && (accept_also_dot || *ptr != '.')
- && *ptr != ',' && *ptr != '\0') {
+ && (accept_also_dot || *ptr != '.')
+ && *ptr != ',' && *ptr != '\0') {
ptr++;
}
@@ -2513,7 +2536,7 @@ convert_id:
innobase_convert_from_id(dst, str, len);
} else if (!strncmp(str, srv_mysql50_table_name_prefix,
- sizeof srv_mysql50_table_name_prefix)) {
+ sizeof srv_mysql50_table_name_prefix)) {
/* This is a pre-5.1 table name
containing chars other than [A-Za-z0-9].
Discard the prefix and use raw UTF-8 encoding. */
@@ -2634,9 +2657,9 @@ dict_scan_table_name(
earlier, we must allow the dot separator between the database
name and the table name also to appear within a quoted
identifier! InnoDB used to print a constraint as:
- ... REFERENCES `databasename.tablename` ...
+ ... REFERENCES `databasename.tablename` ...
starting from 4.0.18 it is
- ... REFERENCES `databasename`.`tablename` ... */
+ ... REFERENCES `databasename`.`tablename` ... */
const char* s;
for (s = scan_name; *s; s++) {
@@ -2753,15 +2776,15 @@ scan_more:
/* Starting quote: remember the quote character. */
quote = *sptr;
} else if (*sptr == '#'
- || (sptr[0] == '-' && sptr[1] == '-' &&
- sptr[2] == ' ')) {
+ || (sptr[0] == '-' && sptr[1] == '-'
+ && sptr[2] == ' ')) {
for (;;) {
/* In Unix a newline is 0x0A while in Windows
it is 0x0D followed by 0x0A */
if (*sptr == (char)0x0A
- || *sptr == (char)0x0D
- || *sptr == '\0') {
+ || *sptr == (char)0x0D
+ || *sptr == '\0') {
goto scan_more;
}
@@ -2818,14 +2841,15 @@ dict_table_get_highest_foreign_id(
while (foreign) {
if (ut_strlen(foreign->id) > ((sizeof dict_ibfk) - 1) + len
- && 0 == ut_memcmp(foreign->id, table->name, len)
- && 0 == ut_memcmp(foreign->id + len,
- dict_ibfk, (sizeof dict_ibfk) - 1)
- && foreign->id[len + ((sizeof dict_ibfk) - 1)] != '0') {
+ && 0 == ut_memcmp(foreign->id, table->name, len)
+ && 0 == ut_memcmp(foreign->id + len,
+ dict_ibfk, (sizeof dict_ibfk) - 1)
+ && foreign->id[len + ((sizeof dict_ibfk) - 1)] != '0') {
/* It is of the >= 4.0.18 format */
- id = strtoul(foreign->id + len + ((sizeof dict_ibfk) - 1),
- &endp, 10);
+ id = strtoul(foreign->id + len
+ + ((sizeof dict_ibfk) - 1),
+ &endp, 10);
if (*endp == '\0') {
ut_a(id != biggest_id);
@@ -2923,8 +2947,9 @@ dict_create_foreign_constraints_low(
mutex_enter(&dict_foreign_err_mutex);
dict_foreign_error_report_low(ef, name);
fprintf(ef,
-"Cannot find the table in the internal data dictionary of InnoDB.\n"
-"Create table statement:\n%s\n", sql_string);
+ "Cannot find the table in the internal"
+ " data dictionary of InnoDB.\n"
+ "Create table statement:\n%s\n", sql_string);
mutex_exit(&dict_foreign_err_mutex);
return(DB_ERROR);
@@ -2950,10 +2975,12 @@ dict_create_foreign_constraints_low(
/* We are doing an ALTER TABLE: scan the table name we are altering */
ptr = dict_scan_table_name(cs, ptr, &table_to_alter, name,
- &success, heap, &referenced_table_name);
+ &success, heap, &referenced_table_name);
if (!success) {
fprintf(stderr,
-"InnoDB: Error: could not find the table being ALTERED in:\n%s\n", sql_string);
+ "InnoDB: Error: could not find"
+ " the table being ALTERED in:\n%s\n",
+ sql_string);
return(DB_ERROR);
}
@@ -2970,8 +2997,8 @@ dict_create_foreign_constraints_low(
if (table_to_alter == NULL) {
highest_id_so_far = 0;
} else {
- highest_id_so_far = dict_table_get_highest_foreign_id(
- table_to_alter);
+ highest_id_so_far = dict_table_get_highest_foreign_id
+ (table_to_alter);
}
/* Scan for foreign key declarations in a loop */
@@ -3004,7 +3031,7 @@ loop:
/* read constraint name unless got "CONSTRAINT FOREIGN" */
if (ptr != ptr2) {
ptr = dict_scan_id(cs, ptr, heap,
- &constraint_name, FALSE, FALSE);
+ &constraint_name, FALSE, FALSE);
}
} else {
ptr = ptr2;
@@ -3012,12 +3039,12 @@ loop:
if (*ptr == '\0') {
/* The proper way to reject foreign keys for temporary
- tables would be to split the lexing and syntactical
- analysis of foreign key clauses from the actual adding
- of them, so that ha_innodb.cc could first parse the SQL
- command, determine if there are any foreign keys, and
- if so, immediately reject the command if the table is a
- temporary one. For now, this kludge will work. */
+ tables would be to split the lexing and syntactical
+ analysis of foreign key clauses from the actual adding
+ of them, so that ha_innodb.cc could first parse the SQL
+ command, determine if there are any foreign keys, and
+ if so, immediately reject the command if the table is a
+ temporary one. For now, this kludge will work. */
if (reject_fks && (UT_LIST_GET_LEN(table->foreign_list) > 0)) {
return(DB_CANNOT_ADD_CONSTRAINT);
@@ -3027,8 +3054,8 @@ loop:
/* The following call adds the foreign key constraints
to the data dictionary system tables on disk */
- error = dict_create_add_foreigns_to_dictionary(
- highest_id_so_far, table, trx);
+ error = dict_create_add_foreigns_to_dictionary
+ (highest_id_so_far, table, trx);
return(error);
}
@@ -3058,8 +3085,8 @@ loop:
ptr = dict_skip_word(cs, ptr, &success);
if (!success) {
- dict_foreign_report_syntax_err(name,
- start_of_latest_foreign, ptr);
+ dict_foreign_report_syntax_err
+ (name, start_of_latest_foreign, ptr);
return(DB_CANNOT_ADD_CONSTRAINT);
}
@@ -3080,12 +3107,12 @@ loop:
col_loop1:
ut_a(i < (sizeof column_names) / sizeof *column_names);
ptr = dict_scan_col(cs, ptr, &success, table, columns + i,
- heap, column_names + i);
+ heap, column_names + i);
if (!success) {
mutex_enter(&dict_foreign_err_mutex);
dict_foreign_error_report_low(ef, name);
fprintf(ef, "%s:\nCannot resolve column name close to:\n%s\n",
- start_of_latest_foreign, ptr);
+ start_of_latest_foreign, ptr);
mutex_exit(&dict_foreign_err_mutex);
return(DB_CANNOT_ADD_CONSTRAINT);
@@ -3102,8 +3129,8 @@ col_loop1:
ptr = dict_accept(cs, ptr, ")", &success);
if (!success) {
- dict_foreign_report_syntax_err(name, start_of_latest_foreign,
- ptr);
+ dict_foreign_report_syntax_err
+ (name, start_of_latest_foreign, ptr);
return(DB_CANNOT_ADD_CONSTRAINT);
}
@@ -3118,9 +3145,10 @@ col_loop1:
fputs("There is no index in table ", ef);
ut_print_name(ef, NULL, TRUE, name);
fprintf(ef, " where the columns appear\n"
-"as the first columns. Constraint:\n%s\n"
-"See http://dev.mysql.com/doc/refman/5.1/en/innodb-foreign-key-constraints.html\n"
-"for correct foreign key definition.\n",
+ "as the first columns. Constraint:\n%s\n"
+ "See http://dev.mysql.com/doc/refman/5.1/en/"
+ "innodb-foreign-key-constraints.html\n"
+ "for correct foreign key definition.\n",
start_of_latest_foreign);
mutex_exit(&dict_foreign_err_mutex);
@@ -3129,8 +3157,8 @@ col_loop1:
ptr = dict_accept(cs, ptr, "REFERENCES", &success);
if (!success || !my_isspace(cs, *ptr)) {
- dict_foreign_report_syntax_err(name, start_of_latest_foreign,
- ptr);
+ dict_foreign_report_syntax_err
+ (name, start_of_latest_foreign, ptr);
return(DB_CANNOT_ADD_CONSTRAINT);
}
@@ -3148,8 +3176,8 @@ col_loop1:
db_len = dict_get_db_name_len(table->name);
- foreign->id = mem_heap_alloc(foreign->heap,
- db_len + strlen(constraint_name) + 2);
+ foreign->id = mem_heap_alloc
+ (foreign->heap, db_len + strlen(constraint_name) + 2);
ut_memcpy(foreign->id, table->name, db_len);
foreign->id[db_len] = '/';
@@ -3158,18 +3186,18 @@ col_loop1:
foreign->foreign_table = table;
foreign->foreign_table_name = mem_heap_strdup(foreign->heap,
- table->name);
+ table->name);
foreign->foreign_index = index;
foreign->n_fields = i;
foreign->foreign_col_names = mem_heap_alloc(foreign->heap,
- i * sizeof(void*));
+ i * sizeof(void*));
for (i = 0; i < foreign->n_fields; i++) {
- foreign->foreign_col_names[i] =
- mem_heap_strdup(foreign->heap, columns[i]->name);
+ foreign->foreign_col_names[i] = mem_heap_strdup
+ (foreign->heap, columns[i]->name);
}
ptr = dict_scan_table_name(cs, ptr, &referenced_table, name,
- &success, heap, &referenced_table_name);
+ &success, heap, &referenced_table_name);
/* Note that referenced_table can be NULL if the user has suppressed
checking of foreign key constraints! */
@@ -3192,7 +3220,7 @@ col_loop1:
if (!success) {
dict_foreign_free(foreign);
dict_foreign_report_syntax_err(name, start_of_latest_foreign,
- ptr);
+ ptr);
return(DB_CANNOT_ADD_CONSTRAINT);
}
@@ -3201,7 +3229,7 @@ col_loop1:
col_loop2:
ptr = dict_scan_col(cs, ptr, &success, referenced_table, columns + i,
- heap, column_names + i);
+ heap, column_names + i);
i++;
if (!success) {
@@ -3229,7 +3257,7 @@ col_loop2:
dict_foreign_free(foreign);
dict_foreign_report_syntax_err(name, start_of_latest_foreign,
- ptr);
+ ptr);
return(DB_CANNOT_ADD_CONSTRAINT);
}
@@ -3254,8 +3282,8 @@ scan_on_conditions:
if (!success) {
dict_foreign_free(foreign);
- dict_foreign_report_syntax_err(name,
- start_of_latest_foreign, ptr);
+ dict_foreign_report_syntax_err
+ (name, start_of_latest_foreign, ptr);
return(DB_CANNOT_ADD_CONSTRAINT);
}
@@ -3291,8 +3319,8 @@ scan_on_conditions:
if (!success) {
dict_foreign_free(foreign);
- dict_foreign_report_syntax_err(name,
- start_of_latest_foreign, ptr);
+ dict_foreign_report_syntax_err
+ (name, start_of_latest_foreign, ptr);
return(DB_CANNOT_ADD_CONSTRAINT);
}
@@ -3311,7 +3339,7 @@ scan_on_conditions:
if (!success) {
dict_foreign_free(foreign);
dict_foreign_report_syntax_err(name, start_of_latest_foreign,
- ptr);
+ ptr);
return(DB_CANNOT_ADD_CONSTRAINT);
}
@@ -3320,14 +3348,14 @@ scan_on_conditions:
if (!success) {
dict_foreign_free(foreign);
dict_foreign_report_syntax_err(name, start_of_latest_foreign,
- ptr);
+ ptr);
return(DB_CANNOT_ADD_CONSTRAINT);
}
for (j = 0; j < foreign->n_fields; j++) {
- if ((dict_index_get_nth_type(
- foreign->foreign_index, j)->prtype)
- & DATA_NOT_NULL) {
+ if ((dict_index_get_nth_type
+ (foreign->foreign_index, j)->prtype)
+ & DATA_NOT_NULL) {
/* It is not sensible to define SET NULL
if the column is not allowed to be NULL! */
@@ -3337,8 +3365,10 @@ scan_on_conditions:
mutex_enter(&dict_foreign_err_mutex);
dict_foreign_error_report_low(ef, name);
fprintf(ef, "%s:\n"
- "You have defined a SET NULL condition though some of the\n"
- "columns are defined as NOT NULL.\n", start_of_latest_foreign);
+ "You have defined a SET NULL condition"
+ " though some of the\n"
+ "columns are defined as NOT NULL.\n",
+ start_of_latest_foreign);
mutex_exit(&dict_foreign_err_mutex);
return(DB_CANNOT_ADD_CONSTRAINT);
@@ -3362,7 +3392,8 @@ try_find_index:
mutex_enter(&dict_foreign_err_mutex);
dict_foreign_error_report_low(ef, name);
fprintf(ef, "%s:\n"
-"You have twice an ON DELETE clause or twice an ON UPDATE clause.\n",
+ "You have twice an ON DELETE clause"
+ " or twice an ON UPDATE clause.\n",
start_of_latest_foreign);
mutex_exit(&dict_foreign_err_mutex);
@@ -3375,20 +3406,28 @@ try_find_index:
if (referenced_table) {
index = dict_foreign_find_index(referenced_table,
- column_names, i, foreign->foreign_index, TRUE);
+ column_names, i,
+ foreign->foreign_index, TRUE);
if (!index) {
dict_foreign_free(foreign);
mutex_enter(&dict_foreign_err_mutex);
dict_foreign_error_report_low(ef, name);
fprintf(ef, "%s:\n"
-"Cannot find an index in the referenced table where the\n"
-"referenced columns appear as the first columns, or column types\n"
-"in the table and the referenced table do not match for constraint.\n"
-"Note that the internal storage type of ENUM and SET changed in\n"
-"tables created with >= InnoDB-4.1.12, and such columns in old tables\n"
-"cannot be referenced by such columns in new tables.\n"
-"See http://dev.mysql.com/doc/refman/5.1/en/innodb-foreign-key-constraints.html\n"
-"for correct foreign key definition.\n",
+ "Cannot find an index in the"
+ " referenced table where the\n"
+ "referenced columns appear as the"
+ " first columns, or column types\n"
+ "in the table and the referenced table"
+ " do not match for constraint.\n"
+ "Note that the internal storage type of"
+ " ENUM and SET changed in\n"
+ "tables created with >= InnoDB-4.1.12,"
+ " and such columns in old tables\n"
+ "cannot be referenced by such columns"
+ " in new tables.\n"
+ "See http://dev.mysql.com/doc/refman/5.1/en/"
+ "innodb-foreign-key-constraints.html\n"
+ "for correct foreign key definition.\n",
start_of_latest_foreign);
mutex_exit(&dict_foreign_err_mutex);
@@ -3402,11 +3441,11 @@ try_find_index:
foreign->referenced_index = index;
foreign->referenced_table = referenced_table;
- foreign->referenced_table_name = mem_heap_strdup(foreign->heap,
- referenced_table_name);
+ foreign->referenced_table_name
+ = mem_heap_strdup(foreign->heap, referenced_table_name);
foreign->referenced_col_names = mem_heap_alloc(foreign->heap,
- i * sizeof(void*));
+ i * sizeof(void*));
for (i = 0; i < foreign->n_fields; i++) {
foreign->referenced_col_names[i]
= mem_heap_strdup(foreign->heap, column_names[i]);
@@ -3418,8 +3457,8 @@ try_find_index:
if (referenced_table) {
UT_LIST_ADD_LAST(referenced_list,
- referenced_table->referenced_list,
- foreign);
+ referenced_table->referenced_list,
+ foreign);
}
goto loop;
@@ -3480,9 +3519,9 @@ dict_create_foreign_constraints(
str = dict_strip_comments(sql_string);
heap = mem_heap_create(10000);
- err = dict_create_foreign_constraints_low(trx, heap,
- innobase_get_charset(trx->mysql_thd),
- str, name, reject_fks);
+ err = dict_create_foreign_constraints_low
+ (trx, heap, innobase_get_charset(trx->mysql_thd),
+ str, name, reject_fks);
mem_heap_free(heap);
mem_free(str);
@@ -3578,9 +3617,9 @@ loop:
while (foreign != NULL) {
if (0 == strcmp(foreign->id, id)
- || (strchr(foreign->id, '/')
- && 0 == strcmp(id,
- dict_remove_db_name(foreign->id)))) {
+ || (strchr(foreign->id, '/')
+ && 0 == strcmp(id,
+ dict_remove_db_name(foreign->id)))) {
/* Found */
break;
}
@@ -3592,11 +3631,11 @@ loop:
mutex_enter(&dict_foreign_err_mutex);
rewind(ef);
ut_print_timestamp(ef);
- fputs(
- " Error in dropping of a foreign key constraint of table ", ef);
+ fputs(" Error in dropping of a foreign key constraint"
+ " of table ", ef);
ut_print_name(ef, NULL, TRUE, table->name);
fputs(",\n"
- "in SQL command\n", ef);
+ "in SQL command\n", ef);
fputs(str, ef);
fputs("\nCannot find a constraint with the given id ", ef);
ut_print_name(ef, NULL, FALSE, id);
@@ -3614,8 +3653,8 @@ syntax_error:
mutex_enter(&dict_foreign_err_mutex);
rewind(ef);
ut_print_timestamp(ef);
- fputs(
- " Syntax error in dropping of a foreign key constraint of table ", ef);
+ fputs(" Syntax error in dropping of a"
+ " foreign key constraint of table ", ef);
ut_print_name(ef, NULL, TRUE, table->name);
fprintf(ef, ",\n"
"close to:\n%s\n in SQL command\n%s\n", ptr, str);
@@ -3735,7 +3774,7 @@ dict_tree_check_search_tuple(
ut_a(index);
ut_a(dtuple_get_n_fields_cmp(tuple)
- <= dict_index_get_n_unique_in_tree(index));
+ <= dict_index_get_n_unique_in_tree(index));
return(TRUE);
}
#endif /* UNIV_DEBUG */
@@ -3802,8 +3841,8 @@ dict_tree_build_node_ptr(
dtype_set(dfield_get_type(field), DATA_SYS_CHILD, DATA_NOT_NULL, 4, 0);
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);
+ dtuple_set_info_bits(tuple, dtuple_get_info_bits(tuple)
+ | REC_STATUS_NODE_PTR);
ut_ad(dtuple_check_typed(tuple));
@@ -3860,7 +3899,7 @@ dict_tree_build_data_tuple(
ind = tree->tree_index;
ut_ad(dict_table_is_comp(ind->table)
- || n_fields <= rec_get_n_fields_old(rec));
+ || n_fields <= rec_get_n_fields_old(rec));
tuple = dtuple_create(heap, n_fields);
@@ -3940,8 +3979,10 @@ dict_update_statistics_low(
ut_print_timestamp(stderr);
fprintf(stderr,
" InnoDB: cannot calculate statistics for table %s\n"
-"InnoDB: because the .ibd file is missing. For help, please refer to\n"
-"InnoDB: http://dev.mysql.com/doc/refman/5.1/en/innodb-troubleshooting.html\n",
+ "InnoDB: because the .ibd file is missing. For help,"
+ " please refer to\n"
+ "InnoDB: http://dev.mysql.com/doc/refman/5.1/en/"
+ "innodb-troubleshooting.html\n",
table->name);
return;
@@ -3989,13 +4030,13 @@ dict_update_statistics_low(
index = dict_table_get_first_index(table);
- table->stat_n_rows = index->stat_n_diff_key_vals[
- dict_index_get_n_unique(index)];
+ table->stat_n_rows = index->stat_n_diff_key_vals
+ [dict_index_get_n_unique(index)];
table->stat_clustered_index_size = index->stat_index_size;
table->stat_sum_of_other_index_sizes = sum_of_index_sizes
- - index->stat_index_size;
+ - index->stat_index_size;
table->stat_initialized = TRUE;
@@ -4110,15 +4151,16 @@ dict_table_print_low(
dict_update_statistics_low(table, TRUE);
fprintf(stderr,
-"--------------------------------------\n"
-"TABLE: name %s, id %lu %lu, columns %lu, indexes %lu, appr.rows %lu\n"
-" COLUMNS: ",
- table->name,
- (ulong) ut_dulint_get_high(table->id),
- (ulong) ut_dulint_get_low(table->id),
- (ulong) table->n_cols,
- (ulong) UT_LIST_GET_LEN(table->indexes),
- (ulong) table->stat_n_rows);
+ "--------------------------------------\n"
+ "TABLE: name %s, id %lu %lu, columns %lu, indexes %lu,"
+ " appr.rows %lu\n"
+ " COLUMNS: ",
+ table->name,
+ (ulong) ut_dulint_get_high(table->id),
+ (ulong) ut_dulint_get_low(table->id),
+ (ulong) table->n_cols,
+ (ulong) UT_LIST_GET_LEN(table->indexes),
+ (ulong) table->stat_n_rows);
for (i = 0; i < table->n_cols - 1; i++) {
dict_col_print_low(dict_table_get_nth_col(table, i));
@@ -4188,14 +4230,15 @@ dict_index_print_low(
tree = index->tree;
if (index->n_user_defined_cols > 0) {
- n_vals = index->stat_n_diff_key_vals[
- index->n_user_defined_cols];
+ n_vals = index->stat_n_diff_key_vals
+ [index->n_user_defined_cols];
} else {
n_vals = index->stat_n_diff_key_vals[1];
}
fprintf(stderr,
- " INDEX: name %s, id %lu %lu, fields %lu/%lu, uniq %lu, type %lu\n"
+ " INDEX: name %s, id %lu %lu, fields %lu/%lu,"
+ " uniq %lu, type %lu\n"
" root page %lu, appr.key vals %lu,"
" leaf pages %lu, size pages %lu\n"
" FIELDS: ",
@@ -4260,7 +4303,7 @@ dict_print_info_on_foreign_key_in_create_format(
if (strchr(foreign->id, '/')) {
/* Strip the preceding database name from the constraint id */
stripped_id = foreign->id + 1
- + dict_get_db_name_len(foreign->id);
+ + dict_get_db_name_len(foreign->id);
} else {
stripped_id = foreign->id;
}
@@ -4290,10 +4333,10 @@ dict_print_info_on_foreign_key_in_create_format(
fputs(") REFERENCES ", file);
if (dict_tables_have_same_db(foreign->foreign_table_name,
- foreign->referenced_table_name)) {
+ foreign->referenced_table_name)) {
/* Do not print the database name of the referenced table */
- ut_print_name(file, trx, TRUE, dict_remove_db_name(
- foreign->referenced_table_name));
+ ut_print_name(file, trx, TRUE, dict_remove_db_name
+ (foreign->referenced_table_name));
} else {
/* Look for the '/' in the table name */
@@ -4303,10 +4346,10 @@ dict_print_info_on_foreign_key_in_create_format(
}
ut_print_namel(file, trx, TRUE,
- foreign->referenced_table_name, i);
+ foreign->referenced_table_name, i);
putc('.', file);
ut_print_name(file, trx, TRUE,
- foreign->referenced_table_name + i + 1);
+ foreign->referenced_table_name + i + 1);
}
putc(' ', file);
@@ -4314,7 +4357,7 @@ dict_print_info_on_foreign_key_in_create_format(
for (i = 0;;) {
ut_print_name(file, trx, FALSE,
- foreign->referenced_col_names[i]);
+ foreign->referenced_col_names[i]);
if (++i < foreign->n_fields) {
fputs(", ", file);
} else {
@@ -4377,8 +4420,8 @@ dict_print_info_on_foreign_keys(
while (foreign != NULL) {
if (create_table_format) {
- dict_print_info_on_foreign_key_in_create_format(
- file, trx, foreign, TRUE);
+ dict_print_info_on_foreign_key_in_create_format
+ (file, trx, foreign, TRUE);
} else {
ulint i;
fputs("; (", file);
@@ -4389,12 +4432,12 @@ dict_print_info_on_foreign_keys(
}
ut_print_name(file, trx, FALSE,
- foreign->foreign_col_names[i]);
+ foreign->foreign_col_names[i]);
}
fputs(") REFER ", file);
ut_print_name(file, trx, TRUE,
- foreign->referenced_table_name);
+ foreign->referenced_table_name);
putc('(', file);
for (i = 0; i < foreign->n_fields; i++) {
@@ -4402,7 +4445,8 @@ dict_print_info_on_foreign_keys(
putc(' ', file);
}
ut_print_name(file, trx, FALSE,
- foreign->referenced_col_names[i]);
+ foreign->referenced_col_names
+ [i]);
}
putc(')', file);
diff --git a/storage/innobase/dict/dict0load.c b/storage/innobase/dict/dict0load.c
index 58900d85f67..bc393140a6f 100644
--- a/storage/innobase/dict/dict0load.c
+++ b/storage/innobase/dict/dict0load.c
@@ -67,7 +67,7 @@ dict_get_first_table_name_in_db(
dict_index_copy_types(tuple, sys_index, 1);
btr_pcur_open_on_user_rec(sys_index, tuple, PAGE_CUR_GE,
- BTR_SEARCH_LEAF, &pcur, &mtr);
+ BTR_SEARCH_LEAF, &pcur, &mtr);
loop:
rec = btr_pcur_get_rec(&pcur);
@@ -84,7 +84,7 @@ loop:
field = rec_get_nth_field_old(rec, 0, &len);
if (len < strlen(name)
- || ut_memcmp(name, field, strlen(name)) != 0) {
+ || ut_memcmp(name, field, strlen(name)) != 0) {
/* Not found */
btr_pcur_close(&pcur);
@@ -144,7 +144,7 @@ dict_print(void)
sys_index = UT_LIST_GET_FIRST(sys_tables->indexes);
btr_pcur_open_at_index_side(TRUE, sys_index, BTR_SEARCH_LEAF, &pcur,
- TRUE, &mtr);
+ TRUE, &mtr);
loop:
btr_pcur_move_to_next_user_rec(&pcur, &mtr);
@@ -238,7 +238,7 @@ dict_check_tablespaces_and_store_max_id(
ut_a(!dict_table_is_comp(sys_tables));
btr_pcur_open_at_index_side(TRUE, sys_index, BTR_SEARCH_LEAF, &pcur,
- TRUE, &mtr);
+ TRUE, &mtr);
loop:
btr_pcur_move_to_next_user_rec(&pcur, &mtr);
@@ -254,7 +254,7 @@ loop:
known space id */
/* printf("Biggest space id in data dictionary %lu\n",
- max_space_id); */
+ max_space_id); */
fil_set_max_space_id_if_bigger(max_space_id);
mutex_exit(&(dict_sys->mutex));
@@ -284,7 +284,7 @@ loop:
exists; print a warning to the .err log if not */
fil_space_for_table_exists_in_mem(space_id, name,
- FALSE, TRUE, TRUE);
+ FALSE, TRUE, TRUE);
}
if (space_id != 0 && !in_crash_recovery) {
@@ -292,7 +292,7 @@ loop:
object and check that the .ibd file exists. */
fil_open_single_table_tablespace(FALSE, space_id,
- name);
+ name);
}
mem_free(name);
@@ -355,7 +355,7 @@ dict_load_columns(
dict_index_copy_types(tuple, sys_index, 1);
btr_pcur_open_on_user_rec(sys_index, tuple, PAGE_CUR_GE,
- BTR_SEARCH_LEAF, &pcur, &mtr);
+ BTR_SEARCH_LEAF, &pcur, &mtr);
for (i = 0; i < table->n_cols - DATA_N_SYS_COLS; i++) {
rec = btr_pcur_get_rec(&pcur);
@@ -372,9 +372,8 @@ dict_load_columns(
ut_ad(len == 4);
ut_a(i == mach_read_from_4(field));
- ut_a(0 == ut_strcmp("NAME",
- dict_field_get_col(
- dict_index_get_nth_field(sys_index, 4))->name));
+ ut_a(!strcmp("NAME", dict_field_get_col
+ (dict_index_get_nth_field(sys_index, 4))->name));
field = rec_get_nth_field_old(rec, 4, &len);
name = mem_heap_strdupl(heap, (char*) field, len);
@@ -386,36 +385,37 @@ dict_load_columns(
prtype = mach_read_from_4(field);
if (dtype_get_charset_coll(prtype) == 0
- && dtype_is_string_type(mtype)) {
+ && dtype_is_string_type(mtype)) {
/* The table was created with < 4.1.2. */
if (dtype_is_binary_string_type(mtype, prtype)) {
/* Use the binary collation for
string columns of binary type. */
- prtype = dtype_form_prtype(prtype,
- DATA_MYSQL_BINARY_CHARSET_COLL);
+ prtype = dtype_form_prtype
+ (prtype,
+ DATA_MYSQL_BINARY_CHARSET_COLL);
} else {
/* Use the default charset for
other than binary columns. */
- prtype = dtype_form_prtype(prtype,
- data_mysql_default_charset_coll);
+ prtype = dtype_form_prtype
+ (prtype,
+ data_mysql_default_charset_coll);
}
}
field = rec_get_nth_field_old(rec, 7, &len);
col_len = mach_read_from_4(field);
- ut_a(0 == ut_strcmp("PREC",
- dict_field_get_col(
- dict_index_get_nth_field(sys_index, 8))->name));
+ ut_a(!strcmp("PREC", dict_field_get_col
+ (dict_index_get_nth_field(sys_index, 8))->name));
field = rec_get_nth_field_old(rec, 8, &len);
prec = mach_read_from_4(field);
dict_mem_table_add_col(table, name, mtype, prtype, col_len,
- prec);
+ prec);
btr_pcur_move_to_next_user_rec(&pcur, &mtr);
}
@@ -488,7 +488,7 @@ dict_load_fields(
dict_index_copy_types(tuple, sys_index, 1);
btr_pcur_open_on_user_rec(sys_index, tuple, PAGE_CUR_GE,
- BTR_SEARCH_LEAF, &pcur, &mtr);
+ BTR_SEARCH_LEAF, &pcur, &mtr);
for (i = 0; i < index->n_fields; i++) {
rec = btr_pcur_get_rec(&pcur);
@@ -516,24 +516,24 @@ dict_load_fields(
pos_and_prefix_len = mach_read_from_4(field);
ut_a((pos_and_prefix_len & 0xFFFFUL) == i
- || (pos_and_prefix_len & 0xFFFF0000UL) == (i << 16));
+ || (pos_and_prefix_len & 0xFFFF0000UL) == (i << 16));
if ((i == 0 && pos_and_prefix_len > 0)
- || (pos_and_prefix_len & 0xFFFF0000UL) > 0) {
+ || (pos_and_prefix_len & 0xFFFF0000UL) > 0) {
prefix_len = pos_and_prefix_len & 0xFFFFUL;
} else {
prefix_len = 0;
}
- ut_a(0 == ut_strcmp("COL_NAME",
- dict_field_get_col(
- dict_index_get_nth_field(sys_index, 4))->name));
+ ut_a(!strcmp("COL_NAME", dict_field_get_col
+ (dict_index_get_nth_field(sys_index, 4))->name));
field = rec_get_nth_field_old(rec, 4, &len);
- dict_mem_index_add_field(index,
- mem_heap_strdupl(heap, (char*) field, len), prefix_len);
+ dict_mem_index_add_field(index, mem_heap_strdupl
+ (heap, (char*) field, len),
+ prefix_len);
btr_pcur_move_to_next_user_rec(&pcur, &mtr);
}
@@ -579,7 +579,7 @@ dict_load_indexes(
#endif /* UNIV_SYNC_DEBUG */
if ((ut_dulint_get_high(table->id) == 0)
- && (ut_dulint_get_low(table->id) < DICT_HDR_FIRST_ID)) {
+ && (ut_dulint_get_low(table->id) < DICT_HDR_FIRST_ID)) {
is_sys_table = TRUE;
} else {
is_sys_table = FALSE;
@@ -601,7 +601,7 @@ dict_load_indexes(
dict_index_copy_types(tuple, sys_index, 1);
btr_pcur_open_on_user_rec(sys_index, tuple, PAGE_CUR_GE,
- BTR_SEARCH_LEAF, &pcur, &mtr);
+ BTR_SEARCH_LEAF, &pcur, &mtr);
for (;;) {
if (!btr_pcur_is_on_user_rec(&pcur, &mtr)) {
@@ -619,7 +619,7 @@ dict_load_indexes(
if (rec_get_deleted_flag(rec, 0)) {
dict_load_report_deleted_index(table->name,
- ULINT_UNDEFINED);
+ ULINT_UNDEFINED);
btr_pcur_close(&pcur);
mtr_commit(&mtr);
@@ -631,9 +631,8 @@ dict_load_indexes(
ut_ad(len == 8);
id = mach_read_from_8(field);
- ut_a(0 == ut_strcmp("NAME",
- dict_field_get_col(
- dict_index_get_nth_field(sys_index, 4))->name));
+ ut_a(!strcmp("NAME", dict_field_get_col
+ (dict_index_get_nth_field(sys_index, 4))->name));
field = rec_get_nth_field_old(rec, 4, &name_len);
name_buf = mem_heap_strdupl(heap, (char*) field, name_len);
@@ -647,9 +646,8 @@ dict_load_indexes(
field = rec_get_nth_field_old(rec, 7, &len);
space = mach_read_from_4(field);
- ut_a(0 == ut_strcmp("PAGE_NO",
- dict_field_get_col(
- dict_index_get_nth_field(sys_index, 8))->name));
+ ut_a(!strcmp("PAGE_NO", dict_field_get_col
+ (dict_index_get_nth_field(sys_index, 8))->name));
field = rec_get_nth_field_old(rec, 8, &len);
page_no = mach_read_from_4(field);
@@ -657,8 +655,9 @@ dict_load_indexes(
if (page_no == FIL_NULL) {
fprintf(stderr,
- "InnoDB: Error: trying to load index %s for table %s\n"
- "InnoDB: but the index tree has been freed!\n",
+ "InnoDB: Error: trying to load index %s"
+ " for table %s\n"
+ "InnoDB: but the index tree has been freed!\n",
name_buf, table->name);
btr_pcur_close(&pcur);
@@ -668,11 +667,13 @@ dict_load_indexes(
}
if ((type & DICT_CLUSTERED) == 0
- && NULL == dict_table_get_first_index(table)) {
+ && NULL == dict_table_get_first_index(table)) {
fprintf(stderr,
- "InnoDB: Error: trying to load index %s for table %s\n"
- "InnoDB: but the first index is not clustered!\n",
+ "InnoDB: Error: trying to load index %s"
+ " for table %s\n"
+ "InnoDB: but the first index"
+ " is not clustered!\n",
name_buf, table->name);
btr_pcur_close(&pcur);
@@ -682,17 +683,17 @@ dict_load_indexes(
}
if (is_sys_table
- && ((type & DICT_CLUSTERED)
+ && ((type & DICT_CLUSTERED)
|| ((table == dict_sys->sys_tables)
- && (name_len == (sizeof "ID_IND") - 1)
- && (0 == ut_memcmp(name_buf, "ID_IND",
- name_len))))) {
+ && (name_len == (sizeof "ID_IND") - 1)
+ && (0 == ut_memcmp(name_buf, "ID_IND",
+ name_len))))) {
/* The index was created in memory already at booting
of the database server */
} else {
index = dict_mem_index_create(table->name, name_buf,
- space, type, n_fields);
+ space, type, n_fields);
index->id = id;
dict_load_fields(table, index, heap);
@@ -762,13 +763,13 @@ dict_load_table(
dict_index_copy_types(tuple, sys_index, 1);
btr_pcur_open_on_user_rec(sys_index, tuple, PAGE_CUR_GE,
- BTR_SEARCH_LEAF, &pcur, &mtr);
+ BTR_SEARCH_LEAF, &pcur, &mtr);
rec = btr_pcur_get_rec(&pcur);
if (!btr_pcur_is_on_user_rec(&pcur, &mtr)
- || rec_get_deleted_flag(rec, 0)) {
+ || rec_get_deleted_flag(rec, 0)) {
/* Not found */
- err_exit:
+err_exit:
btr_pcur_close(&pcur);
mtr_commit(&mtr);
mem_heap_free(heap);
@@ -784,9 +785,8 @@ dict_load_table(
goto err_exit;
}
- ut_a(0 == ut_strcmp("SPACE",
- dict_field_get_col(
- dict_index_get_nth_field(sys_index, 9))->name));
+ ut_a(!strcmp("SPACE", dict_field_get_col
+ (dict_index_get_nth_field(sys_index, 9))->name));
field = rec_get_nth_field_old(rec, 9, &len);
space = mach_read_from_4(field);
@@ -794,7 +794,7 @@ dict_load_table(
/* Check if the tablespace exists and has the right name */
if (space != 0) {
if (fil_space_for_table_exists_in_mem(space, name, FALSE,
- FALSE, FALSE)) {
+ FALSE, FALSE)) {
/* Ok; (if we did a crash recovery then the tablespace
can already be in the memory cache) */
} else {
@@ -804,12 +804,13 @@ dict_load_table(
ut_print_timestamp(stderr);
fprintf(stderr,
-" InnoDB: error: space object of table %s,\n"
-"InnoDB: space id %lu did not exist in memory. Retrying an open.\n",
- name, (ulong)space);
+ " InnoDB: error: space object of table %s,\n"
+ "InnoDB: space id %lu did not exist in memory."
+ " Retrying an open.\n",
+ name, (ulong)space);
/* Try to open the tablespace */
if (!fil_open_single_table_tablespace(TRUE,
- space, name)) {
+ space, name)) {
/* We failed to find a sensible tablespace
file */
@@ -818,9 +819,8 @@ dict_load_table(
}
}
- ut_a(0 == ut_strcmp("N_COLS",
- dict_field_get_col(
- dict_index_get_nth_field(sys_index, 4))->name));
+ ut_a(!strcmp("N_COLS", dict_field_get_col
+ (dict_index_get_nth_field(sys_index, 4))->name));
field = rec_get_nth_field_old(rec, 4, &len);
n_cols = mach_read_from_4(field);
@@ -833,13 +833,12 @@ dict_load_table(
}
table = dict_mem_table_create(name, space, n_cols & ~0x80000000UL,
- flags);
+ flags);
table->ibd_file_missing = ibd_file_missing;
- ut_a(0 == ut_strcmp("ID",
- dict_field_get_col(
- dict_index_get_nth_field(sys_index, 3))->name));
+ ut_a(!strcmp("ID", dict_field_get_col
+ (dict_index_get_nth_field(sys_index, 3))->name));
field = rec_get_nth_field_old(rec, 3, &len);
table->id = mach_read_from_8(field);
@@ -863,7 +862,7 @@ dict_load_table(
dict_load_indexes(table, heap);
err = dict_load_foreigns(table->name, TRUE);
-/*
+#if 0
if (err != DB_SUCCESS) {
mutex_enter(&dict_foreign_err_mutex);
@@ -871,16 +870,22 @@ dict_load_table(
ut_print_timestamp(stderr);
fprintf(stderr,
-" InnoDB: Error: could not make a foreign key definition to match\n"
-"InnoDB: the foreign key table or the referenced table!\n"
-"InnoDB: The data dictionary of InnoDB is corrupt. You may need to drop\n"
-"InnoDB: and recreate the foreign key table or the referenced table.\n"
-"InnoDB: Submit a detailed bug report to http://bugs.mysql.com\n"
-"InnoDB: Latest foreign key error printout:\n%s\n", dict_foreign_err_buf);
+ " InnoDB: Error: could not make a foreign key"
+ " definition to match\n"
+ "InnoDB: the foreign key table"
+ " or the referenced table!\n"
+ "InnoDB: The data dictionary of InnoDB is corrupt."
+ " You may need to drop\n"
+ "InnoDB: and recreate the foreign key table"
+ " or the referenced table.\n"
+ "InnoDB: Submit a detailed bug report"
+ " to http://bugs.mysql.com\n"
+ "InnoDB: Latest foreign key error printout:\n%s\n",
+ dict_foreign_err_buf);
mutex_exit(&dict_foreign_err_mutex);
}
-*/
+#endif /* 0 */
mem_heap_free(heap);
return(table);
@@ -920,8 +925,8 @@ dict_load_table_on_id(
/*---------------------------------------------------*/
/* Get the secondary index based on ID for table SYS_TABLES */
sys_tables = dict_sys->sys_tables;
- sys_table_ids = dict_table_get_next_index(
- dict_table_get_first_index(sys_tables));
+ sys_table_ids = dict_table_get_next_index
+ (dict_table_get_first_index(sys_tables));
ut_a(!dict_table_is_comp(sys_tables));
heap = mem_heap_create(256);
@@ -935,11 +940,11 @@ dict_load_table_on_id(
dict_index_copy_types(tuple, sys_table_ids, 1);
btr_pcur_open_on_user_rec(sys_table_ids, tuple, PAGE_CUR_GE,
- BTR_SEARCH_LEAF, &pcur, &mtr);
+ BTR_SEARCH_LEAF, &pcur, &mtr);
rec = btr_pcur_get_rec(&pcur);
if (!btr_pcur_is_on_user_rec(&pcur, &mtr)
- || rec_get_deleted_flag(rec, 0)) {
+ || rec_get_deleted_flag(rec, 0)) {
/* Not found */
btr_pcur_close(&pcur);
@@ -1008,8 +1013,8 @@ static
void
dict_load_foreign_cols(
/*===================*/
- const char* id, /* in: foreign constraint id as a null-
- terminated string */
+ const char* id, /* in: foreign constraint id as a
+ null-terminated string */
dict_foreign_t* foreign)/* in: foreign constraint object */
{
dict_table_t* sys_foreign_cols;
@@ -1027,11 +1032,11 @@ dict_load_foreign_cols(
ut_ad(mutex_own(&(dict_sys->mutex)));
#endif /* UNIV_SYNC_DEBUG */
- foreign->foreign_col_names = mem_heap_alloc(foreign->heap,
- foreign->n_fields * sizeof(void*));
+ foreign->foreign_col_names = mem_heap_alloc
+ (foreign->heap, foreign->n_fields * sizeof(void*));
- foreign->referenced_col_names = mem_heap_alloc(foreign->heap,
- foreign->n_fields * sizeof(void*));
+ foreign->referenced_col_names = mem_heap_alloc
+ (foreign->heap, foreign->n_fields * sizeof(void*));
mtr_start(&mtr);
sys_foreign_cols = dict_table_get_low("SYS_FOREIGN_COLS");
@@ -1045,7 +1050,7 @@ dict_load_foreign_cols(
dict_index_copy_types(tuple, sys_index, 1);
btr_pcur_open_on_user_rec(sys_index, tuple, PAGE_CUR_GE,
- BTR_SEARCH_LEAF, &pcur, &mtr);
+ BTR_SEARCH_LEAF, &pcur, &mtr);
for (i = 0; i < foreign->n_fields; i++) {
rec = btr_pcur_get_rec(&pcur);
@@ -1062,12 +1067,12 @@ dict_load_foreign_cols(
ut_a(i == mach_read_from_4(field));
field = rec_get_nth_field_old(rec, 4, &len);
- foreign->foreign_col_names[i] =
- mem_heap_strdupl(foreign->heap, (char*) field, len);
+ foreign->foreign_col_names[i] = mem_heap_strdupl
+ (foreign->heap, (char*) field, len);
field = rec_get_nth_field_old(rec, 5, &len);
- foreign->referenced_col_names[i] =
- mem_heap_strdupl(foreign->heap, (char*) field, len);
+ foreign->referenced_col_names[i] = mem_heap_strdupl
+ (foreign->heap, (char*) field, len);
btr_pcur_move_to_next_user_rec(&pcur, &mtr);
}
@@ -1085,7 +1090,8 @@ dict_load_foreign(
/* out: DB_SUCCESS or error code */
const char* id, /* in: foreign constraint id as a
null-terminated string */
- ibool check_charsets)/* in: TRUE=check charset compatibility */
+ ibool check_charsets)
+ /* in: TRUE=check charset compatibility */
{
dict_foreign_t* foreign;
dict_table_t* sys_foreign;
@@ -1118,11 +1124,11 @@ dict_load_foreign(
dict_index_copy_types(tuple, sys_index, 1);
btr_pcur_open_on_user_rec(sys_index, tuple, PAGE_CUR_GE,
- BTR_SEARCH_LEAF, &pcur, &mtr);
+ BTR_SEARCH_LEAF, &pcur, &mtr);
rec = btr_pcur_get_rec(&pcur);
if (!btr_pcur_is_on_user_rec(&pcur, &mtr)
- || rec_get_deleted_flag(rec, 0)) {
+ || rec_get_deleted_flag(rec, 0)) {
/* Not found */
fprintf(stderr,
@@ -1159,8 +1165,8 @@ dict_load_foreign(
foreign = dict_mem_foreign_create();
- foreign->n_fields =
- mach_read_from_4(rec_get_nth_field_old(rec, 5, &len));
+ foreign->n_fields = mach_read_from_4
+ (rec_get_nth_field_old(rec, 5, &len));
ut_a(len == 4);
@@ -1172,12 +1178,12 @@ dict_load_foreign(
foreign->id = mem_heap_strdup(foreign->heap, id);
field = rec_get_nth_field_old(rec, 3, &len);
- foreign->foreign_table_name =
- mem_heap_strdupl(foreign->heap, (char*) field, len);
+ foreign->foreign_table_name = mem_heap_strdupl
+ (foreign->heap, (char*) field, len);
field = rec_get_nth_field_old(rec, 4, &len);
- foreign->referenced_table_name =
- mem_heap_strdupl(foreign->heap, (char*) field, len);
+ foreign->referenced_table_name = mem_heap_strdupl
+ (foreign->heap, (char*) field, len);
btr_pcur_close(&pcur);
mtr_commit(&mtr);
@@ -1239,7 +1245,8 @@ dict_load_foreigns(
/* No foreign keys defined yet in this database */
fprintf(stderr,
- "InnoDB: Error: no foreign key system tables in the database\n");
+ "InnoDB: Error: no foreign key system tables"
+ " in the database\n");
return(DB_ERROR);
}
@@ -1250,8 +1257,8 @@ dict_load_foreigns(
/* Get the secondary index based on FOR_NAME from table
SYS_FOREIGN */
- sec_index = dict_table_get_next_index(
- dict_table_get_first_index(sys_foreign));
+ sec_index = dict_table_get_next_index
+ (dict_table_get_first_index(sys_foreign));
start_load:
heap = mem_heap_create(256);
@@ -1262,7 +1269,7 @@ start_load:
dict_index_copy_types(tuple, sec_index, 1);
btr_pcur_open_on_user_rec(sec_index, tuple, PAGE_CUR_GE,
- BTR_SEARCH_LEAF, &pcur, &mtr);
+ BTR_SEARCH_LEAF, &pcur, &mtr);
loop:
rec = btr_pcur_get_rec(&pcur);
@@ -1283,8 +1290,8 @@ loop:
charset-collation, in a case-insensitive way. */
if (0 != cmp_data_data(dfield_get_type(dfield),
- dfield_get_data(dfield), dfield_get_len(dfield),
- field, len)) {
+ dfield_get_data(dfield), dfield_get_len(dfield),
+ field, len)) {
goto load_next_index;
}
diff --git a/storage/innobase/dict/dict0mem.c b/storage/innobase/dict/dict0mem.c
index 42bf39078d1..a6a42dd0411 100644
--- a/storage/innobase/dict/dict0mem.c
+++ b/storage/innobase/dict/dict0mem.c
@@ -65,7 +65,7 @@ dict_mem_table_create(
table->cached = FALSE;
table->cols = mem_heap_alloc(heap, (n_cols + DATA_N_SYS_COLS)
- * sizeof(dict_col_t));
+ * sizeof(dict_col_t));
UT_LIST_INIT(table->indexes);
table->auto_inc_lock = mem_heap_alloc(heap, lock_get_size());
@@ -177,9 +177,9 @@ dict_mem_index_create(
index->n_def = index->n_nullable = 0;
index->n_fields = n_fields;
index->fields = mem_heap_alloc(heap, 1 + n_fields
- * sizeof(dict_field_t));
- /* The '1 +' above prevents allocation
- of an empty mem block */
+ * sizeof(dict_field_t));
+ /* The '1 +' above prevents allocation
+ of an empty mem block */
index->stat_n_diff_key_vals = NULL;
index->cached = FALSE;
diff --git a/storage/innobase/eval/eval0eval.c b/storage/innobase/eval/eval0eval.c
index 79f889a39ee..18408832e91 100644
--- a/storage/innobase/eval/eval0eval.c
+++ b/storage/innobase/eval/eval0eval.c
@@ -44,7 +44,7 @@ eval_node_alloc_val_buf(
byte* data;
ut_ad(que_node_get_type(node) == QUE_NODE_SYMBOL
- || que_node_get_type(node) == QUE_NODE_FUNC);
+ || que_node_get_type(node) == QUE_NODE_FUNC);
dfield = que_node_get_val(node);
@@ -81,7 +81,7 @@ eval_node_free_val_buf(
byte* data;
ut_ad(que_node_get_type(node) == QUE_NODE_SYMBOL
- || que_node_get_type(node) == QUE_NODE_FUNC);
+ || que_node_get_type(node) == QUE_NODE_FUNC);
dfield = que_node_get_val(node);
@@ -115,7 +115,7 @@ eval_cmp(
arg2 = que_node_get_next(arg1);
res = cmp_dfield_dfield(que_node_get_val(arg1),
- que_node_get_val(arg2));
+ que_node_get_val(arg2));
val = TRUE;
func = cmp_node->func;
@@ -317,7 +317,7 @@ eval_predefined_2(
if (!eval_node_get_ibool_val(arg1)) {
fputs("SQL assertion fails in a stored procedure!\n",
- stderr);
+ stderr);
}
ut_a(eval_node_get_ibool_val(arg1));
@@ -333,10 +333,10 @@ eval_predefined_2(
ut_ad(len2 >= len1);
if (len2 > len1) {
- int_val = (lint)(len1 +
- (eval_rnd % (len2 - len1 + 1)));
+ int_val = (lint) (len1
+ + (eval_rnd % (len2 - len1 + 1)));
} else {
- int_val = (lint)len1;
+ int_val = (lint) len1;
}
eval_rnd = ut_rnd_gen_next_ulint(eval_rnd);
@@ -385,7 +385,7 @@ eval_notfound(
if (cursor->token_type == SYM_LIT) {
ut_ad(ut_memcmp(dfield_get_data(que_node_get_val(cursor)),
- "SQL", 3) == 0);
+ "SQL", 3) == 0);
sel_node = cursor->sym_table->query_graph->last_sel_node;
} else {
@@ -466,7 +466,7 @@ eval_replstr(
len2 = (ulint)eval_node_get_int_val(arg4);
if ((dfield_get_len(que_node_get_val(arg1)) < len1 + len2)
- || (dfield_get_len(que_node_get_val(arg2)) < len2)) {
+ || (dfield_get_len(que_node_get_val(arg2)) < len2)) {
ut_error;
}
@@ -741,19 +741,20 @@ eval_predefined(
uint_val = (ulint) int_val;
}
for (tmp = int_len; uint_val > 0; uint_val /= 10) {
- data[--tmp] = (byte) ('0' + (byte)(uint_val % 10));
+ data[--tmp] = (byte)
+ ('0' + (byte)(uint_val % 10));
}
}
dfield_set_len((dfield_t*) que_node_get_val(func_node),
- int_len);
+ int_len);
return;
} else if (func == PARS_TO_NUMBER_TOKEN) {
int_val = atoi((char*)
- dfield_get_data(que_node_get_val(arg1)));
+ dfield_get_data(que_node_get_val(arg1)));
} else if (func == PARS_SYSDATE_TOKEN) {
int_val = (lint)ut_time();
@@ -793,9 +794,9 @@ eval_func(
values, except for eval_cmp and notfound */
if ((dfield_get_len(que_node_get_val(arg)) == UNIV_SQL_NULL)
- && (class != PARS_FUNC_CMP)
- && (func != PARS_NOTFOUND_TOKEN)
- && (func != PARS_PRINTF_TOKEN)) {
+ && (class != PARS_FUNC_CMP)
+ && (func != PARS_NOTFOUND_TOKEN)
+ && (func != PARS_PRINTF_TOKEN)) {
ut_error;
}
diff --git a/storage/innobase/eval/eval0proc.c b/storage/innobase/eval/eval0proc.c
index 96b8ef75955..3b3a42d56ef 100644
--- a/storage/innobase/eval/eval0proc.c
+++ b/storage/innobase/eval/eval0proc.c
@@ -51,7 +51,8 @@ if_step(
for (;;) {
eval_exp(elsif_node->cond);
- if (eval_node_get_ibool_val(elsif_node->cond)) {
+ if (eval_node_get_ibool_val
+ (elsif_node->cond)) {
/* The condition evaluated to TRUE:
start execution from the first
@@ -104,7 +105,7 @@ while_step(
ut_ad(que_node_get_type(node) == QUE_NODE_WHILE);
ut_ad((thr->prev_node == que_node_get_parent(node))
- || (que_node_get_next(thr->prev_node) == NULL));
+ || (que_node_get_next(thr->prev_node) == NULL));
/* Evaluate the condition */
@@ -192,8 +193,8 @@ for_step(
loop_var_value = eval_node_get_int_val(node->loop_start_limit);
- node->loop_end_value = eval_node_get_int_val(
- node->loop_end_limit);
+ node->loop_end_value
+ = eval_node_get_int_val(node->loop_end_limit);
}
/* Check if we should do another loop */
diff --git a/storage/innobase/fil/fil0fil.c b/storage/innobase/fil/fil0fil.c
index 722ffc12743..e0a9955f8fb 100644
--- a/storage/innobase/fil/fil0fil.c
+++ b/storage/innobase/fil/fil0fil.c
@@ -470,8 +470,8 @@ fil_node_create(
if (!space) {
ut_print_timestamp(stderr);
fprintf(stderr,
-" InnoDB: Error: Could not find tablespace %lu for\n"
-"InnoDB: file ", (ulong) id);
+ " InnoDB: Error: Could not find tablespace %lu for\n"
+ "InnoDB: file ", (ulong) id);
ut_print_filename(stderr, name);
fputs(" in the tablespace memory cache.\n", stderr);
mem_free(node->name);
@@ -529,9 +529,9 @@ fil_node_open_file(
os_file_read() in Windows to read from a file opened for
async I/O! */
- node->handle = os_file_create_simple_no_error_handling(
- node->name, OS_FILE_OPEN,
- OS_FILE_READ_ONLY, &success);
+ node->handle = os_file_create_simple_no_error_handling
+ (node->name,
+ OS_FILE_OPEN, OS_FILE_READ_ONLY, &success);
if (!success) {
/* The following call prints an error message */
os_file_get_last_error(TRUE);
@@ -539,8 +539,9 @@ fil_node_open_file(
ut_print_timestamp(stderr);
fprintf(stderr,
-" InnoDB: Fatal error: cannot open %s\n."
-"InnoDB: Have you deleted .ibd files under a running mysqld server?\n",
+ " InnoDB: Fatal error: cannot open %s\n."
+ "InnoDB: Have you deleted .ibd files"
+ " under a running mysqld server?\n",
node->name);
ut_a(0);
}
@@ -548,7 +549,7 @@ fil_node_open_file(
os_file_get_size(node->handle, &size_low, &size_high);
size_bytes = (((ib_longlong)size_high) << 32)
- + (ib_longlong)size_low;
+ + (ib_longlong)size_low;
#ifdef UNIV_HOTBACKUP
node->size = (ulint) (size_bytes / UNIV_PAGE_SIZE);
@@ -558,10 +559,15 @@ fil_node_open_file(
if (size_bytes < FIL_IBD_FILE_INITIAL_SIZE * UNIV_PAGE_SIZE) {
fprintf(stderr,
-"InnoDB: Error: the size of single-table tablespace file %s\n"
-"InnoDB: is only %lu %lu, should be at least %lu!\n", node->name,
- (ulong) size_high,
- (ulong) size_low, (ulong) (4 * UNIV_PAGE_SIZE));
+ "InnoDB: Error: the size of single-table"
+ " tablespace file %s\n"
+ "InnoDB: is only %lu %lu,"
+ " should be at least %lu!\n",
+ node->name,
+ (ulong) size_high,
+ (ulong) size_low,
+ (ulong) (FIL_IBD_FILE_INITIAL_SIZE
+ * UNIV_PAGE_SIZE));
ut_a(0);
}
@@ -574,7 +580,7 @@ fil_node_open_file(
page = ut_align(buf2, UNIV_PAGE_SIZE);
success = os_file_read(node->handle, page, 0, 0,
- UNIV_PAGE_SIZE);
+ UNIV_PAGE_SIZE);
space_id = fsp_header_get_space_id(page);
ut_free(buf2);
@@ -585,24 +591,27 @@ fil_node_open_file(
if (space_id == ULINT_UNDEFINED || space_id == 0) {
fprintf(stderr,
-"InnoDB: Error: tablespace id %lu in file %s is not sensible\n",
- (ulong) space_id,
- node->name);
+ "InnoDB: Error: tablespace id %lu"
+ " in file %s is not sensible\n",
+ (ulong) space_id, node->name);
ut_a(0);
}
if (space_id != space->id) {
fprintf(stderr,
-"InnoDB: Error: tablespace id is %lu in the data dictionary\n"
-"InnoDB: but in file %s it is %lu!\n", space->id, node->name, space_id);
+ "InnoDB: Error: tablespace id is %lu"
+ " in the data dictionary\n"
+ "InnoDB: but in file %s it is %lu!\n",
+ space->id, node->name, space_id);
ut_a(0);
}
if (size_bytes >= FSP_EXTENT_SIZE * UNIV_PAGE_SIZE) {
- node->size = (ulint) ((size_bytes / (1024 * 1024))
- * ((1024 * 1024) / UNIV_PAGE_SIZE));
+ node->size = (ulint)
+ ((size_bytes / (1024 * 1024))
+ * ((1024 * 1024) / UNIV_PAGE_SIZE));
} else {
node->size = (ulint) (size_bytes / UNIV_PAGE_SIZE);
}
@@ -618,14 +627,14 @@ fil_node_open_file(
if (space->purpose == FIL_LOG) {
node->handle = os_file_create(node->name, OS_FILE_OPEN,
- OS_FILE_AIO, OS_LOG_FILE, &ret);
+ OS_FILE_AIO, OS_LOG_FILE, &ret);
} else if (node->is_raw_disk) {
node->handle = os_file_create(node->name,
- OS_FILE_OPEN_RAW,
- OS_FILE_AIO, OS_DATA_FILE, &ret);
+ OS_FILE_OPEN_RAW,
+ OS_FILE_AIO, OS_DATA_FILE, &ret);
} else {
node->handle = os_file_create(node->name, OS_FILE_OPEN,
- OS_FILE_AIO, OS_DATA_FILE, &ret);
+ OS_FILE_AIO, OS_DATA_FILE, &ret);
}
ut_a(ret);
@@ -704,12 +713,13 @@ fil_try_to_close_file_in_LRU(
if (print_info) {
fprintf(stderr,
-"InnoDB: fil_sys open file LRU len %lu\n", (ulong) UT_LIST_GET_LEN(system->LRU));
+ "InnoDB: fil_sys open file LRU len %lu\n",
+ (ulong) UT_LIST_GET_LEN(system->LRU));
}
while (node != NULL) {
if (node->modification_counter == node->flush_counter
- && node->n_pending_flushes == 0) {
+ && node->n_pending_flushes == 0) {
fil_node_close_file(node, system);
@@ -724,7 +734,7 @@ fil_try_to_close_file_in_LRU(
}
if (print_info
- && node->modification_counter != node->flush_counter) {
+ && node->modification_counter != node->flush_counter) {
fputs("InnoDB: cannot close file ", stderr);
ut_print_filename(stderr, node->name);
fprintf(stderr,
@@ -778,7 +788,7 @@ retry:
}
HASH_SEARCH(hash, system->spaces, space_id, space,
- space->id == space_id);
+ space->id == space_id);
if (space != NULL && space->stop_ios) {
/* We are going to do a rename file and want to stop new i/o's
for a while */
@@ -831,10 +841,13 @@ close_more:
if (count >= 2) {
ut_print_timestamp(stderr);
fprintf(stderr,
-" InnoDB: Warning: too many (%lu) files stay open while the maximum\n"
-"InnoDB: allowed value would be %lu.\n"
-"InnoDB: You may need to raise the value of innodb_max_files_open in\n"
-"InnoDB: my.cnf.\n", (ulong) system->n_open, (ulong) system->max_n_open);
+ " InnoDB: Warning: too many (%lu) files stay open"
+ " while the maximum\n"
+ "InnoDB: allowed value would be %lu.\n"
+ "InnoDB: You may need to raise the value of"
+ " innodb_max_files_open in\n"
+ "InnoDB: my.cnf.\n",
+ (ulong) system->n_open, (ulong) system->max_n_open);
return;
}
@@ -882,13 +895,13 @@ fil_node_free(
node->modification_counter = node->flush_counter;
if (space->is_in_unflushed_spaces
- && fil_space_is_flushed(space)) {
+ && fil_space_is_flushed(space)) {
space->is_in_unflushed_spaces = FALSE;
UT_LIST_REMOVE(unflushed_spaces,
- system->unflushed_spaces,
- space);
+ system->unflushed_spaces,
+ space);
}
fil_node_close_file(node, system);
@@ -955,7 +968,7 @@ fil_space_create(
try_again:
/*printf(
"InnoDB: Adding tablespace %lu of name %s, purpose %lu\n", id, name,
- purpose);*/
+ purpose);*/
ut_a(system);
ut_a(name);
@@ -963,16 +976,18 @@ try_again:
mutex_enter(&(system->mutex));
HASH_SEARCH(name_hash, system->name_hash, ut_fold_string(name), space,
- 0 == strcmp(name, space->name));
+ 0 == strcmp(name, space->name));
if (space != NULL) {
ut_print_timestamp(stderr);
fprintf(stderr,
-" InnoDB: Warning: trying to init to the tablespace memory cache\n"
-"InnoDB: a tablespace %lu of name ", (ulong) id);
+ " InnoDB: Warning: trying to init to the"
+ " tablespace memory cache\n"
+ "InnoDB: a tablespace %lu of name ", (ulong) id);
ut_print_filename(stderr, name);
fprintf(stderr, ",\n"
-"InnoDB: but a tablespace %lu of the same name\n"
-"InnoDB: already exists in the tablespace memory cache!\n",
+ "InnoDB: but a tablespace %lu of the same name\n"
+ "InnoDB: already exists in the"
+ " tablespace memory cache!\n",
(ulong) space->id);
if (id == 0 || purpose != FIL_TABLESPACE) {
@@ -983,13 +998,19 @@ try_again:
}
fprintf(stderr,
-"InnoDB: We assume that InnoDB did a crash recovery, and you had\n"
-"InnoDB: an .ibd file for which the table did not exist in the\n"
-"InnoDB: InnoDB internal data dictionary in the ibdata files.\n"
-"InnoDB: We assume that you later removed the .ibd and .frm files,\n"
-"InnoDB: and are now trying to recreate the table. We now remove the\n"
-"InnoDB: conflicting tablespace object from the memory cache and try\n"
-"InnoDB: the init again.\n");
+ "InnoDB: We assume that InnoDB did a crash recovery,"
+ " and you had\n"
+ "InnoDB: an .ibd file for which the table"
+ " did not exist in the\n"
+ "InnoDB: InnoDB internal data dictionary in the"
+ " ibdata files.\n"
+ "InnoDB: We assume that you later removed the"
+ " .ibd and .frm files,\n"
+ "InnoDB: and are now trying to recreate the table."
+ " We now remove the\n"
+ "InnoDB: conflicting tablespace object"
+ " from the memory cache and try\n"
+ "InnoDB: the init again.\n");
namesake_id = space->id;
@@ -1004,14 +1025,16 @@ try_again:
if (space != NULL) {
fprintf(stderr,
-"InnoDB: Error: trying to add tablespace %lu of name ", (ulong) id);
+ "InnoDB: Error: trying to add tablespace %lu"
+ " of name ", (ulong) id);
ut_print_filename(stderr, name);
fprintf(stderr, "\n"
-"InnoDB: to the tablespace memory cache, but tablespace\n"
-"InnoDB: %lu of name ", (ulong) space->id);
+ "InnoDB: to the tablespace memory cache,"
+ " but tablespace\n"
+ "InnoDB: %lu of name ", (ulong) space->id);
ut_print_filename(stderr, space->name);
fputs(" already exists in the tablespace\n"
-"InnoDB: memory cache!\n", stderr);
+ "InnoDB: memory cache!\n", stderr);
mutex_exit(&(system->mutex));
@@ -1052,7 +1075,7 @@ try_again:
HASH_INSERT(fil_space_t, hash, system->spaces, id, space);
HASH_INSERT(fil_space_t, name_hash, system->name_hash,
- ut_fold_string(name), space);
+ ut_fold_string(name), space);
space->is_in_unflushed_spaces = FALSE;
UT_LIST_ADD_LAST(space_list, system->space_list, space);
@@ -1085,20 +1108,27 @@ fil_assign_new_space_id(void)
if (id > (SRV_LOG_SPACE_FIRST_ID / 2) && (id % 1000000UL == 0)) {
ut_print_timestamp(stderr);
fprintf(stderr,
-"InnoDB: Warning: you are running out of new single-table tablespace id's.\n"
-"InnoDB: Current counter is %lu and it must not exceed %lu!\n"
-"InnoDB: To reset the counter to zero you have to dump all your tables and\n"
-"InnoDB: recreate the whole InnoDB installation.\n", (ulong) id,
- (ulong) SRV_LOG_SPACE_FIRST_ID);
+ "InnoDB: Warning: you are running out of new"
+ " single-table tablespace id's.\n"
+ "InnoDB: Current counter is %lu and it"
+ " must not exceed %lu!\n"
+ "InnoDB: To reset the counter to zero"
+ " you have to dump all your tables and\n"
+ "InnoDB: recreate the whole InnoDB installation.\n",
+ (ulong) id,
+ (ulong) SRV_LOG_SPACE_FIRST_ID);
}
if (id >= SRV_LOG_SPACE_FIRST_ID) {
ut_print_timestamp(stderr);
fprintf(stderr,
-"InnoDB: You have run out of single-table tablespace id's!\n"
-"InnoDB: Current counter is %lu.\n"
-"InnoDB: To reset the counter to zero you have to dump all your tables and\n"
-"InnoDB: recreate the whole InnoDB installation.\n", (ulong) id);
+ "InnoDB: You have run out of single-table"
+ " tablespace id's!\n"
+ "InnoDB: Current counter is %lu.\n"
+ "InnoDB: To reset the counter to zero you"
+ " have to dump all your tables and\n"
+ "InnoDB: recreate the whole InnoDB installation.\n",
+ (ulong) id);
system->max_assigned_id--;
id = ULINT_UNDEFINED;
@@ -1132,8 +1162,9 @@ fil_space_free(
if (!space) {
ut_print_timestamp(stderr);
fprintf(stderr,
-" InnoDB: Error: trying to remove tablespace %lu from the cache but\n"
-"InnoDB: it is not there.\n", (ulong) id);
+ " InnoDB: Error: trying to remove tablespace %lu"
+ " from the cache but\n"
+ "InnoDB: it is not there.\n", (ulong) id);
mutex_exit(&(system->mutex));
@@ -1143,18 +1174,18 @@ fil_space_free(
HASH_DELETE(fil_space_t, hash, system->spaces, id, space);
HASH_SEARCH(name_hash, system->name_hash, ut_fold_string(space->name),
- namespace, 0 == strcmp(space->name, namespace->name));
+ namespace, 0 == strcmp(space->name, namespace->name));
ut_a(namespace);
ut_a(space == namespace);
HASH_DELETE(fil_space_t, name_hash, system->name_hash,
- ut_fold_string(space->name), space);
+ ut_fold_string(space->name), space);
if (space->is_in_unflushed_spaces) {
space->is_in_unflushed_spaces = FALSE;
UT_LIST_REMOVE(unflushed_spaces, system->unflushed_spaces,
- space);
+ space);
}
UT_LIST_REMOVE(space_list, system->space_list, space);
@@ -1359,15 +1390,26 @@ fil_open_log_and_system_tablespace_files(void)
while (node != NULL) {
if (!node->open) {
fil_node_open_file(node, system,
- space);
+ space);
}
if (system->max_n_open < 10 + system->n_open) {
fprintf(stderr,
-"InnoDB: Warning: you must raise the value of innodb_max_open_files in\n"
-"InnoDB: my.cnf! Remember that InnoDB keeps all log files and all system\n"
-"InnoDB: tablespace files open for the whole time mysqld is running, and\n"
-"InnoDB: needs to open also some .ibd files if the file-per-table storage\n"
-"InnoDB: model is used. Current open files %lu, max allowed open files %lu.\n",
+ "InnoDB: Warning: you must"
+ " raise the value of"
+ " innodb_max_open_files in\n"
+ "InnoDB: my.cnf! Remember that"
+ " InnoDB keeps all log files"
+ " and all system\n"
+ "InnoDB: tablespace files open"
+ " for the whole time mysqld is"
+ " running, and\n"
+ "InnoDB: needs to open also"
+ " some .ibd files if the"
+ " file-per-table storage\n"
+ "InnoDB: model is used."
+ " Current open files %lu,"
+ " max allowed"
+ " open files %lu.\n",
(ulong) system->n_open,
(ulong) system->max_n_open);
}
@@ -1424,7 +1466,8 @@ fil_set_max_space_id_if_bigger(
if (max_id >= SRV_LOG_SPACE_FIRST_ID) {
fprintf(stderr,
-"InnoDB: Fatal error: max tablespace id is too high, %lu\n", (ulong) max_id);
+ "InnoDB: Fatal error: max tablespace id"
+ " is too high, %lu\n", (ulong) max_id);
ut_a(0);
}
@@ -1514,16 +1557,16 @@ fil_write_flushed_lsn_to_data_files(
always open. */
if (space->purpose == FIL_TABLESPACE
- && space->id == 0) {
+ && space->id == 0) {
sum_of_sizes = 0;
node = UT_LIST_GET_FIRST(space->chain);
while (node) {
mutex_exit(&(fil_system->mutex));
- err = fil_write_lsn_and_arch_no_to_file(
- space->id, sum_of_sizes,
- lsn, arch_log_no);
+ err = fil_write_lsn_and_arch_no_to_file
+ (space->id, sum_of_sizes,
+ lsn, arch_log_no);
if (err != DB_SUCCESS) {
return(err);
@@ -1622,7 +1665,8 @@ fil_inc_pending_ibuf_merges(
if (space == NULL) {
fprintf(stderr,
-"InnoDB: Error: trying to do ibuf merge to a dropped tablespace %lu\n",
+ "InnoDB: Error: trying to do ibuf merge to a"
+ " dropped tablespace %lu\n",
(ulong) id);
}
@@ -1656,7 +1700,8 @@ fil_decr_pending_ibuf_merges(
if (space == NULL) {
fprintf(stderr,
-"InnoDB: Error: decrementing ibuf merge of a dropped tablespace %lu\n",
+ "InnoDB: Error: decrementing ibuf merge of a"
+ " dropped tablespace %lu\n",
(ulong) id);
}
@@ -1728,7 +1773,7 @@ fil_op_write_log(
}
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
and handling */
@@ -1827,14 +1872,14 @@ fil_op_log_parse_or_replay(
}
/* We managed to parse a full log record body */
-/*
+ /*
printf("Parsed log rec of type %lu space %lu\n"
- "name %s\n", type, space_id, name);
+ "name %s\n", type, space_id, name);
if (type == MLOG_FILE_RENAME) {
- printf("new name %s\n", new_name);
+ printf("new name %s\n", new_name);
}
-*/
+ */
if (do_replay == FALSE) {
return(ptr);
@@ -1867,11 +1912,13 @@ fil_op_log_parse_or_replay(
with the same name */
if (fil_get_space_id_for_table(new_name)
- == ULINT_UNDEFINED) {
+ == ULINT_UNDEFINED) {
/* We do not care of the old name, that is
why we pass NULL as the first argument */
- ut_a(fil_rename_tablespace(NULL, space_id,
- new_name));
+ if (!fil_rename_tablespace(NULL, space_id,
+ new_name)) {
+ ut_error;
+ }
}
}
} else {
@@ -1879,8 +1926,8 @@ fil_op_log_parse_or_replay(
if (fil_tablespace_exists_in_mem(space_id)) {
/* Do nothing */
- } else if (fil_get_space_id_for_table(name) !=
- ULINT_UNDEFINED) {
+ } else if (fil_get_space_id_for_table(name)
+ != ULINT_UNDEFINED) {
/* Do nothing */
} else {
/* Create the database directory for name, if it does
@@ -1889,10 +1936,11 @@ fil_op_log_parse_or_replay(
ut_a(space_id != 0);
- ut_a(DB_SUCCESS ==
- fil_create_new_single_table_tablespace(
- &space_id, name, FALSE,
- FIL_IBD_FILE_INITIAL_SIZE));
+ if (fil_create_new_single_table_tablespace
+ (&space_id, name, FALSE,
+ FIL_IBD_FILE_INITIAL_SIZE) != DB_SUCCESS) {
+ ut_error;
+ }
}
}
@@ -1933,14 +1981,16 @@ stop_ibuf_merges:
goto try_again;
} else {
if (count > 5000) {
- ut_print_timestamp(stderr);
- fputs(
-" InnoDB: Warning: trying to delete tablespace ", stderr);
- ut_print_filename(stderr, space->name);
- fprintf(stderr, ",\n"
-"InnoDB: but there are %lu pending ibuf merges on it.\n"
-"InnoDB: Loop %lu.\n", (ulong) space->n_pending_ibuf_merges,
- (ulong) count);
+ ut_print_timestamp(stderr);
+ fputs(" InnoDB: Warning: trying to"
+ " delete tablespace ", stderr);
+ ut_print_filename(stderr, space->name);
+ fprintf(stderr, ",\n"
+ "InnoDB: but there are %lu pending"
+ " ibuf merges on it.\n"
+ "InnoDB: Loop %lu.\n",
+ (ulong) space->n_pending_ibuf_merges,
+ (ulong) count);
}
mutex_exit(&(system->mutex));
@@ -1963,8 +2013,9 @@ try_again:
if (space == NULL) {
ut_print_timestamp(stderr);
fprintf(stderr,
-" InnoDB: Error: cannot delete tablespace %lu\n"
-"InnoDB: because it is not found in the tablespace memory cache.\n",
+ " InnoDB: Error: cannot delete tablespace %lu\n"
+ "InnoDB: because it is not found in the"
+ " tablespace memory cache.\n",
(ulong) id);
mutex_exit(&(system->mutex));
@@ -1983,12 +2034,14 @@ try_again:
if (space->n_pending_flushes > 0 || node->n_pending > 0) {
if (count > 1000) {
ut_print_timestamp(stderr);
- fputs(
-" InnoDB: Warning: trying to delete tablespace ", stderr);
+ fputs(" InnoDB: Warning: trying to"
+ " delete tablespace ", stderr);
ut_print_filename(stderr, space->name);
fprintf(stderr, ",\n"
-"InnoDB: but there are %lu flushes and %lu pending i/o's on it\n"
-"InnoDB: Loop %lu.\n", (ulong) space->n_pending_flushes,
+ "InnoDB: but there are %lu flushes"
+ " and %lu pending i/o's on it\n"
+ "InnoDB: Loop %lu.\n",
+ (ulong) space->n_pending_flushes,
(ulong) node->n_pending,
(ulong) count);
}
@@ -2071,8 +2124,10 @@ fil_discard_tablespace(
if (!success) {
fprintf(stderr,
-"InnoDB: Warning: cannot delete tablespace %lu in DISCARD TABLESPACE.\n"
-"InnoDB: But let us remove the insert buffer entries for this tablespace.\n",
+ "InnoDB: Warning: cannot delete tablespace %lu"
+ " in DISCARD TABLESPACE.\n"
+ "InnoDB: But let us remove the"
+ " insert buffer entries for this tablespace.\n",
(ulong) id);
}
@@ -2099,7 +2154,7 @@ fil_rename_tablespace_in_mem(
const char* old_name = space->name;
HASH_SEARCH(name_hash, system->name_hash, ut_fold_string(old_name),
- space2, 0 == strcmp(old_name, space2->name));
+ space2, 0 == strcmp(old_name, space2->name));
if (space != space2) {
fputs("InnoDB: Error: cannot find ", stderr);
ut_print_filename(stderr, old_name);
@@ -2109,7 +2164,7 @@ fil_rename_tablespace_in_mem(
}
HASH_SEARCH(name_hash, system->name_hash, ut_fold_string(path),
- space2, 0 == strcmp(path, space2->name));
+ space2, 0 == strcmp(path, space2->name));
if (space2 != NULL) {
fputs("InnoDB: Error: ", stderr);
ut_print_filename(stderr, path);
@@ -2119,7 +2174,7 @@ fil_rename_tablespace_in_mem(
}
HASH_DELETE(fil_space_t, name_hash, system->name_hash,
- ut_fold_string(space->name), space);
+ ut_fold_string(space->name), space);
mem_free(space->name);
mem_free(node->name);
@@ -2127,7 +2182,7 @@ fil_rename_tablespace_in_mem(
node->name = mem_strdup(path);
HASH_INSERT(fil_space_t, name_hash, system->name_hash,
- ut_fold_string(path), space);
+ ut_fold_string(path), space);
return(TRUE);
}
@@ -2213,8 +2268,9 @@ retry:
if (space == NULL) {
fprintf(stderr,
-"InnoDB: Error: cannot find space id %lu from the tablespace memory cache\n"
-"InnoDB: though the table ", (ulong) id);
+ "InnoDB: Error: cannot find space id %lu"
+ " in the tablespace memory cache\n"
+ "InnoDB: though the table ", (ulong) id);
ut_print_filename(stderr, old_name);
fputs(" in a rename operation should have that id\n", stderr);
mutex_exit(&(system->mutex));
@@ -2288,7 +2344,7 @@ retry:
to the tablespace memory cache */
ut_a(fil_rename_tablespace_in_mem(space, node,
- old_path));
+ old_path));
}
}
@@ -2306,7 +2362,7 @@ retry:
mtr_start(&mtr);
fil_op_write_log(MLOG_FILE_RENAME, id, old_name, new_name,
- &mtr);
+ &mtr);
mtr_commit(&mtr);
}
#endif
@@ -2350,7 +2406,7 @@ fil_create_new_single_table_tablespace(
path = fil_make_ibd_name(tablename, is_temp);
file = os_file_create(path, OS_FILE_CREATE, OS_FILE_NORMAL,
- OS_DATA_FILE, &ret);
+ OS_DATA_FILE, &ret);
if (ret == FALSE) {
ut_print_timestamp(stderr);
fputs(" InnoDB: Error creating file ", stderr);
@@ -2362,16 +2418,22 @@ fil_create_new_single_table_tablespace(
err = os_file_get_last_error(TRUE);
if (err == OS_FILE_ALREADY_EXISTS) {
- fputs(
-"InnoDB: The file already exists though the corresponding table did not\n"
-"InnoDB: exist in the InnoDB data dictionary. Have you moved InnoDB\n"
-"InnoDB: .ibd files around without using the SQL commands\n"
-"InnoDB: DISCARD TABLESPACE and IMPORT TABLESPACE, or did\n"
-"InnoDB: mysqld crash in the middle of CREATE TABLE? You can\n"
-"InnoDB: resolve the problem by removing the file ", stderr);
+ fputs("InnoDB: The file already exists though"
+ " the corresponding table did not\n"
+ "InnoDB: exist in the InnoDB data dictionary."
+ " Have you moved InnoDB\n"
+ "InnoDB: .ibd files around without using the"
+ " SQL commands\n"
+ "InnoDB: DISCARD TABLESPACE and"
+ " IMPORT TABLESPACE, or did\n"
+ "InnoDB: mysqld crash in the middle of"
+ " CREATE TABLE? You can\n"
+ "InnoDB: resolve the problem by"
+ " removing the file ", stderr);
ut_print_filename(stderr, path);
fputs("\n"
-"InnoDB: under the 'datadir' of MySQL.\n", stderr);
+ "InnoDB: under the 'datadir' of MySQL.\n",
+ stderr);
mem_free(path);
return(DB_TABLESPACE_ALREADY_EXISTS);
@@ -2410,9 +2472,9 @@ fil_create_new_single_table_tablespace(
if (*space_id == ULINT_UNDEFINED) {
ut_free(buf2);
- error_exit:
+error_exit:
os_file_close(file);
- error_exit2:
+error_exit2:
os_file_delete(path);
mem_free(path);
@@ -2439,8 +2501,8 @@ fil_create_new_single_table_tablespace(
ut_free(buf2);
if (!ret) {
- fputs(
-"InnoDB: Error: could not write the first page to tablespace ", stderr);
+ fputs("InnoDB: Error: could not write the first page"
+ " to tablespace ", stderr);
ut_print_filename(stderr, path);
putc('\n', stderr);
goto error_exit;
@@ -2449,8 +2511,7 @@ fil_create_new_single_table_tablespace(
ret = os_file_flush(file);
if (!ret) {
- fputs(
-"InnoDB: Error: file flush of tablespace ", stderr);
+ fputs("InnoDB: Error: file flush of tablespace ", stderr);
ut_print_filename(stderr, path);
fputs(" failed\n", stderr);
goto error_exit;
@@ -2472,13 +2533,14 @@ fil_create_new_single_table_tablespace(
#ifndef UNIV_HOTBACKUP
{
- mtr_t mtr;
+ mtr_t mtr;
- mtr_start(&mtr);
+ mtr_start(&mtr);
- fil_op_write_log(MLOG_FILE_CREATE, *space_id, tablename, NULL, &mtr);
+ fil_op_write_log(MLOG_FILE_CREATE, *space_id, tablename,
+ NULL, &mtr);
- mtr_commit(&mtr);
+ mtr_commit(&mtr);
}
#endif
mem_free(path);
@@ -2518,17 +2580,17 @@ fil_reset_too_high_lsns(
filepath = fil_make_ibd_name(name, FALSE);
- file = os_file_create_simple_no_error_handling(filepath, OS_FILE_OPEN,
- OS_FILE_READ_WRITE, &success);
+ file = os_file_create_simple_no_error_handling
+ (filepath, OS_FILE_OPEN, OS_FILE_READ_WRITE, &success);
if (!success) {
/* The following call prints an error message */
os_file_get_last_error(TRUE);
ut_print_timestamp(stderr);
- fputs(
-" InnoDB: Error: trying to open a table, but could not\n"
-"InnoDB: open the tablespace file ", stderr);
+ fputs(" InnoDB: Error: trying to open a table,"
+ " but could not\n"
+ "InnoDB: open the tablespace file ", stderr);
ut_print_filename(stderr, filepath);
fputs("!\n", stderr);
mem_free(filepath);
@@ -2563,9 +2625,11 @@ fil_reset_too_high_lsns(
ut_print_timestamp(stderr);
fprintf(stderr,
-" InnoDB: Flush lsn in the tablespace file %lu to be imported\n"
-"InnoDB: is %lu %lu, which exceeds current system lsn %lu %lu.\n"
-"InnoDB: We reset the lsn's in the file ",
+ " InnoDB: Flush lsn in the tablespace file %lu"
+ " to be imported\n"
+ "InnoDB: is %lu %lu, which exceeds current"
+ " system lsn %lu %lu.\n"
+ "InnoDB: We reset the lsn's in the file ",
(ulong) space_id,
(ulong) ut_dulint_get_high(flush_lsn),
(ulong) ut_dulint_get_low(flush_lsn),
@@ -2581,8 +2645,8 @@ fil_reset_too_high_lsns(
for (offset = 0; offset < file_size; offset += UNIV_PAGE_SIZE) {
success = os_file_read(file, page,
- (ulint)(offset & 0xFFFFFFFFUL),
- (ulint)(offset >> 32), UNIV_PAGE_SIZE);
+ (ulint)(offset & 0xFFFFFFFFUL),
+ (ulint)(offset >> 32), UNIV_PAGE_SIZE);
if (!success) {
goto func_exit;
@@ -2590,15 +2654,16 @@ fil_reset_too_high_lsns(
if (ut_dulint_cmp(mach_read_from_8(page + FIL_PAGE_LSN),
current_lsn) > 0) {
/* We have to reset the lsn */
- space_id = mach_read_from_4(page
- + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID);
+ space_id = mach_read_from_4
+ (page + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID);
page_no = mach_read_from_4(page + FIL_PAGE_OFFSET);
buf_flush_init_for_writing(page, current_lsn, space_id,
- page_no);
+ page_no);
success = os_file_write(filepath, file, page,
- (ulint)(offset & 0xFFFFFFFFUL),
- (ulint)(offset >> 32), UNIV_PAGE_SIZE);
+ (ulint)(offset & 0xFFFFFFFFUL),
+ (ulint)(offset >> 32),
+ UNIV_PAGE_SIZE);
if (!success) {
goto func_exit;
@@ -2670,26 +2735,30 @@ fil_open_single_table_tablespace(
filepath = fil_make_ibd_name(name, FALSE);
- file = os_file_create_simple_no_error_handling(filepath, OS_FILE_OPEN,
- OS_FILE_READ_ONLY, &success);
+ file = os_file_create_simple_no_error_handling
+ (filepath, OS_FILE_OPEN, OS_FILE_READ_ONLY, &success);
if (!success) {
/* The following call prints an error message */
os_file_get_last_error(TRUE);
ut_print_timestamp(stderr);
- fputs(
-" InnoDB: Error: trying to open a table, but could not\n"
-"InnoDB: open the tablespace file ", stderr);
+ fputs(" InnoDB: Error: trying to open a table,"
+ " but could not\n"
+ "InnoDB: open the tablespace file ", stderr);
ut_print_filename(stderr, filepath);
fputs("!\n"
-"InnoDB: Have you moved InnoDB .ibd files around without using the\n"
-"InnoDB: commands DISCARD TABLESPACE and IMPORT TABLESPACE?\n"
-"InnoDB: It is also possible that this is a temporary table #sql...,\n"
-"InnoDB: and MySQL removed the .ibd file for this.\n"
-"InnoDB: Please refer to\n"
-"InnoDB: http://dev.mysql.com/doc/refman/5.1/en/innodb-troubleshooting.html\n"
-"InnoDB: for how to resolve the issue.\n", stderr);
+ "InnoDB: Have you moved InnoDB .ibd files around"
+ " without using the\n"
+ "InnoDB: commands DISCARD TABLESPACE and"
+ " IMPORT TABLESPACE?\n"
+ "InnoDB: It is also possible that this is"
+ " a temporary table #sql...,\n"
+ "InnoDB: and MySQL removed the .ibd file for this.\n"
+ "InnoDB: Please refer to\n"
+ "InnoDB: http://dev.mysql.com/doc/refman/5.1/en/"
+ "innodb-troubleshooting.html\n"
+ "InnoDB: for how to resolve the issue.\n", stderr);
mem_free(filepath);
@@ -2719,16 +2788,19 @@ fil_open_single_table_tablespace(
if (space_id != id) {
ut_print_timestamp(stderr);
- fputs(
-" InnoDB: Error: tablespace id in file ", stderr);
+ fputs(" InnoDB: Error: tablespace id in file ", stderr);
ut_print_filename(stderr, filepath);
fprintf(stderr, " is %lu, but in the InnoDB\n"
-"InnoDB: data dictionary it is %lu.\n"
-"InnoDB: Have you moved InnoDB .ibd files around without using the\n"
-"InnoDB: commands DISCARD TABLESPACE and IMPORT TABLESPACE?\n"
-"InnoDB: Please refer to\n"
-"InnoDB: http://dev.mysql.com/doc/refman/5.1/en/innodb-troubleshooting.html\n"
-"InnoDB: for how to resolve the issue.\n", (ulong) space_id, (ulong) id);
+ "InnoDB: data dictionary it is %lu.\n"
+ "InnoDB: Have you moved InnoDB .ibd files"
+ " around without using the\n"
+ "InnoDB: commands DISCARD TABLESPACE and"
+ " IMPORT TABLESPACE?\n"
+ "InnoDB: Please refer to\n"
+ "InnoDB: http://dev.mysql.com/doc/refman/5.1/en/"
+ "innodb-troubleshooting.html\n"
+ "InnoDB: for how to resolve the issue.\n",
+ (ulong) space_id, (ulong) id);
ret = FALSE;
@@ -2799,10 +2871,10 @@ fil_load_single_table_tablespace(
fil_space_t* space;
#endif
filepath = mem_alloc(strlen(dbname) + strlen(filename)
- + strlen(fil_path_to_mysql_datadir) + 3);
+ + strlen(fil_path_to_mysql_datadir) + 3);
sprintf(filepath, "%s/%s/%s", fil_path_to_mysql_datadir, dbname,
- filename);
+ filename);
srv_normalize_path_for_win(filepath);
#ifdef __WIN__
# ifndef UNIV_HOTBACKUP
@@ -2815,34 +2887,46 @@ fil_load_single_table_tablespace(
dict_casedn_str(filepath);
# endif /* !UNIV_HOTBACKUP */
#endif
- file = os_file_create_simple_no_error_handling(filepath, OS_FILE_OPEN,
- OS_FILE_READ_ONLY, &success);
+ file = os_file_create_simple_no_error_handling
+ (filepath, OS_FILE_OPEN, OS_FILE_READ_ONLY, &success);
if (!success) {
/* The following call prints an error message */
os_file_get_last_error(TRUE);
fprintf(stderr,
-"InnoDB: Error: could not open single-table tablespace file\n"
-"InnoDB: %s!\n"
-"InnoDB: We do not continue the crash recovery, because the table may become\n"
-"InnoDB: corrupt if we cannot apply the log records in the InnoDB log to it.\n"
-"InnoDB: To fix the problem and start mysqld:\n"
-"InnoDB: 1) If there is a permission problem in the file and mysqld cannot\n"
-"InnoDB: open the file, you should modify the permissions.\n"
-"InnoDB: 2) If the table is not needed, or you can restore it from a backup,\n"
-"InnoDB: then you can remove the .ibd file, and InnoDB will do a normal\n"
-"InnoDB: crash recovery and ignore that table.\n"
-"InnoDB: 3) If the file system or the disk is broken, and you cannot remove\n"
-"InnoDB: the .ibd file, you can set innodb_force_recovery > 0 in my.cnf\n"
-"InnoDB: and force InnoDB to continue crash recovery here.\n", filepath);
+ "InnoDB: Error: could not open single-table tablespace"
+ " file\n"
+ "InnoDB: %s!\n"
+ "InnoDB: We do not continue the crash recovery,"
+ " because the table may become\n"
+ "InnoDB: corrupt if we cannot apply the log records"
+ " in the InnoDB log to it.\n"
+ "InnoDB: To fix the problem and start mysqld:\n"
+ "InnoDB: 1) If there is a permission problem"
+ " in the file and mysqld cannot\n"
+ "InnoDB: open the file, you should"
+ " modify the permissions.\n"
+ "InnoDB: 2) If the table is not needed, or you can"
+ " restore it from a backup,\n"
+ "InnoDB: then you can remove the .ibd file,"
+ " and InnoDB will do a normal\n"
+ "InnoDB: crash recovery and ignore that table.\n"
+ "InnoDB: 3) If the file system or the"
+ " disk is broken, and you cannot remove\n"
+ "InnoDB: the .ibd file, you can set"
+ " innodb_force_recovery > 0 in my.cnf\n"
+ "InnoDB: and force InnoDB to continue crash"
+ " recovery here.\n", filepath);
mem_free(filepath);
if (srv_force_recovery > 0) {
fprintf(stderr,
-"InnoDB: innodb_force_recovery was set to %lu. Continuing crash recovery\n"
-"InnoDB: even though we cannot access the .ibd file of this table.\n",
- srv_force_recovery);
+ "InnoDB: innodb_force_recovery"
+ " was set to %lu. Continuing crash recovery\n"
+ "InnoDB: even though we cannot access"
+ " the .ibd file of this table.\n",
+ srv_force_recovery);
return;
}
@@ -2856,28 +2940,40 @@ fil_load_single_table_tablespace(
os_file_get_last_error(TRUE);
fprintf(stderr,
-"InnoDB: Error: could not measure the size of single-table tablespace file\n"
-"InnoDB: %s!\n"
-"InnoDB: We do not continue crash recovery, because the table will become\n"
-"InnoDB: corrupt if we cannot apply the log records in the InnoDB log to it.\n"
-"InnoDB: To fix the problem and start mysqld:\n"
-"InnoDB: 1) If there is a permission problem in the file and mysqld cannot\n"
-"InnoDB: access the file, you should modify the permissions.\n"
-"InnoDB: 2) If the table is not needed, or you can restore it from a backup,\n"
-"InnoDB: then you can remove the .ibd file, and InnoDB will do a normal\n"
-"InnoDB: crash recovery and ignore that table.\n"
-"InnoDB: 3) If the file system or the disk is broken, and you cannot remove\n"
-"InnoDB: the .ibd file, you can set innodb_force_recovery > 0 in my.cnf\n"
-"InnoDB: and force InnoDB to continue crash recovery here.\n", filepath);
+ "InnoDB: Error: could not measure the size"
+ " of single-table tablespace file\n"
+ "InnoDB: %s!\n"
+ "InnoDB: We do not continue crash recovery,"
+ " because the table will become\n"
+ "InnoDB: corrupt if we cannot apply the log records"
+ " in the InnoDB log to it.\n"
+ "InnoDB: To fix the problem and start mysqld:\n"
+ "InnoDB: 1) If there is a permission problem"
+ " in the file and mysqld cannot\n"
+ "InnoDB: access the file, you should"
+ " modify the permissions.\n"
+ "InnoDB: 2) If the table is not needed,"
+ " or you can restore it from a backup,\n"
+ "InnoDB: then you can remove the .ibd file,"
+ " and InnoDB will do a normal\n"
+ "InnoDB: crash recovery and ignore that table.\n"
+ "InnoDB: 3) If the file system or the disk is broken,"
+ " and you cannot remove\n"
+ "InnoDB: the .ibd file, you can set"
+ " innodb_force_recovery > 0 in my.cnf\n"
+ "InnoDB: and force InnoDB to continue"
+ " crash recovery here.\n", filepath);
os_file_close(file);
mem_free(filepath);
if (srv_force_recovery > 0) {
fprintf(stderr,
-"InnoDB: innodb_force_recovery was set to %lu. Continuing crash recovery\n"
-"InnoDB: even though we cannot access the .ibd file of this table.\n",
- srv_force_recovery);
+ "InnoDB: innodb_force_recovery"
+ " was set to %lu. Continuing crash recovery\n"
+ "InnoDB: even though we cannot access"
+ " the .ibd file of this table.\n",
+ srv_force_recovery);
return;
}
@@ -2894,8 +2990,10 @@ fil_load_single_table_tablespace(
#ifndef UNIV_HOTBACKUP
if (size < FIL_IBD_FILE_INITIAL_SIZE * UNIV_PAGE_SIZE) {
fprintf(stderr,
-"InnoDB: Error: the size of single-table tablespace file %s\n"
-"InnoDB: is only %lu %lu, should be at least %lu!", filepath,
+ "InnoDB: Error: the size of single-table tablespace"
+ " file %s\n"
+ "InnoDB: is only %lu %lu, should be at least %lu!",
+ filepath,
(ulong) size_high,
(ulong) size_low, (ulong) (4 * UNIV_PAGE_SIZE));
os_file_close(file);
@@ -2923,7 +3021,8 @@ fil_load_single_table_tablespace(
#ifndef UNIV_HOTBACKUP
if (space_id == ULINT_UNDEFINED || space_id == 0) {
fprintf(stderr,
-"InnoDB: Error: tablespace id %lu in file %s is not sensible\n",
+ "InnoDB: Error: tablespace id %lu in file %s"
+ " is not sensible\n",
(ulong) space_id,
filepath);
goto func_exit;
@@ -2933,12 +3032,15 @@ fil_load_single_table_tablespace(
char* new_path;
fprintf(stderr,
-"InnoDB: Renaming tablespace %s of id %lu,\n"
-"InnoDB: to %s_ibbackup_old_vers_<timestamp>\n"
-"InnoDB: because its size %lld is too small (< 4 pages 16 kB each),\n"
-"InnoDB: or the space id in the file header is not sensible.\n"
-"InnoDB: This can happen in an ibbackup run, and is not dangerous.\n",
- filepath, space_id, filepath, size);
+ "InnoDB: Renaming tablespace %s of id %lu,\n"
+ "InnoDB: to %s_ibbackup_old_vers_<timestamp>\n"
+ "InnoDB: because its size %lld is too small"
+ " (< 4 pages 16 kB each),\n"
+ "InnoDB: or the space id in the file header"
+ " is not sensible.\n"
+ "InnoDB: This can happen in an ibbackup run,"
+ " and is not dangerous.\n",
+ filepath, space_id, filepath, size);
os_file_close(file);
new_path = fil_make_ibbackup_old_name(filepath);
@@ -2966,12 +3068,14 @@ fil_load_single_table_tablespace(
char* new_path;
fprintf(stderr,
-"InnoDB: Renaming tablespace %s of id %lu,\n"
-"InnoDB: to %s_ibbackup_old_vers_<timestamp>\n"
-"InnoDB: because space %s with the same id\n"
-"InnoDB: was scanned earlier. This can happen if you have renamed tables\n"
-"InnoDB: during an ibbackup run.\n", filepath, space_id, filepath,
- space->name);
+ "InnoDB: Renaming tablespace %s of id %lu,\n"
+ "InnoDB: to %s_ibbackup_old_vers_<timestamp>\n"
+ "InnoDB: because space %s with the same id\n"
+ "InnoDB: was scanned earlier. This can happen"
+ " if you have renamed tables\n"
+ "InnoDB: during an ibbackup run.\n",
+ filepath, space_id, filepath,
+ space->name);
os_file_close(file);
new_path = fil_make_ibbackup_old_name(filepath);
@@ -3034,9 +3138,11 @@ fil_file_readdir_next_file(
}
fprintf(stderr,
-"InnoDB: Error: os_file_readdir_next_file() returned -1 in\n"
-"InnoDB: directory %s\n"
-"InnoDB: Crash recovery may have failed for some .ibd files!\n", dirname);
+ "InnoDB: Error: os_file_readdir_next_file()"
+ " returned -1 in\n"
+ "InnoDB: directory %s\n"
+ "InnoDB: Crash recovery may have failed"
+ " for some .ibd files!\n", dirname);
*err = DB_ERROR;
}
@@ -3081,13 +3187,13 @@ fil_load_single_table_tablespaces(void)
directories of MySQL. */
ret = fil_file_readdir_next_file(&err, fil_path_to_mysql_datadir, dir,
- &dbinfo);
+ &dbinfo);
while (ret == 0) {
ulint len;
/* printf("Looking at %s in datadir\n", dbinfo.name); */
if (dbinfo.type == OS_FILE_TYPE_FILE
- || dbinfo.type == OS_FILE_TYPE_UNKNOWN) {
+ || dbinfo.type == OS_FILE_TYPE_UNKNOWN) {
goto next_datadir_item;
}
@@ -3096,7 +3202,7 @@ fil_load_single_table_tablespaces(void)
if a symlink is a directory */
len = strlen(fil_path_to_mysql_datadir)
- + strlen (dbinfo.name) + 2;
+ + strlen (dbinfo.name) + 2;
if (len > dbpath_len) {
dbpath_len = len;
@@ -3107,7 +3213,7 @@ fil_load_single_table_tablespaces(void)
dbpath = mem_alloc(dbpath_len);
}
sprintf(dbpath, "%s/%s", fil_path_to_mysql_datadir,
- dbinfo.name);
+ dbinfo.name);
srv_normalize_path_for_win(dbpath);
dbdir = os_file_opendir(dbpath, FALSE);
@@ -3119,10 +3225,10 @@ fil_load_single_table_tablespaces(void)
looking for possible .ibd files in it */
ret = fil_file_readdir_next_file(&err, dbpath, dbdir,
- &fileinfo);
+ &fileinfo);
while (ret == 0) {
/* printf(
- " Looking at file %s\n", fileinfo.name); */
+ " Looking at file %s\n", fileinfo.name); */
if (fileinfo.type == OS_FILE_TYPE_DIR) {
@@ -3131,23 +3237,23 @@ fil_load_single_table_tablespaces(void)
/* We found a symlink or a file */
if (strlen(fileinfo.name) > 4
- && 0 == strcmp(fileinfo.name +
- strlen(fileinfo.name) - 4,
- ".ibd")) {
+ && 0 == strcmp(fileinfo.name
+ + strlen(fileinfo.name) - 4,
+ ".ibd")) {
/* The name ends in .ibd; try opening
the file */
- fil_load_single_table_tablespace(
- dbinfo.name, fileinfo.name);
+ fil_load_single_table_tablespace
+ (dbinfo.name, fileinfo.name);
}
next_file_item:
ret = fil_file_readdir_next_file(&err,
- dbpath, dbdir,
- &fileinfo);
+ dbpath, dbdir,
+ &fileinfo);
}
if (0 != os_file_closedir(dbdir)) {
- fputs(
-"InnoDB: Warning: could not close database directory ", stderr);
+ fputs("InnoDB: Warning: could not"
+ " close database directory ", stderr);
ut_print_filename(stderr, dbpath);
putc('\n', stderr);
@@ -3157,15 +3263,15 @@ next_file_item:
next_datadir_item:
ret = fil_file_readdir_next_file(&err,
- fil_path_to_mysql_datadir,
- dir, &dbinfo);
+ fil_path_to_mysql_datadir,
+ dir, &dbinfo);
}
mem_free(dbpath);
if (0 != os_file_closedir(dir)) {
fprintf(stderr,
-"InnoDB: Error: could not close MySQL datadir\n");
+ "InnoDB: Error: could not close MySQL datadir\n");
return(DB_ERROR);
}
@@ -3193,11 +3299,12 @@ fil_print_orphaned_tablespaces(void)
while (space) {
if (space->purpose == FIL_TABLESPACE && space->id != 0
- && !space->mark) {
+ && !space->mark) {
fputs("InnoDB: Warning: tablespace ", stderr);
ut_print_filename(stderr, space->name);
fprintf(stderr, " of id %lu has no matching table in\n"
-"InnoDB: the InnoDB data dictionary.\n", (ulong) space->id);
+ "InnoDB: the InnoDB data dictionary.\n",
+ (ulong) space->id);
}
space = UT_LIST_GET_NEXT(space_list, space);
@@ -3236,7 +3343,7 @@ fil_tablespace_deleted_or_being_deleted_in_mem(
}
if (version != ((ib_longlong)-1)
- && space->tablespace_version != version) {
+ && space->tablespace_version != version) {
mutex_exit(&(system->mutex));
return(TRUE);
@@ -3323,8 +3430,8 @@ fil_space_for_table_exists_in_mem(
directory path from the datadir to the file */
HASH_SEARCH(name_hash, system->name_hash,
- ut_fold_string(path), namespace,
- 0 == strcmp(namespace->name, path));
+ ut_fold_string(path), namespace,
+ 0 == strcmp(namespace->name, path));
if (space && space == namespace) {
/* Found */
@@ -3352,30 +3459,38 @@ fil_space_for_table_exists_in_mem(
fputs(" InnoDB: Error: table ", stderr);
ut_print_filename(stderr, name);
fprintf(stderr, "\n"
-"InnoDB: in InnoDB data dictionary has tablespace id %lu,\n"
-"InnoDB: but tablespace with that id or name does not exist. Have\n"
-"InnoDB: you deleted or moved .ibd files?\n"
-"InnoDB: This may also be a table created with CREATE TEMPORARY TABLE\n"
-"InnoDB: whose .ibd and .frm files MySQL automatically removed, but the\n"
-"InnoDB: table still exists in the InnoDB internal data dictionary.\n",
+ "InnoDB: in InnoDB data dictionary"
+ " has tablespace id %lu,\n"
+ "InnoDB: but tablespace with that id"
+ " or name does not exist. Have\n"
+ "InnoDB: you deleted or moved .ibd files?\n"
+ "InnoDB: This may also be a table created with"
+ " CREATE TEMPORARY TABLE\n"
+ "InnoDB: whose .ibd and .frm files"
+ " MySQL automatically removed, but the\n"
+ "InnoDB: table still exists in the"
+ " InnoDB internal data dictionary.\n",
(ulong) id);
} else {
ut_print_timestamp(stderr);
fputs(" InnoDB: Error: table ", stderr);
ut_print_filename(stderr, name);
fprintf(stderr, "\n"
-"InnoDB: in InnoDB data dictionary has tablespace id %lu,\n"
-"InnoDB: but a tablespace with that id does not exist. There is\n"
-"InnoDB: a tablespace of name %s and id %lu, though. Have\n"
-"InnoDB: you deleted or moved .ibd files?\n",
+ "InnoDB: in InnoDB data dictionary has"
+ " tablespace id %lu,\n"
+ "InnoDB: but a tablespace with that id"
+ " does not exist. There is\n"
+ "InnoDB: a tablespace of name %s and id %lu,"
+ " though. Have\n"
+ "InnoDB: you deleted or moved .ibd files?\n",
(ulong) id, namespace->name,
(ulong) namespace->id);
}
- error_exit:
- fputs(
-"InnoDB: Please refer to\n"
-"InnoDB: http://dev.mysql.com/doc/refman/5.1/en/innodb-troubleshooting.html\n"
-"InnoDB: for how to resolve the issue.\n", stderr);
+error_exit:
+ fputs("InnoDB: Please refer to\n"
+ "InnoDB: http://dev.mysql.com/doc/refman/5.1/en/"
+ "innodb-troubleshooting.html\n"
+ "InnoDB: for how to resolve the issue.\n", stderr);
mem_free(path);
mutex_exit(&(system->mutex));
@@ -3388,14 +3503,17 @@ fil_space_for_table_exists_in_mem(
fputs(" InnoDB: Error: table ", stderr);
ut_print_filename(stderr, name);
fprintf(stderr, "\n"
-"InnoDB: in InnoDB data dictionary has tablespace id %lu,\n"
-"InnoDB: but the tablespace with that id has name %s.\n"
-"InnoDB: Have you deleted or moved .ibd files?\n", (ulong) id, space->name);
+ "InnoDB: in InnoDB data dictionary has"
+ " tablespace id %lu,\n"
+ "InnoDB: but the tablespace with that id"
+ " has name %s.\n"
+ "InnoDB: Have you deleted or moved .ibd files?\n",
+ (ulong) id, space->name);
if (namespace != NULL) {
- fputs(
-"InnoDB: There is a tablespace with the right name\n"
-"InnoDB: ", stderr);
+ fputs("InnoDB: There is a tablespace"
+ " with the right name\n"
+ "InnoDB: ", stderr);
ut_print_filename(stderr, namespace->name);
fprintf(stderr, ", but its id is %lu.\n",
(ulong) namespace->id);
@@ -3437,8 +3555,8 @@ fil_get_space_id_for_table(
directory path to the file */
HASH_SEARCH(name_hash, system->name_hash,
- ut_fold_string(path), namespace,
- 0 == strcmp(namespace->name, path));
+ ut_fold_string(path), namespace,
+ 0 == strcmp(namespace->name, path));
if (namespace) {
id = namespace->id;
}
@@ -3482,7 +3600,7 @@ fil_extend_space_to_desired_size(
fil_mutex_enter_and_prepare_for_io(space_id);
HASH_SEARCH(hash, system->spaces, space_id, space,
- space->id == space_id);
+ space->id == space_id);
ut_a(space);
if (space->size >= size_after_extend) {
@@ -3504,7 +3622,7 @@ fil_extend_space_to_desired_size(
/* Extend at most 64 pages at a time */
buf_size = ut_min(64, size_after_extend - start_page_no)
- * UNIV_PAGE_SIZE;
+ * UNIV_PAGE_SIZE;
buf2 = mem_alloc(buf_size + UNIV_PAGE_SIZE);
buf = ut_align(buf2, UNIV_PAGE_SIZE);
@@ -3512,12 +3630,12 @@ fil_extend_space_to_desired_size(
while (start_page_no < size_after_extend) {
ulint n_pages = ut_min(buf_size / UNIV_PAGE_SIZE,
- size_after_extend - start_page_no);
+ size_after_extend - start_page_no);
offset_high = (start_page_no - file_start_page_no)
- / (4096 * ((1024 * 1024) / UNIV_PAGE_SIZE));
+ / (4096 * ((1024 * 1024) / UNIV_PAGE_SIZE));
offset_low = ((start_page_no - file_start_page_no)
- % (4096 * ((1024 * 1024) / UNIV_PAGE_SIZE)))
+ % (4096 * ((1024 * 1024) / UNIV_PAGE_SIZE)))
* UNIV_PAGE_SIZE;
#ifdef UNIV_HOTBACKUP
success = os_file_write(node->name, node->handle, buf,
@@ -3525,10 +3643,10 @@ fil_extend_space_to_desired_size(
UNIV_PAGE_SIZE * n_pages);
#else
success = os_aio(OS_FILE_WRITE, OS_AIO_SYNC,
- node->name, node->handle, buf,
- offset_low, offset_high,
- UNIV_PAGE_SIZE * n_pages,
- NULL, NULL);
+ node->name, node->handle, buf,
+ offset_low, offset_high,
+ UNIV_PAGE_SIZE * n_pages,
+ NULL, NULL);
#endif
if (success) {
node->size += n_pages;
@@ -3540,8 +3658,9 @@ fil_extend_space_to_desired_size(
how much we were able to extend it */
n_pages = ((ulint)
- (os_file_get_size_as_iblonglong(node->handle)
- / UNIV_PAGE_SIZE)) - node->size;
+ (os_file_get_size_as_iblonglong
+ (node->handle)
+ / UNIV_PAGE_SIZE)) - node->size;
node->size += n_pages;
space->size += n_pages;
@@ -3565,14 +3684,14 @@ fil_extend_space_to_desired_size(
/* Keep the last data file size info up to date, rounded to
full megabytes */
- srv_data_file_sizes[srv_n_data_files - 1] =
- (node->size / pages_per_mb) * pages_per_mb;
+ srv_data_file_sizes[srv_n_data_files - 1]
+ = (node->size / pages_per_mb) * pages_per_mb;
}
#endif /* !UNIV_HOTBACKUP */
/*
printf("Extended %s to %lu, actual size %lu pages\n", space->name,
- size_after_extend, *actual_size); */
+ size_after_extend, *actual_size); */
mutex_exit(&(system->mutex));
fil_flush(space_id);
@@ -3612,20 +3731,23 @@ fil_extend_tablespaces_to_stored_len(void)
mutex, because this is a
single-threaded operation */
error = fil_read(TRUE, space->id, 0, 0, UNIV_PAGE_SIZE, buf,
- NULL);
+ NULL);
ut_a(error == DB_SUCCESS);
size_in_header = fsp_get_size_low(buf);
- success = fil_extend_space_to_desired_size(&actual_size,
- space->id, size_in_header);
+ success = fil_extend_space_to_desired_size
+ (&actual_size, space->id, size_in_header);
if (!success) {
fprintf(stderr,
-"InnoDB: Error: could not extend the tablespace of %s\n"
-"InnoDB: to the size stored in header, %lu pages;\n"
-"InnoDB: size after extension %lu pages\n"
-"InnoDB: Check that you have free disk space and retry!\n", space->name,
- size_in_header, actual_size);
+ "InnoDB: Error: could not extend the"
+ " tablespace of %s\n"
+ "InnoDB: to the size stored in header,"
+ " %lu pages;\n"
+ "InnoDB: size after extension %lu pages\n"
+ "InnoDB: Check that you have free disk space"
+ " and retry!\n",
+ space->name, size_in_header, actual_size);
exit(1);
}
@@ -3756,7 +3878,8 @@ fil_node_prepare_for_io(
if (system->n_open > system->max_n_open + 5) {
ut_print_timestamp(stderr);
fprintf(stderr,
-" InnoDB: Warning: open files %lu exceeds the limit %lu\n",
+ " InnoDB: Warning: open files %lu"
+ " exceeds the limit %lu\n",
(ulong) system->n_open,
(ulong) system->max_n_open);
}
@@ -3769,7 +3892,7 @@ fil_node_prepare_for_io(
}
if (node->n_pending == 0 && space->purpose == FIL_TABLESPACE
- && space->id != 0) {
+ && space->id != 0) {
/* The node is in the LRU list, remove it */
ut_a(UT_LIST_GET_LEN(system->LRU) > 0);
@@ -3811,13 +3934,13 @@ fil_node_complete_io(
node->space->is_in_unflushed_spaces = TRUE;
UT_LIST_ADD_FIRST(unflushed_spaces,
- system->unflushed_spaces,
- node->space);
+ system->unflushed_spaces,
+ node->space);
}
}
if (node->n_pending == 0 && node->space->purpose == FIL_TABLESPACE
- && node->space->id != 0) {
+ && node->space->id != 0) {
/* The node must be put back to the LRU list */
UT_LIST_ADD_FIRST(LRU, system->LRU, node);
}
@@ -3837,13 +3960,16 @@ fil_report_invalid_page_access(
ulint type) /* in: I/O type */
{
fprintf(stderr,
- "InnoDB: Error: trying to access page number %lu in space %lu,\n"
- "InnoDB: space name %s,\n"
- "InnoDB: which is outside the tablespace bounds.\n"
- "InnoDB: Byte offset %lu, len %lu, i/o type %lu.\n"
- "InnoDB: If you get this error at mysqld startup, please check that\n"
- "InnoDB: your my.cnf matches the ibdata files that you have in the\n"
- "InnoDB: MySQL server.\n",
+ "InnoDB: Error: trying to access page number %lu"
+ " in space %lu,\n"
+ "InnoDB: space name %s,\n"
+ "InnoDB: which is outside the tablespace bounds.\n"
+ "InnoDB: Byte offset %lu, len %lu, i/o type %lu.\n"
+ "InnoDB: If you get this error at mysqld startup,"
+ " please check that\n"
+ "InnoDB: your my.cnf matches the ibdata files"
+ " that you have in the\n"
+ "InnoDB: MySQL server.\n",
(ulong) block_offset, (ulong) space_id, space_name,
(ulong) byte_offset, (ulong) len, (ulong) type);
}
@@ -3905,16 +4031,16 @@ fil_io(
#ifndef UNIV_LOG_DEBUG
/* ibuf bitmap pages must be read in the sync aio mode: */
ut_ad(recv_no_ibuf_operations || (type == OS_FILE_WRITE)
- || !ibuf_bitmap_page(block_offset) || sync || is_log);
+ || !ibuf_bitmap_page(block_offset) || sync || is_log);
#ifdef UNIV_SYNC_DEBUG
ut_ad(!ibuf_inside() || is_log || (type == OS_FILE_WRITE)
- || ibuf_page(space_id, block_offset));
+ || ibuf_page(space_id, block_offset));
#endif
#endif
if (sync) {
mode = OS_AIO_SYNC;
} else if (type == OS_FILE_READ && !is_log
- && ibuf_page(space_id, block_offset)) {
+ && ibuf_page(space_id, block_offset)) {
mode = OS_AIO_IBUF;
} else if (is_log) {
mode = OS_AIO_LOG;
@@ -3934,14 +4060,16 @@ fil_io(
fil_mutex_enter_and_prepare_for_io(space_id);
HASH_SEARCH(hash, system->spaces, space_id, space,
- space->id == space_id);
+ space->id == space_id);
if (!space) {
mutex_exit(&(system->mutex));
ut_print_timestamp(stderr);
fprintf(stderr,
-" InnoDB: Error: trying to do i/o to a tablespace which does not exist.\n"
-"InnoDB: i/o type %lu, space id %lu, page no. %lu, i/o length %lu bytes\n",
+ " InnoDB: Error: trying to do i/o"
+ " to a tablespace which does not exist.\n"
+ "InnoDB: i/o type %lu, space id %lu,"
+ " page no. %lu, i/o length %lu bytes\n",
(ulong) type, (ulong) space_id, (ulong) block_offset,
(ulong) len);
@@ -3954,8 +4082,9 @@ fil_io(
for (;;) {
if (node == NULL) {
- fil_report_invalid_page_access(block_offset, space_id,
- space->name, byte_offset, len, type);
+ fil_report_invalid_page_access
+ (block_offset, space_id,
+ space->name, byte_offset, len, type);
ut_error;
}
@@ -3982,10 +4111,11 @@ fil_io(
/* Check that at least the start offset is within the bounds of a
single-table tablespace */
if (space->purpose == FIL_TABLESPACE && space->id != 0
- && node->size <= block_offset) {
+ && node->size <= block_offset) {
- fil_report_invalid_page_access(block_offset, space_id,
- space->name, byte_offset, len, type);
+ fil_report_invalid_page_access
+ (block_offset, space_id,
+ space->name, byte_offset, len, type);
ut_error;
}
@@ -3997,10 +4127,10 @@ fil_io(
offset_high = (block_offset >> (32 - UNIV_PAGE_SIZE_SHIFT));
offset_low = ((block_offset << UNIV_PAGE_SIZE_SHIFT) & 0xFFFFFFFFUL)
- + byte_offset;
+ + byte_offset;
- ut_a(node->size - block_offset >=
- (byte_offset + len + (UNIV_PAGE_SIZE - 1)) / UNIV_PAGE_SIZE);
+ ut_a(node->size - block_offset
+ >= (byte_offset + len + (UNIV_PAGE_SIZE - 1)) / UNIV_PAGE_SIZE);
/* Do aio */
@@ -4011,15 +4141,15 @@ fil_io(
/* In ibbackup do normal i/o, not aio */
if (type == OS_FILE_READ) {
ret = os_file_read(node->handle, buf, offset_low, offset_high,
- len);
+ len);
} else {
ret = os_file_write(node->name, node->handle, buf,
- offset_low, offset_high, len);
+ offset_low, offset_high, len);
}
#else
/* Queue the aio request */
ret = os_aio(type, mode | wake_later, node->name, node->handle, buf,
- offset_low, offset_high, len, node, message);
+ offset_low, offset_high, len, node, message);
#endif
ut_a(ret);
@@ -4064,7 +4194,7 @@ fil_read(
aio used, else ignored */
{
return(fil_io(OS_FILE_READ, sync, space_id, block_offset,
- byte_offset, len, buf, message));
+ byte_offset, len, buf, message));
}
/************************************************************************
@@ -4092,7 +4222,7 @@ fil_write(
aio used, else ignored */
{
return(fil_io(OS_FILE_WRITE, sync, space_id, block_offset,
- byte_offset, len, buf, message));
+ byte_offset, len, buf, message));
}
/**************************************************************************
@@ -4119,7 +4249,7 @@ fil_aio_wait(
srv_set_io_thread_op_info(segment, "native aio handle");
#ifdef WIN_ASYNC_IO
ret = os_aio_windows_handle(segment, 0, &fil_node,
- &message, &type);
+ &message, &type);
#elif defined(POSIX_ASYNC_IO)
ret = os_aio_posix_handle(segment, &fil_node, &message);
#else
@@ -4130,7 +4260,7 @@ fil_aio_wait(
srv_set_io_thread_op_info(segment, "simulated aio handle");
ret = os_aio_simulated_handle(segment, &fil_node,
- &message, &type);
+ &message, &type);
}
ut_a(ret);
@@ -4179,7 +4309,7 @@ fil_flush(
mutex_enter(&(system->mutex));
HASH_SEARCH(hash, system->spaces, space_id, space,
- space->id == space_id);
+ space->id == space_id);
if (!space || space->is_being_deleted) {
mutex_exit(&(system->mutex));
@@ -4238,7 +4368,7 @@ retry:
mutex_exit(&(system->mutex));
/* fprintf(stderr, "Flushing to file %s\n",
- node->name); */
+ node->name); */
os_file_flush(file);
@@ -4250,13 +4380,14 @@ skip_flush:
node->flush_counter = old_mod_counter;
if (space->is_in_unflushed_spaces
- && fil_space_is_flushed(space)) {
+ && fil_space_is_flushed(space)) {
space->is_in_unflushed_spaces = FALSE;
- UT_LIST_REMOVE(unflushed_spaces,
- system->unflushed_spaces,
- space);
+ UT_LIST_REMOVE
+ (unflushed_spaces,
+ system->unflushed_spaces,
+ space);
}
}
diff --git a/storage/innobase/fsp/fsp0fsp.c b/storage/innobase/fsp/fsp0fsp.c
index 9b0406a1c26..4da25f4d479 100644
--- a/storage/innobase/fsp/fsp0fsp.c
+++ b/storage/innobase/fsp/fsp0fsp.c
@@ -135,9 +135,12 @@ typedef byte fseg_inode_t;
page number within space, FIL_NULL
means that the slot is not in use */
/*-------------------------------------*/
-#define FSEG_INODE_SIZE (16 + 3 * FLST_BASE_NODE_SIZE + FSEG_FRAG_ARR_N_SLOTS * FSEG_FRAG_SLOT_SIZE)
+#define FSEG_INODE_SIZE \
+ (16 + 3 * FLST_BASE_NODE_SIZE \
+ + FSEG_FRAG_ARR_N_SLOTS * FSEG_FRAG_SLOT_SIZE)
-#define FSP_SEG_INODES_PER_PAGE ((UNIV_PAGE_SIZE - FSEG_ARR_OFFSET - 10) / FSEG_INODE_SIZE)
+#define FSP_SEG_INODES_PER_PAGE \
+ ((UNIV_PAGE_SIZE - FSEG_ARR_OFFSET - 10) / FSEG_INODE_SIZE)
/* Number of segment inodes which fit on a
single page */
@@ -204,7 +207,8 @@ the extent are free and which contain old tuple version to clean. */
/* File extent data structure size in bytes. The "+ 7 ) / 8" part in the
definition rounds the number of bytes upward. */
-#define XDES_SIZE (XDES_BITMAP + (FSP_EXTENT_SIZE * XDES_BITS_PER_PAGE + 7) / 8)
+#define XDES_SIZE \
+ (XDES_BITMAP + (FSP_EXTENT_SIZE * XDES_BITS_PER_PAGE + 7) / 8)
/* Offset of the descriptor array on a descriptor page */
#define XDES_ARR_OFFSET (FSP_HEADER_OFFSET + FSP_HEADER_SIZE)
@@ -351,7 +355,7 @@ xdes_get_bit(
ulint bit_index;
ut_ad(mtr_memo_contains(mtr, buf_block_align(descr),
- MTR_MEMO_PAGE_X_FIX));
+ MTR_MEMO_PAGE_X_FIX));
ut_ad((bit == XDES_FREE_BIT) || (bit == XDES_CLEAN_BIT));
ut_ad(offset < FSP_EXTENT_SIZE);
@@ -360,10 +364,9 @@ xdes_get_bit(
byte_index = index / 8;
bit_index = index % 8;
- return(ut_bit_get_nth(
- mtr_read_ulint(descr + XDES_BITMAP + byte_index,
- MLOG_1BYTE, mtr),
- bit_index));
+ return(ut_bit_get_nth(mtr_read_ulint(descr + XDES_BITMAP + byte_index,
+ MLOG_1BYTE, mtr),
+ bit_index));
}
/**************************************************************************
@@ -385,7 +388,7 @@ xdes_set_bit(
ulint descr_byte;
ut_ad(mtr_memo_contains(mtr, buf_block_align(descr),
- MTR_MEMO_PAGE_X_FIX));
+ MTR_MEMO_PAGE_X_FIX));
ut_ad((bit == XDES_FREE_BIT) || (bit == XDES_CLEAN_BIT));
ut_ad(offset < FSP_EXTENT_SIZE);
@@ -395,11 +398,11 @@ xdes_set_bit(
bit_index = index % 8;
descr_byte = mtr_read_ulint(descr + XDES_BITMAP + byte_index,
- MLOG_1BYTE, mtr);
+ MLOG_1BYTE, mtr);
descr_byte = ut_bit_set_nth(descr_byte, bit_index, val);
mlog_write_ulint(descr + XDES_BITMAP + byte_index, descr_byte,
- MLOG_1BYTE, mtr);
+ MLOG_1BYTE, mtr);
}
/**************************************************************************
@@ -424,7 +427,7 @@ xdes_find_bit(
ut_ad(val <= TRUE);
ut_ad(hint < FSP_EXTENT_SIZE);
ut_ad(mtr_memo_contains(mtr, buf_block_align(descr),
- MTR_MEMO_PAGE_X_FIX));
+ MTR_MEMO_PAGE_X_FIX));
for (i = hint; i < FSP_EXTENT_SIZE; i++) {
if (val == xdes_get_bit(descr, bit, i, mtr)) {
@@ -463,7 +466,7 @@ xdes_find_bit_downward(
ut_ad(val <= TRUE);
ut_ad(hint < FSP_EXTENT_SIZE);
ut_ad(mtr_memo_contains(mtr, buf_block_align(descr),
- MTR_MEMO_PAGE_X_FIX));
+ MTR_MEMO_PAGE_X_FIX));
for (i = hint + 1; i > 0; i--) {
if (val == xdes_get_bit(descr, bit, i - 1, mtr)) {
@@ -496,7 +499,7 @@ xdes_get_n_used(
ut_ad(descr && mtr);
ut_ad(mtr_memo_contains(mtr, buf_block_align(descr),
- MTR_MEMO_PAGE_X_FIX));
+ MTR_MEMO_PAGE_X_FIX));
for (i = 0; i < FSP_EXTENT_SIZE; i++) {
if (FALSE == xdes_get_bit(descr, XDES_FREE_BIT, i, mtr)) {
count++;
@@ -556,7 +559,7 @@ xdes_set_state(
ut_ad(state >= XDES_FREE);
ut_ad(state <= XDES_FSEG);
ut_ad(mtr_memo_contains(mtr, buf_block_align(descr),
- MTR_MEMO_PAGE_X_FIX));
+ MTR_MEMO_PAGE_X_FIX));
mlog_write_ulint(descr + XDES_STATE, state, MLOG_4BYTES, mtr);
}
@@ -573,7 +576,7 @@ xdes_get_state(
{
ut_ad(descr && mtr);
ut_ad(mtr_memo_contains(mtr, buf_block_align(descr),
- MTR_MEMO_PAGE_X_FIX));
+ MTR_MEMO_PAGE_X_FIX));
return(mtr_read_ulint(descr + XDES_STATE, MLOG_4BYTES, mtr));
}
@@ -591,7 +594,7 @@ xdes_init(
ut_ad(descr && mtr);
ut_ad(mtr_memo_contains(mtr, buf_block_align(descr),
- MTR_MEMO_PAGE_X_FIX));
+ MTR_MEMO_PAGE_X_FIX));
ut_ad((XDES_SIZE - XDES_BITMAP) % 4 == 0);
for (i = XDES_BITMAP; i < XDES_SIZE; i += 4) {
@@ -627,8 +630,8 @@ xdes_calc_descriptor_index(
/* out: descriptor index */
ulint offset) /* in: page offset */
{
- return(ut_2pow_remainder(offset, XDES_DESCRIBED_PER_PAGE) /
- FSP_EXTENT_SIZE);
+ return(ut_2pow_remainder(offset, XDES_DESCRIBED_PER_PAGE)
+ / FSP_EXTENT_SIZE);
}
/************************************************************************
@@ -659,7 +662,7 @@ xdes_get_descriptor_with_space_hdr(
ut_ad(mtr);
ut_ad(mtr_memo_contains(mtr, fil_space_get_latch(space),
- MTR_MEMO_X_LOCK));
+ MTR_MEMO_X_LOCK));
/* Read free limit and space size */
limit = mtr_read_ulint(sp_header + FSP_FREE_LIMIT, MLOG_4BYTES, mtr);
size = mtr_read_ulint(sp_header + FSP_SIZE, MLOG_4BYTES, mtr);
@@ -685,14 +688,14 @@ xdes_get_descriptor_with_space_hdr(
descr_page = buf_frame_align(sp_header);
} else {
descr_page = buf_page_get(space, descr_page_no, RW_X_LATCH,
- mtr);
+ mtr);
#ifdef UNIV_SYNC_DEBUG
buf_page_dbg_add_level(descr_page, SYNC_FSP_PAGE);
#endif /* UNIV_SYNC_DEBUG */
}
return(descr_page + XDES_ARR_OFFSET
- + XDES_SIZE * xdes_calc_descriptor_index(offset));
+ + XDES_SIZE * xdes_calc_descriptor_index(offset));
}
/************************************************************************
@@ -717,12 +720,12 @@ xdes_get_descriptor(
fsp_header_t* sp_header;
sp_header = FSP_HEADER_OFFSET
- + buf_page_get(space, 0, RW_X_LATCH, mtr);
+ + buf_page_get(space, 0, RW_X_LATCH, mtr);
#ifdef UNIV_SYNC_DEBUG
buf_page_dbg_add_level(sp_header, SYNC_FSP_PAGE);
#endif /* UNIV_SYNC_DEBUG */
return(xdes_get_descriptor_with_space_hdr(sp_header, space, offset,
- mtr));
+ mtr));
}
/************************************************************************
@@ -743,7 +746,7 @@ xdes_lst_get_descriptor(
ut_ad(mtr);
ut_ad(mtr_memo_contains(mtr, fil_space_get_latch(space),
- MTR_MEMO_X_LOCK));
+ MTR_MEMO_X_LOCK));
descr = fut_get_ptr(space, lst_node, RW_X_LATCH, mtr) - XDES_FLST_NODE;
return(descr);
@@ -765,8 +768,8 @@ xdes_lst_get_next(
space = buf_frame_get_space_id(descr);
- return(xdes_lst_get_descriptor(space,
- flst_get_next_addr(descr + XDES_FLST_NODE, mtr), mtr));
+ return(xdes_lst_get_descriptor
+ (space, flst_get_next_addr(descr + XDES_FLST_NODE, mtr), mtr));
}
/************************************************************************
@@ -781,9 +784,9 @@ xdes_get_offset(
ut_ad(descr);
return(buf_frame_get_page_no(descr)
- + ((descr - buf_frame_align(descr) - XDES_ARR_OFFSET)
- / XDES_SIZE)
- * FSP_EXTENT_SIZE);
+ + ((descr - buf_frame_align(descr) - XDES_ARR_OFFSET)
+ / XDES_SIZE)
+ * FSP_EXTENT_SIZE);
}
/***************************************************************
@@ -803,7 +806,7 @@ fsp_init_file_page_low(
memset(page, 0xff, UNIV_PAGE_SIZE);
#endif
mach_write_to_8(page + UNIV_PAGE_SIZE - FIL_PAGE_END_LSN_OLD_CHKSUM,
- ut_dulint_zero);
+ ut_dulint_zero);
mach_write_to_8(page + FIL_PAGE_LSN, ut_dulint_zero);
}
@@ -893,7 +896,7 @@ fsp_header_init(
fsp_init_file_page(page, mtr);
mlog_write_ulint(page + FIL_PAGE_TYPE, FIL_PAGE_TYPE_FSP_HDR,
- MLOG_2BYTES, mtr);
+ MLOG_2BYTES, mtr);
header = FSP_HEADER_OFFSET + page;
@@ -915,7 +918,7 @@ fsp_header_init(
if (space == 0) {
fsp_fill_free_list(FALSE, space, header, mtr);
btr_create(DICT_CLUSTERED | DICT_UNIVERSAL | DICT_IBUF, space,
- ut_dulint_add(DICT_IBUF_ID_MIN, space), FALSE, mtr);
+ ut_dulint_add(DICT_IBUF_ID_MIN, space), FALSE, mtr);
} else {
fsp_fill_free_list(TRUE, space, header, mtr);
}
@@ -939,7 +942,8 @@ fsp_header_get_space_id(
if (id != fsp_id) {
fprintf(stderr,
-"InnoDB: Error: space id in fsp header %lu, but in the page header %lu\n",
+ "InnoDB: Error: space id in fsp header %lu,"
+ " but in the page header %lu\n",
(ulong) fsp_id, (ulong) id);
return(ULINT_UNDEFINED);
@@ -970,7 +974,7 @@ fsp_header_inc_size(
size = mtr_read_ulint(header + FSP_SIZE, MLOG_4BYTES, mtr);
mlog_write_ulint(header + FSP_SIZE, size + size_inc, MLOG_4BYTES,
- mtr);
+ mtr);
}
/**************************************************************************
@@ -1062,7 +1066,7 @@ fsp_try_extend_data_file_with_pages(
ut_a(page_no >= size);
success = fil_extend_space_to_desired_size(&actual_size, space,
- page_no + 1);
+ page_no + 1);
/* actual_size now has the space size in pages; it may be less than
we wanted if we ran out of disk space */
@@ -1107,16 +1111,18 @@ fsp_try_extend_data_file(
if (space == 0 && srv_last_file_size_max != 0) {
if (srv_last_file_size_max
- < srv_data_file_sizes[srv_n_data_files - 1]) {
+ < srv_data_file_sizes[srv_n_data_files - 1]) {
fprintf(stderr,
-"InnoDB: Error: Last data file size is %lu, max size allowed %lu\n",
- (ulong) srv_data_file_sizes[srv_n_data_files - 1],
+ "InnoDB: Error: Last data file size is %lu,"
+ " max size allowed %lu\n",
+ (ulong) srv_data_file_sizes
+ [srv_n_data_files - 1],
(ulong) srv_last_file_size_max);
}
size_increase = srv_last_file_size_max
- - srv_data_file_sizes[srv_n_data_files - 1];
+ - srv_data_file_sizes[srv_n_data_files - 1];
if (size_increase > SRV_AUTO_EXTEND_INCREMENT) {
size_increase = SRV_AUTO_EXTEND_INCREMENT;
}
@@ -1131,12 +1137,13 @@ fsp_try_extend_data_file(
if (size < FSP_EXTENT_SIZE) {
/* Let us first extend the file to 64 pages */
- success = fsp_try_extend_data_file_with_pages(
- space, FSP_EXTENT_SIZE - 1,
- header, mtr);
+ success = fsp_try_extend_data_file_with_pages
+ (space, FSP_EXTENT_SIZE - 1,
+ header, mtr);
if (!success) {
- new_size = mtr_read_ulint(
- header + FSP_SIZE, MLOG_4BYTES, mtr);
+ new_size = mtr_read_ulint
+ (header + FSP_SIZE,
+ MLOG_4BYTES, mtr);
*actual_increase = new_size - old_size;
@@ -1163,13 +1170,14 @@ fsp_try_extend_data_file(
}
success = fil_extend_space_to_desired_size(&actual_size, space,
- size + size_increase);
+ size + size_increase);
/* We ignore any fragments of a full megabyte when storing the size
to the space header */
mlog_write_ulint(header + FSP_SIZE,
- ut_calc_align_down(actual_size, (1024 * 1024) / UNIV_PAGE_SIZE),
- MLOG_4BYTES, mtr);
+ ut_calc_align_down(actual_size,
+ (1024 * 1024) / UNIV_PAGE_SIZE),
+ MLOG_4BYTES, mtr);
new_size = mtr_read_ulint(header + FSP_SIZE, MLOG_4BYTES, mtr);
*actual_increase = new_size - old_size;
@@ -1212,7 +1220,7 @@ fsp_fill_free_list(
limit = mtr_read_ulint(header + FSP_FREE_LIMIT, MLOG_4BYTES, mtr);
if (space == 0 && srv_auto_extend_last_data_file
- && size < limit + FSP_EXTENT_SIZE * FSP_FREE_ADD) {
+ && size < limit + FSP_EXTENT_SIZE * FSP_FREE_ADD) {
/* Try to increase the last data file size */
fsp_try_extend_data_file(&actual_increase, space, header, mtr);
@@ -1220,7 +1228,7 @@ fsp_fill_free_list(
}
if (space != 0 && !init_space
- && size < limit + FSP_EXTENT_SIZE * FSP_FREE_ADD) {
+ && size < limit + FSP_EXTENT_SIZE * FSP_FREE_ADD) {
/* Try to increase the .ibd file size */
fsp_try_extend_data_file(&actual_increase, space, header, mtr);
@@ -1230,17 +1238,17 @@ fsp_fill_free_list(
i = limit;
while ((init_space && i < 1)
- || ((i + FSP_EXTENT_SIZE <= size) && (count < FSP_FREE_ADD))) {
+ || ((i + FSP_EXTENT_SIZE <= size) && (count < FSP_FREE_ADD))) {
mlog_write_ulint(header + FSP_FREE_LIMIT, i + FSP_EXTENT_SIZE,
- MLOG_4BYTES, mtr);
+ MLOG_4BYTES, mtr);
/* Update the free limit info in the log system and make
a checkpoint */
if (space == 0) {
- log_fsp_current_free_limit_set_and_checkpoint(
- (i + FSP_EXTENT_SIZE)
- / ((1024 * 1024) / UNIV_PAGE_SIZE));
+ log_fsp_current_free_limit_set_and_checkpoint
+ ((i + FSP_EXTENT_SIZE)
+ / ((1024 * 1024) / UNIV_PAGE_SIZE));
}
if (0 == i % XDES_DESCRIBED_PER_PAGE) {
@@ -1254,11 +1262,12 @@ fsp_fill_free_list(
buf_page_get(space, i, RW_X_LATCH, mtr);
#ifdef UNIV_SYNC_DEBUG
buf_page_dbg_add_level(descr_page,
- SYNC_FSP_PAGE);
+ SYNC_FSP_PAGE);
#endif /* UNIV_SYNC_DEBUG */
fsp_init_file_page(descr_page, mtr);
mlog_write_ulint(descr_page + FIL_PAGE_TYPE,
- FIL_PAGE_TYPE_XDES, MLOG_2BYTES, mtr);
+ FIL_PAGE_TYPE_XDES,
+ MLOG_2BYTES, mtr);
}
/* Initialize the ibuf bitmap page in a separate
@@ -1269,9 +1278,10 @@ fsp_fill_free_list(
mtr_start(&ibuf_mtr);
ibuf_page = buf_page_create(space,
- i + FSP_IBUF_BITMAP_OFFSET, &ibuf_mtr);
+ i + FSP_IBUF_BITMAP_OFFSET,
+ &ibuf_mtr);
buf_page_get(space, i + FSP_IBUF_BITMAP_OFFSET,
- RW_X_LATCH, &ibuf_mtr);
+ RW_X_LATCH, &ibuf_mtr);
#ifdef UNIV_SYNC_DEBUG
buf_page_dbg_add_level(ibuf_page, SYNC_FSP_PAGE);
#endif /* UNIV_SYNC_DEBUG */
@@ -1283,7 +1293,7 @@ fsp_fill_free_list(
}
descr = xdes_get_descriptor_with_space_hdr(header, space, i,
- mtr);
+ mtr);
xdes_init(descr, mtr);
#if XDES_DESCRIBED_PER_PAGE % FSP_EXTENT_SIZE
@@ -1298,18 +1308,18 @@ fsp_fill_free_list(
xdes_set_bit(descr, XDES_FREE_BIT, 0, FALSE, mtr);
xdes_set_bit(descr, XDES_FREE_BIT,
- FSP_IBUF_BITMAP_OFFSET, FALSE, mtr);
+ FSP_IBUF_BITMAP_OFFSET, FALSE, mtr);
xdes_set_state(descr, XDES_FREE_FRAG, mtr);
flst_add_last(header + FSP_FREE_FRAG,
- descr + XDES_FLST_NODE, mtr);
+ descr + XDES_FLST_NODE, mtr);
frag_n_used = mtr_read_ulint(header + FSP_FRAG_N_USED,
- MLOG_4BYTES, mtr);
+ MLOG_4BYTES, mtr);
mlog_write_ulint(header + FSP_FRAG_N_USED,
- frag_n_used + 2, MLOG_4BYTES, mtr);
+ frag_n_used + 2, MLOG_4BYTES, mtr);
} else {
flst_add_last(header + FSP_FREE,
- descr + XDES_FLST_NODE, mtr);
+ descr + XDES_FLST_NODE, mtr);
count++;
}
@@ -1419,7 +1429,7 @@ fsp_alloc_free_page(
xdes_set_state(descr, XDES_FREE_FRAG, mtr);
flst_add_last(header + FSP_FREE_FRAG,
- descr + XDES_FLST_NODE, mtr);
+ descr + XDES_FLST_NODE, mtr);
} else {
descr = xdes_lst_get_descriptor(space, first, mtr);
}
@@ -1432,7 +1442,7 @@ fsp_alloc_free_page(
for a free page in the extent. */
free = xdes_find_bit(descr, XDES_FREE_BIT, TRUE,
- hint % FSP_EXTENT_SIZE, mtr);
+ hint % FSP_EXTENT_SIZE, mtr);
if (free == ULINT_UNDEFINED) {
ut_print_buf(stderr, ((byte*)descr) - 500, 1000);
@@ -1451,13 +1461,16 @@ fsp_alloc_free_page(
ut_a(space != 0);
if (page_no >= FSP_EXTENT_SIZE) {
fprintf(stderr,
-"InnoDB: Error: trying to extend a single-table tablespace %lu\n"
-"InnoDB: by single page(s) though the space size %lu. Page no %lu.\n",
- (ulong) space, (ulong) space_size, (ulong) page_no);
+ "InnoDB: Error: trying to extend a"
+ " single-table tablespace %lu\n"
+ "InnoDB: by single page(s) though the"
+ " space size %lu. Page no %lu.\n",
+ (ulong) space, (ulong) space_size,
+ (ulong) page_no);
return(FIL_NULL);
}
success = fsp_try_extend_data_file_with_pages(space, page_no,
- header, mtr);
+ header, mtr);
if (!success) {
/* No disk space left */
return(FIL_NULL);
@@ -1468,21 +1481,21 @@ fsp_alloc_free_page(
/* Update the FRAG_N_USED field */
frag_n_used = mtr_read_ulint(header + FSP_FRAG_N_USED, MLOG_4BYTES,
- mtr);
+ mtr);
frag_n_used++;
mlog_write_ulint(header + FSP_FRAG_N_USED, frag_n_used, MLOG_4BYTES,
- mtr);
+ mtr);
if (xdes_is_full(descr, mtr)) {
/* The fragment is full: move it to another list */
flst_remove(header + FSP_FREE_FRAG, descr + XDES_FLST_NODE,
- mtr);
+ mtr);
xdes_set_state(descr, XDES_FULL_FRAG, mtr);
flst_add_last(header + FSP_FULL_FRAG, descr + XDES_FLST_NODE,
- mtr);
+ mtr);
mlog_write_ulint(header + FSP_FRAG_N_USED,
- frag_n_used - FSP_EXTENT_SIZE, MLOG_4BYTES,
- mtr);
+ frag_n_used - FSP_EXTENT_SIZE, MLOG_4BYTES,
+ mtr);
}
/* Initialize the allocated page to the buffer pool, so that it can
@@ -1519,7 +1532,7 @@ fsp_free_page(
ut_ad(mtr);
-/* fprintf(stderr, "Freeing page %lu in space %lu\n", page, space); */
+ /* fprintf(stderr, "Freeing page %lu in space %lu\n", page, space); */
header = fsp_get_space_header(space, mtr);
@@ -1529,9 +1542,10 @@ fsp_free_page(
if (state != XDES_FREE_FRAG && state != XDES_FULL_FRAG) {
fprintf(stderr,
-"InnoDB: Error: File space extent descriptor of page %lu has state %lu\n",
- (ulong) page,
- (ulong) state);
+ "InnoDB: Error: File space extent descriptor"
+ " of page %lu has state %lu\n",
+ (ulong) page,
+ (ulong) state);
fputs("InnoDB: Dump of descriptor: ", stderr);
ut_print_buf(stderr, ((byte*)descr) - 50, 200);
putc('\n', stderr);
@@ -1548,8 +1562,9 @@ fsp_free_page(
if (xdes_get_bit(descr, XDES_FREE_BIT, page % FSP_EXTENT_SIZE, mtr)) {
fprintf(stderr,
-"InnoDB: Error: File space extent descriptor of page %lu says it is free\n"
-"InnoDB: Dump of descriptor: ", (ulong) page);
+ "InnoDB: Error: File space extent descriptor"
+ " of page %lu says it is free\n"
+ "InnoDB: Dump of descriptor: ", (ulong) page);
ut_print_buf(stderr, ((byte*)descr) - 50, 200);
putc('\n', stderr);
@@ -1563,27 +1578,27 @@ fsp_free_page(
xdes_set_bit(descr, XDES_CLEAN_BIT, page % FSP_EXTENT_SIZE, TRUE, mtr);
frag_n_used = mtr_read_ulint(header + FSP_FRAG_N_USED, MLOG_4BYTES,
- mtr);
+ mtr);
if (state == XDES_FULL_FRAG) {
/* The fragment was full: move it to another list */
flst_remove(header + FSP_FULL_FRAG, descr + XDES_FLST_NODE,
- mtr);
+ mtr);
xdes_set_state(descr, XDES_FREE_FRAG, mtr);
flst_add_last(header + FSP_FREE_FRAG, descr + XDES_FLST_NODE,
- mtr);
+ mtr);
mlog_write_ulint(header + FSP_FRAG_N_USED,
- frag_n_used + FSP_EXTENT_SIZE - 1,
- MLOG_4BYTES, mtr);
+ frag_n_used + FSP_EXTENT_SIZE - 1,
+ MLOG_4BYTES, mtr);
} else {
ut_a(frag_n_used > 0);
mlog_write_ulint(header + FSP_FRAG_N_USED, frag_n_used - 1,
- MLOG_4BYTES, mtr);
+ MLOG_4BYTES, mtr);
}
if (xdes_is_free(descr, mtr)) {
/* The extent has become free: move it to another list */
flst_remove(header + FSP_FREE_FRAG, descr + XDES_FLST_NODE,
- mtr);
+ mtr);
fsp_free_extent(space, page, mtr);
}
}
@@ -1632,7 +1647,7 @@ fsp_seg_inode_page_get_nth_inode(
{
ut_ad(i < FSP_SEG_INODES_PER_PAGE);
ut_ad(mtr_memo_contains(mtr, buf_block_align(page),
- MTR_MEMO_PAGE_X_FIX));
+ MTR_MEMO_PAGE_X_FIX));
return(page + FSEG_ARR_OFFSET + FSEG_INODE_SIZE * i);
}
@@ -1656,7 +1671,7 @@ fsp_seg_inode_page_find_used(
inode = fsp_seg_inode_page_get_nth_inode(page, i, mtr);
if (ut_dulint_cmp(mach_read_from_8(inode + FSEG_ID),
- ut_dulint_zero) != 0) {
+ ut_dulint_zero) != 0) {
/* This is used */
return(i);
@@ -1686,7 +1701,7 @@ fsp_seg_inode_page_find_free(
inode = fsp_seg_inode_page_get_nth_inode(page, i, mtr);
if (ut_dulint_cmp(mach_read_from_8(inode + FSEG_ID),
- ut_dulint_zero) == 0) {
+ ut_dulint_zero) == 0) {
/* This is unused */
return(i);
@@ -1726,7 +1741,7 @@ fsp_alloc_seg_inode_page(
buf_block_align(page)->check_index_page_at_flush = FALSE;
mlog_write_ulint(page + FIL_PAGE_TYPE, FIL_PAGE_INODE,
- MLOG_2BYTES, mtr);
+ MLOG_2BYTES, mtr);
#ifdef UNIV_SYNC_DEBUG
buf_page_dbg_add_level(page, SYNC_FSP_PAGE);
#endif /* UNIV_SYNC_DEBUG */
@@ -1739,7 +1754,7 @@ fsp_alloc_seg_inode_page(
}
flst_add_last(space_header + FSP_SEG_INODES_FREE,
- page + FSEG_INODE_PAGE_NODE, mtr);
+ page + FSEG_INODE_PAGE_NODE, mtr);
return(TRUE);
}
@@ -1774,7 +1789,7 @@ fsp_alloc_seg_inode(
page_no = flst_get_first(space_header + FSP_SEG_INODES_FREE, mtr).page;
page = buf_page_get(buf_frame_get_space_id(space_header), page_no,
- RW_X_LATCH, mtr);
+ RW_X_LATCH, mtr);
#ifdef UNIV_SYNC_DEBUG
buf_page_dbg_add_level(page, SYNC_FSP_PAGE);
#endif /* UNIV_SYNC_DEBUG */
@@ -1786,15 +1801,15 @@ fsp_alloc_seg_inode(
inode = fsp_seg_inode_page_get_nth_inode(page, n, mtr);
if (ULINT_UNDEFINED == fsp_seg_inode_page_find_free(page, n + 1,
- mtr)) {
+ mtr)) {
/* There are no other unused headers left on the page: move it
to another list */
flst_remove(space_header + FSP_SEG_INODES_FREE,
- page + FSEG_INODE_PAGE_NODE, mtr);
+ page + FSEG_INODE_PAGE_NODE, mtr);
flst_add_last(space_header + FSP_SEG_INODES_FULL,
- page + FSEG_INODE_PAGE_NODE, mtr);
+ page + FSEG_INODE_PAGE_NODE, mtr);
}
return(inode);
@@ -1824,10 +1839,10 @@ fsp_free_seg_inode(
/* Move the page to another list */
flst_remove(space_header + FSP_SEG_INODES_FULL,
- page + FSEG_INODE_PAGE_NODE, mtr);
+ page + FSEG_INODE_PAGE_NODE, mtr);
flst_add_last(space_header + FSP_SEG_INODES_FREE,
- page + FSEG_INODE_PAGE_NODE, mtr);
+ page + FSEG_INODE_PAGE_NODE, mtr);
}
mlog_write_dulint(inode + FSEG_ID, ut_dulint_zero, mtr);
@@ -1838,7 +1853,7 @@ fsp_free_seg_inode(
/* There are no other used headers left on the page: free it */
flst_remove(space_header + FSP_SEG_INODES_FREE,
- page + FSEG_INODE_PAGE_NODE, mtr);
+ page + FSEG_INODE_PAGE_NODE, mtr);
fsp_free_page(space, buf_frame_get_page_no(page), mtr);
}
@@ -1861,7 +1876,7 @@ fseg_inode_get(
inode_addr.boffset = mach_read_from_2(header + FSEG_HDR_OFFSET);
inode = fut_get_ptr(mach_read_from_4(header + FSEG_HDR_SPACE),
- inode_addr, RW_X_LATCH, mtr);
+ inode_addr, RW_X_LATCH, mtr);
ut_ad(mach_read_from_4(inode + FSEG_MAGIC_N) == FSEG_MAGIC_N_VALUE);
@@ -1882,9 +1897,9 @@ fseg_get_nth_frag_page_no(
ut_ad(inode && mtr);
ut_ad(n < FSEG_FRAG_ARR_N_SLOTS);
ut_ad(mtr_memo_contains(mtr, buf_block_align(inode),
- MTR_MEMO_PAGE_X_FIX));
+ MTR_MEMO_PAGE_X_FIX));
return(mach_read_from_4(inode + FSEG_FRAG_ARR
- + n * FSEG_FRAG_SLOT_SIZE));
+ + n * FSEG_FRAG_SLOT_SIZE));
}
/**************************************************************************
@@ -1901,10 +1916,10 @@ fseg_set_nth_frag_page_no(
ut_ad(inode && mtr);
ut_ad(n < FSEG_FRAG_ARR_N_SLOTS);
ut_ad(mtr_memo_contains(mtr, buf_block_align(inode),
- MTR_MEMO_PAGE_X_FIX));
+ MTR_MEMO_PAGE_X_FIX));
mlog_write_ulint(inode + FSEG_FRAG_ARR + n * FSEG_FRAG_SLOT_SIZE,
- page_no, MLOG_4BYTES, mtr);
+ page_no, MLOG_4BYTES, mtr);
}
/**************************************************************************
@@ -1952,8 +1967,8 @@ fseg_find_last_used_frag_page_slot(
ut_ad(inode && mtr);
for (i = 0; i < FSEG_FRAG_ARR_N_SLOTS; i++) {
- page_no = fseg_get_nth_frag_page_no(inode,
- FSEG_FRAG_ARR_N_SLOTS - i - 1, mtr);
+ page_no = fseg_get_nth_frag_page_no
+ (inode, FSEG_FRAG_ARR_N_SLOTS - i - 1, mtr);
if (page_no != FIL_NULL) {
@@ -2026,13 +2041,13 @@ fseg_create_general(
if (page != 0) {
header = byte_offset + buf_page_get(space, page, RW_X_LATCH,
- mtr);
+ mtr);
}
#ifdef UNIV_SYNC_DEBUG
ut_ad(!mutex_own(&kernel_mutex)
- || mtr_memo_contains(mtr, fil_space_get_latch(space),
- MTR_MEMO_X_LOCK));
+ || mtr_memo_contains(mtr, fil_space_get_latch(space),
+ MTR_MEMO_X_LOCK));
#endif /* UNIV_SYNC_DEBUG */
latch = fil_space_get_latch(space);
@@ -2049,7 +2064,7 @@ fseg_create_general(
if (!has_done_reservation) {
success = fsp_reserve_free_extents(&n_reserved, space, 2,
- FSP_NORMAL, mtr);
+ FSP_NORMAL, mtr);
if (!success) {
return(NULL);
}
@@ -2070,7 +2085,7 @@ fseg_create_general(
seg_id = mtr_read_dulint(space_header + FSP_SEG_ID, mtr);
mlog_write_dulint(space_header + FSP_SEG_ID, ut_dulint_add(seg_id, 1),
- mtr);
+ mtr);
mlog_write_dulint(inode + FSEG_ID, seg_id, mtr);
mlog_write_ulint(inode + FSEG_NOT_FULL_N_USED, 0, MLOG_4BYTES, mtr);
@@ -2080,7 +2095,7 @@ fseg_create_general(
flst_init(inode + FSEG_FULL, mtr);
mlog_write_ulint(inode + FSEG_MAGIC_N, FSEG_MAGIC_N_VALUE,
- MLOG_4BYTES, mtr);
+ MLOG_4BYTES, mtr);
for (i = 0; i < FSEG_FRAG_ARR_N_SLOTS; i++) {
fseg_set_nth_frag_page_no(inode, i, FIL_NULL, mtr);
}
@@ -2096,16 +2111,16 @@ fseg_create_general(
}
header = byte_offset
- + buf_page_get(space, page, RW_X_LATCH, mtr);
+ + buf_page_get(space, page, RW_X_LATCH, mtr);
mlog_write_ulint(header - byte_offset + FIL_PAGE_TYPE,
- FIL_PAGE_TYPE_SYS, MLOG_2BYTES, mtr);
+ FIL_PAGE_TYPE_SYS, MLOG_2BYTES, mtr);
}
mlog_write_ulint(header + FSEG_HDR_OFFSET,
- inode - buf_frame_align(inode), MLOG_2BYTES, mtr);
+ inode - buf_frame_align(inode), MLOG_2BYTES, mtr);
mlog_write_ulint(header + FSEG_HDR_PAGE_NO,
- buf_frame_get_page_no(inode), MLOG_4BYTES, mtr);
+ buf_frame_get_page_no(inode), MLOG_4BYTES, mtr);
mlog_write_ulint(header + FSEG_HDR_SPACE, space, MLOG_4BYTES, mtr);
@@ -2157,7 +2172,7 @@ fseg_n_reserved_pages_low(
ut_ad(inode && used && mtr);
ut_ad(mtr_memo_contains(mtr, buf_block_align(inode),
- MTR_MEMO_PAGE_X_FIX));
+ MTR_MEMO_PAGE_X_FIX));
*used = mtr_read_ulint(inode + FSEG_NOT_FULL_N_USED, MLOG_4BYTES, mtr)
+ FSP_EXTENT_SIZE * flst_get_len(inode + FSEG_FULL, mtr)
@@ -2191,8 +2206,8 @@ fseg_n_reserved_pages(
#ifdef UNIV_SYNC_DEBUG
ut_ad(!mutex_own(&kernel_mutex)
- || mtr_memo_contains(mtr, fil_space_get_latch(space),
- MTR_MEMO_X_LOCK));
+ || mtr_memo_contains(mtr, fil_space_get_latch(space),
+ MTR_MEMO_X_LOCK));
#endif /* UNIV_SYNC_DEBUG */
mtr_x_lock(fil_space_get_latch(space), mtr);
@@ -2244,8 +2259,8 @@ fseg_fill_free_list(
for (i = 0; i < FSEG_FREE_LIST_MAX_LEN; i++) {
descr = xdes_get_descriptor(space, hint, mtr);
- if ((descr == NULL) ||
- (XDES_FREE != xdes_get_state(descr, mtr))) {
+ if ((descr == NULL)
+ || (XDES_FREE != xdes_get_state(descr, mtr))) {
/* We cannot allocate the desired extent: stop */
@@ -2306,7 +2321,8 @@ fseg_alloc_free_extent(
/* Try to fill the segment free list */
fseg_fill_free_list(inode, space,
- xdes_get_offset(descr) + FSP_EXTENT_SIZE, mtr);
+ xdes_get_offset(descr) + FSP_EXTENT_SIZE,
+ mtr);
}
return(descr);
@@ -2348,8 +2364,8 @@ fseg_alloc_free_page_low(
ut_ad(mtr);
ut_ad((direction >= FSP_UP) && (direction <= FSP_NO_DIR));
- ut_ad(mach_read_from_4(seg_inode + FSEG_MAGIC_N) ==
- FSEG_MAGIC_N_VALUE);
+ ut_ad(mach_read_from_4(seg_inode + FSEG_MAGIC_N)
+ == FSEG_MAGIC_N_VALUE);
seg_id = mtr_read_dulint(seg_inode + FSEG_ID, mtr);
ut_ad(ut_dulint_cmp(seg_id, ut_dulint_zero) > 0);
@@ -2359,7 +2375,7 @@ fseg_alloc_free_page_low(
space_header = fsp_get_space_header(space, mtr);
descr = xdes_get_descriptor_with_space_hdr(space_header, space,
- hint, mtr);
+ hint, mtr);
if (descr == NULL) {
/* Hint outside space or too high above free limit: reset
hint */
@@ -2370,16 +2386,16 @@ fseg_alloc_free_page_low(
/* In the big if-else below we look for ret_page and ret_descr */
/*-------------------------------------------------------------*/
if ((xdes_get_state(descr, mtr) == XDES_FSEG)
- && (0 == ut_dulint_cmp(mtr_read_dulint(descr + XDES_ID,
- mtr), seg_id))
- && (xdes_get_bit(descr, XDES_FREE_BIT,
- hint % FSP_EXTENT_SIZE, mtr) == TRUE)) {
+ && (0 == ut_dulint_cmp(mtr_read_dulint(descr + XDES_ID,
+ mtr), seg_id))
+ && (xdes_get_bit(descr, XDES_FREE_BIT,
+ hint % FSP_EXTENT_SIZE, mtr) == TRUE)) {
/* 1. We can take the hinted page
=================================*/
ret_descr = descr;
ret_page = hint;
- /*-------------------------------------------------------------*/
+ /*-----------------------------------------------------------*/
} else if ((xdes_get_state(descr, mtr) == XDES_FREE)
&& ((reserved - used) < reserved / FSEG_FILLFACTOR)
&& (used >= FSEG_FRAG_LIMIT)) {
@@ -2395,18 +2411,18 @@ fseg_alloc_free_page_low(
xdes_set_state(ret_descr, XDES_FSEG, mtr);
mlog_write_dulint(ret_descr + XDES_ID, seg_id, mtr);
flst_add_last(seg_inode + FSEG_FREE,
- ret_descr + XDES_FLST_NODE, mtr);
+ ret_descr + XDES_FLST_NODE, mtr);
/* Try to fill the segment free list */
fseg_fill_free_list(seg_inode, space,
- hint + FSP_EXTENT_SIZE, mtr);
+ hint + FSP_EXTENT_SIZE, mtr);
ret_page = hint;
- /*-------------------------------------------------------------*/
+ /*-----------------------------------------------------------*/
} else if ((direction != FSP_NO_DIR)
&& ((reserved - used) < reserved / FSEG_FILLFACTOR)
&& (used >= FSEG_FRAG_LIMIT)
- && (NULL != (ret_descr =
- fseg_alloc_free_extent(seg_inode, space, mtr)))) {
+ && (!!(ret_descr
+ = fseg_alloc_free_extent(seg_inode, space, mtr)))) {
/* 3. We take any free extent (which was already assigned above
===============================================================
@@ -2419,10 +2435,10 @@ fseg_alloc_free_page_low(
if (direction == FSP_DOWN) {
ret_page += FSP_EXTENT_SIZE - 1;
}
- /*-------------------------------------------------------------*/
+ /*-----------------------------------------------------------*/
} else if ((xdes_get_state(descr, mtr) == XDES_FSEG)
&& (0 == ut_dulint_cmp(mtr_read_dulint(descr + XDES_ID,
- mtr), seg_id))
+ mtr), seg_id))
&& (!xdes_is_full(descr, mtr))) {
/* 4. We can take the page from the same extent as the
@@ -2432,10 +2448,10 @@ fseg_alloc_free_page_low(
segment)
========*/
ret_descr = descr;
- ret_page = xdes_get_offset(ret_descr) +
- xdes_find_bit(ret_descr, XDES_FREE_BIT, TRUE,
+ ret_page = xdes_get_offset(ret_descr)
+ + xdes_find_bit(ret_descr, XDES_FREE_BIT, TRUE,
hint % FSP_EXTENT_SIZE, mtr);
- /*-------------------------------------------------------------*/
+ /*-----------------------------------------------------------*/
} else if (reserved - used > 0) {
/* 5. We take any unused page from the segment
==============================================*/
@@ -2443,7 +2459,7 @@ fseg_alloc_free_page_low(
if (flst_get_len(seg_inode + FSEG_NOT_FULL, mtr) > 0) {
first = flst_get_first(seg_inode + FSEG_NOT_FULL,
- mtr);
+ mtr);
} else if (flst_get_len(seg_inode + FSEG_FREE, mtr) > 0) {
first = flst_get_first(seg_inode + FSEG_FREE, mtr);
} else {
@@ -2452,10 +2468,10 @@ fseg_alloc_free_page_low(
}
ret_descr = xdes_lst_get_descriptor(space, first, mtr);
- ret_page = xdes_get_offset(ret_descr) +
- xdes_find_bit(ret_descr, XDES_FREE_BIT, TRUE,
- 0, mtr);
- /*-------------------------------------------------------------*/
+ ret_page = xdes_get_offset(ret_descr)
+ + xdes_find_bit(ret_descr, XDES_FREE_BIT, TRUE,
+ 0, mtr);
+ /*-----------------------------------------------------------*/
} else if (used < FSEG_FRAG_LIMIT) {
/* 6. We allocate an individual page from the space
===================================================*/
@@ -2471,9 +2487,9 @@ fseg_alloc_free_page_low(
ut_a(n != FIL_NULL);
fseg_set_nth_frag_page_no(seg_inode, n, ret_page,
- mtr);
+ mtr);
}
- /*-------------------------------------------------------------*/
+ /*-----------------------------------------------------------*/
} else {
/* 7. We allocate a new extent and take its first page
======================================================*/
@@ -2501,15 +2517,17 @@ fseg_alloc_free_page_low(
if (ret_page >= FSP_EXTENT_SIZE) {
fprintf(stderr,
-"InnoDB: Error (2): trying to extend a single-table tablespace %lu\n"
-"InnoDB: by single page(s) though the space size %lu. Page no %lu.\n",
+ "InnoDB: Error (2): trying to extend"
+ " a single-table tablespace %lu\n"
+ "InnoDB: by single page(s) though"
+ " the space size %lu. Page no %lu.\n",
(ulong) space, (ulong) space_size,
(ulong) ret_page);
return(FIL_NULL);
}
- success = fsp_try_extend_data_file_with_pages(space,
- ret_page, space_header, mtr);
+ success = fsp_try_extend_data_file_with_pages
+ (space, ret_page, space_header, mtr);
if (!success) {
/* No disk space left */
return(FIL_NULL);
@@ -2539,7 +2557,7 @@ fseg_alloc_free_page_low(
ut_ad(xdes_get_descriptor(space, ret_page, mtr) == ret_descr);
ut_ad(xdes_get_bit(ret_descr, XDES_FREE_BIT,
- ret_page % FSP_EXTENT_SIZE, mtr) == TRUE);
+ ret_page % FSP_EXTENT_SIZE, mtr) == TRUE);
fseg_mark_page_used(seg_inode, space, ret_page, mtr);
}
@@ -2584,8 +2602,8 @@ fseg_alloc_free_page_general(
#ifdef UNIV_SYNC_DEBUG
ut_ad(!mutex_own(&kernel_mutex)
- || mtr_memo_contains(mtr, fil_space_get_latch(space),
- MTR_MEMO_X_LOCK));
+ || mtr_memo_contains(mtr, fil_space_get_latch(space),
+ MTR_MEMO_X_LOCK));
#endif /* UNIV_SYNC_DEBUG */
latch = fil_space_get_latch(space);
@@ -2604,14 +2622,14 @@ fseg_alloc_free_page_general(
if (!has_done_reservation) {
success = fsp_reserve_free_extents(&n_reserved, space, 2,
- FSP_NORMAL, mtr);
+ FSP_NORMAL, mtr);
if (!success) {
return(FIL_NULL);
}
}
page_no = fseg_alloc_free_page_low(buf_frame_get_space_id(inode),
- inode, hint, direction, mtr);
+ inode, hint, direction, mtr);
if (!has_done_reservation) {
fil_space_release_free_extents(space, n_reserved);
}
@@ -2639,7 +2657,7 @@ fseg_alloc_free_page(
mtr_t* mtr) /* in: mtr handle */
{
return(fseg_alloc_free_page_general(seg_header, hint, direction,
- FALSE, mtr));
+ FALSE, mtr));
}
/**************************************************************************
@@ -2668,7 +2686,7 @@ fsp_reserve_free_pages(
ut_a(size < FSP_EXTENT_SIZE / 2);
descr = xdes_get_descriptor_with_space_hdr(space_header, space, 0,
- mtr);
+ mtr);
n_used = xdes_get_n_used(descr, mtr);
ut_a(n_used <= size);
@@ -2679,7 +2697,7 @@ fsp_reserve_free_pages(
}
return(fsp_try_extend_data_file_with_pages(space, n_used + 1,
- space_header, mtr));
+ space_header, mtr));
}
/**************************************************************************
@@ -2734,8 +2752,8 @@ fsp_reserve_free_extents(
ut_ad(mtr);
#ifdef UNIV_SYNC_DEBUG
ut_ad(!mutex_own(&kernel_mutex)
- || mtr_memo_contains(mtr, fil_space_get_latch(space),
- MTR_MEMO_X_LOCK));
+ || mtr_memo_contains(mtr, fil_space_get_latch(space),
+ MTR_MEMO_X_LOCK));
#endif /* UNIV_SYNC_DEBUG */
*n_reserved = n_ext;
@@ -2756,7 +2774,7 @@ try_again:
n_free_list_ext = flst_get_len(space_header + FSP_FREE, mtr);
free_limit = mtr_read_ulint(space_header + FSP_FREE_LIMIT,
- MLOG_4BYTES, mtr);
+ MLOG_4BYTES, mtr);
/* Below we play safe when counting free extents above the free limit:
some of them will contain extent descriptor pages, and therefore
@@ -2767,7 +2785,7 @@ try_again:
if (n_free_up > 0) {
n_free_up--;
n_free_up = n_free_up - n_free_up
- / (XDES_DESCRIBED_PER_PAGE / FSP_EXTENT_SIZE);
+ / (XDES_DESCRIBED_PER_PAGE / FSP_EXTENT_SIZE);
}
n_free = n_free_list_ext + n_free_up;
@@ -2803,7 +2821,7 @@ try_again:
}
try_to_extend:
success = fsp_try_extend_data_file(&n_pages_added, space,
- space_header, mtr);
+ space_header, mtr);
if (success && n_pages_added > 0) {
goto try_again;
@@ -2850,7 +2868,7 @@ fsp_get_available_space_in_free_extents(
n_free_list_ext = flst_get_len(space_header + FSP_FREE, &mtr);
free_limit = mtr_read_ulint(space_header + FSP_FREE_LIMIT,
- MLOG_4BYTES, &mtr);
+ MLOG_4BYTES, &mtr);
mtr_commit(&mtr);
if (size < FSP_EXTENT_SIZE) {
@@ -2870,7 +2888,7 @@ fsp_get_available_space_in_free_extents(
if (n_free_up > 0) {
n_free_up--;
n_free_up = n_free_up - n_free_up
- / (XDES_DESCRIBED_PER_PAGE / FSP_EXTENT_SIZE);
+ / (XDES_DESCRIBED_PER_PAGE / FSP_EXTENT_SIZE);
}
n_free = n_free_list_ext + n_free_up;
@@ -2886,7 +2904,7 @@ fsp_get_available_space_in_free_extents(
}
return(((n_free - reserve) * FSP_EXTENT_SIZE)
- * (UNIV_PAGE_SIZE / 1024));
+ * (UNIV_PAGE_SIZE / 1024));
}
/************************************************************************
@@ -2908,39 +2926,39 @@ fseg_mark_page_used(
descr = xdes_get_descriptor(space, page, mtr);
- ut_ad(mtr_read_ulint(seg_inode + FSEG_ID, MLOG_4BYTES, mtr) ==
- mtr_read_ulint(descr + XDES_ID, MLOG_4BYTES, mtr));
+ ut_ad(mtr_read_ulint(seg_inode + FSEG_ID, MLOG_4BYTES, mtr)
+ == mtr_read_ulint(descr + XDES_ID, MLOG_4BYTES, mtr));
if (xdes_is_free(descr, mtr)) {
/* We move the extent from the free list to the
NOT_FULL list */
flst_remove(seg_inode + FSEG_FREE, descr + XDES_FLST_NODE,
- mtr);
+ mtr);
flst_add_last(seg_inode + FSEG_NOT_FULL,
- descr + XDES_FLST_NODE, mtr);
+ descr + XDES_FLST_NODE, mtr);
}
ut_ad(xdes_get_bit(descr, XDES_FREE_BIT, page % FSP_EXTENT_SIZE, mtr)
- == TRUE);
+ == TRUE);
/* We mark the page as used */
xdes_set_bit(descr, XDES_FREE_BIT, page % FSP_EXTENT_SIZE, FALSE, mtr);
not_full_n_used = mtr_read_ulint(seg_inode + FSEG_NOT_FULL_N_USED,
- MLOG_4BYTES, mtr);
+ MLOG_4BYTES, mtr);
not_full_n_used++;
mlog_write_ulint(seg_inode + FSEG_NOT_FULL_N_USED, not_full_n_used,
- MLOG_4BYTES, mtr);
+ MLOG_4BYTES, mtr);
if (xdes_is_full(descr, mtr)) {
/* We move the extent from the NOT_FULL list to the
FULL list */
flst_remove(seg_inode + FSEG_NOT_FULL,
- descr + XDES_FLST_NODE, mtr);
+ descr + XDES_FLST_NODE, mtr);
flst_add_last(seg_inode + FSEG_FULL,
- descr + XDES_FLST_NODE, mtr);
+ descr + XDES_FLST_NODE, mtr);
mlog_write_ulint(seg_inode + FSEG_NOT_FULL_N_USED,
- not_full_n_used - FSP_EXTENT_SIZE,
- MLOG_4BYTES, mtr);
+ not_full_n_used - FSP_EXTENT_SIZE,
+ MLOG_4BYTES, mtr);
}
}
@@ -2963,8 +2981,8 @@ fseg_free_page_low(
ulint i;
ut_ad(seg_inode && mtr);
- ut_ad(mach_read_from_4(seg_inode + FSEG_MAGIC_N) ==
- FSEG_MAGIC_N_VALUE);
+ ut_ad(mach_read_from_4(seg_inode + FSEG_MAGIC_N)
+ == FSEG_MAGIC_N_VALUE);
/* Drop search system page hash index if the page is found in
the pool and is hashed */
@@ -2976,20 +2994,23 @@ fseg_free_page_low(
ut_a(descr);
if (xdes_get_bit(descr, XDES_FREE_BIT, page % FSP_EXTENT_SIZE, mtr)) {
fputs("InnoDB: Dump of the tablespace extent descriptor: ",
- stderr);
+ stderr);
ut_print_buf(stderr, descr, 40);
fprintf(stderr, "\n"
-"InnoDB: Serious error! InnoDB is trying to free page %lu\n"
-"InnoDB: though it is already marked as free in the tablespace!\n"
-"InnoDB: The tablespace free space info is corrupt.\n"
-"InnoDB: You may need to dump your InnoDB tables and recreate the whole\n"
-"InnoDB: database!\n", (ulong) page);
- crash:
- fputs(
-"InnoDB: Please refer to\n"
-"InnoDB: http://dev.mysql.com/doc/refman/5.1/en/forcing-recovery.html\n"
-"InnoDB: about forcing recovery.\n", stderr);
+ "InnoDB: Serious error! InnoDB is trying to"
+ " free page %lu\n"
+ "InnoDB: though it is already marked as free"
+ " in the tablespace!\n"
+ "InnoDB: The tablespace free space info is corrupt.\n"
+ "InnoDB: You may need to dump your"
+ " InnoDB tables and recreate the whole\n"
+ "InnoDB: database!\n", (ulong) page);
+crash:
+ fputs("InnoDB: Please refer to\n"
+ "InnoDB: http://dev.mysql.com/doc/refman/5.1/en/"
+ "forcing-recovery.html\n"
+ "InnoDB: about forcing recovery.\n", stderr);
ut_error;
}
@@ -3000,10 +3021,10 @@ fseg_free_page_low(
for (i = 0;; i++) {
if (fseg_get_nth_frag_page_no(seg_inode, i, mtr)
- == page) {
+ == page) {
fseg_set_nth_frag_page_no(seg_inode, i,
- FIL_NULL, mtr);
+ FIL_NULL, mtr);
break;
}
}
@@ -3017,52 +3038,54 @@ fseg_free_page_low(
descr_id = mtr_read_dulint(descr + XDES_ID, mtr);
seg_id = mtr_read_dulint(seg_inode + FSEG_ID, mtr);
-/*
+#if 0
fprintf(stderr,
-"InnoDB: InnoDB is freeing space %lu page %lu,\n"
-"InnoDB: which belongs to descr seg %lu %lu\n"
-"InnoDB: segment %lu %lu.\n",
- space, page,
- ut_dulint_get_high(descr_id),
- ut_dulint_get_low(descr_id),
- ut_dulint_get_high(seg_id),
- ut_dulint_get_low(seg_id));
-*/
+ "InnoDB: InnoDB is freeing space %lu page %lu,\n"
+ "InnoDB: which belongs to descr seg %lu %lu\n"
+ "InnoDB: segment %lu %lu.\n",
+ (ulong) space, (ulong) page,
+ (ulong) ut_dulint_get_high(descr_id),
+ (ulong) ut_dulint_get_low(descr_id),
+ (ulong) ut_dulint_get_high(seg_id),
+ (ulong) ut_dulint_get_low(seg_id));
+#endif /* 0 */
if (0 != ut_dulint_cmp(descr_id, seg_id)) {
fputs("InnoDB: Dump of the tablespace extent descriptor: ",
- stderr);
+ stderr);
ut_print_buf(stderr, descr, 40);
fputs("\nInnoDB: Dump of the segment inode: ", stderr);
ut_print_buf(stderr, seg_inode, 40);
putc('\n', stderr);
fprintf(stderr,
-"InnoDB: Serious error: InnoDB is trying to free space %lu page %lu,\n"
-"InnoDB: which does not belong to segment %lu %lu but belongs\n"
-"InnoDB: to segment %lu %lu.\n",
- (ulong) space, (ulong) page,
- (ulong) ut_dulint_get_high(descr_id),
- (ulong) ut_dulint_get_low(descr_id),
- (ulong) ut_dulint_get_high(seg_id),
- (ulong) ut_dulint_get_low(seg_id));
+ "InnoDB: Serious error: InnoDB is trying to"
+ " free space %lu page %lu,\n"
+ "InnoDB: which does not belong to"
+ " segment %lu %lu but belongs\n"
+ "InnoDB: to segment %lu %lu.\n",
+ (ulong) space, (ulong) page,
+ (ulong) ut_dulint_get_high(descr_id),
+ (ulong) ut_dulint_get_low(descr_id),
+ (ulong) ut_dulint_get_high(seg_id),
+ (ulong) ut_dulint_get_low(seg_id));
goto crash;
}
not_full_n_used = mtr_read_ulint(seg_inode + FSEG_NOT_FULL_N_USED,
- MLOG_4BYTES, mtr);
+ MLOG_4BYTES, mtr);
if (xdes_is_full(descr, mtr)) {
/* The fragment is full: move it to another list */
flst_remove(seg_inode + FSEG_FULL,
- descr + XDES_FLST_NODE, mtr);
+ descr + XDES_FLST_NODE, mtr);
flst_add_last(seg_inode + FSEG_NOT_FULL,
- descr + XDES_FLST_NODE, mtr);
+ descr + XDES_FLST_NODE, mtr);
mlog_write_ulint(seg_inode + FSEG_NOT_FULL_N_USED,
- not_full_n_used + FSP_EXTENT_SIZE - 1,
- MLOG_4BYTES, mtr);
+ not_full_n_used + FSP_EXTENT_SIZE - 1,
+ MLOG_4BYTES, mtr);
} else {
ut_a(not_full_n_used > 0);
mlog_write_ulint(seg_inode + FSEG_NOT_FULL_N_USED,
- not_full_n_used - 1, MLOG_4BYTES, mtr);
+ not_full_n_used - 1, MLOG_4BYTES, mtr);
}
xdes_set_bit(descr, XDES_FREE_BIT, page % FSP_EXTENT_SIZE, TRUE, mtr);
@@ -3071,7 +3094,7 @@ fseg_free_page_low(
if (xdes_is_free(descr, mtr)) {
/* The extent has become free: free it to space */
flst_remove(seg_inode + FSEG_NOT_FULL,
- descr + XDES_FLST_NODE, mtr);
+ descr + XDES_FLST_NODE, mtr);
fsp_free_extent(space, page, mtr);
}
}
@@ -3091,8 +3114,8 @@ fseg_free_page(
#ifdef UNIV_SYNC_DEBUG
ut_ad(!mutex_own(&kernel_mutex)
- || mtr_memo_contains(mtr, fil_space_get_latch(space),
- MTR_MEMO_X_LOCK));
+ || mtr_memo_contains(mtr, fil_space_get_latch(space),
+ MTR_MEMO_X_LOCK));
#endif /* UNIV_SYNC_DEBUG */
mtr_x_lock(fil_space_get_latch(space), mtr);
@@ -3127,9 +3150,8 @@ fseg_free_extent(
descr = xdes_get_descriptor(space, page, mtr);
ut_a(xdes_get_state(descr, mtr) == XDES_FSEG);
- ut_a(0 == ut_dulint_cmp(
- mtr_read_dulint(descr + XDES_ID, mtr),
- mtr_read_dulint(seg_inode + FSEG_ID, mtr)));
+ ut_a(0 == ut_dulint_cmp(mtr_read_dulint(descr + XDES_ID, mtr),
+ mtr_read_dulint(seg_inode + FSEG_ID, mtr)));
first_page_in_extent = page - (page % FSP_EXTENT_SIZE);
@@ -3139,30 +3161,29 @@ fseg_free_extent(
/* Drop search system page hash index if the page is
found in the pool and is hashed */
- btr_search_drop_page_hash_when_freed(space,
- first_page_in_extent + i);
+ btr_search_drop_page_hash_when_freed
+ (space, first_page_in_extent + i);
}
}
if (xdes_is_full(descr, mtr)) {
flst_remove(seg_inode + FSEG_FULL,
- descr + XDES_FLST_NODE, mtr);
+ descr + XDES_FLST_NODE, mtr);
} else if (xdes_is_free(descr, mtr)) {
flst_remove(seg_inode + FSEG_FREE,
- descr + XDES_FLST_NODE, mtr);
+ descr + XDES_FLST_NODE, mtr);
} else {
flst_remove(seg_inode + FSEG_NOT_FULL,
- descr + XDES_FLST_NODE, mtr);
+ descr + XDES_FLST_NODE, mtr);
- not_full_n_used = mtr_read_ulint(
- seg_inode + FSEG_NOT_FULL_N_USED,
- MLOG_4BYTES, mtr);
+ not_full_n_used = mtr_read_ulint
+ (seg_inode + FSEG_NOT_FULL_N_USED, MLOG_4BYTES, mtr);
descr_n_used = xdes_get_n_used(descr, mtr);
ut_a(not_full_n_used >= descr_n_used);
mlog_write_ulint(seg_inode + FSEG_NOT_FULL_N_USED,
- not_full_n_used - descr_n_used,
- MLOG_4BYTES, mtr);
+ not_full_n_used - descr_n_used,
+ MLOG_4BYTES, mtr);
}
fsp_free_extent(space, page, mtr);
@@ -3171,7 +3192,7 @@ fseg_free_extent(
for (i = 0; i < FSP_EXTENT_SIZE; i++) {
buf_page_set_file_page_was_freed(space,
- first_page_in_extent + i);
+ first_page_in_extent + i);
}
#endif
}
@@ -3202,8 +3223,8 @@ fseg_free_step(
#ifdef UNIV_SYNC_DEBUG
ut_ad(!mutex_own(&kernel_mutex)
- || mtr_memo_contains(mtr, fil_space_get_latch(space),
- MTR_MEMO_X_LOCK));
+ || mtr_memo_contains(mtr, fil_space_get_latch(space),
+ MTR_MEMO_X_LOCK));
#endif /* UNIV_SYNC_DEBUG */
mtr_x_lock(fil_space_get_latch(space), mtr);
@@ -3214,7 +3235,7 @@ fseg_free_step(
ut_a(descr);
ut_a(xdes_get_bit(descr, XDES_FREE_BIT, buf_frame_get_page_no(header)
- % FSP_EXTENT_SIZE, mtr) == FALSE);
+ % FSP_EXTENT_SIZE, mtr) == FALSE);
inode = fseg_inode_get(header, mtr);
descr = fseg_get_first_extent(inode, mtr);
@@ -3239,7 +3260,7 @@ fseg_free_step(
}
fseg_free_page_low(inode, space,
- fseg_get_nth_frag_page_no(inode, n, mtr), mtr);
+ fseg_get_nth_frag_page_no(inode, n, mtr), mtr);
n = fseg_find_last_used_frag_page_slot(inode, mtr);
@@ -3277,8 +3298,8 @@ fseg_free_step_not_header(
#ifdef UNIV_SYNC_DEBUG
ut_ad(!mutex_own(&kernel_mutex)
- || mtr_memo_contains(mtr, fil_space_get_latch(space),
- MTR_MEMO_X_LOCK));
+ || mtr_memo_contains(mtr, fil_space_get_latch(space),
+ MTR_MEMO_X_LOCK));
#endif /* UNIV_SYNC_DEBUG */
mtr_x_lock(fil_space_get_latch(space), mtr);
@@ -3416,14 +3437,14 @@ fseg_validate_low(
ulint n_used2 = 0;
ut_ad(mtr_memo_contains(mtr2, buf_block_align(inode),
- MTR_MEMO_PAGE_X_FIX));
+ MTR_MEMO_PAGE_X_FIX));
ut_ad(mach_read_from_4(inode + FSEG_MAGIC_N) == FSEG_MAGIC_N_VALUE);
space = buf_frame_get_space_id(inode);
seg_id = mtr_read_dulint(inode + FSEG_ID, mtr2);
n_used = mtr_read_ulint(inode + FSEG_NOT_FULL_N_USED,
- MLOG_4BYTES, mtr2);
+ MLOG_4BYTES, mtr2);
flst_validate(inode + FSEG_FREE, mtr2);
flst_validate(inode + FSEG_NOT_FULL, mtr2);
flst_validate(inode + FSEG_FULL, mtr2);
@@ -3439,8 +3460,8 @@ fseg_validate_low(
ut_a(xdes_get_n_used(descr, &mtr) == 0);
ut_a(xdes_get_state(descr, &mtr) == XDES_FSEG);
- ut_a(0 == ut_dulint_cmp(
- mtr_read_dulint(descr + XDES_ID, &mtr), seg_id));
+ ut_a(!ut_dulint_cmp(mtr_read_dulint(descr + XDES_ID, &mtr),
+ seg_id));
node_addr = flst_get_next_addr(descr + XDES_FLST_NODE, &mtr);
mtr_commit(&mtr);
@@ -3459,8 +3480,8 @@ fseg_validate_low(
ut_a(xdes_get_n_used(descr, &mtr) > 0);
ut_a(xdes_get_n_used(descr, &mtr) < FSP_EXTENT_SIZE);
ut_a(xdes_get_state(descr, &mtr) == XDES_FSEG);
- ut_a(0 == ut_dulint_cmp(
- mtr_read_dulint(descr + XDES_ID, &mtr), seg_id));
+ ut_a(!ut_dulint_cmp(mtr_read_dulint(descr + XDES_ID, &mtr),
+ seg_id));
n_used2 += xdes_get_n_used(descr, &mtr);
@@ -3480,8 +3501,8 @@ fseg_validate_low(
ut_a(xdes_get_n_used(descr, &mtr) == FSP_EXTENT_SIZE);
ut_a(xdes_get_state(descr, &mtr) == XDES_FSEG);
- ut_a(0 == ut_dulint_cmp(
- mtr_read_dulint(descr + XDES_ID, &mtr), seg_id));
+ ut_a(!ut_dulint_cmp(mtr_read_dulint(descr + XDES_ID, &mtr),
+ seg_id));
node_addr = flst_get_next_addr(descr + XDES_FLST_NODE, &mtr);
mtr_commit(&mtr);
@@ -3540,7 +3561,7 @@ fseg_print_low(
dulint d_var;
ut_ad(mtr_memo_contains(mtr, buf_block_align(inode),
- MTR_MEMO_PAGE_X_FIX));
+ MTR_MEMO_PAGE_X_FIX));
space = buf_frame_get_space_id(inode);
page_no = buf_frame_get_page_no(inode);
@@ -3552,16 +3573,19 @@ fseg_print_low(
seg_id_high = ut_dulint_get_high(d_var);
n_used = mtr_read_ulint(inode + FSEG_NOT_FULL_N_USED,
- MLOG_4BYTES, mtr);
+ MLOG_4BYTES, mtr);
n_frag = fseg_get_n_frag_pages(inode, mtr);
n_free = flst_get_len(inode + FSEG_FREE, mtr);
n_not_full = flst_get_len(inode + FSEG_NOT_FULL, mtr);
n_full = flst_get_len(inode + FSEG_FULL, mtr);
fprintf(stderr,
-"SEGMENT id %lu %lu space %lu; page %lu; res %lu used %lu; full ext %lu\n"
-"fragm pages %lu; free extents %lu; not full extents %lu: pages %lu\n",
- (ulong) seg_id_high, (ulong) seg_id_low, (ulong) space, (ulong) page_no,
+ "SEGMENT id %lu %lu space %lu; page %lu;"
+ " res %lu used %lu; full ext %lu\n"
+ "fragm pages %lu; free extents %lu;"
+ " not full extents %lu: pages %lu\n",
+ (ulong) seg_id_high, (ulong) seg_id_low,
+ (ulong) space, (ulong) page_no,
(ulong) reserved, (ulong) used, (ulong) n_full,
(ulong) n_frag, (ulong) n_free, (ulong) n_not_full,
(ulong) n_used);
@@ -3628,12 +3652,12 @@ fsp_validate(
size = mtr_read_ulint(header + FSP_SIZE, MLOG_4BYTES, &mtr);
free_limit = mtr_read_ulint(header + FSP_FREE_LIMIT,
- MLOG_4BYTES, &mtr);
+ MLOG_4BYTES, &mtr);
frag_n_used = mtr_read_ulint(header + FSP_FRAG_N_USED,
- MLOG_4BYTES, &mtr);
+ MLOG_4BYTES, &mtr);
- n_full_frag_pages = FSP_EXTENT_SIZE *
- flst_get_len(header + FSP_FULL_FRAG, &mtr);
+ n_full_frag_pages = FSP_EXTENT_SIZE
+ * flst_get_len(header + FSP_FULL_FRAG, &mtr);
ut_a(free_limit <= size || (space != 0 && size < FSP_EXTENT_SIZE));
@@ -3734,27 +3758,28 @@ fsp_validate(
mtr_start(&mtr);
mtr_x_lock(fil_space_get_latch(space), &mtr);
- seg_inode_page = fut_get_ptr(space, node_addr,
- RW_X_LATCH, &mtr) - FSEG_INODE_PAGE_NODE;
+ seg_inode_page = fut_get_ptr
+ (space, node_addr, RW_X_LATCH, &mtr)
+ - FSEG_INODE_PAGE_NODE;
- seg_inode = fsp_seg_inode_page_get_nth_inode(
- seg_inode_page, n, &mtr);
- ut_a(ut_dulint_cmp(
- mach_read_from_8(seg_inode + FSEG_ID),
- ut_dulint_zero) != 0);
+ seg_inode = fsp_seg_inode_page_get_nth_inode
+ (seg_inode_page, n, &mtr);
+ ut_a(ut_dulint_cmp
+ (mach_read_from_8(seg_inode + FSEG_ID),
+ ut_dulint_zero) != 0);
fseg_validate_low(seg_inode, &mtr);
descr_count += flst_get_len(seg_inode + FSEG_FREE,
- &mtr);
+ &mtr);
descr_count += flst_get_len(seg_inode + FSEG_FULL,
- &mtr);
+ &mtr);
descr_count += flst_get_len(seg_inode + FSEG_NOT_FULL,
- &mtr);
+ &mtr);
n_used2 += fseg_get_n_frag_pages(seg_inode, &mtr);
- next_node_addr = flst_get_next_addr(seg_inode_page
- + FSEG_INODE_PAGE_NODE, &mtr);
+ next_node_addr = flst_get_next_addr
+ (seg_inode_page + FSEG_INODE_PAGE_NODE, &mtr);
mtr_commit(&mtr);
}
@@ -3779,28 +3804,29 @@ fsp_validate(
mtr_start(&mtr);
mtr_x_lock(fil_space_get_latch(space), &mtr);
- seg_inode_page = fut_get_ptr(space, node_addr,
- RW_X_LATCH, &mtr) - FSEG_INODE_PAGE_NODE;
+ seg_inode_page = fut_get_ptr
+ (space, node_addr, RW_X_LATCH, &mtr)
+ - FSEG_INODE_PAGE_NODE;
- seg_inode = fsp_seg_inode_page_get_nth_inode(
- seg_inode_page, n, &mtr);
- if (ut_dulint_cmp(mach_read_from_8(
- seg_inode + FSEG_ID),
- ut_dulint_zero) != 0) {
+ seg_inode = fsp_seg_inode_page_get_nth_inode
+ (seg_inode_page, n, &mtr);
+ if (ut_dulint_cmp
+ (mach_read_from_8(seg_inode + FSEG_ID),
+ ut_dulint_zero) != 0) {
fseg_validate_low(seg_inode, &mtr);
- descr_count += flst_get_len(
- seg_inode + FSEG_FREE, &mtr);
- descr_count += flst_get_len(
- seg_inode + FSEG_FULL, &mtr);
- descr_count += flst_get_len(
- seg_inode + FSEG_NOT_FULL, &mtr);
- n_used2 += fseg_get_n_frag_pages(
- seg_inode, &mtr);
+ descr_count += flst_get_len
+ (seg_inode + FSEG_FREE, &mtr);
+ descr_count += flst_get_len
+ (seg_inode + FSEG_FULL, &mtr);
+ descr_count += flst_get_len
+ (seg_inode + FSEG_NOT_FULL, &mtr);
+ n_used2 += fseg_get_n_frag_pages
+ (seg_inode, &mtr);
}
- next_node_addr = flst_get_next_addr(seg_inode_page
- + FSEG_INODE_PAGE_NODE, &mtr);
+ next_node_addr = flst_get_next_addr
+ (seg_inode_page + FSEG_INODE_PAGE_NODE, &mtr);
mtr_commit(&mtr);
}
@@ -3809,9 +3835,9 @@ fsp_validate(
ut_a(descr_count * FSP_EXTENT_SIZE == free_limit);
ut_a(n_used + n_full_frag_pages
- == n_used2 + 2* ((free_limit + XDES_DESCRIBED_PER_PAGE - 1)
- / XDES_DESCRIBED_PER_PAGE)
- + seg_inode_len_full + seg_inode_len_free);
+ == n_used2 + 2* ((free_limit + XDES_DESCRIBED_PER_PAGE - 1)
+ / XDES_DESCRIBED_PER_PAGE)
+ + seg_inode_len_full + seg_inode_len_free);
ut_a(frag_n_used == n_used);
mtr_commit(&mtr2);
@@ -3862,9 +3888,9 @@ fsp_print(
size = mtr_read_ulint(header + FSP_SIZE, MLOG_4BYTES, &mtr);
free_limit = mtr_read_ulint(header + FSP_FREE_LIMIT, MLOG_4BYTES,
- &mtr);
+ &mtr);
frag_n_used = mtr_read_ulint(header + FSP_FRAG_N_USED, MLOG_4BYTES,
- &mtr);
+ &mtr);
n_free = flst_get_len(header + FSP_FREE, &mtr);
n_free_frag = flst_get_len(header + FSP_FREE_FRAG, &mtr);
n_full_frag = flst_get_len(header + FSP_FULL_FRAG, &mtr);
@@ -3875,10 +3901,11 @@ fsp_print(
seg_id_high = ut_dulint_get_high(d_var);
fprintf(stderr,
-"FILE SPACE INFO: id %lu\n"
-"size %lu, free limit %lu, free extents %lu\n"
-"not full frag extents %lu: used pages %lu, full frag extents %lu\n"
-"first seg id not used %lu %lu\n",
+ "FILE SPACE INFO: id %lu\n"
+ "size %lu, free limit %lu, free extents %lu\n"
+ "not full frag extents %lu: used pages %lu,"
+ " full frag extents %lu\n"
+ "first seg id not used %lu %lu\n",
(long) space,
(ulong) size, (ulong) free_limit, (ulong) n_free,
(ulong) n_free_frag, (ulong) frag_n_used, (ulong) n_full_frag,
@@ -3904,20 +3931,21 @@ fsp_print(
mtr_start(&mtr);
mtr_x_lock(fil_space_get_latch(space), &mtr);
- seg_inode_page = fut_get_ptr(space, node_addr,
- RW_X_LATCH, &mtr) - FSEG_INODE_PAGE_NODE;
+ seg_inode_page = fut_get_ptr
+ (space, node_addr, RW_X_LATCH, &mtr)
+ - FSEG_INODE_PAGE_NODE;
- seg_inode = fsp_seg_inode_page_get_nth_inode(
- seg_inode_page, n, &mtr);
- ut_a(ut_dulint_cmp(mach_read_from_8(
- seg_inode + FSEG_ID),
- ut_dulint_zero) != 0);
+ seg_inode = fsp_seg_inode_page_get_nth_inode
+ (seg_inode_page, n, &mtr);
+ ut_a(ut_dulint_cmp
+ (mach_read_from_8(seg_inode + FSEG_ID),
+ ut_dulint_zero) != 0);
fseg_print_low(seg_inode, &mtr);
n_segs++;
- next_node_addr = flst_get_next_addr(seg_inode_page
- + FSEG_INODE_PAGE_NODE, &mtr);
+ next_node_addr = flst_get_next_addr
+ (seg_inode_page + FSEG_INODE_PAGE_NODE, &mtr);
mtr_commit(&mtr);
}
@@ -3940,21 +3968,22 @@ fsp_print(
mtr_start(&mtr);
mtr_x_lock(fil_space_get_latch(space), &mtr);
- seg_inode_page = fut_get_ptr(space, node_addr,
- RW_X_LATCH, &mtr) - FSEG_INODE_PAGE_NODE;
+ seg_inode_page = fut_get_ptr
+ (space, node_addr, RW_X_LATCH, &mtr)
+ - FSEG_INODE_PAGE_NODE;
- seg_inode = fsp_seg_inode_page_get_nth_inode(
- seg_inode_page, n, &mtr);
- if (ut_dulint_cmp(mach_read_from_8(
- seg_inode + FSEG_ID),
- ut_dulint_zero) != 0) {
+ seg_inode = fsp_seg_inode_page_get_nth_inode
+ (seg_inode_page, n, &mtr);
+ if (ut_dulint_cmp
+ (mach_read_from_8(seg_inode + FSEG_ID),
+ ut_dulint_zero) != 0) {
fseg_print_low(seg_inode, &mtr);
n_segs++;
}
- next_node_addr = flst_get_next_addr(seg_inode_page
- + FSEG_INODE_PAGE_NODE, &mtr);
+ next_node_addr = flst_get_next_addr
+ (seg_inode_page + FSEG_INODE_PAGE_NODE, &mtr);
mtr_commit(&mtr);
}
diff --git a/storage/innobase/fut/fut0lst.c b/storage/innobase/fut/fut0lst.c
index cdf7719dde0..75fa8bf5552 100644
--- a/storage/innobase/fut/fut0lst.c
+++ b/storage/innobase/fut/fut0lst.c
@@ -33,9 +33,9 @@ flst_add_to_empty(
ut_ad(mtr && base && node);
ut_ad(base != node);
ut_ad(mtr_memo_contains(mtr, buf_block_align(base),
- MTR_MEMO_PAGE_X_FIX));
+ MTR_MEMO_PAGE_X_FIX));
ut_ad(mtr_memo_contains(mtr, buf_block_align(node),
- MTR_MEMO_PAGE_X_FIX));
+ MTR_MEMO_PAGE_X_FIX));
len = flst_get_len(base, mtr);
ut_a(len == 0);
@@ -72,9 +72,9 @@ flst_add_last(
ut_ad(mtr && base && node);
ut_ad(base != node);
ut_ad(mtr_memo_contains(mtr, buf_block_align(base),
- MTR_MEMO_PAGE_X_FIX));
+ MTR_MEMO_PAGE_X_FIX));
ut_ad(mtr_memo_contains(mtr, buf_block_align(node),
- MTR_MEMO_PAGE_X_FIX));
+ MTR_MEMO_PAGE_X_FIX));
len = flst_get_len(base, mtr);
last_addr = flst_get_last(base, mtr);
@@ -86,7 +86,7 @@ flst_add_last(
last_node = buf_frame_align(node) + last_addr.boffset;
} else {
last_node = fut_get_ptr(space, last_addr, RW_X_LATCH,
- mtr);
+ mtr);
}
flst_insert_after(base, last_node, node, mtr);
@@ -115,9 +115,9 @@ flst_add_first(
ut_ad(mtr && base && node);
ut_ad(base != node);
ut_ad(mtr_memo_contains(mtr, buf_block_align(base),
- MTR_MEMO_PAGE_X_FIX));
+ MTR_MEMO_PAGE_X_FIX));
ut_ad(mtr_memo_contains(mtr, buf_block_align(node),
- MTR_MEMO_PAGE_X_FIX));
+ MTR_MEMO_PAGE_X_FIX));
len = flst_get_len(base, mtr);
first_addr = flst_get_first(base, mtr);
@@ -127,10 +127,10 @@ flst_add_first(
if (len != 0) {
if (first_addr.page == node_addr.page) {
first_node = buf_frame_align(node)
- + first_addr.boffset;
+ + first_addr.boffset;
} else {
first_node = fut_get_ptr(space, first_addr,
- RW_X_LATCH, mtr);
+ RW_X_LATCH, mtr);
}
flst_insert_before(base, node, first_node, mtr);
@@ -163,11 +163,11 @@ flst_insert_after(
ut_ad(base != node2);
ut_ad(node2 != node1);
ut_ad(mtr_memo_contains(mtr, buf_block_align(base),
- MTR_MEMO_PAGE_X_FIX));
+ MTR_MEMO_PAGE_X_FIX));
ut_ad(mtr_memo_contains(mtr, buf_block_align(node1),
- MTR_MEMO_PAGE_X_FIX));
+ MTR_MEMO_PAGE_X_FIX));
ut_ad(mtr_memo_contains(mtr, buf_block_align(node2),
- MTR_MEMO_PAGE_X_FIX));
+ MTR_MEMO_PAGE_X_FIX));
buf_ptr_get_fsp_addr(node1, &space, &node1_addr);
buf_ptr_get_fsp_addr(node2, &space, &node2_addr);
@@ -218,11 +218,11 @@ flst_insert_before(
ut_ad(base != node3);
ut_ad(node2 != node3);
ut_ad(mtr_memo_contains(mtr, buf_block_align(base),
- MTR_MEMO_PAGE_X_FIX));
+ MTR_MEMO_PAGE_X_FIX));
ut_ad(mtr_memo_contains(mtr, buf_block_align(node2),
- MTR_MEMO_PAGE_X_FIX));
+ MTR_MEMO_PAGE_X_FIX));
ut_ad(mtr_memo_contains(mtr, buf_block_align(node3),
- MTR_MEMO_PAGE_X_FIX));
+ MTR_MEMO_PAGE_X_FIX));
buf_ptr_get_fsp_addr(node2, &space, &node2_addr);
buf_ptr_get_fsp_addr(node3, &space, &node3_addr);
@@ -270,9 +270,9 @@ flst_remove(
ut_ad(mtr && node2 && base);
ut_ad(mtr_memo_contains(mtr, buf_block_align(base),
- MTR_MEMO_PAGE_X_FIX));
+ MTR_MEMO_PAGE_X_FIX));
ut_ad(mtr_memo_contains(mtr, buf_block_align(node2),
- MTR_MEMO_PAGE_X_FIX));
+ MTR_MEMO_PAGE_X_FIX));
buf_ptr_get_fsp_addr(node2, &space, &node2_addr);
@@ -288,7 +288,7 @@ flst_remove(
node1 = buf_frame_align(node2) + node1_addr.boffset;
} else {
node1 = fut_get_ptr(space, node1_addr, RW_X_LATCH,
- mtr);
+ mtr);
}
ut_ad(node1 != node2);
@@ -307,7 +307,7 @@ flst_remove(
node3 = buf_frame_align(node2) + node3_addr.boffset;
} else {
node3 = fut_get_ptr(space, node3_addr, RW_X_LATCH,
- mtr);
+ mtr);
}
ut_ad(node2 != node3);
@@ -347,9 +347,9 @@ flst_cut_end(
ut_ad(mtr && node2 && base);
ut_ad(mtr_memo_contains(mtr, buf_block_align(base),
- MTR_MEMO_PAGE_X_FIX));
+ MTR_MEMO_PAGE_X_FIX));
ut_ad(mtr_memo_contains(mtr, buf_block_align(node2),
- MTR_MEMO_PAGE_X_FIX));
+ MTR_MEMO_PAGE_X_FIX));
ut_ad(n_nodes > 0);
buf_ptr_get_fsp_addr(node2, &space, &node2_addr);
@@ -365,7 +365,7 @@ flst_cut_end(
node1 = buf_frame_align(node2) + node1_addr.boffset;
} else {
node1 = fut_get_ptr(space, node1_addr, RW_X_LATCH,
- mtr);
+ mtr);
}
flst_write_addr(node1 + FLST_NEXT, fil_addr_null, mtr);
@@ -402,9 +402,9 @@ flst_truncate_end(
ut_ad(mtr && node2 && base);
ut_ad(mtr_memo_contains(mtr, buf_block_align(base),
- MTR_MEMO_PAGE_X_FIX));
+ MTR_MEMO_PAGE_X_FIX));
ut_ad(mtr_memo_contains(mtr, buf_block_align(node2),
- MTR_MEMO_PAGE_X_FIX));
+ MTR_MEMO_PAGE_X_FIX));
if (n_nodes == 0) {
ut_ad(fil_addr_is_null(flst_get_next_addr(node2, mtr)));
@@ -446,7 +446,7 @@ flst_validate(
ut_ad(base);
ut_ad(mtr_memo_contains(mtr1, buf_block_align(base),
- MTR_MEMO_PAGE_X_FIX));
+ MTR_MEMO_PAGE_X_FIX));
/* We use two mini-transaction handles: the first is used to
lock the base node, and prevent other threads from modifying the
@@ -504,7 +504,7 @@ flst_print(
ut_ad(base && mtr);
ut_ad(mtr_memo_contains(mtr, buf_block_align(base),
- MTR_MEMO_PAGE_X_FIX));
+ MTR_MEMO_PAGE_X_FIX));
frame = buf_frame_align(base);
len = flst_get_len(base, mtr);
diff --git a/storage/innobase/ha/ha0ha.c b/storage/innobase/ha/ha0ha.c
index 6b03ea5f2fe..23ea2554f01 100644
--- a/storage/innobase/ha/ha0ha.c
+++ b/storage/innobase/ha/ha0ha.c
@@ -310,8 +310,9 @@ ha_validate(
if (hash_calc_hash(node->fold, table) != i) {
ut_print_timestamp(stderr);
fprintf(stderr,
-"InnoDB: Error: hash table node fold value %lu does not\n"
-"InnoDB: match with the cell number %lu.\n",
+ "InnoDB: Error: hash table node"
+ " fold value %lu does not\n"
+ "InnoDB: match the cell number %lu.\n",
(ulong) node->fold, (ulong) i);
ok = FALSE;
@@ -363,6 +364,7 @@ ha_print_info(
n_bufs++;
}
- fprintf(file, ", node heap has %lu buffer(s)\n", (ulong) n_bufs);
+ fprintf(file, ", node heap has %lu buffer(s)\n",
+ (ulong) n_bufs);
}
}
diff --git a/storage/innobase/ibuf/ibuf0ibuf.c b/storage/innobase/ibuf/ibuf0ibuf.c
index 4e38e1f0353..2f4d0ae1009 100644
--- a/storage/innobase/ibuf/ibuf0ibuf.c
+++ b/storage/innobase/ibuf/ibuf0ibuf.c
@@ -308,7 +308,7 @@ ibuf_tree_root_get(
mtr_x_lock(dict_tree_get_lock((data->index)->tree), mtr);
page = buf_page_get(space, FSP_IBUF_TREE_ROOT_PAGE_NO, RW_X_LATCH,
- mtr);
+ mtr);
#ifdef UNIV_SYNC_DEBUG
buf_page_dbg_add_level(page, SYNC_TREE_NODE);
#endif /* UNIV_SYNC_DEBUG */
@@ -372,7 +372,7 @@ ibuf_init_at_db_start(void)
change */
ibuf->max_size = buf_pool_get_curr_size() / UNIV_PAGE_SIZE
- / IBUF_POOL_SIZE_PER_MAX_SIZE;
+ / IBUF_POOL_SIZE_PER_MAX_SIZE;
UT_LIST_INIT(ibuf->data_list);
@@ -385,7 +385,7 @@ ibuf_init_at_db_start(void)
for (i = 0; i < IBUF_COUNT_N_SPACES; i++) {
ibuf_counts[i] = mem_alloc(sizeof(ulint)
- * IBUF_COUNT_N_PAGES);
+ * IBUF_COUNT_N_PAGES);
for (j = 0; j < IBUF_COUNT_N_PAGES; j++) {
ibuf_count_set(i, j, 0);
}
@@ -395,7 +395,7 @@ ibuf_init_at_db_start(void)
}
#endif
mutex_create(&ibuf_pessimistic_insert_mutex,
- SYNC_IBUF_PESS_INSERT_MUTEX);
+ SYNC_IBUF_PESS_INSERT_MUTEX);
mutex_create(&ibuf_mutex, SYNC_IBUF_MUTEX);
@@ -429,7 +429,7 @@ ibuf_data_sizes_update(
data->height = 1 + btr_page_get_level(root, mtr);
data->size = data->seg_size - (1 + data->free_list_len);
- /* the '1 +' is the ibuf header page */
+ /* the '1 +' is the ibuf header page */
ut_ad(data->size < data->seg_size);
if (page_get_n_recs(root) == 0) {
@@ -443,8 +443,10 @@ ibuf_data_sizes_update(
ibuf->size = ibuf->size + data->size - old_size;
-/* fprintf(stderr, "ibuf size %lu, space ibuf size %lu\n", ibuf->size,
- data->size); */
+#if 0
+ fprintf(stderr, "ibuf size %lu, space ibuf size %lu\n",
+ ibuf->size, data->size);
+#endif
}
/**********************************************************************
@@ -471,14 +473,6 @@ ibuf_data_init_for_space(
ut_a(space == 0);
-#ifdef UNIV_LOG_DEBUG
- if (space % 2 == 1) {
-
- fputs("No ibuf op in replicate space\n", stderr);
-
- return(NULL);
- }
-#endif
data = mem_alloc(sizeof(ibuf_data_t));
data->space = space;
@@ -492,7 +486,7 @@ ibuf_data_init_for_space(
header_page = ibuf_header_page_get(space, &mtr);
fseg_n_reserved_pages(header_page + IBUF_HEADER + IBUF_TREE_SEG_HEADER,
- &n_used, &mtr);
+ &n_used, &mtr);
ibuf_enter();
ut_ad(n_used >= 2);
@@ -500,7 +494,7 @@ ibuf_data_init_for_space(
data->seg_size = n_used;
root = buf_page_get(space, FSP_IBUF_TREE_ROOT_PAGE_NO, RW_X_LATCH,
- &mtr);
+ &mtr);
#ifdef UNIV_SYNC_DEBUG
buf_page_dbg_add_level(root, SYNC_TREE_NODE);
#endif /* UNIV_SYNC_DEBUG */
@@ -511,15 +505,15 @@ ibuf_data_init_for_space(
data->n_merged_recs = 0;
ibuf_data_sizes_update(data, root, &mtr);
-/*
+ /*
if (!data->empty) {
- fprintf(stderr,
-"InnoDB: index entries found in the insert buffer\n");
+ fprintf(stderr,
+ "InnoDB: index entries found in the insert buffer\n");
} else {
- fprintf(stderr,
-"InnoDB: insert buffer empty\n");
+ fprintf(stderr,
+ "InnoDB: insert buffer empty\n");
}
-*/
+ */
mutex_exit(&ibuf_mutex);
mtr_commit(&mtr);
@@ -537,8 +531,9 @@ ibuf_data_init_for_space(
dict_table_add_to_cache(table);
- index = dict_mem_index_create(buf, "CLUST_IND", space,
- DICT_CLUSTERED | DICT_UNIVERSAL | DICT_IBUF,2);
+ index = dict_mem_index_create
+ (buf, "CLUST_IND", space,
+ DICT_CLUSTERED | DICT_UNIVERSAL | DICT_IBUF, 2);
dict_mem_index_add_field(index, "PAGE_NO", 0);
dict_mem_index_add_field(index, "TYPES", 0);
@@ -630,7 +625,7 @@ ibuf_bitmap_page_get_bits(
# error "IBUF_BITS_PER_PAGE % 2 != 0"
#endif
ut_ad(mtr_memo_contains(mtr, buf_block_align(page),
- MTR_MEMO_PAGE_X_FIX));
+ MTR_MEMO_PAGE_X_FIX));
bit_offset = (page_no % XDES_DESCRIBED_PER_PAGE) * IBUF_BITS_PER_PAGE
+ bit;
@@ -674,11 +669,11 @@ ibuf_bitmap_page_set_bits(
# error "IBUF_BITS_PER_PAGE % 2 != 0"
#endif
ut_ad(mtr_memo_contains(mtr, buf_block_align(page),
- MTR_MEMO_PAGE_X_FIX));
+ MTR_MEMO_PAGE_X_FIX));
#ifdef UNIV_IBUF_DEBUG
ut_a((bit != IBUF_BITMAP_BUFFERED) || (val != FALSE)
- || (0 == ibuf_count_get(buf_frame_get_space_id(page),
- page_no)));
+ || (0 == ibuf_count_get(buf_frame_get_space_id(page),
+ page_no)));
#endif
bit_offset = (page_no % XDES_DESCRIBED_PER_PAGE) * IBUF_BITS_PER_PAGE
+ bit;
@@ -702,7 +697,7 @@ ibuf_bitmap_page_set_bits(
}
mlog_write_ulint(page + IBUF_BITMAP + byte_offset, map_byte,
- MLOG_1BYTE, mtr);
+ MLOG_1BYTE, mtr);
}
/************************************************************************
@@ -716,8 +711,8 @@ ibuf_bitmap_page_no_calc(
ulint page_no) /* in: tablespace page number */
{
return(FSP_IBUF_BITMAP_OFFSET
- + XDES_DESCRIBED_PER_PAGE
- * (page_no / XDES_DESCRIBED_PER_PAGE));
+ + XDES_DESCRIBED_PER_PAGE
+ * (page_no / XDES_DESCRIBED_PER_PAGE));
}
/************************************************************************
@@ -738,7 +733,7 @@ ibuf_bitmap_get_map_page(
page_t* page;
page = buf_page_get(space, ibuf_bitmap_page_no_calc(page_no),
- RW_X_LATCH, mtr);
+ RW_X_LATCH, mtr);
#ifdef UNIV_SYNC_DEBUG
buf_page_dbg_add_level(page, SYNC_IBUF_BITMAP);
#endif /* UNIV_SYNC_DEBUG */
@@ -773,18 +768,21 @@ ibuf_set_free_bits_low(
return;
}
- bitmap_page = ibuf_bitmap_get_map_page(buf_frame_get_space_id(page),
- buf_frame_get_page_no(page), mtr);
+ bitmap_page = ibuf_bitmap_get_map_page
+ (buf_frame_get_space_id(page),
+ buf_frame_get_page_no(page), mtr);
#ifdef UNIV_IBUF_DEBUG
- /* fprintf(stderr,
+# if 0
+ fprintf(stderr,
"Setting page no %lu free bits to %lu should be %lu\n",
- buf_frame_get_page_no(page), val,
- ibuf_index_page_calc_free(page)); */
+ buf_frame_get_page_no(page), val,
+ ibuf_index_page_calc_free(page));
+# endif
ut_a(val <= ibuf_index_page_calc_free(page));
-#endif
+#endif /* UNIV_IBUF_DEBUG */
ibuf_bitmap_page_set_bits(bitmap_page, buf_frame_get_page_no(page),
- IBUF_BITMAP_FREE, val, mtr);
+ IBUF_BITMAP_FREE, val, mtr);
}
@@ -820,34 +818,40 @@ ibuf_set_free_bits(
mtr_start(&mtr);
- bitmap_page = ibuf_bitmap_get_map_page(buf_frame_get_space_id(page),
- buf_frame_get_page_no(page), &mtr);
+ bitmap_page = ibuf_bitmap_get_map_page
+ (buf_frame_get_space_id(page),
+ buf_frame_get_page_no(page), &mtr);
if (max_val != ULINT_UNDEFINED) {
#ifdef UNIV_IBUF_DEBUG
ulint old_val;
- old_val = ibuf_bitmap_page_get_bits(bitmap_page,
- buf_frame_get_page_no(page),
- IBUF_BITMAP_FREE, &mtr);
+ old_val = ibuf_bitmap_page_get_bits
+ (bitmap_page, buf_frame_get_page_no(page),
+ IBUF_BITMAP_FREE, &mtr);
+# if 0
if (old_val != max_val) {
- /* fprintf(stderr,
- "Ibuf: page %lu old val %lu max val %lu\n",
- buf_frame_get_page_no(page), old_val, max_val); */
+ fprintf(stderr,
+ "Ibuf: page %lu old val %lu max val %lu\n",
+ buf_frame_get_page_no(page),
+ old_val, max_val);
}
+# endif
ut_a(old_val <= max_val);
#endif
}
#ifdef UNIV_IBUF_DEBUG
-/* fprintf(stderr, "Setting page no %lu free bits to %lu should be %lu\n",
- buf_frame_get_page_no(page), val,
- ibuf_index_page_calc_free(page)); */
+# if 0
+ fprintf(stderr, "Setting page no %lu free bits to %lu should be %lu\n",
+ buf_frame_get_page_no(page), val,
+ ibuf_index_page_calc_free(page));
+# endif
ut_a(val <= ibuf_index_page_calc_free(page));
#endif
ibuf_bitmap_page_set_bits(bitmap_page, buf_frame_get_page_no(page),
- IBUF_BITMAP_FREE, val, &mtr);
+ IBUF_BITMAP_FREE, val, &mtr);
mtr_commit(&mtr);
}
@@ -955,7 +959,7 @@ ibuf_fixed_addr_page(
ulint page_no)/* in: page number */
{
return((space == 0 && page_no == IBUF_TREE_ROOT_PAGE_NO)
- || ibuf_bitmap_page(page_no));
+ || ibuf_bitmap_page(page_no));
}
/***************************************************************************
@@ -997,7 +1001,7 @@ ibuf_page(
bitmap_page = ibuf_bitmap_get_map_page(space, page_no, &mtr);
ret = ibuf_bitmap_page_get_bits(bitmap_page, page_no, IBUF_BITMAP_IBUF,
- &mtr);
+ &mtr);
mtr_commit(&mtr);
return(ret);
@@ -1019,14 +1023,6 @@ ibuf_page_low(
page_t* bitmap_page;
ibool ret;
-#ifdef UNIV_LOG_DEBUG
- if (space % 2 != 0) {
-
- fputs("No ibuf in a replicate space\n", stderr);
-
- return(FALSE);
- }
-#endif
if (ibuf_fixed_addr_page(space, page_no)) {
return(TRUE);
@@ -1035,7 +1031,7 @@ ibuf_page_low(
bitmap_page = ibuf_bitmap_get_map_page(space, page_no, mtr);
ret = ibuf_bitmap_page_get_bits(bitmap_page, page_no, IBUF_BITMAP_IBUF,
- mtr);
+ mtr);
return(ret);
}
@@ -1122,10 +1118,11 @@ ibuf_dummy_index_create(
dict_index_t* index;
table = dict_mem_table_create("IBUF_DUMMY",
- DICT_HDR_SPACE, n, comp ? DICT_TF_COMPACT : 0);
+ DICT_HDR_SPACE, n,
+ comp ? DICT_TF_COMPACT : 0);
index = dict_mem_index_create("IBUF_DUMMY", "IBUF_DUMMY",
- DICT_HDR_SPACE, 0, n);
+ DICT_HDR_SPACE, 0, n);
index->table = table;
@@ -1146,12 +1143,12 @@ ibuf_dummy_index_add_col(
{
ulint i = index->table->n_def;
dict_mem_table_add_col(index->table, "DUMMY",
- dtype_get_mtype(type),
- dtype_get_prtype(type),
- dtype_get_len(type),
- dtype_get_prec(type));
+ dtype_get_mtype(type),
+ dtype_get_prtype(type),
+ dtype_get_len(type),
+ dtype_get_prec(type));
dict_index_add_col(index,
- dict_table_get_nth_col(index->table, i), len);
+ dict_table_get_nth_col(index->table, i), len);
}
/************************************************************************
Deallocates a dummy index for inserting a record to a non-clustered index.
@@ -1216,9 +1213,9 @@ ibuf_build_entry_from_ibuf_rec(
dfield_set_data(field, data, len);
- dtype_read_for_order_and_null_size(
- dfield_get_type(field),
- types + i * DATA_ORDER_NULL_TYPE_BUF_SIZE);
+ dtype_read_for_order_and_null_size
+ (dfield_get_type(field),
+ types + i * DATA_ORDER_NULL_TYPE_BUF_SIZE);
}
*pindex = ibuf_dummy_index_create(n_fields, FALSE);
@@ -1238,8 +1235,8 @@ ibuf_build_entry_from_ibuf_rec(
types = rec_get_nth_field_old(ibuf_rec, 3, &len);
ut_a(len % DATA_NEW_ORDER_NULL_TYPE_BUF_SIZE <= 1);
- index = ibuf_dummy_index_create(n_fields,
- len % DATA_NEW_ORDER_NULL_TYPE_BUF_SIZE);
+ index = ibuf_dummy_index_create
+ (n_fields, len % DATA_NEW_ORDER_NULL_TYPE_BUF_SIZE);
if (len % DATA_NEW_ORDER_NULL_TYPE_BUF_SIZE) {
/* compact record format */
@@ -1257,9 +1254,9 @@ ibuf_build_entry_from_ibuf_rec(
dfield_set_data(field, data, len);
- dtype_new_read_for_order_and_null_size(
- dfield_get_type(field),
- types + i * DATA_NEW_ORDER_NULL_TYPE_BUF_SIZE);
+ dtype_new_read_for_order_and_null_size
+ (dfield_get_type(field),
+ types + i * DATA_NEW_ORDER_NULL_TYPE_BUF_SIZE);
ibuf_dummy_index_add_col(index, dfield_get_type(field), len);
}
@@ -1318,9 +1315,8 @@ ibuf_rec_get_volume(
ulint volume;
dict_index_t* dummy_index;
mem_heap_t* heap = mem_heap_create(500);
- dtuple_t* entry =
- ibuf_build_entry_from_ibuf_rec(
- ibuf_rec, heap, &dummy_index);
+ dtuple_t* entry = ibuf_build_entry_from_ibuf_rec
+ (ibuf_rec, heap, &dummy_index);
volume = rec_get_converted_size(dummy_index, entry);
ibuf_dummy_index_free(dummy_index);
mem_heap_free(heap);
@@ -1336,13 +1332,15 @@ ibuf_rec_get_volume(
if (new_format) {
data = rec_get_nth_field_old(ibuf_rec, i + 4, &len);
- dtype_new_read_for_order_and_null_size(&dtype,
- types + i * DATA_NEW_ORDER_NULL_TYPE_BUF_SIZE);
+ dtype_new_read_for_order_and_null_size
+ (&dtype, types + i
+ * DATA_NEW_ORDER_NULL_TYPE_BUF_SIZE);
} else {
data = rec_get_nth_field_old(ibuf_rec, i + 2, &len);
- dtype_read_for_order_and_null_size(&dtype,
- types + i * DATA_ORDER_NULL_TYPE_BUF_SIZE);
+ dtype_read_for_order_and_null_size
+ (&dtype, types + i
+ * DATA_ORDER_NULL_TYPE_BUF_SIZE);
}
if (len == UNIV_SQL_NULL) {
@@ -1353,7 +1351,7 @@ ibuf_rec_get_volume(
}
return(data_size + rec_get_converted_extra_size(data_size, n_fields)
- + page_dir_calc_reserved_space(1));
+ + page_dir_calc_reserved_space(1));
}
/*************************************************************************
@@ -1389,9 +1387,9 @@ ibuf_entry_build(
(3) the third contains the page number, and
(4) the fourth contains the relevent type information of each data
field; the length of this field % DATA_NEW_ORDER_NULL_TYPE_BUF_SIZE is
- (a) 0 for b-trees in the old format, and
- (b) 1 for b-trees in the compact format, the first byte of the field
- being the marker (0);
+ (a) 0 for b-trees in the old format, and
+ (b) 1 for b-trees in the compact format, the first byte of the field
+ being the marker (0);
(5) and the rest of the fields are copied from entry. All fields
in the tuple are ordered like the type binary in our insert buffer
tree. */
@@ -1436,8 +1434,8 @@ ibuf_entry_build(
/* Store the type info in buf2, and add the fields from entry to
tuple */
buf2 = mem_heap_alloc(heap, n_fields
- * DATA_NEW_ORDER_NULL_TYPE_BUF_SIZE
- + comp);
+ * DATA_NEW_ORDER_NULL_TYPE_BUF_SIZE
+ + comp);
if (comp) {
*buf2++ = 0; /* write the compact format indicator */
}
@@ -1449,9 +1447,9 @@ ibuf_entry_build(
entry_field = dtuple_get_nth_field(entry, i);
dfield_copy(field, entry_field);
- dtype_new_store_for_order_and_null_size(
- buf2 + i * DATA_NEW_ORDER_NULL_TYPE_BUF_SIZE,
- dfield_get_type(entry_field));
+ dtype_new_store_for_order_and_null_size
+ (buf2 + i * DATA_NEW_ORDER_NULL_TYPE_BUF_SIZE,
+ dfield_get_type(entry_field));
}
/* Store the type info in buf2 to field 3 of tuple */
@@ -1463,8 +1461,8 @@ ibuf_entry_build(
}
dfield_set_data(field, buf2, n_fields
- * DATA_NEW_ORDER_NULL_TYPE_BUF_SIZE
- + comp);
+ * DATA_NEW_ORDER_NULL_TYPE_BUF_SIZE
+ + comp);
/* Set all the types in the new tuple binary */
dtuple_set_types_binary(tuple, n_fields + 4);
@@ -1654,8 +1652,8 @@ ibuf_add_free_page(
header page apart from the ibuf tree. */
page_no = fseg_alloc_free_page(header_page + IBUF_HEADER
- + IBUF_TREE_SEG_HEADER, 0, FSP_UP,
- &mtr);
+ + IBUF_TREE_SEG_HEADER, 0, FSP_UP,
+ &mtr);
if (page_no == FIL_NULL) {
mtr_commit(&mtr);
@@ -1677,10 +1675,10 @@ ibuf_add_free_page(
/* Add the page to the free list and update the ibuf size data */
flst_add_last(root + PAGE_HEADER + PAGE_BTR_IBUF_FREE_LIST,
- page + PAGE_HEADER + PAGE_BTR_IBUF_FREE_LIST_NODE, &mtr);
+ page + PAGE_HEADER + PAGE_BTR_IBUF_FREE_LIST_NODE, &mtr);
mlog_write_ulint(page + FIL_PAGE_TYPE, FIL_PAGE_IBUF_FREE_LIST,
- MLOG_2BYTES, &mtr);
+ MLOG_2BYTES, &mtr);
ibuf_data->seg_size++;
ibuf_data->free_list_len++;
@@ -1691,7 +1689,7 @@ ibuf_add_free_page(
bitmap_page = ibuf_bitmap_get_map_page(space, page_no, &mtr);
ibuf_bitmap_page_set_bits(bitmap_page, page_no, IBUF_BITMAP_IBUF,
- TRUE, &mtr);
+ TRUE, &mtr);
mtr_commit(&mtr);
mutex_exit(&ibuf_mutex);
@@ -1753,8 +1751,8 @@ ibuf_remove_free_page(
root = ibuf_tree_root_get(ibuf_data, space, &mtr2);
page_no = flst_get_last(root + PAGE_HEADER + PAGE_BTR_IBUF_FREE_LIST,
- &mtr2)
- .page;
+ &mtr2)
+ .page;
/* NOTE that we must release the latch on the ibuf tree root
because in fseg_free_page we access level 1 pages, and the root
@@ -1772,7 +1770,7 @@ ibuf_remove_free_page(
page from it. */
fseg_free_page(header_page + IBUF_HEADER + IBUF_TREE_SEG_HEADER,
- space, page_no, &mtr);
+ space, page_no, &mtr);
#ifdef UNIV_DEBUG_FILE_ACCESSES
buf_page_reset_file_page_was_freed(space, page_no);
#endif
@@ -1783,8 +1781,8 @@ ibuf_remove_free_page(
root = ibuf_tree_root_get(ibuf_data, space, &mtr);
ut_ad(page_no == flst_get_last(root + PAGE_HEADER
- + PAGE_BTR_IBUF_FREE_LIST, &mtr)
- .page);
+ + PAGE_BTR_IBUF_FREE_LIST, &mtr)
+ .page);
page = buf_page_get(space, page_no, RW_X_LATCH, &mtr);
@@ -1795,7 +1793,7 @@ ibuf_remove_free_page(
/* Remove the page from the free list and update the ibuf size data */
flst_remove(root + PAGE_HEADER + PAGE_BTR_IBUF_FREE_LIST,
- page + PAGE_HEADER + PAGE_BTR_IBUF_FREE_LIST_NODE, &mtr);
+ page + PAGE_HEADER + PAGE_BTR_IBUF_FREE_LIST_NODE, &mtr);
ibuf_data->seg_size--;
ibuf_data->free_list_len--;
@@ -1808,7 +1806,7 @@ ibuf_remove_free_page(
bitmap_page = ibuf_bitmap_get_map_page(space, page_no, &mtr);
ibuf_bitmap_page_set_bits(bitmap_page, page_no, IBUF_BITMAP_IBUF,
- FALSE, &mtr);
+ FALSE, &mtr);
#ifdef UNIV_DEBUG_FILE_ACCESSES
buf_page_set_file_page_was_freed(space, page_no);
#endif
@@ -1834,7 +1832,8 @@ ibuf_free_excess_pages(
if (space != 0) {
fprintf(stderr,
-"InnoDB: Error: calling ibuf_free_excess_pages for space %lu\n", (ulong) space);
+ "InnoDB: Error: calling ibuf_free_excess_pages"
+ " for space %lu\n", (ulong) space);
return;
}
@@ -1853,9 +1852,9 @@ ibuf_free_excess_pages(
if (ibuf_data == NULL) {
/* Not yet initialized */
-#ifdef UNIV_DEBUG
- /*fprintf(stderr,
- "Ibuf for space %lu not yet initialized\n", space); */
+#if 0 /* defined UNIV_DEBUG */
+ fprintf(stderr,
+ "Ibuf for space %lu not yet initialized\n", space);
#endif
return;
@@ -1952,14 +1951,14 @@ ibuf_get_merge_page_nos(
rec_space_id = ibuf_rec_get_space(rec);
if (rec_space_id != first_space_id
- || rec_page_no / IBUF_MERGE_AREA
- != first_page_no / IBUF_MERGE_AREA) {
+ || rec_page_no / IBUF_MERGE_AREA
+ != first_page_no / IBUF_MERGE_AREA) {
break;
}
if (rec_page_no != prev_page_no
- || rec_space_id != prev_space_id) {
+ || rec_space_id != prev_space_id) {
n_pages++;
}
@@ -1996,22 +1995,21 @@ ibuf_get_merge_page_nos(
ut_a(*n_stored < IBUF_MAX_N_PAGES_MERGED);
#endif
if ((rec_space_id != prev_space_id
- || rec_page_no != prev_page_no)
- && (prev_space_id != 0 || prev_page_no != 0)) {
+ || rec_page_no != prev_page_no)
+ && (prev_space_id != 0 || prev_page_no != 0)) {
if ((prev_page_no == first_page_no
- && prev_space_id == first_space_id)
- || contract
- || (volume_for_page >
- ((IBUF_MERGE_THRESHOLD - 1)
- * 4 * UNIV_PAGE_SIZE
- / IBUF_PAGE_SIZE_PER_FREE_SPACE)
- / IBUF_MERGE_THRESHOLD)) {
+ && prev_space_id == first_space_id)
+ || contract
+ || (volume_for_page
+ > ((IBUF_MERGE_THRESHOLD - 1)
+ * 4 * UNIV_PAGE_SIZE
+ / IBUF_PAGE_SIZE_PER_FREE_SPACE)
+ / IBUF_MERGE_THRESHOLD)) {
space_ids[*n_stored] = prev_space_id;
space_versions[*n_stored]
- = fil_space_get_version(
- prev_space_id);
+ = fil_space_get_version(prev_space_id);
page_nos[*n_stored] = prev_page_no;
(*n_stored)++;
@@ -2020,8 +2018,8 @@ ibuf_get_merge_page_nos(
}
if (rec_space_id != first_space_id
- || rec_page_no / IBUF_MERGE_AREA
- != first_page_no / IBUF_MERGE_AREA) {
+ || rec_page_no / IBUF_MERGE_AREA
+ != first_page_no / IBUF_MERGE_AREA) {
break;
}
@@ -2048,8 +2046,10 @@ ibuf_get_merge_page_nos(
#ifdef UNIV_IBUF_DEBUG
ut_a(*n_stored <= IBUF_MAX_N_PAGES_MERGED);
#endif
-/* fprintf(stderr, "Ibuf merge batch %lu pages %lu volume\n", *n_stored,
- sum_volumes); */
+#if 0
+ fprintf(stderr, "Ibuf merge batch %lu pages %lu volume\n",
+ *n_stored, sum_volumes);
+#endif
return(sum_volumes);
}
@@ -2156,10 +2156,11 @@ loop:
mutex_exit(&ibuf_mutex);
sum_sizes = ibuf_get_merge_page_nos(TRUE, btr_pcur_get_rec(&pcur),
- space_ids, space_versions, page_nos, &n_stored);
-#ifdef UNIV_IBUF_DEBUG
- /* fprintf(stderr, "Ibuf contract sync %lu pages %lu volume %lu\n",
- sync, n_stored, sum_sizes); */
+ space_ids, space_versions,
+ page_nos, &n_stored);
+#if 0 /* defined UNIV_IBUF_DEBUG */
+ fprintf(stderr, "Ibuf contract sync %lu pages %lu volume %lu\n",
+ sync, n_stored, sum_sizes);
#endif
ibuf_exit();
@@ -2167,7 +2168,7 @@ loop:
btr_pcur_close(&pcur);
buf_read_ibuf_merge_pages(sync, space_ids, space_versions, page_nos,
- n_stored);
+ n_stored);
*n_pages = n_stored;
return(sum_sizes + 1);
@@ -2299,7 +2300,7 @@ ibuf_get_volume_buffered(
ut_a(trx_sys_multiple_tablespace_format);
ut_ad((pcur->latch_mode == BTR_MODIFY_PREV)
- || (pcur->latch_mode == BTR_MODIFY_TREE));
+ || (pcur->latch_mode == BTR_MODIFY_TREE));
/* Count the volume of records earlier in the alphabetical order than
pcur */
@@ -2321,7 +2322,7 @@ ibuf_get_volume_buffered(
}
if (page_no != ibuf_rec_get_page_no(rec)
- || space != ibuf_rec_get_space(rec)) {
+ || space != ibuf_rec_get_space(rec)) {
goto count_later;
}
@@ -2343,7 +2344,7 @@ ibuf_get_volume_buffered(
prev_page = buf_page_get(0, prev_page_no, RW_X_LATCH, mtr);
#ifdef UNIV_BTR_DEBUG
ut_a(btr_page_get_next(prev_page, mtr)
- == buf_frame_get_page_no(page));
+ == buf_frame_get_page_no(page));
#endif /* UNIV_BTR_DEBUG */
#ifdef UNIV_SYNC_DEBUG
@@ -2364,7 +2365,7 @@ ibuf_get_volume_buffered(
}
if (page_no != ibuf_rec_get_page_no(rec)
- || space != ibuf_rec_get_space(rec)) {
+ || space != ibuf_rec_get_space(rec)) {
goto count_later;
}
@@ -2388,7 +2389,7 @@ count_later:
}
if (page_no != ibuf_rec_get_page_no(rec)
- || space != ibuf_rec_get_space(rec)) {
+ || space != ibuf_rec_get_space(rec)) {
return(volume);
}
@@ -2410,7 +2411,7 @@ count_later:
next_page = buf_page_get(0, next_page_no, RW_X_LATCH, mtr);
#ifdef UNIV_BTR_DEBUG
ut_a(btr_page_get_prev(next_page, mtr)
- == buf_frame_get_page_no(page));
+ == buf_frame_get_page_no(page));
#endif /* UNIV_BTR_DEBUG */
#ifdef UNIV_SYNC_DEBUG
@@ -2429,7 +2430,7 @@ count_later:
}
if (page_no != ibuf_rec_get_page_no(rec)
- || space != ibuf_rec_get_space(rec)) {
+ || space != ibuf_rec_get_space(rec)) {
return(volume);
}
@@ -2467,7 +2468,7 @@ ibuf_update_max_tablespace_id(void)
mtr_start(&mtr);
btr_pcur_open_at_index_side(FALSE, ibuf_index, BTR_SEARCH_LEAF,
- &pcur, TRUE, &mtr);
+ &pcur, TRUE, &mtr);
btr_pcur_move_to_prev(&pcur, &mtr);
if (btr_pcur_is_before_first_on_page(&pcur, &mtr)) {
@@ -2605,7 +2606,7 @@ ibuf_insert_low(
will be inserted to the insert buffer. */
ibuf_entry = ibuf_entry_build(entry, dict_table_is_comp(index->table),
- space, page_no, heap);
+ space, page_no, heap);
/* Open a cursor to the insert buffer tree to calculate if we can add
the new entry to it without exceeding the free space limit for the
@@ -2629,7 +2630,7 @@ ibuf_insert_low(
/* We check if the index page is suitable for buffered entries */
if (buf_page_peek(space, page_no)
- || lock_rec_expl_exist_on_page(space, page_no)) {
+ || lock_rec_expl_exist_on_page(space, page_no)) {
err = DB_STRONG_FAIL;
mtr_commit(&bitmap_mtr);
@@ -2638,10 +2639,10 @@ ibuf_insert_low(
}
bits = ibuf_bitmap_page_get_bits(bitmap_page, page_no,
- IBUF_BITMAP_FREE, &bitmap_mtr);
+ IBUF_BITMAP_FREE, &bitmap_mtr);
if (buffered + entry_size + page_dir_calc_reserved_space(1)
- > ibuf_index_page_calc_free_from_bits(bits)) {
+ > ibuf_index_page_calc_free_from_bits(bits)) {
mtr_commit(&bitmap_mtr);
/* It may not fit */
@@ -2659,10 +2660,12 @@ ibuf_insert_low(
buffered entries for this index page, if the bit is not set yet */
old_bit_value = ibuf_bitmap_page_get_bits(bitmap_page, page_no,
- IBUF_BITMAP_BUFFERED, &bitmap_mtr);
+ IBUF_BITMAP_BUFFERED,
+ &bitmap_mtr);
if (!old_bit_value) {
ibuf_bitmap_page_set_bits(bitmap_page, page_no,
- IBUF_BITMAP_BUFFERED, TRUE, &bitmap_mtr);
+ IBUF_BITMAP_BUFFERED, TRUE,
+ &bitmap_mtr);
}
mtr_commit(&bitmap_mtr);
@@ -2677,7 +2680,7 @@ ibuf_insert_low(
if (err == DB_SUCCESS) {
/* Update the page max trx id field */
page_update_max_trx_id(buf_frame_align(ins_rec),
- thr_get_trx(thr)->id);
+ thr_get_trx(thr)->id);
}
} else {
ut_ad(mode == BTR_MODIFY_TREE);
@@ -2691,14 +2694,14 @@ ibuf_insert_low(
err = btr_cur_pessimistic_insert(BTR_NO_LOCKING_FLAG
| BTR_NO_UNDO_LOG_FLAG,
- cursor,
- ibuf_entry, &ins_rec,
- &dummy_big_rec, thr,
- &mtr);
+ cursor,
+ ibuf_entry, &ins_rec,
+ &dummy_big_rec, thr,
+ &mtr);
if (err == DB_SUCCESS) {
/* Update the page max trx id field */
page_update_max_trx_id(buf_frame_align(ins_rec),
- thr_get_trx(thr)->id);
+ thr_get_trx(thr)->id);
}
ibuf_data_sizes_update(ibuf_data, root, &mtr);
@@ -2707,12 +2710,13 @@ ibuf_insert_low(
function_exit:
#ifdef UNIV_IBUF_DEBUG
if (err == DB_SUCCESS) {
- printf(
-"Incrementing ibuf count of space %lu page %lu\n"
-"from %lu by 1\n", space, page_no, ibuf_count_get(space, page_no));
+ fprintf(stderr,
+ "Incrementing ibuf count of space %lu page %lu\n"
+ "from %lu by 1\n", space, page_no,
+ ibuf_count_get(space, page_no));
ibuf_count_set(space, page_no,
- ibuf_count_get(space, page_no) + 1);
+ ibuf_count_get(space, page_no) + 1);
}
#endif
if (mode == BTR_MODIFY_TREE) {
@@ -2746,7 +2750,7 @@ function_exit:
ut_a(n_stored <= IBUF_MAX_N_PAGES_MERGED);
#endif
buf_read_ibuf_merge_pages(FALSE, space_ids, space_versions,
- page_nos, n_stored);
+ page_nos, n_stored);
}
return(err);
@@ -2775,22 +2779,22 @@ ibuf_insert(
ut_a(!(index->type & DICT_CLUSTERED));
if (rec_get_converted_size(index, entry)
- >= page_get_free_space_of_empty(
- dict_table_is_comp(index->table)) / 2) {
+ >= (page_get_free_space_of_empty(dict_table_is_comp(index->table))
+ / 2)) {
return(FALSE);
}
err = ibuf_insert_low(BTR_MODIFY_PREV, entry, index, space, page_no,
- thr);
+ thr);
if (err == DB_FAIL) {
err = ibuf_insert_low(BTR_MODIFY_TREE, entry, index, space,
- page_no, thr);
+ page_no, thr);
}
if (err == DB_SUCCESS) {
#ifdef UNIV_IBUF_DEBUG
/* fprintf(stderr, "Ibuf insert for page no %lu of index %s\n",
- page_no, index->name); */
+ page_no, index->name); */
#endif
return(TRUE);
@@ -2824,36 +2828,40 @@ ibuf_insert_to_index_page(
ut_ad(dtuple_check_typed(entry));
if (UNIV_UNLIKELY(dict_table_is_comp(index->table)
- != (ibool)!!page_is_comp(page))) {
- fputs(
-"InnoDB: Trying to insert a record from the insert buffer to an index page\n"
-"InnoDB: but the 'compact' flag does not match!\n", stderr);
+ != (ibool)!!page_is_comp(page))) {
+ fputs("InnoDB: Trying to insert a record from"
+ " the insert buffer to an index page\n"
+ "InnoDB: but the 'compact' flag does not match!\n",
+ stderr);
goto dump;
}
rec = page_rec_get_next(page_get_infimum_rec(page));
if (UNIV_UNLIKELY(rec_get_n_fields(rec, index)
- != dtuple_get_n_fields(entry))) {
- fputs(
-"InnoDB: Trying to insert a record from the insert buffer to an index page\n"
-"InnoDB: but the number of fields does not match!\n", stderr);
- dump:
+ != dtuple_get_n_fields(entry))) {
+ fputs("InnoDB: Trying to insert a record from"
+ " the insert buffer to an index page\n"
+ "InnoDB: but the number of fields does not match!\n",
+ stderr);
+dump:
buf_page_print(page);
dtuple_print(stderr, entry);
- fputs(
-"InnoDB: The table where where this index record belongs\n"
-"InnoDB: is now probably corrupt. Please run CHECK TABLE on\n"
-"InnoDB: your tables.\n"
-"InnoDB: Send a detailed bug report to mysql@lists.mysql.com!\n", stderr);
+ fputs("InnoDB: The table where where"
+ " this index record belongs\n"
+ "InnoDB: is now probably corrupt."
+ " Please run CHECK TABLE on\n"
+ "InnoDB: your tables.\n"
+ "InnoDB: Submit a detailed bug report to"
+ " http://bugs.mysql.com!\n", stderr);
return;
}
low_match = page_cur_search(page, index, entry,
- PAGE_CUR_LE, &page_cur);
+ PAGE_CUR_LE, &page_cur);
if (low_match == dtuple_get_n_fields(entry)) {
rec = page_cur_get_rec(&page_cur);
@@ -2868,39 +2876,45 @@ ibuf_insert_to_index_page(
btr_page_reorganize(page, index, mtr);
page_cur_search(page, index, entry,
- PAGE_CUR_LE, &page_cur);
+ PAGE_CUR_LE, &page_cur);
/* This time the record must fit */
- if (UNIV_UNLIKELY(!page_cur_tuple_insert(
- &page_cur, entry, index, mtr))) {
+ if (UNIV_UNLIKELY(!page_cur_tuple_insert
+ (&page_cur, entry, index, mtr))) {
ut_print_timestamp(stderr);
fprintf(stderr,
-"InnoDB: Error: Insert buffer insert fails; page free %lu, dtuple size %lu\n",
- (ulong) page_get_max_insert_size(page, 1),
- (ulong) rec_get_converted_size(index, entry));
+ "InnoDB: Error: Insert buffer insert"
+ " fails; page free %lu,"
+ " dtuple size %lu\n",
+ (ulong) page_get_max_insert_size
+ (page, 1),
+ (ulong) rec_get_converted_size
+ (index, entry));
fputs("InnoDB: Cannot insert index record ",
- stderr);
+ stderr);
dtuple_print(stderr, entry);
- fputs(
-"\nInnoDB: The table where where this index record belongs\n"
-"InnoDB: is now probably corrupt. Please run CHECK TABLE on\n"
-"InnoDB: that table.\n", stderr);
-
- bitmap_page = ibuf_bitmap_get_map_page(
- buf_frame_get_space_id(page),
- buf_frame_get_page_no(page),
- mtr);
- old_bits = ibuf_bitmap_page_get_bits(
- bitmap_page,
- buf_frame_get_page_no(page),
- IBUF_BITMAP_FREE, mtr);
-
- fprintf(stderr, "Bitmap bits %lu\n", (ulong) old_bits);
-
- fputs(
-"InnoDB: Submit a detailed bug report to http://bugs.mysql.com\n", stderr);
+ fputs("\nInnoDB: The table where"
+ " this index record belongs\n"
+ "InnoDB: is now probably corrupt."
+ " Please run CHECK TABLE on\n"
+ "InnoDB: that table.\n", stderr);
+
+ bitmap_page = ibuf_bitmap_get_map_page
+ (buf_frame_get_space_id(page),
+ buf_frame_get_page_no(page),
+ mtr);
+ old_bits = ibuf_bitmap_page_get_bits
+ (bitmap_page,
+ buf_frame_get_page_no(page),
+ IBUF_BITMAP_FREE, mtr);
+
+ fprintf(stderr, "Bitmap bits %lu\n",
+ (ulong) old_bits);
+
+ fputs("InnoDB: Submit a detailed bug report"
+ " to http://bugs.mysql.com\n", stderr);
}
}
}
@@ -2936,11 +2950,12 @@ ibuf_delete_rec(
if (success) {
#ifdef UNIV_IBUF_DEBUG
- printf(
-"Decrementing ibuf count of space %lu page %lu\n"
-"from %lu by 1\n", space, page_no, ibuf_count_get(space, page_no));
+ fprintf(stderr,
+ "Decrementing ibuf count of space %lu page %lu\n"
+ "from %lu by 1\n", space, page_no,
+ ibuf_count_get(space, page_no));
ibuf_count_set(space, page_no,
- ibuf_count_get(space, page_no) - 1);
+ ibuf_count_get(space, page_no) - 1);
#endif
return(FALSE);
}
@@ -2963,9 +2978,11 @@ ibuf_delete_rec(
if (!success) {
fprintf(stderr,
- "InnoDB: ERROR: Submit the output to http://bugs.mysql.com\n"
- "InnoDB: ibuf cursor restoration fails!\n"
- "InnoDB: ibuf record inserted to page %lu\n", (ulong) page_no);
+ "InnoDB: ERROR: Submit the output to"
+ " http://bugs.mysql.com\n"
+ "InnoDB: ibuf cursor restoration fails!\n"
+ "InnoDB: ibuf record inserted to page %lu\n",
+ (ulong) page_no);
fflush(stderr);
rec_print_old(stderr, btr_pcur_get_rec(pcur));
@@ -2973,7 +2990,7 @@ ibuf_delete_rec(
dtuple_print(stderr, search_tuple);
rec_print_old(stderr,
- page_rec_get_next(btr_pcur_get_rec(pcur)));
+ page_rec_get_next(btr_pcur_get_rec(pcur)));
fflush(stderr);
btr_pcur_commit_specify_mtr(pcur, mtr);
@@ -2996,7 +3013,7 @@ ibuf_delete_rec(
root = ibuf_tree_root_get(ibuf_data, 0, mtr);
btr_cur_pessimistic_delete(&err, TRUE, btr_pcur_get_btr_cur(pcur),
- FALSE, mtr);
+ FALSE, mtr);
ut_a(err == DB_SUCCESS);
#ifdef UNIV_IBUF_DEBUG
@@ -3058,16 +3075,8 @@ ibuf_merge_or_delete_for_page(
return;
}
-#ifdef UNIV_LOG_DEBUG
- if (space % 2 != 0) {
-
- fputs("No ibuf operation in a replicate space\n", stderr);
-
- return;
- }
-#endif
if (ibuf_fixed_addr_page(space, page_no) || fsp_descr_page(page_no)
- || trx_sys_hdr_page(space, page_no)) {
+ || trx_sys_hdr_page(space, page_no)) {
return;
}
@@ -3093,7 +3102,7 @@ ibuf_merge_or_delete_for_page(
bitmap_page = ibuf_bitmap_get_map_page(space, page_no, &mtr);
if (!ibuf_bitmap_page_get_bits(bitmap_page, page_no,
- IBUF_BITMAP_BUFFERED, &mtr)) {
+ IBUF_BITMAP_BUFFERED, &mtr)) {
/* No inserts buffered for this page */
mtr_commit(&mtr);
@@ -3120,7 +3129,7 @@ ibuf_merge_or_delete_for_page(
search_tuple = ibuf_search_tuple_build(space, page_no, heap);
} else {
search_tuple = ibuf_new_search_tuple_build(space, page_no,
- heap);
+ heap);
}
if (page) {
@@ -3141,10 +3150,10 @@ ibuf_merge_or_delete_for_page(
mtr_start(&mtr);
fputs(" InnoDB: Dump of the ibuf bitmap page:\n",
- stderr);
+ stderr);
bitmap_page = ibuf_bitmap_get_map_page(space, page_no,
- &mtr);
+ &mtr);
buf_page_print(bitmap_page);
mtr_commit(&mtr);
@@ -3154,13 +3163,20 @@ ibuf_merge_or_delete_for_page(
buf_page_print(page);
fprintf(stderr,
-"InnoDB: Error: corruption in the tablespace. Bitmap shows insert\n"
-"InnoDB: buffer records to page n:o %lu though the page\n"
-"InnoDB: type is %lu, which is not an index page!\n"
-"InnoDB: We try to resolve the problem by skipping the insert buffer\n"
-"InnoDB: merge for this page. Please run CHECK TABLE on your tables\n"
-"InnoDB: to determine if they are corrupt after this.\n\n"
-"InnoDB: Please submit a detailed bug report to http://bugs.mysql.com\n\n",
+ "InnoDB: Error: corruption in the tablespace."
+ " Bitmap shows insert\n"
+ "InnoDB: buffer records to page n:o %lu"
+ " though the page\n"
+ "InnoDB: type is %lu, which is"
+ " not an index page!\n"
+ "InnoDB: We try to resolve the problem"
+ " by skipping the insert buffer\n"
+ "InnoDB: merge for this page."
+ " Please run CHECK TABLE on your tables\n"
+ "InnoDB: to determine if they are corrupt"
+ " after this.\n\n"
+ "InnoDB: Please submit a detailed bug report"
+ " to http://bugs.mysql.com\n\n",
(ulong) page_no,
(ulong) fil_page_get_type(page));
}
@@ -3175,9 +3191,9 @@ loop:
if (page) {
ibool success = buf_page_get_known_nowait(RW_X_LATCH, page,
- BUF_KEEP_OLD,
- __FILE__, __LINE__,
- &mtr);
+ BUF_KEEP_OLD,
+ __FILE__, __LINE__,
+ &mtr);
ut_a(success);
#ifdef UNIV_SYNC_DEBUG
buf_page_dbg_add_level(page, SYNC_TREE_NODE);
@@ -3187,7 +3203,7 @@ loop:
/* Position pcur in the insert buffer at the first entry for this
index page */
btr_pcur_open_on_user_rec(ibuf_data->index, search_tuple, PAGE_CUR_GE,
- BTR_MODIFY_LEAF, &pcur, &mtr);
+ BTR_MODIFY_LEAF, &pcur, &mtr);
if (!btr_pcur_is_on_user_rec(&pcur, &mtr)) {
ut_ad(btr_pcur_is_after_last_in_tree(&pcur, &mtr));
@@ -3201,7 +3217,7 @@ loop:
/* Check if the entry is for this index page */
if (ibuf_rec_get_page_no(ibuf_rec) != page_no
- || ibuf_rec_get_space(ibuf_rec) != space) {
+ || ibuf_rec_get_space(ibuf_rec) != space) {
if (page) {
page_header_reset_last_insert(page, &mtr);
}
@@ -3219,20 +3235,20 @@ loop:
keep the latch to the ibuf_rec page until the
insertion is finished! */
dict_index_t* dummy_index;
- dulint max_trx_id = page_get_max_trx_id(
- buf_frame_align(ibuf_rec));
+ dulint max_trx_id = page_get_max_trx_id
+ (buf_frame_align(ibuf_rec));
page_update_max_trx_id(page, max_trx_id);
- entry = ibuf_build_entry_from_ibuf_rec(ibuf_rec,
- heap, &dummy_index);
+ entry = ibuf_build_entry_from_ibuf_rec
+ (ibuf_rec, heap, &dummy_index);
#ifdef UNIV_IBUF_DEBUG
volume += rec_get_converted_size(dummy_index, entry)
- + page_dir_calc_reserved_space(1);
+ + page_dir_calc_reserved_space(1);
ut_a(volume <= 4 * UNIV_PAGE_SIZE
- / IBUF_PAGE_SIZE_PER_FREE_SPACE);
+ / IBUF_PAGE_SIZE_PER_FREE_SPACE);
#endif
ibuf_insert_to_index_page(entry, page,
- dummy_index, &mtr);
+ dummy_index, &mtr);
ibuf_dummy_index_free(dummy_index);
}
@@ -3240,7 +3256,7 @@ loop:
/* Delete the record from ibuf */
if (ibuf_delete_rec(space, page_no, &pcur, search_tuple,
- &mtr)) {
+ &mtr)) {
/* Deletion was pessimistic and mtr was committed:
we start from the beginning again */
@@ -3265,27 +3281,29 @@ reset_bit:
if (update_ibuf_bitmap) {
bitmap_page = ibuf_bitmap_get_map_page(space, page_no, &mtr);
ibuf_bitmap_page_set_bits(bitmap_page, page_no,
- IBUF_BITMAP_BUFFERED, FALSE, &mtr);
- if (page) {
- ulint old_bits = ibuf_bitmap_page_get_bits(bitmap_page,
- page_no, IBUF_BITMAP_FREE, &mtr);
- ulint new_bits = ibuf_index_page_calc_free(page);
-#ifdef UNIV_IBUF_DEBUG
- /* fprintf(stderr, "Old bits %lu new bits %lu max size %lu\n",
- old_bits, new_bits,
- page_get_max_insert_size_after_reorganize(page, 1)); */
+ IBUF_BITMAP_BUFFERED, FALSE, &mtr);
+ if (page) {
+ ulint old_bits = ibuf_bitmap_page_get_bits
+ (bitmap_page, page_no, IBUF_BITMAP_FREE, &mtr);
+ ulint new_bits = ibuf_index_page_calc_free(page);
+#if 0 /* defined UNIV_IBUF_DEBUG */
+ fprintf(stderr, "Old bits %lu new bits %lu"
+ " max size %lu\n",
+ old_bits, new_bits,
+ page_get_max_insert_size_after_reorganize
+ (page, 1));
#endif
if (old_bits != new_bits) {
ibuf_bitmap_page_set_bits(bitmap_page, page_no,
- IBUF_BITMAP_FREE,
- new_bits, &mtr);
+ IBUF_BITMAP_FREE,
+ new_bits, &mtr);
}
}
}
-#ifdef UNIV_IBUF_DEBUG
- /* fprintf(stderr,
+#if 0 /* defined UNIV_IBUF_DEBUG */
+ fprintf(stderr,
"Ibuf merge %lu records volume %lu to page no %lu\n",
- n_inserts, volume, page_no); */
+ n_inserts, volume, page_no);
#endif
mtr_commit(&mtr);
btr_pcur_close(&pcur);
@@ -3352,7 +3370,7 @@ loop:
/* Position pcur in the insert buffer at the first entry for the
space */
btr_pcur_open_on_user_rec(ibuf_data->index, search_tuple, PAGE_CUR_GE,
- BTR_MODIFY_LEAF, &pcur, &mtr);
+ BTR_MODIFY_LEAF, &pcur, &mtr);
if (!btr_pcur_is_on_user_rec(&pcur, &mtr)) {
ut_ad(btr_pcur_is_after_last_in_tree(&pcur, &mtr));
@@ -3376,7 +3394,7 @@ loop:
/* Delete the record from ibuf */
closed = ibuf_delete_rec(space, page_no, &pcur, search_tuple,
- &mtr);
+ &mtr);
if (closed) {
/* Deletion was pessimistic and mtr was committed:
we start from the beginning again */
@@ -3409,8 +3427,8 @@ leave_loop:
mutex_exit(&ibuf_mutex);
/*
fprintf(stderr,
- "InnoDB: Discarded %lu ibuf entries for space %lu\n",
- (ulong) n_inserts, (ulong) space);
+ "InnoDB: Discarded %lu ibuf entries for space %lu\n",
+ (ulong) n_inserts, (ulong) space);
*/
ibuf_exit();
@@ -3477,9 +3495,11 @@ ibuf_is_empty(void)
if (data->empty == FALSE) {
fprintf(stderr,
-"InnoDB: Warning: insert buffer tree is empty but the data struct does not\n"
-"InnoDB: know it. This condition is legal if the master thread has not yet\n"
-"InnoDB: run to completion.\n");
+ "InnoDB: Warning: insert buffer tree is empty"
+ " but the data struct does not\n"
+ "InnoDB: know it. This condition is legal"
+ " if the master thread has not yet\n"
+ "InnoDB: run to completion.\n");
}
} else {
ut_a(data->empty == FALSE);
@@ -3517,8 +3537,8 @@ ibuf_print(
while (data) {
fprintf(file,
- "Ibuf: size %lu, free list len %lu, seg size %lu,\n"
- "%lu inserts, %lu merged recs, %lu merges\n",
+ "Ibuf: size %lu, free list len %lu, seg size %lu,\n"
+ "%lu inserts, %lu merged recs, %lu merges\n",
(ulong) data->size,
(ulong) data->free_list_len,
(ulong) data->seg_size,
@@ -3532,7 +3552,8 @@ ibuf_print(
fprintf(stderr,
"Ibuf count for page %lu is %lu\n",
(ulong) i,
- (ulong) ibuf_count_get(data->space, i));
+ (ulong)
+ ibuf_count_get(data->space, i));
}
}
#endif
diff --git a/storage/innobase/include/btr0btr.ic b/storage/innobase/include/btr0btr.ic
index c24b1603bd2..1f39b52f3c8 100644
--- a/storage/innobase/include/btr0btr.ic
+++ b/storage/innobase/include/btr0btr.ic
@@ -109,7 +109,7 @@ btr_page_set_level(
ut_ad(level <= BTR_MAX_NODE_LEVEL);
mlog_write_ulint(page + PAGE_HEADER + PAGE_LEVEL, level,
- MLOG_2BYTES, mtr);
+ MLOG_2BYTES, mtr);
}
/************************************************************
@@ -124,9 +124,9 @@ btr_page_get_next(
{
ut_ad(page && mtr);
ut_ad(mtr_memo_contains(mtr, buf_block_align(page),
- MTR_MEMO_PAGE_X_FIX)
- || mtr_memo_contains(mtr, buf_block_align(page),
- MTR_MEMO_PAGE_S_FIX));
+ MTR_MEMO_PAGE_X_FIX)
+ || mtr_memo_contains(mtr, buf_block_align(page),
+ MTR_MEMO_PAGE_S_FIX));
return(mach_read_from_4(page + FIL_PAGE_NEXT));
}
@@ -194,7 +194,7 @@ btr_node_ptr_get_child_page_no(
/* The child address is in the last field */
field = rec_get_nth_field(rec, offsets,
- rec_offs_n_fields(offsets) - 1, &len);
+ rec_offs_n_fields(offsets) - 1, &len);
ut_ad(len == 4);
@@ -202,7 +202,8 @@ btr_node_ptr_get_child_page_no(
if (UNIV_UNLIKELY(page_no == 0)) {
fprintf(stderr,
-"InnoDB: a nonsensical page number 0 in a node ptr record at offset %lu\n",
+ "InnoDB: a nonsensical page number 0"
+ " in a node ptr record at offset %lu\n",
(ulong) ut_align_offset(rec, UNIV_PAGE_SIZE));
buf_page_print(buf_frame_align(rec));
}
@@ -221,13 +222,13 @@ btr_leaf_page_release(
mtr_t* mtr) /* in: mtr */
{
ut_ad(!mtr_memo_contains(mtr, buf_block_align(page),
- MTR_MEMO_MODIFY));
+ MTR_MEMO_MODIFY));
if (latch_mode == BTR_SEARCH_LEAF) {
mtr_memo_release(mtr, buf_block_align(page),
- MTR_MEMO_PAGE_S_FIX);
+ MTR_MEMO_PAGE_S_FIX);
} else {
ut_ad(latch_mode == BTR_MODIFY_LEAF);
mtr_memo_release(mtr, buf_block_align(page),
- MTR_MEMO_PAGE_X_FIX);
+ MTR_MEMO_PAGE_X_FIX);
}
}
diff --git a/storage/innobase/include/btr0cur.h b/storage/innobase/include/btr0cur.h
index d5dd4f3010a..1d41a345699 100644
--- a/storage/innobase/include/btr0cur.h
+++ b/storage/innobase/include/btr0cur.h
@@ -583,9 +583,11 @@ to know struct size! */
struct btr_cur_struct {
dict_index_t* index; /* index where positioned */
page_cur_t page_cur; /* page cursor */
- page_t* left_page; /* this field is used to store a pointer
- to the left neighbor page, in the cases
- BTR_SEARCH_PREV and BTR_MODIFY_PREV */
+ page_t* left_page; /* this field is used to store
+ a pointer to the left neighbor
+ page, in the cases
+ BTR_SEARCH_PREV and
+ BTR_MODIFY_PREV */
/*------------------------------*/
que_thr_t* thr; /* this field is only used when
btr_cur_search_... is called for an
diff --git a/storage/innobase/include/btr0cur.ic b/storage/innobase/include/btr0cur.ic
index 7fbdf6035b0..76a4ff938a2 100644
--- a/storage/innobase/include/btr0cur.ic
+++ b/storage/innobase/include/btr0cur.ic
@@ -101,8 +101,8 @@ btr_cur_compress_recommendation(
page = btr_cur_get_page(cursor);
if ((page_get_data_size(page) < BTR_CUR_PAGE_COMPRESS_LIMIT)
- || ((btr_page_get_next(page, mtr) == FIL_NULL)
- && (btr_page_get_prev(page, mtr) == FIL_NULL))) {
+ || ((btr_page_get_next(page, mtr) == FIL_NULL)
+ && (btr_page_get_prev(page, mtr) == FIL_NULL))) {
/* The page fillfactor has dropped below a predefined
minimum value OR the level in the B-tree contains just
@@ -110,7 +110,7 @@ btr_cur_compress_recommendation(
root page. */
if (dict_tree_get_page((cursor->index)->tree)
- == buf_frame_get_page_no(page)) {
+ == buf_frame_get_page_no(page)) {
/* It is the root page */
@@ -144,9 +144,9 @@ btr_cur_can_delete_without_compress(
page = btr_cur_get_page(cursor);
if ((page_get_data_size(page) - rec_size < BTR_CUR_PAGE_COMPRESS_LIMIT)
- || ((btr_page_get_next(page, mtr) == FIL_NULL)
- && (btr_page_get_prev(page, mtr) == FIL_NULL))
- || (page_get_n_recs(page) < 2)) {
+ || ((btr_page_get_next(page, mtr) == FIL_NULL)
+ && (btr_page_get_prev(page, mtr) == FIL_NULL))
+ || (page_get_n_recs(page) < 2)) {
/* The page fillfactor will drop below a predefined
minimum value, OR the level in the B-tree contains just
@@ -154,7 +154,7 @@ btr_cur_can_delete_without_compress(
compression if this is not the root page. */
if (dict_tree_get_page((cursor->index)->tree)
- == buf_frame_get_page_no(page)) {
+ == buf_frame_get_page_no(page)) {
/* It is the root page */
diff --git a/storage/innobase/include/btr0pcur.ic b/storage/innobase/include/btr0pcur.ic
index a8aa82cf203..66462530716 100644
--- a/storage/innobase/include/btr0pcur.ic
+++ b/storage/innobase/include/btr0pcur.ic
@@ -20,7 +20,7 @@ btr_pcur_get_rel_pos(
ut_ad(cursor->old_rec);
ut_ad(cursor->old_stored == BTR_PCUR_OLD_STORED);
ut_ad(cursor->pos_state == BTR_PCUR_WAS_POSITIONED
- || cursor->pos_state == BTR_PCUR_IS_POSITIONED);
+ || cursor->pos_state == BTR_PCUR_IS_POSITIONED);
return(cursor->rel_pos);
}
@@ -120,7 +120,7 @@ btr_pcur_get_up_match(
btr_cur_t* btr_cursor;
ut_ad((cursor->pos_state == BTR_PCUR_WAS_POSITIONED)
- || (cursor->pos_state == BTR_PCUR_IS_POSITIONED));
+ || (cursor->pos_state == BTR_PCUR_IS_POSITIONED));
btr_cursor = btr_pcur_get_btr_cur(cursor);
@@ -143,7 +143,7 @@ btr_pcur_get_low_match(
btr_cur_t* btr_cursor;
ut_ad((cursor->pos_state == BTR_PCUR_WAS_POSITIONED)
- || (cursor->pos_state == BTR_PCUR_IS_POSITIONED));
+ || (cursor->pos_state == BTR_PCUR_IS_POSITIONED));
btr_cursor = btr_pcur_get_btr_cur(cursor);
ut_ad(btr_cursor->low_match != ULINT_UNDEFINED);
@@ -198,7 +198,7 @@ btr_pcur_is_on_user_rec(
ut_ad(cursor->latch_mode != BTR_NO_LATCHES);
if ((btr_pcur_is_before_first_on_page(cursor, mtr))
- || (btr_pcur_is_after_last_on_page(cursor, mtr))) {
+ || (btr_pcur_is_after_last_on_page(cursor, mtr))) {
return(FALSE);
}
@@ -491,7 +491,7 @@ btr_pcur_open(
btr_cursor = btr_pcur_get_btr_cur(cursor);
btr_cur_search_to_nth_level(index, 0, tuple, mode, latch_mode,
- btr_cursor, 0, mtr);
+ btr_cursor, 0, mtr);
cursor->pos_state = BTR_PCUR_IS_POSITIONED;
cursor->trx_if_known = NULL;
@@ -533,7 +533,7 @@ btr_pcur_open_with_no_init(
btr_cursor = btr_pcur_get_btr_cur(cursor);
btr_cur_search_to_nth_level(index, 0, tuple, mode, latch_mode,
- btr_cursor, has_search_latch, mtr);
+ btr_cursor, has_search_latch, mtr);
cursor->pos_state = BTR_PCUR_IS_POSITIONED;
cursor->old_stored = BTR_PCUR_OLD_NOT_STORED;
@@ -568,7 +568,7 @@ btr_pcur_open_at_index_side(
}
btr_cur_open_at_index_side(from_left, index, latch_mode,
- btr_pcur_get_btr_cur(pcur), mtr);
+ btr_pcur_get_btr_cur(pcur), mtr);
pcur->pos_state = BTR_PCUR_IS_POSITIONED;
pcur->old_stored = BTR_PCUR_OLD_NOT_STORED;
@@ -595,7 +595,7 @@ btr_pcur_open_at_rnd_pos(
btr_pcur_init(cursor);
btr_cur_open_at_rnd_pos(index, latch_mode,
- btr_pcur_get_btr_cur(cursor), mtr);
+ btr_pcur_get_btr_cur(cursor), mtr);
cursor->pos_state = BTR_PCUR_IS_POSITIONED;
cursor->old_stored = BTR_PCUR_OLD_NOT_STORED;
diff --git a/storage/innobase/include/buf0buf.h b/storage/innobase/include/buf0buf.h
index 12aac878614..110ef36a296 100644
--- a/storage/innobase/include/buf0buf.h
+++ b/storage/innobase/include/buf0buf.h
@@ -156,8 +156,8 @@ improve debugging. Only values RW_S_LATCH and RW_X_LATCH are allowed as LA! */
NOTE! The following macros should be used instead of
buf_page_optimistic_get_func, to improve debugging. Only values RW_S_LATCH and
RW_X_LATCH are allowed as LA! */
-#define buf_page_optimistic_get(LA, BL, G, MC, MTR) buf_page_optimistic_get_func(\
- LA, BL, G, MC, __FILE__, __LINE__, MTR)
+#define buf_page_optimistic_get(LA, BL, G, MC, MTR) \
+ buf_page_optimistic_get_func(LA, BL, G, MC, __FILE__, __LINE__, MTR)
/************************************************************************
This is the general function used to get optimistic access to a database
page. */
diff --git a/storage/innobase/include/buf0buf.ic b/storage/innobase/include/buf0buf.ic
index 3c7a64cbcb0..015de862705 100644
--- a/storage/innobase/include/buf0buf.ic
+++ b/storage/innobase/include/buf0buf.ic
@@ -28,7 +28,7 @@ buf_block_peek_if_too_old(
buf_block_t* block) /* in: block to make younger */
{
return(buf_pool->freed_page_clock >= block->freed_page_clock
- + 1 + (buf_pool->curr_size / 1024));
+ + 1 + (buf_pool->curr_size / 1024));
}
/*************************************************************************
@@ -82,8 +82,8 @@ buf_pool_is_block(
void* ptr) /* in: pointer to memory */
{
if ((buf_pool->blocks <= (buf_block_t*)ptr)
- && ((buf_block_t*)ptr < buf_pool->blocks
- + buf_pool->max_size)) {
+ && ((buf_block_t*)ptr < buf_pool->blocks
+ + buf_pool->max_size)) {
return(TRUE);
}
@@ -151,7 +151,7 @@ buf_block_get_frame(
ut_ad(block < buf_pool->blocks + buf_pool->max_size);
ut_ad(block->state != BUF_BLOCK_NOT_USED);
ut_ad((block->state != BUF_BLOCK_FILE_PAGE)
- || (block->buf_fix_count > 0));
+ || (block->buf_fix_count > 0));
return(block->frame);
}
@@ -209,16 +209,19 @@ buf_block_align(
frame_zero = buf_pool->frame_zero;
if (UNIV_UNLIKELY((ulint)ptr < (ulint)frame_zero)
- || UNIV_UNLIKELY((ulint)ptr > (ulint)(buf_pool->high_end))) {
+ || UNIV_UNLIKELY((ulint)ptr > (ulint)(buf_pool->high_end))) {
ut_print_timestamp(stderr);
fprintf(stderr,
-"InnoDB: Error: trying to access a stray pointer %p\n"
-"InnoDB: buf pool start is at %p, end at %p\n"
-"InnoDB: Probable reason is database corruption or memory\n"
-"InnoDB: corruption. If this happens in an InnoDB database recovery, see\n"
-"InnoDB: http://dev.mysql.com/doc/refman/5.1/en/forcing-recovery.html\n"
-"InnoDB: how to force recovery.\n",
+ "InnoDB: Error: trying to access a stray pointer %p\n"
+ "InnoDB: buf pool start is at %p, end at %p\n"
+ "InnoDB: Probable reason is database corruption"
+ " or memory\n"
+ "InnoDB: corruption. If this happens in an"
+ " InnoDB database recovery, see\n"
+ "InnoDB: http://dev.mysql.com/doc/refman/5.1/en/"
+ "forcing-recovery.html\n"
+ "InnoDB: how to force recovery.\n",
ptr, frame_zero,
buf_pool->high_end);
ut_error;
@@ -245,16 +248,19 @@ buf_frame_align(
frame = ut_align_down(ptr, UNIV_PAGE_SIZE);
if (UNIV_UNLIKELY((ulint)frame < (ulint)(buf_pool->frame_zero))
- || UNIV_UNLIKELY((ulint)frame >= (ulint)(buf_pool->high_end))) {
+ || UNIV_UNLIKELY((ulint)frame >= (ulint)(buf_pool->high_end))) {
ut_print_timestamp(stderr);
fprintf(stderr,
-"InnoDB: Error: trying to access a stray pointer %p\n"
-"InnoDB: buf pool start is at %p, end at %p\n"
-"InnoDB: Probable reason is database corruption or memory\n"
-"InnoDB: corruption. If this happens in an InnoDB database recovery, see\n"
-"InnoDB: http://dev.mysql.com/doc/refman/5.1/en/forcing-recovery.html\n"
-"InnoDB: how to force recovery.\n",
+ "InnoDB: Error: trying to access a stray pointer %p\n"
+ "InnoDB: buf pool start is at %p, end at %p\n"
+ "InnoDB: Probable reason is database corruption"
+ " or memory\n"
+ "InnoDB: corruption. If this happens in an"
+ " InnoDB database recovery, see\n"
+ "InnoDB: http://dev.mysql.com/doc/refman/5.1/en/"
+ "forcing-recovery.html\n"
+ "InnoDB: how to force recovery.\n",
ptr, buf_pool->frame_zero,
buf_pool->high_end);
ut_error;
@@ -449,7 +455,7 @@ buf_frame_modify_clock_inc(
#ifdef UNIV_SYNC_DEBUG
ut_ad((mutex_own(&(buf_pool->mutex)) && (block->buf_fix_count == 0))
- || rw_lock_own(&(block->lock), RW_LOCK_EXCLUSIVE));
+ || rw_lock_own(&(block->lock), RW_LOCK_EXCLUSIVE));
#endif /*UNIV_SYNC_DEBUG */
UT_DULINT_INC(block->modify_clock);
@@ -470,7 +476,7 @@ buf_block_modify_clock_inc(
{
#ifdef UNIV_SYNC_DEBUG
ut_ad((mutex_own(&(buf_pool->mutex)) && (block->buf_fix_count == 0))
- || rw_lock_own(&(block->lock), RW_LOCK_EXCLUSIVE));
+ || rw_lock_own(&(block->lock), RW_LOCK_EXCLUSIVE));
#endif /* UNIV_SYNC_DEBUG */
UT_DULINT_INC(block->modify_clock);
@@ -490,7 +496,7 @@ buf_block_get_modify_clock(
{
#ifdef UNIV_SYNC_DEBUG
ut_ad(rw_lock_own(&(block->lock), RW_LOCK_SHARED)
- || rw_lock_own(&(block->lock), RW_LOCK_EXCLUSIVE));
+ || rw_lock_own(&(block->lock), RW_LOCK_EXCLUSIVE));
#endif /* UNIV_SYNC_DEBUG */
return(block->modify_clock);
@@ -551,7 +557,7 @@ buf_page_hash_get(
fold = buf_page_address_fold(space, offset);
HASH_SEARCH(hash, buf_pool->page_hash, fold, block,
- (block->space == space) && (block->offset == offset));
+ (block->space == space) && (block->offset == offset));
ut_a(block == NULL || block->state == BUF_BLOCK_FILE_PAGE);
return(block);
@@ -580,9 +586,9 @@ buf_page_get_release_on_io(
buf_frame_t* frame;
frame = buf_page_get_gen(space, offset, rw_latch, guess,
- BUF_GET_IF_IN_POOL,
- __FILE__, __LINE__,
- mtr);
+ BUF_GET_IF_IN_POOL,
+ __FILE__, __LINE__,
+ mtr);
if (frame != NULL) {
return(frame);
diff --git a/storage/innobase/include/buf0flu.ic b/storage/innobase/include/buf0flu.ic
index ea619cd4063..b304673f8be 100644
--- a/storage/innobase/include/buf0flu.ic
+++ b/storage/innobase/include/buf0flu.ic
@@ -59,7 +59,7 @@ buf_flush_note_modification(
buf_flush_insert_into_flush_list(block);
} else {
ut_ad(ut_dulint_cmp(block->oldest_modification,
- mtr->start_lsn) <= 0);
+ mtr->start_lsn) <= 0);
}
++srv_buf_pool_write_requests;
@@ -99,7 +99,7 @@ buf_flush_recv_note_modification(
buf_flush_insert_sorted_into_flush_list(block);
} else {
ut_ad(ut_dulint_cmp(block->oldest_modification,
- start_lsn) <= 0);
+ start_lsn) <= 0);
}
mutex_exit(&(buf_pool->mutex));
diff --git a/storage/innobase/include/buf0rea.h b/storage/innobase/include/buf0rea.h
index 380a42f4b80..e4620172860 100644
--- a/storage/innobase/include/buf0rea.h
+++ b/storage/innobase/include/buf0rea.h
@@ -94,7 +94,8 @@ buf_read_recv_pages(
/* The size in pages of the area which the read-ahead algorithms read if
invoked */
-#define BUF_READ_AHEAD_AREA ut_min(64, ut_2_power_up(buf_pool->curr_size / 32))
+#define BUF_READ_AHEAD_AREA \
+ ut_min(64, ut_2_power_up(buf_pool->curr_size / 32))
/* Modes used in read-ahead */
#define BUF_READ_IBUF_PAGES_ONLY 131
diff --git a/storage/innobase/include/data0data.h b/storage/innobase/include/data0data.h
index 8e906fcb2e5..40592c3c0ce 100644
--- a/storage/innobase/include/data0data.h
+++ b/storage/innobase/include/data0data.h
@@ -320,14 +320,6 @@ void
dfield_print_also_hex(
/*==================*/
dfield_t* dfield); /* in: dfield */
-/*****************************************************************
-Print a dfield value using ut_print_buf. */
-
-void
-dfield_print_raw(
-/*=============*/
- FILE* f, /* in: output stream */
- dfield_t* dfield); /* in: dfield */
/**************************************************************
The following function prints the contents of a tuple. */
diff --git a/storage/innobase/include/data0data.ic b/storage/innobase/include/data0data.ic
index 6b07ade2934..77fce029851 100644
--- a/storage/innobase/include/data0data.ic
+++ b/storage/innobase/include/data0data.ic
@@ -52,7 +52,7 @@ dfield_get_data(
{
ut_ad(field);
ut_ad((field->len == UNIV_SQL_NULL)
- || (field->data != &data_error));
+ || (field->data != &data_error));
return(field->data);
}
@@ -69,7 +69,7 @@ dfield_get_len(
{
ut_ad(field);
ut_ad((field->len == UNIV_SQL_NULL)
- || (field->data != &data_error));
+ || (field->data != &data_error));
return(field->len);
}
@@ -146,9 +146,9 @@ dfield_datas_are_binary_equal(
len = field1->len;
if ((len != field2->len)
- || ((len != UNIV_SQL_NULL)
- && (0 != ut_memcmp(field1->data, field2->data,
- len)))) {
+ || ((len != UNIV_SQL_NULL)
+ && (0 != ut_memcmp(field1->data, field2->data,
+ len)))) {
return(FALSE);
}
@@ -262,7 +262,7 @@ dtuple_create(
ut_ad(heap);
tuple = (dtuple_t*) mem_heap_alloc(heap, sizeof(dtuple_t)
- + n_fields * sizeof(dfield_t));
+ + n_fields * sizeof(dfield_t));
tuple->info_bits = 0;
tuple->n_fields = n_fields;
tuple->n_fields_cmp = n_fields;
@@ -426,7 +426,7 @@ dtuple_contains_null(
for (i = 0; i < n; i++) {
if (dfield_get_len(dtuple_get_nth_field(tuple, i))
- == UNIV_SQL_NULL) {
+ == UNIV_SQL_NULL) {
return(TRUE);
}
diff --git a/storage/innobase/include/data0type.ic b/storage/innobase/include/data0type.ic
index aabf471a70c..d2027592c09 100644
--- a/storage/innobase/include/data0type.ic
+++ b/storage/innobase/include/data0type.ic
@@ -59,12 +59,12 @@ dtype_set_mblen(
if (dtype_is_string_type(type->mtype)) {
#ifndef UNIV_HOTBACKUP
innobase_get_cset_width(dtype_get_charset_coll(type->prtype),
- &type->mbminlen, &type->mbmaxlen);
+ &type->mbminlen, &type->mbmaxlen);
ut_ad(type->mbminlen <= type->mbmaxlen);
#else /* !UNIV_HOTBACKUP */
#ifdef notdefined
-printf("ibbackup: DEBUG: type->mtype=%lu, type->prtype=%lu\n",
- type->mtype, type->prtype);
+ printf("ibbackup: DEBUG: type->mtype=%lu, type->prtype=%lu\n",
+ type->mtype, type->prtype);
#endif
ut_a(type->mtype <= DATA_BINARY);
#ifdef notdefined
@@ -208,7 +208,7 @@ dtype_get_pad_char(
case DATA_FIXBINARY:
case DATA_BINARY:
if (UNIV_UNLIKELY(dtype_get_charset_coll(type->prtype)
- == DATA_MYSQL_BINARY_CHARSET_COLL)) {
+ == DATA_MYSQL_BINARY_CHARSET_COLL)) {
/* Starting from 5.0.18, do not pad
VARBINARY or BINARY columns. */
return(ULINT_UNDEFINED);
@@ -257,8 +257,8 @@ dtype_new_store_for_order_and_null_size(
}
/* In versions < 4.1.2 we had: if (type->prtype & DATA_NONLATIN1) {
- buf[0] = buf[0] | 64;
- }
+ buf[0] = buf[0] | 64;
+ }
*/
buf[1] = (byte)(type->prtype & 0xFFUL);
@@ -296,7 +296,7 @@ dtype_read_for_order_and_null_size(
type->len = mach_read_from_2(buf + 2);
type->prtype = dtype_form_prtype(type->prtype,
- data_mysql_default_charset_coll);
+ data_mysql_default_charset_coll);
dtype_set_mblen(type);
}
@@ -368,80 +368,81 @@ dtype_get_fixed_size(
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;
- }
+ 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_FIXBINARY:
case DATA_INT:
case DATA_FLOAT:
case DATA_DOUBLE:
- return(dtype_get_len(type));
+ return(dtype_get_len(type));
case DATA_MYSQL:
- if (type->prtype & DATA_BINARY_TYPE) {
- return(dtype_get_len(type));
- } else {
+ if (type->prtype & DATA_BINARY_TYPE) {
+ return(dtype_get_len(type));
+ } else {
#ifdef UNIV_HOTBACKUP
- if (type->mbminlen == type->mbmaxlen) {
- return(dtype_get_len(type));
- }
+ if (type->mbminlen == type->mbmaxlen) {
+ return(dtype_get_len(type));
+ }
#else /* UNIV_HOTBACKUP */
- /* We play it safe here and ask MySQL for
- mbminlen and mbmaxlen. Although
- type->mbminlen and type->mbmaxlen are
- initialized if and only if type->prtype
- is (in one of the 3 functions in this file),
- it could be that none of these functions
- has been called. */
-
- ulint mbminlen, mbmaxlen;
-
- innobase_get_cset_width(
- dtype_get_charset_coll(type->prtype),
- &mbminlen, &mbmaxlen);
-
- if (UNIV_UNLIKELY(type->mbminlen != mbminlen)
- || UNIV_UNLIKELY(type->mbmaxlen != mbmaxlen)) {
-
- ut_print_timestamp(stderr);
- fprintf(stderr, " InnoDB: "
- "mbminlen=%lu, "
- "mbmaxlen=%lu, "
- "type->mbminlen=%lu, "
- "type->mbmaxlen=%lu\n",
- (ulong) mbminlen,
- (ulong) mbmaxlen,
- (ulong) type->mbminlen,
- (ulong) type->mbmaxlen);
- }
- if (mbminlen == mbmaxlen) {
- return(dtype_get_len(type));
- }
-#endif /* !UNIV_HOTBACKUP */
+ /* We play it safe here and ask MySQL for
+ mbminlen and mbmaxlen. Although
+ type->mbminlen and type->mbmaxlen are
+ initialized if and only if type->prtype
+ is (in one of the 3 functions in this file),
+ it could be that none of these functions
+ has been called. */
+
+ ulint mbminlen, mbmaxlen;
+
+ innobase_get_cset_width
+ (dtype_get_charset_coll(type->prtype),
+ &mbminlen, &mbmaxlen);
+
+ if (UNIV_UNLIKELY(type->mbminlen != mbminlen)
+ || UNIV_UNLIKELY(type->mbmaxlen != mbmaxlen)) {
+
+ ut_print_timestamp(stderr);
+ fprintf(stderr, " InnoDB: "
+ "mbminlen=%lu, "
+ "mbmaxlen=%lu, "
+ "type->mbminlen=%lu, "
+ "type->mbmaxlen=%lu\n",
+ (ulong) mbminlen,
+ (ulong) mbmaxlen,
+ (ulong) type->mbminlen,
+ (ulong) type->mbmaxlen);
}
- /* fall through for variable-length charsets */
+ if (mbminlen == mbmaxlen) {
+ return(dtype_get_len(type));
+ }
+#endif /* !UNIV_HOTBACKUP */
+ }
+ /* fall through for variable-length charsets */
case DATA_VARCHAR:
case DATA_BINARY:
case DATA_DECIMAL:
case DATA_VARMYSQL:
case DATA_BLOB:
- return(0);
- default: ut_error;
+ return(0);
+ default:
+ ut_error;
}
return(0);
@@ -459,46 +460,46 @@ dtype_get_min_size(
switch (type->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;
- }
+ 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_FIXBINARY:
case DATA_INT:
case DATA_FLOAT:
case DATA_DOUBLE:
- return(type->len);
+ return(type->len);
case DATA_MYSQL:
- if ((type->prtype & DATA_BINARY_TYPE)
- || type->mbminlen == type->mbmaxlen) {
- return(type->len);
- }
- /* this is a variable-length character set */
- ut_a(type->mbminlen > 0);
- ut_a(type->mbmaxlen > type->mbminlen);
- ut_a(type->len % type->mbmaxlen == 0);
- return(type->len * type->mbminlen / type->mbmaxlen);
+ if ((type->prtype & DATA_BINARY_TYPE)
+ || type->mbminlen == type->mbmaxlen) {
+ return(type->len);
+ }
+ /* this is a variable-length character set */
+ ut_a(type->mbminlen > 0);
+ ut_a(type->mbmaxlen > type->mbminlen);
+ ut_a(type->len % type->mbmaxlen == 0);
+ return(type->len * type->mbminlen / type->mbmaxlen);
case DATA_VARCHAR:
case DATA_BINARY:
case DATA_DECIMAL:
case DATA_VARMYSQL:
case DATA_BLOB:
- return(0);
+ return(0);
default: ut_error;
}
diff --git a/storage/innobase/include/dict0boot.h b/storage/innobase/include/dict0boot.h
index 39e3bdf72b0..41ce0ac059a 100644
--- a/storage/innobase/include/dict0boot.h
+++ b/storage/innobase/include/dict0boot.h
@@ -108,7 +108,8 @@ dict_create(void);
#define DICT_HDR_TABLE_IDS 36 /* Root of the table index tree */
#define DICT_HDR_COLUMNS 40 /* Root of the column index tree */
#define DICT_HDR_INDEXES 44 /* Root of the index index tree */
-#define DICT_HDR_FIELDS 48 /* Root of the index field index tree */
+#define DICT_HDR_FIELDS 48 /* Root of the index field
+ index tree */
#define DICT_HDR_FSEG_HEADER 56 /* Segment header for the tablespace
segment into which the dictionary
diff --git a/storage/innobase/include/dict0dict.ic b/storage/innobase/include/dict0dict.ic
index c65fdde81e9..de00148535f 100644
--- a/storage/innobase/include/dict0dict.ic
+++ b/storage/innobase/include/dict0dict.ic
@@ -163,7 +163,7 @@ dict_table_get_sys_col(
ut_ad(table->magic_n == DICT_TABLE_MAGIC_N);
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.prtype == (sys | DATA_NOT_NULL));
@@ -324,8 +324,8 @@ dict_index_get_sys_col_pos(
return(col->clust_pos);
}
- return(dict_index_get_nth_col_pos(index,
- dict_table_get_sys_col_no(index->table, type)));
+ return(dict_index_get_nth_col_pos
+ (index, dict_table_get_sys_col_no(index->table, type)));
}
/*************************************************************************
@@ -366,8 +366,8 @@ dict_index_get_nth_type(
dict_index_t* index, /* in: index */
ulint pos) /* in: position of the field */
{
- return(dict_col_get_type(dict_field_get_col(
- dict_index_get_nth_field(index, pos))));
+ return(dict_col_get_type(dict_field_get_col
+ (dict_index_get_nth_field(index, pos))));
}
/************************************************************************
@@ -380,8 +380,8 @@ dict_index_get_nth_col_no(
dict_index_t* index, /* in: index */
ulint pos) /* in: position of the field */
{
- return(dict_col_get_no(dict_field_get_col(
- dict_index_get_nth_field(index, pos))));
+ return(dict_col_get_no(dict_field_get_col
+ (dict_index_get_nth_field(index, pos))));
}
/*************************************************************************
@@ -514,7 +514,7 @@ dict_table_check_if_in_cache_low(
table_fold = ut_fold_string(table_name);
HASH_SEARCH(name_hash, dict_sys->table_hash, table_fold, table,
- ut_strcmp(table->name, table_name) == 0);
+ ut_strcmp(table->name, table_name) == 0);
return(table);
}
@@ -564,7 +564,7 @@ dict_table_get_on_id_low(
fold = ut_fold_dulint(table_id);
HASH_SEARCH(id_hash, dict_sys->table_id_hash, fold, table,
- ut_dulint_cmp(table->id, table_id) == 0);
+ ut_dulint_cmp(table->id, table_id) == 0);
if (table == NULL) {
table = dict_load_table_on_id(table_id);
}
diff --git a/storage/innobase/include/dict0mem.h b/storage/innobase/include/dict0mem.h
index 427991180f6..e8682b79387 100644
--- a/storage/innobase/include/dict0mem.h
+++ b/storage/innobase/include/dict0mem.h
@@ -132,8 +132,6 @@ struct dict_col_struct{
const char* name; /* name */
dtype_t type; /* data type */
dict_table_t* table; /* back pointer to table of this column */
- ulint aux; /* this is used as an auxiliary variable
- in some of the functions below */
};
/* DICT_MAX_INDEX_COL_LEN is measured in bytes and is the max index column
diff --git a/storage/innobase/include/eval0eval.ic b/storage/innobase/include/eval0eval.ic
index 26e9b8e41fe..caffa2e0bfd 100644
--- a/storage/innobase/include/eval0eval.ic
+++ b/storage/innobase/include/eval0eval.ic
@@ -79,7 +79,7 @@ eval_sym(
column */
dfield_copy_data(que_node_get_val(sym_node),
- que_node_get_val(sym_node->indirection));
+ que_node_get_val(sym_node->indirection));
}
}
@@ -230,5 +230,5 @@ eval_node_copy_val(
dfield2 = que_node_get_val(node2);
eval_node_copy_and_alloc_val(node1, dfield_get_data(dfield2),
- dfield_get_len(dfield2));
+ dfield_get_len(dfield2));
}
diff --git a/storage/innobase/include/fut0lst.ic b/storage/innobase/include/fut0lst.ic
index 4681a1ce509..6c7e863b078 100644
--- a/storage/innobase/include/fut0lst.ic
+++ b/storage/innobase/include/fut0lst.ic
@@ -38,11 +38,11 @@ flst_write_addr(
{
ut_ad(faddr && mtr);
ut_ad(mtr_memo_contains(mtr, buf_block_align(faddr),
- MTR_MEMO_PAGE_X_FIX));
+ MTR_MEMO_PAGE_X_FIX));
mlog_write_ulint(faddr + FIL_ADDR_PAGE, addr.page, MLOG_4BYTES, mtr);
mlog_write_ulint(faddr + FIL_ADDR_BYTE, addr.boffset,
- MLOG_2BYTES, mtr);
+ MLOG_2BYTES, mtr);
}
/************************************************************************
@@ -61,7 +61,7 @@ flst_read_addr(
addr.page = mtr_read_ulint(faddr + FIL_ADDR_PAGE, MLOG_4BYTES, mtr);
addr.boffset = mtr_read_ulint(faddr + FIL_ADDR_BYTE, MLOG_2BYTES,
- mtr);
+ mtr);
return(addr);
}
@@ -75,7 +75,7 @@ flst_init(
mtr_t* mtr) /* in: mini-transaction handle */
{
ut_ad(mtr_memo_contains(mtr, buf_block_align(base),
- MTR_MEMO_PAGE_X_FIX));
+ MTR_MEMO_PAGE_X_FIX));
mlog_write_ulint(base + FLST_LEN, 0, MLOG_4BYTES, mtr);
flst_write_addr(base + FLST_FIRST, fil_addr_null, mtr);
flst_write_addr(base + FLST_LAST, fil_addr_null, mtr);
diff --git a/storage/innobase/include/ibuf0ibuf.ic b/storage/innobase/include/ibuf0ibuf.ic
index 7e75fccc160..4c5f6dbf5e1 100644
--- a/storage/innobase/include/ibuf0ibuf.ic
+++ b/storage/innobase/include/ibuf0ibuf.ic
@@ -80,7 +80,7 @@ ibuf_should_try(
decide */
{
if (!(index->type & DICT_CLUSTERED)
- && (ignore_sec_unique || !(index->type & DICT_UNIQUE))) {
+ && (ignore_sec_unique || !(index->type & DICT_UNIQUE))) {
ibuf_flush_count++;
@@ -165,8 +165,8 @@ ibuf_index_page_calc_free(
/* out: value for ibuf bitmap bits */
page_t* page) /* in: non-unique secondary index page */
{
- return(ibuf_index_page_calc_free_bits(
- page_get_max_insert_size_after_reorganize(page, 1)));
+ return(ibuf_index_page_calc_free_bits
+ (page_get_max_insert_size_after_reorganize(page, 1)));
}
/****************************************************************************
@@ -201,7 +201,7 @@ ibuf_update_free_bits_if_full(
# error "ULINT32_UNDEFINED <= UNIV_PAGE_SIZE"
#endif
after = ibuf_index_page_calc_free_bits(max_ins_size
- - increase);
+ - increase);
#ifdef UNIV_IBUF_DEBUG
ut_a(after <= ibuf_index_page_calc_free(page));
#endif
diff --git a/storage/innobase/include/lock0lock.ic b/storage/innobase/include/lock0lock.ic
index c7a71bb45d8..feec460bec8 100644
--- a/storage/innobase/include/lock0lock.ic
+++ b/storage/innobase/include/lock0lock.ic
@@ -47,7 +47,7 @@ lock_rec_hash(
ulint page_no)/* in: page number */
{
return(hash_calc_hash(lock_rec_fold(space, page_no),
- lock_sys->rec_hash));
+ lock_sys->rec_hash));
}
/*************************************************************************
diff --git a/storage/innobase/include/log0log.ic b/storage/innobase/include/log0log.ic
index 898a8f3b6e3..06deff196bc 100644
--- a/storage/innobase/include/log0log.ic
+++ b/storage/innobase/include/log0log.ic
@@ -33,7 +33,7 @@ log_block_get_flush_bit(
byte* log_block) /* in: log block */
{
if (LOG_BLOCK_FLUSH_BIT_MASK
- & mach_read_from_4(log_block + LOG_BLOCK_HDR_NO)) {
+ & mach_read_from_4(log_block + LOG_BLOCK_HDR_NO)) {
return(TRUE);
}
@@ -74,7 +74,7 @@ log_block_get_hdr_no(
byte* log_block) /* in: log block */
{
return(~LOG_BLOCK_FLUSH_BIT_MASK
- & mach_read_from_4(log_block + LOG_BLOCK_HDR_NO));
+ & mach_read_from_4(log_block + LOG_BLOCK_HDR_NO));
}
/****************************************************************
@@ -166,7 +166,7 @@ log_block_set_checkpoint_no(
dulint no) /* in: checkpoint no */
{
mach_write_to_4(log_block + LOG_BLOCK_CHECKPOINT_NO,
- ut_dulint_get_low(no));
+ ut_dulint_get_low(no));
}
/****************************************************************
@@ -227,7 +227,7 @@ log_block_get_checksum(
byte* log_block) /* in: log block */
{
return(mach_read_from_4(log_block + OS_FILE_LOG_BLOCK_SIZE
- - LOG_BLOCK_CHECKSUM));
+ - LOG_BLOCK_CHECKSUM));
}
/****************************************************************
@@ -240,8 +240,8 @@ log_block_set_checksum(
ulint checksum) /* in: checksum */
{
mach_write_to_4(log_block + OS_FILE_LOG_BLOCK_SIZE
- - LOG_BLOCK_CHECKSUM,
- checksum);
+ - LOG_BLOCK_CHECKSUM,
+ checksum);
}
/****************************************************************
@@ -287,7 +287,7 @@ log_block_init_in_old_format(
log_block_set_hdr_no(log_block, no);
mach_write_to_4(log_block + OS_FILE_LOG_BLOCK_SIZE
- - LOG_BLOCK_CHECKSUM, no);
+ - LOG_BLOCK_CHECKSUM, no);
log_block_set_data_len(log_block, LOG_BLOCK_HDR_SIZE);
log_block_set_first_rec_group(log_block, 0);
}
@@ -333,8 +333,8 @@ log_reserve_and_write_fast(
ut_memcpy(log->buf + log->buf_free, str, len);
log_block_set_data_len(ut_align_down(log->buf + log->buf_free,
- OS_FILE_LOG_BLOCK_SIZE),
- data_len);
+ OS_FILE_LOG_BLOCK_SIZE),
+ data_len);
#ifdef UNIV_LOG_DEBUG
log->old_buf_free = log->buf_free;
log->old_lsn = log->lsn;
@@ -349,7 +349,7 @@ log_reserve_and_write_fast(
#ifdef UNIV_LOG_DEBUG
log_check_log_recs(log->buf + log->old_buf_free,
- log->buf_free - log->old_buf_free, log->old_lsn);
+ log->buf_free - log->old_buf_free, log->old_lsn);
#endif
return(lsn);
}
diff --git a/storage/innobase/include/log0recv.h b/storage/innobase/include/log0recv.h
index 7bdf8bf6100..091bbe34562 100644
--- a/storage/innobase/include/log0recv.h
+++ b/storage/innobase/include/log0recv.h
@@ -214,27 +214,6 @@ void
recv_recovery_from_archive_finish(void);
/*===================================*/
#endif /* UNIV_LOG_ARCHIVE */
-/***********************************************************************
-Checks that a replica of a space is identical to the original space. */
-
-void
-recv_compare_spaces(
-/*================*/
- ulint space1, /* in: space id */
- ulint space2, /* in: space id */
- ulint n_pages);/* in: number of pages */
-/***********************************************************************
-Checks that a replica of a space is identical to the original space. Disables
-ibuf operations and flushes and invalidates the buffer pool pages after the
-test. This function can be used to check the recovery before dict or trx
-systems are initialized. */
-
-void
-recv_compare_spaces_low(
-/*====================*/
- ulint space1, /* in: space id */
- ulint space2, /* in: space id */
- ulint n_pages);/* in: number of pages */
/* Block of log record data */
typedef struct recv_data_struct recv_data_t;
@@ -361,11 +340,6 @@ roll-forward */
#define RECV_BEING_PROCESSED 73
#define RECV_PROCESSED 74
-/* The number which is added to a space id to obtain the replicate space
-in the debug version: spaces with an odd number as the id are replicate
-spaces */
-#define RECV_REPLICA_SPACE_ADD 1
-
extern ulint recv_n_pool_free_frames;
#ifndef UNIV_NONINL
diff --git a/storage/innobase/include/mach0data.ic b/storage/innobase/include/mach0data.ic
index 2199565aff4..03ece7529a8 100644
--- a/storage/innobase/include/mach0data.ic
+++ b/storage/innobase/include/mach0data.ic
@@ -65,7 +65,7 @@ mach_read_from_2(
ut_ad(b);
return( ((ulint)(b[0]) << 8)
+ (ulint)(b[1])
- );
+ );
}
/************************************************************
@@ -131,7 +131,7 @@ mach_read_from_3(
return( ((ulint)(b[0]) << 16)
+ ((ulint)(b[1]) << 8)
+ (ulint)(b[2])
- );
+ );
}
/***********************************************************
@@ -146,22 +146,10 @@ mach_write_to_4(
{
ut_ad(b);
-#if (0 == 1) && !defined(__STDC__) && defined(UNIV_INTEL) && (UNIV_WORD_SIZE == 4) && defined(UNIV_VISUALC)
-
- /* We do not use this even on Intel, because unaligned accesses may
- be slow */
-
- __asm MOV EAX, n
- __asm BSWAP EAX /* Intel is little-endian, must swap bytes */
- __asm MOV n, EAX
-
- *((ulint*)b) = n;
-#else
b[0] = (byte)(n >> 24);
b[1] = (byte)(n >> 16);
b[2] = (byte)(n >> 8);
b[3] = (byte)n;
-#endif
}
/************************************************************
@@ -174,28 +162,12 @@ mach_read_from_4(
/* out: ulint integer */
byte* b) /* in: pointer to four bytes */
{
-#if (0 == 1) && !defined(__STDC__) && defined(UNIV_INTEL) && (UNIV_WORD_SIZE == 4) && defined(UNIV_VISUALC)
- /* We do not use this even on Intel, because unaligned accesses may
- be slow */
-
- ulint res;
-
- ut_ad(b);
-
- __asm MOV EDX, b
- __asm MOV ECX, DWORD PTR [EDX]
- __asm BSWAP ECX /* Intel is little-endian, must swap bytes */
- __asm MOV res, ECX
-
- return(res);
-#else
ut_ad(b);
return( ((ulint)(b[0]) << 24)
+ ((ulint)(b[1]) << 16)
+ ((ulint)(b[2]) << 8)
+ (ulint)(b[3])
- );
-#endif
+ );
}
/*************************************************************
@@ -492,7 +464,7 @@ mach_dulint_get_much_compressed_size(
}
return(1 + mach_get_compressed_size(ut_dulint_get_high(n))
- + mach_get_compressed_size(ut_dulint_get_low(n)));
+ + mach_get_compressed_size(ut_dulint_get_low(n)));
}
/*************************************************************
diff --git a/storage/innobase/include/mem0mem.ic b/storage/innobase/include/mem0mem.ic
index db0ab7aba8c..069f8de36cb 100644
--- a/storage/innobase/include/mem0mem.ic
+++ b/storage/innobase/include/mem0mem.ic
@@ -77,7 +77,7 @@ void
mem_block_set_type(mem_block_t* block, ulint type)
{
ut_ad((type == MEM_HEAP_DYNAMIC) || (type == MEM_HEAP_BUFFER)
- || (type == MEM_HEAP_BUFFER + MEM_HEAP_BTR_SEARCH));
+ || (type == MEM_HEAP_BUFFER + MEM_HEAP_BTR_SEARCH));
block->type = type;
}
@@ -150,7 +150,7 @@ mem_heap_alloc(
block to the heap */
if (mem_block_get_len(block)
- < mem_block_get_free(block) + MEM_SPACE_NEEDED(n)) {
+ < mem_block_get_free(block) + MEM_SPACE_NEEDED(n)) {
block = mem_heap_add_block(heap, n);
@@ -228,12 +228,12 @@ mem_heap_free_heap_top(
/* Validate the heap and get its total allocated size */
mem_heap_validate_or_print(heap, NULL, FALSE, &error, &total_size,
- NULL, NULL);
+ NULL, NULL);
ut_a(!error);
/* Get the size below top pointer */
mem_heap_validate_or_print(heap, old_top, FALSE, &error, &size, NULL,
- NULL);
+ NULL);
ut_a(!error);
#endif
@@ -242,7 +242,7 @@ mem_heap_free_heap_top(
while (block != NULL) {
if (((byte*)block + mem_block_get_free(block) >= old_top)
- && ((byte*)block <= old_top)) {
+ && ((byte*)block <= old_top)) {
/* Found the right block */
break;
@@ -280,8 +280,8 @@ mem_heap_free_heap_top(
/* If free == start, we may free the block if it is not the first
one */
- if ((heap != block) && (mem_block_get_free(block) ==
- mem_block_get_start(block))) {
+ if ((heap != block) && (mem_block_get_free(block)
+ == mem_block_get_start(block))) {
mem_heap_block_free(heap, block);
}
}
@@ -354,7 +354,7 @@ mem_heap_free_top(
/* Subtract the free field of block */
mem_block_set_free(block, mem_block_get_free(block)
- - MEM_SPACE_NEEDED(n));
+ - MEM_SPACE_NEEDED(n));
#ifdef UNIV_MEM_DEBUG
ut_ad(mem_block_get_start(block) <= mem_block_get_free(block));
@@ -366,8 +366,8 @@ mem_heap_free_top(
/* If free == start, we may free the block if it is not the first
one */
- if ((heap != block) && (mem_block_get_free(block) ==
- mem_block_get_start(block))) {
+ if ((heap != block) && (mem_block_get_free(block)
+ == mem_block_get_start(block))) {
mem_heap_block_free(heap, block);
}
}
@@ -407,10 +407,11 @@ mem_heap_create_func(
if (n > 0) {
block = mem_heap_create_block(NULL, n, init_block, type,
- file_name, line);
+ file_name, line);
} else {
block = mem_heap_create_block(NULL, MEM_BLOCK_START_SIZE,
- init_block, type, file_name, line);
+ init_block, type,
+ file_name, line);
}
if (block == NULL) {
@@ -496,7 +497,7 @@ mem_alloc_func(
void* buf;
heap = mem_heap_create_func(n, NULL, MEM_HEAP_DYNAMIC, file_name,
- line);
+ line);
/* Note that as we created the first block in the heap big enough
for the buffer requested by the caller, the buffer will be in the
@@ -506,7 +507,7 @@ mem_alloc_func(
buf = mem_heap_alloc(heap, n);
ut_a((byte*)heap == (byte*)buf - MEM_BLOCK_HEADER_SIZE
- - MEM_FIELD_HEADER_SIZE);
+ - MEM_FIELD_HEADER_SIZE);
return(buf);
}
@@ -526,7 +527,7 @@ mem_free_func(
mem_heap_t* heap;
heap = (mem_heap_t*)((byte*)ptr - MEM_BLOCK_HEADER_SIZE
- - MEM_FIELD_HEADER_SIZE);
+ - MEM_FIELD_HEADER_SIZE);
mem_heap_free_func(heap, file_name, line);
}
diff --git a/storage/innobase/include/mtr0log.ic b/storage/innobase/include/mtr0log.ic
index 1a5ef033f87..5b1d1ed34d9 100644
--- a/storage/innobase/include/mtr0log.ic
+++ b/storage/innobase/include/mtr0log.ic
@@ -165,7 +165,7 @@ mlog_write_initial_log_record_fast(
ulint offset;
ut_ad(mtr_memo_contains(mtr, buf_block_align(ptr),
- MTR_MEMO_PAGE_X_FIX));
+ MTR_MEMO_PAGE_X_FIX));
ut_ad(type <= MLOG_BIGGEST_TYPE);
ut_ad(ptr && log_ptr);
@@ -182,9 +182,9 @@ mlog_write_initial_log_record_fast(
mtr->n_log_recs++;
#ifdef UNIV_LOG_DEBUG
-/* fprintf(stderr,
- "Adding to mtr log record type %lu space %lu page no %lu\n",
- type, space, offset); */
+ /* fprintf(stderr,
+ "Adding to mtr log record type %lu space %lu page no %lu\n",
+ type, space, offset); */
#endif
#ifdef UNIV_DEBUG
diff --git a/storage/innobase/include/mtr0mtr.h b/storage/innobase/include/mtr0mtr.h
index 3167ea3bc03..9e8250cb545 100644
--- a/storage/innobase/include/mtr0mtr.h
+++ b/storage/innobase/include/mtr0mtr.h
@@ -70,7 +70,8 @@ flag value must give the length also! */
#define MLOG_PAGE_CREATE ((byte)19) /* create an index page */
#define MLOG_UNDO_INSERT ((byte)20) /* insert entry in an undo
log */
-#define MLOG_UNDO_ERASE_END ((byte)21) /* erase an undo log page end */
+#define MLOG_UNDO_ERASE_END ((byte)21) /* erase an undo log
+ page end */
#define MLOG_UNDO_INIT ((byte)22) /* initialize a page in an
undo log */
#define MLOG_UNDO_HDR_DISCARD ((byte)23) /* discard an update undo log
diff --git a/storage/innobase/include/os0file.h b/storage/innobase/include/os0file.h
index 4ab7fda7358..5ffcdf7e58c 100644
--- a/storage/innobase/include/os0file.h
+++ b/storage/innobase/include/os0file.h
@@ -723,8 +723,10 @@ This function returns information about the specified file */
ibool
os_file_get_status(
/*===============*/
- /* out: TRUE if stat information found */
+ /* out: TRUE if stat
+ information found */
const char* path, /* in: pathname of the file */
- os_file_stat_t* stat_info); /* information of a file in a directory */
+ os_file_stat_t* stat_info); /* information of a file in a
+ directory */
#endif
diff --git a/storage/innobase/include/page0cur.ic b/storage/innobase/include/page0cur.ic
index 243550c055f..b747874abc2 100644
--- a/storage/innobase/include/page0cur.ic
+++ b/storage/innobase/include/page0cur.ic
@@ -162,11 +162,11 @@ page_cur_search(
ut_ad(dtuple_check_typed(tuple));
page_cur_search_with_match(page, index, tuple, mode,
- &up_matched_fields,
- &up_matched_bytes,
- &low_matched_fields,
- &low_matched_bytes,
- cursor);
+ &up_matched_fields,
+ &up_matched_bytes,
+ &low_matched_fields,
+ &low_matched_bytes,
+ cursor);
return(low_matched_fields);
}
@@ -205,6 +205,6 @@ page_cur_rec_insert(
mtr_t* mtr) /* in: mini-transaction handle */
{
return(page_cur_insert_rec_low(cursor, NULL, index, rec,
- offsets, mtr));
+ offsets, mtr));
}
diff --git a/storage/innobase/include/page0page.ic b/storage/innobase/include/page0page.ic
index b33eeaceb1c..9348acd5ffc 100644
--- a/storage/innobase/include/page0page.ic
+++ b/storage/innobase/include/page0page.ic
@@ -93,8 +93,8 @@ page_header_get_ptr(
ut_ad(page);
ut_ad((field == PAGE_FREE)
- || (field == PAGE_LAST_INSERT)
- || (field == PAGE_HEAP_TOP));
+ || (field == PAGE_LAST_INSERT)
+ || (field == PAGE_HEAP_TOP));
offs = page_header_get_field(page, field);
@@ -122,8 +122,8 @@ page_header_set_ptr(
ut_ad(page);
ut_ad((field == PAGE_FREE)
- || (field == PAGE_LAST_INSERT)
- || (field == PAGE_HEAP_TOP));
+ || (field == PAGE_LAST_INSERT)
+ || (field == PAGE_HEAP_TOP));
if (ptr == NULL) {
offs = 0;
@@ -149,7 +149,7 @@ page_header_reset_last_insert(
ut_ad(page && mtr);
mlog_write_ulint(page + PAGE_HEADER + PAGE_LAST_INSERT, 0,
- MLOG_2BYTES, mtr);
+ MLOG_2BYTES, mtr);
}
/****************************************************************
@@ -163,7 +163,7 @@ page_is_comp(
page_t* page) /* in: index page */
{
return(UNIV_EXPECT(page_header_get_field(page, PAGE_N_HEAP) & 0x8000,
- 0x8000));
+ 0x8000));
}
/****************************************************************
@@ -245,9 +245,9 @@ page_rec_is_user_rec_low(
ut_ad(offset <= UNIV_PAGE_SIZE - PAGE_EMPTY_DIR_START);
return(UNIV_LIKELY(offset != PAGE_NEW_SUPREMUM)
- && UNIV_LIKELY(offset != PAGE_NEW_INFIMUM)
- && UNIV_LIKELY(offset != PAGE_OLD_INFIMUM)
- && UNIV_LIKELY(offset != PAGE_OLD_SUPREMUM));
+ && UNIV_LIKELY(offset != PAGE_NEW_INFIMUM)
+ && UNIV_LIKELY(offset != PAGE_OLD_INFIMUM)
+ && UNIV_LIKELY(offset != PAGE_OLD_SUPREMUM));
}
/****************************************************************
@@ -263,7 +263,7 @@ page_rec_is_supremum_low(
ut_ad(offset <= UNIV_PAGE_SIZE - PAGE_EMPTY_DIR_START);
return(UNIV_UNLIKELY(offset == PAGE_NEW_SUPREMUM)
- || UNIV_UNLIKELY(offset == PAGE_OLD_SUPREMUM));
+ || UNIV_UNLIKELY(offset == PAGE_OLD_SUPREMUM));
}
/****************************************************************
@@ -279,7 +279,7 @@ page_rec_is_infimum_low(
ut_ad(offset <= UNIV_PAGE_SIZE - PAGE_EMPTY_DIR_START);
return(UNIV_UNLIKELY(offset == PAGE_NEW_INFIMUM)
- || UNIV_UNLIKELY(offset == PAGE_OLD_INFIMUM));
+ || UNIV_UNLIKELY(offset == PAGE_OLD_INFIMUM));
}
/****************************************************************
@@ -291,8 +291,7 @@ page_rec_is_user_rec(
/* out: TRUE if a user record */
const rec_t* rec) /* in: record */
{
- return(page_rec_is_user_rec_low(
- ut_align_offset(rec, UNIV_PAGE_SIZE)));
+ return(page_rec_is_user_rec_low(ut_align_offset(rec, UNIV_PAGE_SIZE)));
}
/****************************************************************
@@ -304,8 +303,7 @@ page_rec_is_supremum(
/* out: TRUE if the supremum record */
const rec_t* rec) /* in: record */
{
- return(page_rec_is_supremum_low(
- ut_align_offset(rec, UNIV_PAGE_SIZE)));
+ return(page_rec_is_supremum_low(ut_align_offset(rec, UNIV_PAGE_SIZE)));
}
/****************************************************************
@@ -317,8 +315,7 @@ page_rec_is_infimum(
/* out: TRUE if the infimum record */
const rec_t* rec) /* in: record */
{
- return(page_rec_is_infimum_low(
- ut_align_offset(rec, UNIV_PAGE_SIZE)));
+ return(page_rec_is_infimum_low(ut_align_offset(rec, UNIV_PAGE_SIZE)));
}
/*****************************************************************
@@ -357,17 +354,17 @@ page_cmp_dtuple_rec_with_match(
rec_offset = ut_align_offset(rec, UNIV_PAGE_SIZE);
if (UNIV_UNLIKELY(rec_offset == PAGE_NEW_INFIMUM)
- || UNIV_UNLIKELY(rec_offset == PAGE_OLD_INFIMUM)) {
+ || UNIV_UNLIKELY(rec_offset == PAGE_OLD_INFIMUM)) {
return(1);
}
if (UNIV_UNLIKELY(rec_offset == PAGE_NEW_SUPREMUM)
- || UNIV_UNLIKELY(rec_offset == PAGE_OLD_SUPREMUM)) {
+ || UNIV_UNLIKELY(rec_offset == PAGE_OLD_SUPREMUM)) {
return(-1);
}
return(cmp_dtuple_rec_with_match(dtuple, rec, offsets,
- matched_fields,
- matched_bytes));
+ matched_fields,
+ matched_bytes));
}
/*****************************************************************
@@ -430,8 +427,9 @@ page_dir_set_n_heap(
{
ut_ad(n_heap < 0x8000);
- page_header_set_field(page, PAGE_N_HEAP, n_heap | (0x8000 &
- page_header_get_field(page, PAGE_N_HEAP)));
+ page_header_set_field(page, PAGE_N_HEAP, n_heap
+ | (0x8000
+ & page_header_get_field(page, PAGE_N_HEAP)));
}
/*****************************************************************
@@ -447,7 +445,7 @@ page_dir_get_nth_slot(
ut_ad(page_dir_get_n_slots(page) > n);
return(page + UNIV_PAGE_SIZE - PAGE_DIR
- - (n + 1) * PAGE_DIR_SLOT_SIZE);
+ - (n + 1) * PAGE_DIR_SLOT_SIZE);
}
/******************************************************************
@@ -535,7 +533,7 @@ page_dir_calc_reserved_space(
ulint n_recs) /* in: number of records */
{
return((PAGE_DIR_SLOT_SIZE * n_recs + PAGE_DIR_SLOT_MIN_N_OWNED - 1)
- / PAGE_DIR_SLOT_MIN_N_OWNED);
+ / PAGE_DIR_SLOT_MIN_N_OWNED);
}
/****************************************************************
@@ -558,13 +556,14 @@ page_rec_get_next(
if (UNIV_UNLIKELY(offs >= UNIV_PAGE_SIZE)) {
fprintf(stderr,
-"InnoDB: Next record offset is nonsensical %lu in record at offset %lu\n"
-"InnoDB: rec address %p, first buffer frame %p\n"
-"InnoDB: buffer pool high end %p, buf fix count %lu\n",
- (ulong)offs, (ulong)(rec - page),
- rec, buf_pool->frame_zero,
- buf_pool->high_end,
- (ulong)buf_block_align(rec)->buf_fix_count);
+ "InnoDB: Next record offset is nonsensical %lu"
+ " in record at offset %lu\n"
+ "InnoDB: rec address %p, first buffer frame %p\n"
+ "InnoDB: buffer pool high end %p, buf fix count %lu\n",
+ (ulong)offs, (ulong)(rec - page),
+ (void*) rec, (void*) buf_pool->frame_zero,
+ (void*) buf_pool->high_end,
+ (ulong) buf_block_align(rec)->buf_fix_count);
buf_page_print(page);
ut_error;
@@ -683,10 +682,10 @@ page_get_data_size(
ulint ret;
ret = (ulint)(page_header_get_field(page, PAGE_HEAP_TOP)
- - (page_is_comp(page)
- ? PAGE_NEW_SUPREMUM_END
- : PAGE_OLD_SUPREMUM_END)
- - page_header_get_field(page, PAGE_GARBAGE));
+ - (page_is_comp(page)
+ ? PAGE_NEW_SUPREMUM_END
+ : PAGE_OLD_SUPREMUM_END)
+ - page_header_get_field(page, PAGE_GARBAGE));
ut_ad(ret < UNIV_PAGE_SIZE);
@@ -704,15 +703,15 @@ page_get_free_space_of_empty(
{
if (UNIV_LIKELY(comp)) {
return((ulint)(UNIV_PAGE_SIZE
- - PAGE_NEW_SUPREMUM_END
- - PAGE_DIR
- - 2 * PAGE_DIR_SLOT_SIZE));
+ - PAGE_NEW_SUPREMUM_END
+ - PAGE_DIR
+ - 2 * PAGE_DIR_SLOT_SIZE));
}
return((ulint)(UNIV_PAGE_SIZE
- - PAGE_OLD_SUPREMUM_END
- - PAGE_DIR
- - 2 * PAGE_DIR_SLOT_SIZE));
+ - PAGE_OLD_SUPREMUM_END
+ - PAGE_DIR
+ - 2 * PAGE_DIR_SLOT_SIZE));
}
/****************************************************************
@@ -735,14 +734,16 @@ page_get_max_insert_size(
if (page_is_comp(page)) {
occupied = page_header_get_field(page, PAGE_HEAP_TOP)
- - PAGE_NEW_SUPREMUM_END + page_dir_calc_reserved_space(
- n_recs + page_dir_get_n_heap(page) - 2);
+ - PAGE_NEW_SUPREMUM_END
+ + page_dir_calc_reserved_space
+ (n_recs + page_dir_get_n_heap(page) - 2);
free_space = page_get_free_space_of_empty(TRUE);
} else {
occupied = page_header_get_field(page, PAGE_HEAP_TOP)
- - PAGE_OLD_SUPREMUM_END + page_dir_calc_reserved_space(
- n_recs + page_dir_get_n_heap(page) - 2);
+ - PAGE_OLD_SUPREMUM_END
+ + page_dir_calc_reserved_space
+ (n_recs + page_dir_get_n_heap(page) - 2);
free_space = page_get_free_space_of_empty(FALSE);
}
@@ -819,7 +820,7 @@ page_mem_free(
garbage = page_header_get_field(page, PAGE_GARBAGE);
page_header_set_field(page, PAGE_GARBAGE,
- garbage + rec_offs_size(offsets));
+ garbage + rec_offs_size(offsets));
}
#ifdef UNIV_MATERIALIZE
diff --git a/storage/innobase/include/que0que.ic b/storage/innobase/include/que0que.ic
index 70be4068147..a20108a7820 100644
--- a/storage/innobase/include/que0que.ic
+++ b/storage/innobase/include/que0que.ic
@@ -230,9 +230,9 @@ que_thr_peek_stop(
trx = graph->trx;
if (graph->state != QUE_FORK_ACTIVE
- || trx->que_state == TRX_QUE_LOCK_WAIT
- || (UT_LIST_GET_LEN(trx->signals) > 0
- && trx->que_state == TRX_QUE_RUNNING)) {
+ || trx->que_state == TRX_QUE_LOCK_WAIT
+ || (UT_LIST_GET_LEN(trx->signals) > 0
+ && trx->que_state == TRX_QUE_RUNNING)) {
return(TRUE);
}
@@ -250,7 +250,7 @@ que_graph_is_select(
que_t* graph) /* in: graph */
{
if (graph->fork_type == QUE_FORK_SELECT_SCROLL
- || graph->fork_type == QUE_FORK_SELECT_NON_SCROLL) {
+ || graph->fork_type == QUE_FORK_SELECT_NON_SCROLL) {
return(TRUE);
}
diff --git a/storage/innobase/include/read0read.ic b/storage/innobase/include/read0read.ic
index 276e01b9f4a..9785cf1b3ce 100644
--- a/storage/innobase/include/read0read.ic
+++ b/storage/innobase/include/read0read.ic
@@ -69,8 +69,9 @@ read_view_sees_trx_id(
for (i = 0; i < n_ids; i++) {
- cmp = ut_dulint_cmp(trx_id,
- read_view_get_nth_trx_id(view, n_ids - i - 1));
+ cmp = ut_dulint_cmp
+ (trx_id,
+ read_view_get_nth_trx_id(view, n_ids - i - 1));
if (cmp <= 0) {
return(cmp < 0);
}
diff --git a/storage/innobase/include/rem0cmp.ic b/storage/innobase/include/rem0cmp.ic
index 954634737bc..5653ec1ac44 100644
--- a/storage/innobase/include/rem0cmp.ic
+++ b/storage/innobase/include/rem0cmp.ic
@@ -40,9 +40,10 @@ cmp_dfield_dfield(
{
ut_ad(dfield_check_typed(dfield1));
- return(cmp_data_data(dfield_get_type(dfield1),
- dfield_get_data(dfield1), dfield_get_len(dfield1),
- dfield_get_data(dfield2), dfield_get_len(dfield2)));
+ return(cmp_data_data
+ (dfield_get_type(dfield1),
+ dfield_get_data(dfield1), dfield_get_len(dfield1),
+ dfield_get_data(dfield2), dfield_get_len(dfield2)));
}
/*****************************************************************
@@ -65,5 +66,5 @@ cmp_rec_rec(
ulint match_b = 0;
return(cmp_rec_rec_with_match(rec1, rec2, offsets1, offsets2, index,
- &match_f, &match_b));
+ &match_f, &match_b));
}
diff --git a/storage/innobase/include/rem0rec.ic b/storage/innobase/include/rem0rec.ic
index e716241f26c..5e4c0ea0664 100644
--- a/storage/innobase/include/rem0rec.ic
+++ b/storage/innobase/include/rem0rec.ic
@@ -289,10 +289,10 @@ rec_get_next_offs(
(int16_t) field_value + ut_align_offset(...) < UNIV_PAGE_SIZE
*/
ut_ad((field_value >= 32768
- ? field_value - 65536
- : field_value)
- + ut_align_offset(rec, UNIV_PAGE_SIZE)
- < UNIV_PAGE_SIZE);
+ ? field_value - 65536
+ : field_value)
+ + ut_align_offset(rec, UNIV_PAGE_SIZE)
+ < UNIV_PAGE_SIZE);
#endif
if (field_value == 0) {
@@ -336,7 +336,8 @@ rec_set_next_offs(
as a non-negative number */
field_value = (ulint)((lint)next
- - (lint)ut_align_offset(rec, UNIV_PAGE_SIZE));
+ - (lint)ut_align_offset
+ (rec, UNIV_PAGE_SIZE));
field_value &= REC_NEXT_MASK;
} else {
field_value = 0;
@@ -363,7 +364,8 @@ rec_get_n_fields_old(
ut_ad(rec);
ret = rec_get_bit_field_2(rec, REC_OLD_N_FIELDS,
- REC_OLD_N_FIELDS_MASK, REC_OLD_N_FIELDS_SHIFT);
+ REC_OLD_N_FIELDS_MASK,
+ REC_OLD_N_FIELDS_SHIFT);
ut_ad(ret <= REC_MAX_N_FIELDS);
ut_ad(ret > 0);
@@ -385,7 +387,7 @@ rec_set_n_fields_old(
ut_ad(n_fields > 0);
rec_set_bit_field_2(rec, n_fields, REC_OLD_N_FIELDS,
- REC_OLD_N_FIELDS_MASK, REC_OLD_N_FIELDS_SHIFT);
+ REC_OLD_N_FIELDS_MASK, REC_OLD_N_FIELDS_SHIFT);
}
/**********************************************************
@@ -402,7 +404,7 @@ rec_get_status(
ut_ad(rec);
ret = rec_get_bit_field_1(rec, REC_NEW_STATUS,
- REC_NEW_STATUS_MASK, REC_NEW_STATUS_SHIFT);
+ REC_NEW_STATUS_MASK, REC_NEW_STATUS_SHIFT);
ut_ad((ret & ~REC_NEW_STATUS_MASK) == 0);
return(ret);
@@ -456,8 +458,8 @@ rec_get_n_owned(
ut_ad(rec);
ret = rec_get_bit_field_1(rec,
- comp ? REC_NEW_N_OWNED : REC_OLD_N_OWNED,
- REC_N_OWNED_MASK, REC_N_OWNED_SHIFT);
+ comp ? REC_NEW_N_OWNED : REC_OLD_N_OWNED,
+ REC_N_OWNED_MASK, REC_N_OWNED_SHIFT);
ut_ad(ret <= REC_MAX_N_OWNED);
return(ret);
@@ -477,8 +479,8 @@ rec_set_n_owned(
ut_ad(n_owned <= REC_MAX_N_OWNED);
rec_set_bit_field_1(rec, n_owned,
- comp ? REC_NEW_N_OWNED : REC_OLD_N_OWNED,
- REC_N_OWNED_MASK, REC_N_OWNED_SHIFT);
+ comp ? REC_NEW_N_OWNED : REC_OLD_N_OWNED,
+ REC_N_OWNED_MASK, REC_N_OWNED_SHIFT);
}
/**********************************************************
@@ -496,8 +498,8 @@ rec_get_info_bits(
ut_ad(rec);
ret = rec_get_bit_field_1(rec,
- comp ? REC_NEW_INFO_BITS : REC_OLD_INFO_BITS,
- REC_INFO_BITS_MASK, REC_INFO_BITS_SHIFT);
+ comp ? REC_NEW_INFO_BITS : REC_OLD_INFO_BITS,
+ REC_INFO_BITS_MASK, REC_INFO_BITS_SHIFT);
ut_ad((ret & ~REC_INFO_BITS_MASK) == 0);
return(ret);
@@ -517,8 +519,8 @@ rec_set_info_bits(
ut_ad((bits & ~REC_INFO_BITS_MASK) == 0);
rec_set_bit_field_1(rec, bits,
- comp ? REC_NEW_INFO_BITS : REC_OLD_INFO_BITS,
- REC_INFO_BITS_MASK, REC_INFO_BITS_SHIFT);
+ comp ? REC_NEW_INFO_BITS : REC_OLD_INFO_BITS,
+ REC_INFO_BITS_MASK, REC_INFO_BITS_SHIFT);
}
/**********************************************************
@@ -534,7 +536,7 @@ rec_set_status(
ut_ad((bits & ~REC_NEW_STATUS_MASK) == 0);
rec_set_bit_field_1(rec, bits, REC_NEW_STATUS,
- REC_NEW_STATUS_MASK, REC_NEW_STATUS_SHIFT);
+ REC_NEW_STATUS_MASK, REC_NEW_STATUS_SHIFT);
}
/**********************************************************
@@ -595,13 +597,15 @@ rec_get_deleted_flag(
ulint comp) /* in: nonzero=compact page format */
{
if (UNIV_EXPECT(comp, REC_OFFS_COMPACT)) {
- return(UNIV_UNLIKELY(rec_get_bit_field_1(rec,
- REC_NEW_INFO_BITS, REC_INFO_DELETED_FLAG,
- REC_INFO_BITS_SHIFT)));
+ return(UNIV_UNLIKELY
+ (rec_get_bit_field_1(rec, REC_NEW_INFO_BITS,
+ REC_INFO_DELETED_FLAG,
+ REC_INFO_BITS_SHIFT)));
} else {
- return(UNIV_UNLIKELY(rec_get_bit_field_1(rec,
- REC_OLD_INFO_BITS, REC_INFO_DELETED_FLAG,
- REC_INFO_BITS_SHIFT)));
+ return(UNIV_UNLIKELY
+ (rec_get_bit_field_1(rec, REC_OLD_INFO_BITS,
+ REC_INFO_DELETED_FLAG,
+ REC_INFO_BITS_SHIFT)));
}
}
@@ -656,8 +660,8 @@ rec_get_heap_no(
ut_ad(rec);
ret = rec_get_bit_field_2(rec,
- comp ? REC_NEW_HEAP_NO : REC_OLD_HEAP_NO,
- REC_HEAP_NO_MASK, REC_HEAP_NO_SHIFT);
+ comp ? REC_NEW_HEAP_NO : REC_OLD_HEAP_NO,
+ REC_HEAP_NO_MASK, REC_HEAP_NO_SHIFT);
ut_ad(ret <= REC_MAX_HEAP_NO);
return(ret);
@@ -676,8 +680,8 @@ rec_set_heap_no(
ut_ad(heap_no <= REC_MAX_HEAP_NO);
rec_set_bit_field_2(rec, heap_no,
- comp ? REC_NEW_HEAP_NO : REC_OLD_HEAP_NO,
- REC_HEAP_NO_MASK, REC_HEAP_NO_SHIFT);
+ comp ? REC_NEW_HEAP_NO : REC_OLD_HEAP_NO,
+ REC_HEAP_NO_MASK, REC_HEAP_NO_SHIFT);
}
/**********************************************************
@@ -695,7 +699,7 @@ rec_get_1byte_offs_flag(
#endif
return(rec_get_bit_field_1(rec, REC_OLD_SHORT, REC_OLD_SHORT_MASK,
- REC_OLD_SHORT_SHIFT));
+ REC_OLD_SHORT_SHIFT));
}
/**********************************************************
@@ -713,7 +717,7 @@ rec_set_1byte_offs_flag(
ut_ad(flag <= TRUE);
rec_set_bit_field_1(rec, flag, REC_OLD_SHORT, REC_OLD_SHORT_MASK,
- REC_OLD_SHORT_SHIFT);
+ REC_OLD_SHORT_SHIFT);
}
/**********************************************************
@@ -814,7 +818,7 @@ rec_offs_n_fields(
ut_ad(n_fields > 0);
ut_ad(n_fields <= REC_MAX_N_FIELDS);
ut_ad(n_fields + REC_OFFS_HEADER_SIZE
- <= rec_offs_get_n_alloc(offsets));
+ <= rec_offs_get_n_alloc(offsets));
return(n_fields);
}
@@ -842,16 +846,16 @@ rec_offs_validate(
if (index) {
ulint max_n_fields;
ut_ad((ulint) index == offsets[3]);
- max_n_fields = ut_max(
- dict_index_get_n_fields(index),
- dict_index_get_n_unique_in_tree(index) + 1);
+ max_n_fields = ut_max
+ (dict_index_get_n_fields(index),
+ dict_index_get_n_unique_in_tree(index) + 1);
if (comp && rec) {
switch (rec_get_status(rec)) {
case REC_STATUS_ORDINARY:
break;
case REC_STATUS_NODE_PTR:
- max_n_fields =
- dict_index_get_n_unique_in_tree(index) + 1;
+ max_n_fields = dict_index_get_n_unique_in_tree
+ (index) + 1;
break;
case REC_STATUS_INFIMUM:
case REC_STATUS_SUPREMUM:
@@ -960,7 +964,7 @@ rec_offs_nth_extern(
ut_ad(rec_offs_validate(NULL, NULL, offsets));
ut_ad(n < rec_offs_n_fields(offsets));
return(UNIV_UNLIKELY(rec_offs_base(offsets)[1 + n]
- & REC_OFFS_EXTERNAL));
+ & REC_OFFS_EXTERNAL));
}
/**********************************************************
@@ -976,7 +980,7 @@ rec_offs_nth_sql_null(
ut_ad(rec_offs_validate(NULL, NULL, offsets));
ut_ad(n < rec_offs_n_fields(offsets));
return(UNIV_UNLIKELY(rec_offs_base(offsets)[1 + n]
- & REC_OFFS_SQL_NULL));
+ & REC_OFFS_SQL_NULL));
}
/**********************************************************
@@ -992,7 +996,7 @@ rec_offs_nth_size(
ut_ad(rec_offs_validate(NULL, NULL, offsets));
ut_ad(n < rec_offs_n_fields(offsets));
return((rec_offs_base(offsets)[1 + n] - rec_offs_base(offsets)[n])
- & REC_OFFS_MASK);
+ & REC_OFFS_MASK);
}
/**********************************************************
@@ -1129,7 +1133,7 @@ rec_1_get_field_start_offs(
}
return(rec_1_get_prev_field_end_info(rec, n)
- & ~REC_1BYTE_SQL_NULL_MASK);
+ & ~REC_1BYTE_SQL_NULL_MASK);
}
/**********************************************************
@@ -1152,7 +1156,7 @@ rec_2_get_field_start_offs(
}
return(rec_2_get_prev_field_end_info(rec, n)
- & ~(REC_2BYTE_SQL_NULL_MASK | REC_2BYTE_EXTERN_MASK));
+ & ~(REC_2BYTE_SQL_NULL_MASK | REC_2BYTE_EXTERN_MASK));
}
/**********************************************************
@@ -1282,7 +1286,7 @@ rec_offs_set_n_fields(
ut_ad(n_fields > 0);
ut_ad(n_fields <= REC_MAX_N_FIELDS);
ut_ad(n_fields + REC_OFFS_HEADER_SIZE
- <= rec_offs_get_n_alloc(offsets));
+ <= rec_offs_get_n_alloc(offsets));
offsets[1] = n_fields;
}
@@ -1302,7 +1306,7 @@ rec_offs_data_size(
ut_ad(rec_offs_validate(NULL, NULL, offsets));
size = rec_offs_base(offsets)[rec_offs_n_fields(offsets)]
- & REC_OFFS_MASK;
+ & REC_OFFS_MASK;
ut_ad(size < UNIV_PAGE_SIZE);
return(size);
}
@@ -1437,11 +1441,11 @@ rec_get_converted_size(
ut_ad(dtuple_check_typed(dtuple));
ut_ad(index->type & DICT_UNIVERSAL
- || dtuple_get_n_fields(dtuple) ==
- (((dtuple_get_info_bits(dtuple) & REC_NEW_STATUS_MASK)
- == REC_STATUS_NODE_PTR)
- ? dict_index_get_n_unique_in_tree(index) + 1
- : dict_index_get_n_fields(index)));
+ || dtuple_get_n_fields(dtuple)
+ == (((dtuple_get_info_bits(dtuple) & REC_NEW_STATUS_MASK)
+ == REC_STATUS_NODE_PTR)
+ ? dict_index_get_n_unique_in_tree(index) + 1
+ : dict_index_get_n_fields(index)));
if (dict_table_is_comp(index->table)) {
return(rec_get_converted_size_new(index, dtuple));
@@ -1449,8 +1453,8 @@ rec_get_converted_size(
data_size = dtuple_get_data_size(dtuple);
- extra_size = rec_get_converted_extra_size(
- data_size, dtuple_get_n_fields(dtuple));
+ extra_size = rec_get_converted_extra_size
+ (data_size, dtuple_get_n_fields(dtuple));
return(data_size + extra_size);
}
diff --git a/storage/innobase/include/row0mysql.h b/storage/innobase/include/row0mysql.h
index 48fb7432b54..be285037767 100644
--- a/storage/innobase/include/row0mysql.h
+++ b/storage/innobase/include/row0mysql.h
@@ -602,9 +602,10 @@ struct row_prebuilt_struct {
selects */
dtuple_t* search_tuple; /* prebuilt dtuple used in selects */
byte row_id[DATA_ROW_ID_LEN];
- /* if the clustered index was generated,
- the row id of the last row fetched is
- stored here */
+ /* if the clustered index was
+ generated, the row id of the
+ last row fetched is stored
+ here */
dtuple_t* clust_ref; /* prebuilt dtuple used in
sel/upd/del */
ulint select_lock_type;/* LOCK_NONE, LOCK_S, or LOCK_X */
diff --git a/storage/innobase/include/row0purge.h b/storage/innobase/include/row0purge.h
index 2653f8a354d..174dd239eb5 100644
--- a/storage/innobase/include/row0purge.h
+++ b/storage/innobase/include/row0purge.h
@@ -58,7 +58,8 @@ struct purge_node_struct{
it */
dict_table_t* table; /* table where purge is done */
ulint cmpl_info;/* compiler analysis info of an update */
- upd_t* update; /* update vector for a clustered index record */
+ upd_t* update; /* update vector for a clustered index
+ record */
dtuple_t* ref; /* NULL, or row reference to the next row to
handle */
dtuple_t* row; /* NULL, or a copy (also fields copied to
diff --git a/storage/innobase/include/row0row.h b/storage/innobase/include/row0row.h
index 22ad4cb4d6d..bea7627cd86 100644
--- a/storage/innobase/include/row0row.h
+++ b/storage/innobase/include/row0row.h
@@ -80,10 +80,9 @@ dtuple_t*
row_build(
/*======*/
/* out, own: row built; see the NOTE below! */
- ulint type, /* in: ROW_COPY_POINTERS, ROW_COPY_DATA, or
- ROW_COPY_ALSO_EXTERNALS,
- the two last copy also the data fields to
- heap as the first only places pointers to
+ ulint type, /* in: ROW_COPY_POINTERS or ROW_COPY_DATA;
+ the latter copies also the data fields to
+ heap while the first only places pointers to
data fields on the index page, and thus is
more efficient */
dict_index_t* index, /* in: clustered index */
@@ -235,7 +234,6 @@ row_search_index_entry(
#define ROW_COPY_DATA 1
#define ROW_COPY_POINTERS 2
-#define ROW_COPY_ALSO_EXTERNALS 3
/* The allowed latching order of index records is the following:
(1) a secondary index record ->
diff --git a/storage/innobase/include/row0row.ic b/storage/innobase/include/row0row.ic
index 7cf09d25eed..de417f3d971 100644
--- a/storage/innobase/include/row0row.ic
+++ b/storage/innobase/include/row0row.ic
@@ -58,7 +58,7 @@ row_get_rec_trx_id(
return(trx_read_trx_id(rec + offset));
} else {
return(row_get_rec_sys_field(DATA_TRX_ID,
- rec, index, offsets));
+ rec, index, offsets));
}
}
@@ -84,7 +84,7 @@ row_get_rec_roll_ptr(
return(trx_read_roll_ptr(rec + offset + DATA_TRX_ID_LEN));
} else {
return(row_get_rec_sys_field(DATA_ROLL_PTR,
- rec, index, offsets));
+ rec, index, offsets));
}
}
@@ -110,7 +110,7 @@ row_set_rec_trx_id(
trx_write_trx_id(rec + offset, trx_id);
} else {
row_set_rec_sys_field(DATA_TRX_ID,
- rec, index, offsets, trx_id);
+ rec, index, offsets, trx_id);
}
}
@@ -136,7 +136,7 @@ row_set_rec_roll_ptr(
trx_write_roll_ptr(rec + offset + DATA_TRX_ID_LEN, roll_ptr);
} else {
row_set_rec_sys_field(DATA_ROLL_PTR,
- rec, index, offsets, roll_ptr);
+ rec, index, offsets, roll_ptr);
}
}
@@ -175,7 +175,7 @@ row_build_row_ref_fast(
if (field_no != ULINT_UNDEFINED) {
field = rec_get_nth_field(rec, offsets,
- field_no, &len);
+ field_no, &len);
dfield_set_data(dfield, field, len);
}
}
diff --git a/storage/innobase/include/row0sel.h b/storage/innobase/include/row0sel.h
index 70b08d82994..96273a18cd5 100644
--- a/storage/innobase/include/row0sel.h
+++ b/storage/innobase/include/row0sel.h
@@ -298,15 +298,17 @@ struct sel_node_struct{
/* TRUE if the aggregate row has
already been fetched for the current
cursor */
- ibool can_get_updated;/* this is TRUE if the select is in a
- single-table explicit cursor which can
- get updated within the stored procedure,
- or in a searched update or delete;
- NOTE that to determine of an explicit
- cursor if it can get updated, the
- parser checks from a stored procedure
- if it contains positioned update or
- delete statements */
+ ibool can_get_updated;/* this is TRUE if the select
+ is in a single-table explicit
+ cursor which can get updated
+ within the stored procedure,
+ or in a searched update or
+ delete; NOTE that to determine
+ of an explicit cursor if it
+ can get updated, the parser
+ checks from a stored procedure
+ if it contains positioned
+ update or delete statements */
sym_node_t* explicit_cursor;/* not NULL if an explicit cursor */
UT_LIST_BASE_NODE_T(sym_node_t)
copy_variables; /* variables whose values we have to
diff --git a/storage/innobase/include/row0sel.ic b/storage/innobase/include/row0sel.ic
index d58daf79969..1f92b99271e 100644
--- a/storage/innobase/include/row0sel.ic
+++ b/storage/innobase/include/row0sel.ic
@@ -60,11 +60,11 @@ open_step(
if (node->op_type == ROW_SEL_OPEN_CURSOR) {
-/* if (sel_node->state == SEL_NODE_CLOSED) { */
+ /* if (sel_node->state == SEL_NODE_CLOSED) { */
- sel_node_reset_cursor(sel_node);
-/* } else {
- err = DB_ERROR;
+ sel_node_reset_cursor(sel_node);
+ /* } else {
+ err = DB_ERROR;
} */
} else {
if (sel_node->state != SEL_NODE_CLOSED) {
diff --git a/storage/innobase/include/row0undo.h b/storage/innobase/include/row0undo.h
index 29cfbc9ac20..0be09ed1822 100644
--- a/storage/innobase/include/row0undo.h
+++ b/storage/innobase/include/row0undo.h
@@ -86,7 +86,8 @@ struct undo_node_struct{
clustered index record */
dict_table_t* table; /* table where undo is done */
ulint cmpl_info;/* compiler analysis of an update */
- upd_t* update; /* update vector for a clustered index record */
+ upd_t* update; /* update vector for a clustered index
+ record */
dtuple_t* ref; /* row reference to the next row to handle */
dtuple_t* row; /* a copy (also fields copied to heap) of the
row to handle */
diff --git a/storage/innobase/include/row0upd.ic b/storage/innobase/include/row0upd.ic
index d5a797df651..5e852559fe4 100644
--- a/storage/innobase/include/row0upd.ic
+++ b/storage/innobase/include/row0upd.ic
@@ -90,11 +90,11 @@ upd_field_set_field_no(
dict_index_name_print(stderr, trx, index);
fprintf(stderr, "\n"
"InnoDB: but index only has %lu fields\n",
- (ulong) dict_index_get_n_fields(index));
+ (ulong) dict_index_get_n_fields(index));
}
dtype_copy(dfield_get_type(&(upd_field->new_val)),
- dict_index_get_nth_type(index, field_no));
+ dict_index_get_nth_type(index, field_no));
}
/*************************************************************************
@@ -114,7 +114,7 @@ row_upd_rec_sys_fields(
ut_ad(rec_offs_validate(rec, index, offsets));
#ifdef UNIV_SYNC_DEBUG
ut_ad(!buf_block_align(rec)->is_hashed
- || rw_lock_own(&btr_search_latch, RW_LOCK_EX));
+ || rw_lock_own(&btr_search_latch, RW_LOCK_EX));
#endif /* UNIV_SYNC_DEBUG */
row_set_rec_trx_id(rec, index, offsets, trx->id);
diff --git a/storage/innobase/include/sync0rw.h b/storage/innobase/include/sync0rw.h
index 616d3eeb978..e5f3e1341c5 100644
--- a/storage/innobase/include/sync0rw.h
+++ b/storage/innobase/include/sync0rw.h
@@ -61,9 +61,9 @@ Creates, or rather, initializes an rw-lock object in a specified memory
location (which must be appropriately aligned). The rw-lock is initialized
to the non-locked state. Explicit freeing of the rw-lock with rw_lock_free
is necessary only if the memory block containing it is freed. */
-#define rw_lock_create(L, level) rw_lock_create_func((L), (level), __FILE__, __LINE__, #L)
+#define rw_lock_create(L, level) \
+ rw_lock_create_func((L), (level), __FILE__, __LINE__, #L)
-/*=====================*/
/**********************************************************************
Creates, or rather, initializes an rw-lock object in a specified memory
location (which must be appropriately aligned). The rw-lock is initialized
diff --git a/storage/innobase/include/sync0rw.ic b/storage/innobase/include/sync0rw.ic
index 02b12f40bc9..defe0692aa8 100644
--- a/storage/innobase/include/sync0rw.ic
+++ b/storage/innobase/include/sync0rw.ic
@@ -144,7 +144,7 @@ rw_lock_s_lock_low(
#ifdef UNIV_SYNC_DEBUG
rw_lock_add_debug_info(lock, pass, RW_LOCK_SHARED, file_name,
- line);
+ line);
#endif
lock->last_s_file_name = file_name;
lock->last_s_line = line;
@@ -280,7 +280,7 @@ rw_lock_s_lock_func_nowait(
#ifdef UNIV_SYNC_DEBUG
rw_lock_add_debug_info(lock, 0, RW_LOCK_SHARED, file_name,
- line);
+ line);
#endif
lock->last_s_file_name = file_name;
@@ -313,11 +313,11 @@ rw_lock_x_lock_func_nowait(
if (UNIV_UNLIKELY(rw_lock_get_reader_count(lock) != 0)) {
} else if (UNIV_LIKELY(rw_lock_get_writer(lock)
- == RW_LOCK_NOT_LOCKED)) {
+ == RW_LOCK_NOT_LOCKED)) {
rw_lock_set_writer(lock, RW_LOCK_EX);
lock->writer_thread = curr_thread;
lock->pass = 0;
- relock:
+relock:
lock->writer_count++;
#ifdef UNIV_SYNC_DEBUG
@@ -329,8 +329,8 @@ rw_lock_x_lock_func_nowait(
success = TRUE;
} else if (rw_lock_get_writer(lock) == RW_LOCK_EX
- && lock->pass == 0
- && os_thread_eq(lock->writer_thread, curr_thread)) {
+ && lock->pass == 0
+ && os_thread_eq(lock->writer_thread, curr_thread)) {
goto relock;
}
@@ -373,7 +373,7 @@ rw_lock_s_unlock_func(
signal the object */
if (UNIV_UNLIKELY(lock->waiters)
- && lock->reader_count == 0) {
+ && lock->reader_count == 0) {
sg = TRUE;
rw_lock_set_waiters(lock, 0);
@@ -453,7 +453,7 @@ rw_lock_x_unlock_func(
/* If there may be waiters, signal the lock */
if (UNIV_UNLIKELY(lock->waiters)
- && lock->writer_count == 0) {
+ && lock->writer_count == 0) {
sg = TRUE;
rw_lock_set_waiters(lock, 0);
diff --git a/storage/innobase/include/sync0sync.h b/storage/innobase/include/sync0sync.h
index 64b245246f8..7d795e60efd 100644
--- a/storage/innobase/include/sync0sync.h
+++ b/storage/innobase/include/sync0sync.h
@@ -39,8 +39,9 @@ location (which must be appropriately aligned). The mutex is initialized
in the reset state. Explicit freeing of the mutex with mutex_free is
necessary only if the memory block containing it is freed. */
-#define mutex_create(M, level) mutex_create_func((M), (level), __FILE__, __LINE__, #M)
-/*===================*/
+#define mutex_create(M, level) \
+ mutex_create_func((M), (level), __FILE__, __LINE__, #M)
+
/**********************************************************************
Creates, or rather, initializes a mutex object in a specified memory
location (which must be appropriately aligned). The mutex is initialized
diff --git a/storage/innobase/include/sync0sync.ic b/storage/innobase/include/sync0sync.ic
index f384e43779f..bcecc3478b3 100644
--- a/storage/innobase/include/sync0sync.ic
+++ b/storage/innobase/include/sync0sync.ic
@@ -66,25 +66,28 @@ mutex_test_and_set(
lw = &(mutex->lock_word);
__asm MOV ECX, lw
- __asm MOV EDX, 1
- __asm XCHG EDX, DWORD PTR [ECX]
- __asm MOV res, EDX
-
- /* The fence below would prevent this thread from reading the data
- structure protected by the mutex before the test-and-set operation is
- committed, but the fence is apparently not needed:
-
- In a posting to comp.arch newsgroup (August 10, 1997) Andy Glew said
- that in P6 a LOCKed instruction like XCHG establishes a fence with
- respect to memory reads and writes and thus an explicit fence is not
- needed. In P5 he seemed to agree with a previous newsgroup poster that
- LOCKed instructions serialize all instruction execution, and,
- consequently, also memory operations. This is confirmed in Intel
- Software Dev. Manual, Vol. 3. */
-
- /* mutex_fence(); */
-
- return(res);
+ __asm MOV EDX, 1
+ __asm XCHG EDX, DWORD PTR [ECX]
+ __asm MOV res, EDX
+
+ /* The fence below would prevent this thread from
+ reading the data structure protected by the mutex
+ before the test-and-set operation is committed, but
+ the fence is apparently not needed:
+
+ In a posting to comp.arch newsgroup (August 10, 1997)
+ Andy Glew said that in P6 a LOCKed instruction like
+ XCHG establishes a fence with respect to memory reads
+ and writes and thus an explicit fence is not
+ needed. In P5 he seemed to agree with a previous
+ newsgroup poster that LOCKed instructions serialize
+ all instruction execution, and, consequently, also
+ memory operations. This is confirmed in Intel Software
+ Dev. Manual, Vol. 3. */
+
+ /* mutex_fence(); */
+
+ return(res);
#elif defined(not_defined) && defined(__GNUC__) && defined(UNIV_INTEL_X86)
ulint* lw;
ulint res;
@@ -98,8 +101,8 @@ mutex_test_and_set(
code, and the second line tells the input to the asm code. */
asm volatile("movl $1, %%eax; xchgl (%%ecx), %%eax" :
- "=eax" (res), "=m" (*lw) :
- "ecx" (lw));
+ "=eax" (res), "=m" (*lw) :
+ "ecx" (lw));
return(res);
#else
ibool ret;
@@ -135,10 +138,10 @@ mutex_reset_lock_word(
lw = &(mutex->lock_word);
__asm MOV EDX, 0
- __asm MOV ECX, lw
- __asm XCHG EDX, DWORD PTR [ECX]
+ __asm MOV ECX, lw
+ __asm XCHG EDX, DWORD PTR [ECX]
#elif defined(not_defined) && defined(__GNUC__) && defined(UNIV_INTEL_X86)
- ulint* lw;
+ ulint* lw;
lw = &(mutex->lock_word);
@@ -147,11 +150,11 @@ mutex_reset_lock_word(
syntax. The 'l' after the mnemonics denotes a 32-bit operation. */
asm volatile("movl $0, %%eax; xchgl (%%ecx), %%eax" :
- "=m" (*lw) :
- "ecx" (lw) :
- "eax"); /* gcc does not seem to understand that our asm code
- resets eax: tell it explicitly that after the third
- ':' */
+ "=m" (*lw) :
+ "ecx" (lw) :
+ "eax"); /* gcc does not seem to understand
+ that our asm code resets eax: tell it
+ explicitly that after the third ':' */
#else
mutex->lock_word = 0;
@@ -167,8 +170,8 @@ mutex_get_lock_word(
/*================*/
mutex_t* mutex) /* in: mutex */
{
-volatile ulint* ptr; /* declared volatile to ensure that
- lock_word is loaded from memory */
+ volatile ulint* ptr; /* declared volatile to ensure that
+ lock_word is loaded from memory */
ut_ad(mutex);
ptr = &(mutex->lock_word);
@@ -185,8 +188,8 @@ mutex_get_waiters(
/* out: value to set */
mutex_t* mutex) /* in: mutex */
{
-volatile ulint* ptr; /* declared volatile to ensure that
- the value is read from memory */
+ volatile ulint* ptr; /* declared volatile to ensure that
+ the value is read from memory */
ut_ad(mutex);
ptr = &(mutex->waiters);
@@ -252,10 +255,10 @@ mutex_enter_func(
the atomic test_and_set; we could peek, and possibly save time. */
#ifndef UNIV_HOTBACKUP
- mutex->count_using++;
+ mutex->count_using++;
#endif /* UNIV_HOTBACKUP */
- if (!mutex_test_and_set(mutex)) {
+ if (!mutex_test_and_set(mutex)) {
#ifdef UNIV_SYNC_DEBUG
mutex_set_debug_info(mutex, file_name, line);
#endif
diff --git a/storage/innobase/include/trx0rec.ic b/storage/innobase/include/trx0rec.ic
index cd02ed9e04c..a1ddc127ec7 100644
--- a/storage/innobase/include/trx0rec.ic
+++ b/storage/innobase/include/trx0rec.ic
@@ -77,7 +77,7 @@ trx_undo_rec_copy(
trx_undo_rec_t* rec_copy;
len = mach_read_from_2(undo_rec) + buf_frame_align(undo_rec)
- - undo_rec;
+ - undo_rec;
rec_copy = mem_heap_alloc(heap, len);
ut_memcpy(rec_copy, undo_rec, len);
diff --git a/storage/innobase/include/trx0rseg.ic b/storage/innobase/include/trx0rseg.ic
index 4de7a4ab144..eb1893587a6 100644
--- a/storage/innobase/include/trx0rseg.ic
+++ b/storage/innobase/include/trx0rseg.ic
@@ -67,12 +67,13 @@ trx_rsegf_get_nth_undo(
{
if (UNIV_UNLIKELY(n >= TRX_RSEG_N_SLOTS)) {
fprintf(stderr,
- "InnoDB: Error: trying to get slot %lu of rseg\n", (unsigned long) n);
+ "InnoDB: Error: trying to get slot %lu of rseg\n",
+ (ulong) n);
ut_error;
}
- return(mtr_read_ulint(rsegf + TRX_RSEG_UNDO_SLOTS +
- n * TRX_RSEG_SLOT_SIZE, MLOG_4BYTES, mtr));
+ return(mtr_read_ulint(rsegf + TRX_RSEG_UNDO_SLOTS
+ + n * TRX_RSEG_SLOT_SIZE, MLOG_4BYTES, mtr));
}
/*******************************************************************
@@ -88,12 +89,13 @@ trx_rsegf_set_nth_undo(
{
if (UNIV_UNLIKELY(n >= TRX_RSEG_N_SLOTS)) {
fprintf(stderr,
- "InnoDB: Error: trying to set slot %lu of rseg\n", (unsigned long) n);
+ "InnoDB: Error: trying to set slot %lu of rseg\n",
+ (ulong) n);
ut_error;
}
mlog_write_ulint(rsegf + TRX_RSEG_UNDO_SLOTS + n * TRX_RSEG_SLOT_SIZE,
- page_no, MLOG_4BYTES, mtr);
+ page_no, MLOG_4BYTES, mtr);
}
/********************************************************************
diff --git a/storage/innobase/include/trx0sys.ic b/storage/innobase/include/trx0sys.ic
index e0653609b36..9c950be09f0 100644
--- a/storage/innobase/include/trx0sys.ic
+++ b/storage/innobase/include/trx0sys.ic
@@ -100,7 +100,7 @@ trx_sysf_get(
ut_ad(mtr);
header = TRX_SYS + buf_page_get(TRX_SYS_SPACE, TRX_SYS_PAGE_NO,
- RW_X_LATCH, mtr);
+ RW_X_LATCH, mtr);
#ifdef UNIV_SYNC_DEBUG
buf_page_dbg_add_level(header, SYNC_TRX_SYS_HEADER);
@@ -128,8 +128,8 @@ trx_sysf_rseg_get_space(
ut_ad(i < TRX_SYS_N_RSEGS);
return(mtr_read_ulint(sys_header + TRX_SYS_RSEGS
- + i * TRX_SYS_RSEG_SLOT_SIZE
- + TRX_SYS_RSEG_SPACE, MLOG_4BYTES, mtr));
+ + i * TRX_SYS_RSEG_SLOT_SIZE
+ + TRX_SYS_RSEG_SPACE, MLOG_4BYTES, mtr));
}
/*********************************************************************
@@ -152,8 +152,8 @@ trx_sysf_rseg_get_page_no(
ut_ad(i < TRX_SYS_N_RSEGS);
return(mtr_read_ulint(sys_header + TRX_SYS_RSEGS
- + i * TRX_SYS_RSEG_SLOT_SIZE
- + TRX_SYS_RSEG_PAGE_NO, MLOG_4BYTES, mtr));
+ + i * TRX_SYS_RSEG_SLOT_SIZE
+ + TRX_SYS_RSEG_PAGE_NO, MLOG_4BYTES, mtr));
}
/*********************************************************************
@@ -175,10 +175,10 @@ trx_sysf_rseg_set_space(
ut_ad(i < TRX_SYS_N_RSEGS);
mlog_write_ulint(sys_header + TRX_SYS_RSEGS
- + i * TRX_SYS_RSEG_SLOT_SIZE
- + TRX_SYS_RSEG_SPACE,
- space,
- MLOG_4BYTES, mtr);
+ + i * TRX_SYS_RSEG_SLOT_SIZE
+ + TRX_SYS_RSEG_SPACE,
+ space,
+ MLOG_4BYTES, mtr);
}
/*********************************************************************
@@ -201,10 +201,10 @@ trx_sysf_rseg_set_page_no(
ut_ad(i < TRX_SYS_N_RSEGS);
mlog_write_ulint(sys_header + TRX_SYS_RSEGS
- + i * TRX_SYS_RSEG_SLOT_SIZE
- + TRX_SYS_RSEG_PAGE_NO,
- page_no,
- MLOG_4BYTES, mtr);
+ + i * TRX_SYS_RSEG_SLOT_SIZE
+ + TRX_SYS_RSEG_PAGE_NO,
+ page_no,
+ MLOG_4BYTES, mtr);
}
/*********************************************************************
@@ -327,8 +327,8 @@ trx_is_active(
}
trx = trx_get_on_id(trx_id);
- if (trx && (trx->conc_state == TRX_ACTIVE ||
- trx->conc_state == TRX_PREPARED)) {
+ if (trx && (trx->conc_state == TRX_ACTIVE
+ || trx->conc_state == TRX_PREPARED)) {
return(TRUE);
}
@@ -358,7 +358,7 @@ trx_sys_get_new_trx_id(void)
repeatedly started! */
if (ut_dulint_get_low(trx_sys->max_trx_id)
- % TRX_SYS_TRX_ID_WRITE_MARGIN == 0) {
+ % TRX_SYS_TRX_ID_WRITE_MARGIN == 0) {
trx_sys_flush_max_trx_id();
}
diff --git a/storage/innobase/include/trx0trx.h b/storage/innobase/include/trx0trx.h
index 94f85366d1e..8232699c7f9 100644
--- a/storage/innobase/include/trx0trx.h
+++ b/storage/innobase/include/trx0trx.h
@@ -670,9 +670,11 @@ struct trx_struct{
error, or empty. */
};
-#define TRX_MAX_N_THREADS 32 /* maximum number of concurrent
- threads running a single operation of
- a transaction, e.g., a parallel query */
+#define TRX_MAX_N_THREADS 32 /* maximum number of
+ concurrent threads running a
+ single operation of a
+ transaction, e.g., a parallel
+ query */
/* Transaction types */
#define TRX_USER 1 /* normal user transaction */
#define TRX_PURGE 2 /* purge transaction: this is not
diff --git a/storage/innobase/include/trx0trx.ic b/storage/innobase/include/trx0trx.ic
index 3992225ed8b..d562db233e9 100644
--- a/storage/innobase/include/trx0trx.ic
+++ b/storage/innobase/include/trx0trx.ic
@@ -94,5 +94,5 @@ trx_new_rec_locks_contain(
dict_index_t* index) /* in: index */
{
return(trx->new_rec_locks[0] == index
- || trx->new_rec_locks[1] == index);
+ || trx->new_rec_locks[1] == index);
}
diff --git a/storage/innobase/include/trx0undo.h b/storage/innobase/include/trx0undo.h
index 83f022cc2c5..87849ab42c3 100644
--- a/storage/innobase/include/trx0undo.h
+++ b/storage/innobase/include/trx0undo.h
@@ -26,7 +26,7 @@ trx_undo_build_roll_ptr(
ibool is_insert, /* in: TRUE if insert undo log */
ulint rseg_id, /* in: rollback segment id */
ulint page_no, /* in: page number */
- ulint offset); /* in: offset of the undo entry within page */
+ ulint offset); /* in: offset of the undo entry within page */
/***************************************************************************
Decodes a roll pointer dulint. */
UNIV_INLINE
@@ -96,7 +96,7 @@ trx_undo_page_get_prev_rec(
/* out: pointer to record, NULL if none */
trx_undo_rec_t* rec, /* in: undo log record */
ulint page_no,/* in: undo log header page number */
- ulint offset); /* in: undo log header offset on page */
+ ulint offset);/* in: undo log header offset on page */
/**********************************************************************
Returns the next undo log record on the page in the specified log, or
NULL if none exists. */
@@ -107,7 +107,7 @@ trx_undo_page_get_next_rec(
/* out: pointer to record, NULL if none */
trx_undo_rec_t* rec, /* in: undo log record */
ulint page_no,/* in: undo log header page number */
- ulint offset); /* in: undo log header offset on page */
+ ulint offset);/* in: undo log header offset on page */
/**********************************************************************
Returns the last undo record on the page in the specified undo log, or
NULL if none exists. */
@@ -129,7 +129,7 @@ trx_undo_page_get_first_rec(
/* out: pointer to record, NULL if none */
page_t* undo_page,/* in: undo log page */
ulint page_no,/* in: undo log header page number */
- ulint offset); /* in: undo log header offset on page */
+ ulint offset);/* in: undo log header offset on page */
/***************************************************************************
Gets the previous record in an undo log. */
diff --git a/storage/innobase/include/trx0undo.ic b/storage/innobase/include/trx0undo.ic
index 1678b292590..f28f36ade03 100644
--- a/storage/innobase/include/trx0undo.ic
+++ b/storage/innobase/include/trx0undo.ic
@@ -61,7 +61,7 @@ trx_undo_decode_roll_ptr(
*rseg_id = (high / (256 * 256)) % 128;
*page_no = (high % (256 * 256)) * 256 * 256
- + (low / 256) / 256;
+ + (low / 256) / 256;
}
/***************************************************************************
@@ -179,7 +179,7 @@ trx_undo_page_get_start(
if (page_no == buf_frame_get_page_no(undo_page)) {
start = mach_read_from_2(offset + undo_page
- + TRX_UNDO_LOG_START);
+ + TRX_UNDO_LOG_START);
} else {
start = TRX_UNDO_PAGE_HDR + TRX_UNDO_PAGE_HDR_SIZE;
}
@@ -210,11 +210,11 @@ trx_undo_page_get_end(
if (end == 0) {
end = mach_read_from_2(undo_page + TRX_UNDO_PAGE_HDR
- + TRX_UNDO_PAGE_FREE);
+ + TRX_UNDO_PAGE_FREE);
}
} else {
end = mach_read_from_2(undo_page + TRX_UNDO_PAGE_HDR
- + TRX_UNDO_PAGE_FREE);
+ + TRX_UNDO_PAGE_FREE);
}
return(end);
diff --git a/storage/innobase/include/trx0xa.h b/storage/innobase/include/trx0xa.h
index e90ce47ffcf..df85cd663cb 100644
--- a/storage/innobase/include/trx0xa.h
+++ b/storage/innobase/include/trx0xa.h
@@ -144,7 +144,8 @@ struct xa_switch_t {
on this list */
#define XA_RBPROTO XA_RBBASE+5 /* A protocol error occurred in the
resource manager */
-#define XA_RBTIMEOUT XA_RBBASE+6 /* A transaction branch took too long */
+#define XA_RBTIMEOUT XA_RBBASE+6 /* A transaction branch took
+ too long */
#define XA_RBTRANSIENT XA_RBBASE+7 /* May retry the transaction branch */
#define XA_RBEND XA_RBTRANSIENT /* The inclusive upper bound of the
rollback codes */
diff --git a/storage/innobase/include/univ.i b/storage/innobase/include/univ.i
index c1f028ef4a3..e60241b0ff3 100644
--- a/storage/innobase/include/univ.i
+++ b/storage/innobase/include/univ.i
@@ -96,8 +96,6 @@ memory is read outside the allocated blocks. */
#define UNIV_BTR_DEBUG
#define UNIV_LIGHT_MEM_DEBUG
-#define YYDEBUG 1
-
#ifdef HAVE_purify
/* The following sets all new allocated memory to zero before use:
this can be used to eliminate unnecessary Purify warnings, but note that
diff --git a/storage/innobase/include/ut0byte.ic b/storage/innobase/include/ut0byte.ic
index 9829b3a2c46..020cf9cedd9 100644
--- a/storage/innobase/include/ut0byte.ic
+++ b/storage/innobase/include/ut0byte.ic
@@ -62,7 +62,7 @@ ut_conv_dulint_to_longlong(
dulint d) /* in: dulint */
{
return((ib_longlong)d.low
- + (((ib_longlong)d.high) << 32));
+ + (((ib_longlong)d.high) << 32));
}
/***********************************************************
diff --git a/storage/innobase/include/ut0rnd.ic b/storage/innobase/include/ut0rnd.ic
index 455007c7d9b..625c378489a 100644
--- a/storage/innobase/include/ut0rnd.ic
+++ b/storage/innobase/include/ut0rnd.ic
@@ -71,8 +71,7 @@ ut_rnd_gen_ulint(void)
n_bits = 8 * sizeof(ulint);
- ut_rnd_ulint_counter =
- UT_RND1 * ut_rnd_ulint_counter + UT_RND2;
+ ut_rnd_ulint_counter = UT_RND1 * ut_rnd_ulint_counter + UT_RND2;
rnd = ut_rnd_gen_next_ulint(ut_rnd_ulint_counter);
@@ -151,7 +150,7 @@ ut_fold_ulint_pair(
ulint n2) /* in: ulint */
{
return(((((n1 ^ n2 ^ UT_HASH_RANDOM_MASK2) << 8) + n1)
- ^ UT_HASH_RANDOM_MASK) + n2);
+ ^ UT_HASH_RANDOM_MASK) + n2);
}
/*****************************************************************
@@ -164,7 +163,7 @@ ut_fold_dulint(
dulint d) /* in: dulint */
{
return(ut_fold_ulint_pair(ut_dulint_get_low(d),
- ut_dulint_get_high(d)));
+ ut_dulint_get_high(d)));
}
/*****************************************************************
diff --git a/storage/innobase/lock/lock0lock.c b/storage/innobase/lock/lock0lock.c
index a73a78620f1..3a2f17f41e5 100644
--- a/storage/innobase/lock/lock0lock.c
+++ b/storage/innobase/lock/lock0lock.c
@@ -477,14 +477,16 @@ lock_check_trx_id_sanity(
if (ut_dulint_cmp(trx_id, trx_sys->max_trx_id) >= 0) {
ut_print_timestamp(stderr);
fputs(" InnoDB: Error: transaction id associated"
- " with record\n",
- stderr);
+ " with record\n",
+ stderr);
rec_print_new(stderr, rec, offsets);
fputs("InnoDB: in ", stderr);
dict_index_name_print(stderr, NULL, index);
fprintf(stderr, "\n"
-"InnoDB: is %lu %lu which is higher than the global trx id counter %lu %lu!\n"
-"InnoDB: The table is corrupt. You have to do dump + drop + reimport.\n",
+ "InnoDB: is %lu %lu which is higher than the"
+ " global trx id counter %lu %lu!\n"
+ "InnoDB: The table is corrupt. You have to do"
+ " dump + drop + reimport.\n",
(ulong) ut_dulint_get_high(trx_id),
(ulong) ut_dulint_get_low(trx_id),
(ulong) ut_dulint_get_high(trx_sys->max_trx_id),
@@ -674,8 +676,8 @@ lock_get_src_table(
} else if (!src) {
/* This presumably is the source table. */
src = tab_lock->table;
- if (UT_LIST_GET_LEN(src->locks) != 1 ||
- UT_LIST_GET_FIRST(src->locks) != lock) {
+ if (UT_LIST_GET_LEN(src->locks) != 1
+ || UT_LIST_GET_FIRST(src->locks) != lock) {
/* We only support the case when
there is only one lock on this table. */
return(NULL);
@@ -863,9 +865,9 @@ lock_mode_stronger_or_eq(
ulint mode2) /* in: lock mode */
{
ut_ad(mode1 == LOCK_X || mode1 == LOCK_S || mode1 == LOCK_IX
- || mode1 == LOCK_IS || mode1 == LOCK_AUTO_INC);
+ || mode1 == LOCK_IS || mode1 == LOCK_AUTO_INC);
ut_ad(mode2 == LOCK_X || mode2 == LOCK_S || mode2 == LOCK_IX
- || mode2 == LOCK_IS || mode2 == LOCK_AUTO_INC);
+ || mode2 == LOCK_IS || mode2 == LOCK_AUTO_INC);
if (mode1 == LOCK_X) {
return(TRUE);
@@ -875,7 +877,7 @@ lock_mode_stronger_or_eq(
return(TRUE);
} else if (mode1 == LOCK_S
- && (mode2 == LOCK_S || mode2 == LOCK_IS)) {
+ && (mode2 == LOCK_S || mode2 == LOCK_IS)) {
return(TRUE);
} else if (mode1 == LOCK_IS && mode2 == LOCK_IS) {
@@ -883,7 +885,7 @@ lock_mode_stronger_or_eq(
return(TRUE);
} else if (mode1 == LOCK_IX && (mode2 == LOCK_IX
- || mode2 == LOCK_IS)) {
+ || mode2 == LOCK_IS)) {
return(TRUE);
}
@@ -901,9 +903,9 @@ lock_mode_compatible(
ulint mode2) /* in: lock mode */
{
ut_ad(mode1 == LOCK_X || mode1 == LOCK_S || mode1 == LOCK_IX
- || mode1 == LOCK_IS || mode1 == LOCK_AUTO_INC);
+ || mode1 == LOCK_IS || mode1 == LOCK_AUTO_INC);
ut_ad(mode2 == LOCK_X || mode2 == LOCK_S || mode2 == LOCK_IX
- || mode2 == LOCK_IS || mode2 == LOCK_AUTO_INC);
+ || mode2 == LOCK_IS || mode2 == LOCK_AUTO_INC);
if (mode1 == LOCK_S && (mode2 == LOCK_IS || mode2 == LOCK_S)) {
@@ -914,18 +916,18 @@ lock_mode_compatible(
return(FALSE);
} else if (mode1 == LOCK_AUTO_INC && (mode2 == LOCK_IS
- || mode2 == LOCK_IX)) {
+ || mode2 == LOCK_IX)) {
return(TRUE);
} else if (mode1 == LOCK_IS && (mode2 == LOCK_IS
- || mode2 == LOCK_IX
- || mode2 == LOCK_AUTO_INC
- || mode2 == LOCK_S)) {
+ || mode2 == LOCK_IX
+ || mode2 == LOCK_AUTO_INC
+ || mode2 == LOCK_S)) {
return(TRUE);
} else if (mode1 == LOCK_IX && (mode2 == LOCK_IS
- || mode2 == LOCK_AUTO_INC
- || mode2 == LOCK_IX)) {
+ || mode2 == LOCK_AUTO_INC
+ || mode2 == LOCK_IX)) {
return(TRUE);
}
@@ -956,14 +958,14 @@ lock_rec_has_to_wait(
ut_ad(lock_get_type(lock2) == LOCK_REC);
if (trx != lock2->trx
- && !lock_mode_compatible(LOCK_MODE_MASK & type_mode,
- lock_get_mode(lock2))) {
+ && !lock_mode_compatible(LOCK_MODE_MASK & type_mode,
+ lock_get_mode(lock2))) {
/* We have somewhat complex rules when gap type record locks
cause waits */
if ((lock_is_on_supremum || (type_mode & LOCK_GAP))
- && !(type_mode & LOCK_INSERT_INTENTION)) {
+ && !(type_mode & LOCK_INSERT_INTENTION)) {
/* Gap type locks without LOCK_INSERT_INTENTION flag
do not need to wait for anything. This is because
@@ -974,7 +976,7 @@ lock_rec_has_to_wait(
}
if (!(type_mode & LOCK_INSERT_INTENTION)
- && lock_rec_get_gap(lock2)) {
+ && lock_rec_get_gap(lock2)) {
/* Record lock (LOCK_ORDINARY or LOCK_REC_NOT_GAP
does not need to wait for a gap type lock */
@@ -983,7 +985,7 @@ lock_rec_has_to_wait(
}
if ((type_mode & LOCK_GAP)
- && lock_rec_get_rec_not_gap(lock2)) {
+ && lock_rec_get_rec_not_gap(lock2)) {
/* Lock on gap does not need to wait for
a LOCK_REC_NOT_GAP type lock */
@@ -1029,8 +1031,8 @@ lock_has_to_wait(
ut_ad(lock1 && lock2);
if (lock1->trx != lock2->trx
- && !lock_mode_compatible(lock_get_mode(lock1),
- lock_get_mode(lock2))) {
+ && !lock_mode_compatible(lock_get_mode(lock1),
+ lock_get_mode(lock2))) {
if (lock_get_type(lock1) == LOCK_REC) {
ut_ad(lock_get_type(lock2) == LOCK_REC);
@@ -1038,8 +1040,9 @@ lock_has_to_wait(
then the second bit on the lock bitmap is set */
return(lock_rec_has_to_wait(lock1->trx,
- lock1->type_mode, lock2,
- lock_rec_get_nth_bit(lock1,1)));
+ lock1->type_mode, lock2,
+ lock_rec_get_nth_bit
+ (lock1, 1)));
}
return(TRUE);
@@ -1176,7 +1179,7 @@ lock_rec_get_next_on_page(
}
if ((lock->un_member.rec_lock.space == space)
- && (lock->un_member.rec_lock.page_no == page_no)) {
+ && (lock->un_member.rec_lock.page_no == page_no)) {
break;
}
@@ -1203,10 +1206,10 @@ lock_rec_get_first_on_page_addr(
#endif /* UNIV_SYNC_DEBUG */
lock = HASH_GET_FIRST(lock_sys->rec_hash,
- lock_rec_hash(space, page_no));
+ lock_rec_hash(space, page_no));
while (lock) {
if ((lock->un_member.rec_lock.space == space)
- && (lock->un_member.rec_lock.page_no == page_no)) {
+ && (lock->un_member.rec_lock.page_no == page_no)) {
break;
}
@@ -1271,7 +1274,7 @@ lock_rec_get_first_on_page(
page_no = buf_frame_get_page_no(ptr);
if ((lock->un_member.rec_lock.space == space)
- && (lock->un_member.rec_lock.page_no == page_no)) {
+ && (lock->un_member.rec_lock.page_no == page_no)) {
break;
}
@@ -1300,13 +1303,13 @@ lock_rec_get_next(
if (page_rec_is_comp(rec)) {
do {
lock = lock_rec_get_next_on_page(lock);
- } while (lock && !lock_rec_get_nth_bit(lock,
- rec_get_heap_no(rec, TRUE)));
+ } while (lock && !lock_rec_get_nth_bit
+ (lock, rec_get_heap_no(rec, TRUE)));
} else {
do {
lock = lock_rec_get_next_on_page(lock);
- } while (lock && !lock_rec_get_nth_bit(lock,
- rec_get_heap_no(rec, FALSE)));
+ } while (lock && !lock_rec_get_nth_bit
+ (lock, rec_get_heap_no(rec, FALSE)));
}
return(lock);
@@ -1464,7 +1467,7 @@ lock_table_has(
while (lock != NULL) {
if (lock->trx == trx
- && lock_mode_stronger_or_eq(lock_get_mode(lock), mode)) {
+ && lock_mode_stronger_or_eq(lock_get_mode(lock), mode)) {
/* The same trx already has locked the table in
a mode stronger or equal to the mode given */
@@ -1503,23 +1506,23 @@ lock_rec_has_expl(
ut_ad(mutex_own(&kernel_mutex));
#endif /* UNIV_SYNC_DEBUG */
ut_ad((precise_mode & LOCK_MODE_MASK) == LOCK_S
- || (precise_mode & LOCK_MODE_MASK) == LOCK_X);
+ || (precise_mode & LOCK_MODE_MASK) == LOCK_X);
ut_ad(!(precise_mode & LOCK_INSERT_INTENTION));
lock = lock_rec_get_first(rec);
while (lock) {
if (lock->trx == trx
- && lock_mode_stronger_or_eq(lock_get_mode(lock),
- precise_mode & LOCK_MODE_MASK)
- && !lock_get_wait(lock)
- && (!lock_rec_get_rec_not_gap(lock)
- || (precise_mode & LOCK_REC_NOT_GAP)
- || page_rec_is_supremum(rec))
- && (!lock_rec_get_gap(lock)
- || (precise_mode & LOCK_GAP)
- || page_rec_is_supremum(rec))
- && (!lock_rec_get_insert_intention(lock))) {
+ && lock_mode_stronger_or_eq(lock_get_mode(lock),
+ precise_mode & LOCK_MODE_MASK)
+ && !lock_get_wait(lock)
+ && (!lock_rec_get_rec_not_gap(lock)
+ || (precise_mode & LOCK_REC_NOT_GAP)
+ || page_rec_is_supremum(rec))
+ && (!lock_rec_get_gap(lock)
+ || (precise_mode & LOCK_GAP)
+ || page_rec_is_supremum(rec))
+ && (!lock_rec_get_insert_intention(lock))) {
return(lock);
}
@@ -1560,10 +1563,11 @@ lock_rec_other_has_expl_req(
while (lock) {
if (lock->trx != trx
- && (gap ||
- !(lock_rec_get_gap(lock) || page_rec_is_supremum(rec)))
- && (wait || !lock_get_wait(lock))
- && lock_mode_stronger_or_eq(lock_get_mode(lock), mode)) {
+ && (gap
+ || !(lock_rec_get_gap(lock)
+ || page_rec_is_supremum(rec)))
+ && (wait || !lock_get_wait(lock))
+ && lock_mode_stronger_or_eq(lock_get_mode(lock), mode)) {
return(lock);
}
@@ -1598,7 +1602,7 @@ lock_rec_other_has_conflicting(
while (lock) {
if (lock_rec_has_to_wait(trx, mode, lock,
- page_rec_is_supremum(rec))) {
+ page_rec_is_supremum(rec))) {
return(lock);
}
@@ -1634,8 +1638,8 @@ lock_rec_find_similar_on_page(
while (lock != NULL) {
if (lock->trx == trx
- && lock->type_mode == type_mode
- && lock_rec_get_n_bits(lock) > heap_no) {
+ && lock->type_mode == type_mode
+ && lock_rec_get_n_bits(lock) > heap_no) {
return(lock);
}
@@ -1677,8 +1681,8 @@ lock_sec_rec_some_has_impl_off_kernel(
for a page may be incorrect. */
if (!(ut_dulint_cmp(page_get_max_trx_id(page),
- trx_list_get_min_trx_id()) >= 0)
- && !recv_recovery_is_on()) {
+ trx_list_get_min_trx_id()) >= 0)
+ && !recv_recovery_is_on()) {
return(NULL);
}
@@ -1687,7 +1691,7 @@ lock_sec_rec_some_has_impl_off_kernel(
implicit x-lock. We have to look in the clustered index. */
if (!lock_check_trx_id_sanity(page_get_max_trx_id(page),
- rec, index, offsets, TRUE)) {
+ rec, index, offsets, TRUE)) {
buf_page_print(page);
/* The page is corrupt: try to avoid a crash by returning
@@ -1803,7 +1807,7 @@ lock_rec_create(
lock_rec_set_nth_bit(lock, heap_no);
HASH_INSERT(lock_t, hash, lock_sys->rec_hash,
- lock_rec_fold(space, page_no), lock);
+ lock_rec_fold(space, page_no), lock);
if (type_mode & LOCK_WAIT) {
lock_set_lock_and_trx_wait(lock, trx);
@@ -1857,13 +1861,14 @@ lock_rec_enqueue_waiting(
if (trx->dict_operation) {
ut_print_timestamp(stderr);
- fputs(
-" InnoDB: Error: a record lock wait happens in a dictionary operation!\n"
-"InnoDB: Table name ", stderr);
+ fputs(" InnoDB: Error: a record lock wait happens"
+ " in a dictionary operation!\n"
+ "InnoDB: Table name ", stderr);
ut_print_name(stderr, trx, TRUE, index->table_name);
fputs(".\n"
-"InnoDB: Submit a detailed bug report to http://bugs.mysql.com\n",
- stderr);
+ "InnoDB: Submit a detailed bug report"
+ " to http://bugs.mysql.com\n",
+ stderr);
}
/* Enqueue the lock request that will wait to be granted */
@@ -1875,8 +1880,8 @@ lock_rec_enqueue_waiting(
if (lock_deadlock_occurs(lock, trx)) {
lock_reset_lock_and_trx_wait(lock);
- lock_rec_reset_nth_bit(lock, rec_get_heap_no(rec,
- page_rec_is_comp(rec)));
+ lock_rec_reset_nth_bit(lock, rec_get_heap_no
+ (rec, page_rec_is_comp(rec)));
return(DB_DEADLOCK);
}
@@ -1933,13 +1938,13 @@ lock_rec_add_to_queue(
ut_ad(mutex_own(&kernel_mutex));
#endif /* UNIV_SYNC_DEBUG */
ut_ad((type_mode & (LOCK_WAIT | LOCK_GAP))
- || ((type_mode & LOCK_MODE_MASK) != LOCK_S)
- || !lock_rec_other_has_expl_req(LOCK_X, 0, LOCK_WAIT,
- rec, trx));
+ || ((type_mode & LOCK_MODE_MASK) != LOCK_S)
+ || !lock_rec_other_has_expl_req(LOCK_X, 0, LOCK_WAIT,
+ rec, trx));
ut_ad((type_mode & (LOCK_WAIT | LOCK_GAP))
- || ((type_mode & LOCK_MODE_MASK) != LOCK_X)
- || !lock_rec_other_has_expl_req(LOCK_S, 0, LOCK_WAIT,
- rec, trx));
+ || ((type_mode & LOCK_MODE_MASK) != LOCK_X)
+ || !lock_rec_other_has_expl_req(LOCK_S, 0, LOCK_WAIT,
+ rec, trx));
type_mode = type_mode | LOCK_REC;
@@ -1964,7 +1969,7 @@ lock_rec_add_to_queue(
while (lock != NULL) {
if (lock_get_wait(lock)
- && (lock_rec_get_nth_bit(lock, heap_no))) {
+ && (lock_rec_get_nth_bit(lock, heap_no))) {
somebody_waits = TRUE;
}
@@ -2016,14 +2021,14 @@ lock_rec_lock_fast(
ut_ad(mutex_own(&kernel_mutex));
#endif /* UNIV_SYNC_DEBUG */
ut_ad((LOCK_MODE_MASK & mode) != LOCK_S
- || lock_table_has(thr_get_trx(thr), index->table, LOCK_IS));
+ || lock_table_has(thr_get_trx(thr), index->table, LOCK_IS));
ut_ad((LOCK_MODE_MASK & mode) != LOCK_X
- || lock_table_has(thr_get_trx(thr), index->table, LOCK_IX));
+ || lock_table_has(thr_get_trx(thr), index->table, LOCK_IX));
ut_ad((LOCK_MODE_MASK & mode) == LOCK_S
- || (LOCK_MODE_MASK & mode) == LOCK_X);
+ || (LOCK_MODE_MASK & mode) == LOCK_X);
ut_ad(mode - (LOCK_MODE_MASK & mode) == LOCK_GAP
- || mode - (LOCK_MODE_MASK & mode) == 0
- || mode - (LOCK_MODE_MASK & mode) == LOCK_REC_NOT_GAP);
+ || mode - (LOCK_MODE_MASK & mode) == 0
+ || mode - (LOCK_MODE_MASK & mode) == LOCK_REC_NOT_GAP);
heap_no = rec_get_heap_no(rec, page_rec_is_comp(rec));
@@ -2036,7 +2041,8 @@ lock_rec_lock_fast(
lock_rec_create(mode, rec, index, trx);
if (srv_locks_unsafe_for_binlog
- || trx->isolation_level == TRX_ISO_READ_COMMITTED) {
+ || trx->isolation_level
+ == TRX_ISO_READ_COMMITTED) {
trx_register_new_rec_lock(trx, index);
}
}
@@ -2050,8 +2056,8 @@ lock_rec_lock_fast(
}
if (lock->trx != trx
- || lock->type_mode != (mode | LOCK_REC)
- || lock_rec_get_n_bits(lock) <= heap_no) {
+ || lock->type_mode != (mode | LOCK_REC)
+ || lock_rec_get_n_bits(lock) <= heap_no) {
return(FALSE);
}
@@ -2063,7 +2069,8 @@ lock_rec_lock_fast(
if (!lock_rec_get_nth_bit(lock, heap_no)) {
lock_rec_set_nth_bit(lock, heap_no);
if (srv_locks_unsafe_for_binlog
- || trx->isolation_level == TRX_ISO_READ_COMMITTED) {
+ || trx->isolation_level
+ == TRX_ISO_READ_COMMITTED) {
trx_register_new_rec_lock(trx, index);
}
}
@@ -2099,14 +2106,14 @@ lock_rec_lock_slow(
ut_ad(mutex_own(&kernel_mutex));
#endif /* UNIV_SYNC_DEBUG */
ut_ad((LOCK_MODE_MASK & mode) != LOCK_S
- || lock_table_has(thr_get_trx(thr), index->table, LOCK_IS));
+ || lock_table_has(thr_get_trx(thr), index->table, LOCK_IS));
ut_ad((LOCK_MODE_MASK & mode) != LOCK_X
- || lock_table_has(thr_get_trx(thr), index->table, LOCK_IX));
+ || lock_table_has(thr_get_trx(thr), index->table, LOCK_IX));
ut_ad((LOCK_MODE_MASK & mode) == LOCK_S
- || (LOCK_MODE_MASK & mode) == LOCK_X);
+ || (LOCK_MODE_MASK & mode) == LOCK_X);
ut_ad(mode - (LOCK_MODE_MASK & mode) == LOCK_GAP
- || mode - (LOCK_MODE_MASK & mode) == 0
- || mode - (LOCK_MODE_MASK & mode) == LOCK_REC_NOT_GAP);
+ || mode - (LOCK_MODE_MASK & mode) == 0
+ || mode - (LOCK_MODE_MASK & mode) == LOCK_REC_NOT_GAP);
trx = thr_get_trx(thr);
@@ -2124,7 +2131,7 @@ lock_rec_lock_slow(
err = lock_rec_enqueue_waiting(mode, rec, index, thr);
if (srv_locks_unsafe_for_binlog
- || trx->isolation_level == TRX_ISO_READ_COMMITTED) {
+ || trx->isolation_level == TRX_ISO_READ_COMMITTED) {
trx_register_new_rec_lock(trx, index);
}
} else {
@@ -2132,9 +2139,10 @@ lock_rec_lock_slow(
/* Set the requested lock on the record */
lock_rec_add_to_queue(LOCK_REC | mode, rec, index,
- trx);
+ trx);
if (srv_locks_unsafe_for_binlog
- || trx->isolation_level == TRX_ISO_READ_COMMITTED) {
+ || trx->isolation_level
+ == TRX_ISO_READ_COMMITTED) {
trx_register_new_rec_lock(trx, index);
}
}
@@ -2172,14 +2180,14 @@ lock_rec_lock(
ut_ad(mutex_own(&kernel_mutex));
#endif /* UNIV_SYNC_DEBUG */
ut_ad((LOCK_MODE_MASK & mode) != LOCK_S
- || lock_table_has(thr_get_trx(thr), index->table, LOCK_IS));
+ || lock_table_has(thr_get_trx(thr), index->table, LOCK_IS));
ut_ad((LOCK_MODE_MASK & mode) != LOCK_X
- || lock_table_has(thr_get_trx(thr), index->table, LOCK_IX));
+ || lock_table_has(thr_get_trx(thr), index->table, LOCK_IX));
ut_ad((LOCK_MODE_MASK & mode) == LOCK_S
- || (LOCK_MODE_MASK & mode) == LOCK_X);
+ || (LOCK_MODE_MASK & mode) == LOCK_X);
ut_ad(mode - (LOCK_MODE_MASK & mode) == LOCK_GAP
- || mode - (LOCK_MODE_MASK & mode) == LOCK_REC_NOT_GAP
- || mode - (LOCK_MODE_MASK & mode) == 0);
+ || mode - (LOCK_MODE_MASK & mode) == LOCK_REC_NOT_GAP
+ || mode - (LOCK_MODE_MASK & mode) == 0);
if (lock_rec_lock_fast(impl, mode, rec, index, thr)) {
@@ -2223,7 +2231,7 @@ lock_rec_has_to_wait_in_queue(
while (lock != wait_lock) {
if (lock_rec_get_nth_bit(lock, heap_no)
- && lock_has_to_wait(wait_lock, lock)) {
+ && lock_has_to_wait(wait_lock, lock)) {
return(TRUE);
}
@@ -2253,7 +2261,8 @@ lock_grant(
if (lock->trx->auto_inc_lock != NULL) {
fprintf(stderr,
- "InnoDB: Error: trx already had an AUTO-INC lock!\n");
+ "InnoDB: Error: trx already had"
+ " an AUTO-INC lock!\n");
}
/* Store pointer to lock to trx so that we know to
@@ -2335,7 +2344,7 @@ lock_rec_dequeue_from_page(
page_no = in_lock->un_member.rec_lock.page_no;
HASH_DELETE(lock_t, hash, lock_sys->rec_hash,
- lock_rec_fold(space, page_no), in_lock);
+ lock_rec_fold(space, page_no), in_lock);
UT_LIST_REMOVE(trx_locks, trx->trx_locks, in_lock);
@@ -2346,7 +2355,7 @@ lock_rec_dequeue_from_page(
while (lock != NULL) {
if (lock_get_wait(lock)
- && !lock_rec_has_to_wait_in_queue(lock)) {
+ && !lock_rec_has_to_wait_in_queue(lock)) {
/* Grant the lock */
lock_grant(lock);
@@ -2380,7 +2389,7 @@ lock_rec_discard(
page_no = in_lock->un_member.rec_lock.page_no;
HASH_DELETE(lock_t, hash, lock_sys->rec_hash,
- lock_rec_fold(space, page_no), in_lock);
+ lock_rec_fold(space, page_no), in_lock);
UT_LIST_REMOVE(trx_locks, trx->trx_locks, in_lock);
}
@@ -2482,14 +2491,14 @@ lock_rec_inherit_to_gap(
while (lock != NULL) {
if (!lock_rec_get_insert_intention(lock)
- && !((srv_locks_unsafe_for_binlog
- || lock->trx->isolation_level ==
- TRX_ISO_READ_COMMITTED)
- && lock_get_mode(lock) == LOCK_X)) {
+ && !((srv_locks_unsafe_for_binlog
+ || lock->trx->isolation_level
+ == TRX_ISO_READ_COMMITTED)
+ && lock_get_mode(lock) == LOCK_X)) {
lock_rec_add_to_queue(LOCK_REC | lock_get_mode(lock)
- | LOCK_GAP,
- heir, lock->index, lock->trx);
+ | LOCK_GAP,
+ heir, lock->index, lock->trx);
}
lock = lock_rec_get_next(rec, lock);
@@ -2517,12 +2526,12 @@ lock_rec_inherit_to_gap_if_gap_lock(
while (lock != NULL) {
if (!lock_rec_get_insert_intention(lock)
- && (page_rec_is_supremum(rec)
- || !lock_rec_get_rec_not_gap(lock))) {
+ && (page_rec_is_supremum(rec)
+ || !lock_rec_get_rec_not_gap(lock))) {
lock_rec_add_to_queue(LOCK_REC | lock_get_mode(lock)
- | LOCK_GAP,
- heir, lock->index, lock->trx);
+ | LOCK_GAP,
+ heir, lock->index, lock->trx);
}
lock = lock_rec_get_next(rec, lock);
@@ -2568,7 +2577,7 @@ lock_rec_move(
the function works also if donator == receiver */
lock_rec_add_to_queue(type_mode, receiver, lock->index,
- lock->trx);
+ lock->trx);
lock = lock_rec_get_next(donator, lock);
}
@@ -2650,12 +2659,12 @@ lock_move_reorganize_page(
/* Set locks according to old locks */
for (;;) {
- ut_ad(comp || 0 == ut_memcmp(page_cur_get_rec(&cur1),
- page_cur_get_rec(&cur2),
- rec_get_data_size_old(
- page_cur_get_rec(&cur2))));
+ ut_ad(comp || !memcmp(page_cur_get_rec(&cur1),
+ page_cur_get_rec(&cur2),
+ rec_get_data_size_old
+ (page_cur_get_rec(&cur2))));
old_heap_no = rec_get_heap_no(page_cur_get_rec(&cur2),
- comp);
+ comp);
if (lock_rec_get_nth_bit(lock, old_heap_no)) {
@@ -2663,14 +2672,14 @@ lock_move_reorganize_page(
small for the new heap number! */
lock_rec_add_to_queue(lock->type_mode,
- page_cur_get_rec(&cur1),
- lock->index, lock->trx);
+ page_cur_get_rec(&cur1),
+ lock->index, lock->trx);
/* if ((page_cur_get_rec(&cur1) == sup)
- && lock_get_wait(lock)) {
- fprintf(stderr,
+ && lock_get_wait(lock)) {
+ fprintf(stderr,
"---\n--\n!!!Lock reorg: supr type %lu\n",
- lock->type_mode);
+ lock->type_mode);
} */
}
@@ -2683,7 +2692,7 @@ lock_move_reorganize_page(
page_cur_move_to_next(&cur2);
}
- /* Remember that we chained old locks on the trx_locks field: */
+ /* Remember that we chained old locks on the trx_locks field */
lock = UT_LIST_GET_NEXT(trx_locks, lock);
}
@@ -2692,8 +2701,10 @@ lock_move_reorganize_page(
mem_heap_free(heap);
-/* ut_ad(lock_rec_validate_page(buf_frame_get_space_id(page),
- buf_frame_get_page_no(page))); */
+#if 0
+ ut_ad(lock_rec_validate_page(buf_frame_get_space_id(page),
+ buf_frame_get_page_no(page)));
+#endif
}
/*****************************************************************
@@ -2746,12 +2757,12 @@ lock_move_rec_list_end(
reset the lock bits on the old */
while (page_cur_get_rec(&cur1) != sup) {
- ut_ad(comp || 0 == ut_memcmp(page_cur_get_rec(&cur1),
- page_cur_get_rec(&cur2),
- rec_get_data_size_old(
- page_cur_get_rec(&cur2))));
+ ut_ad(comp || !memcmp(page_cur_get_rec(&cur1),
+ page_cur_get_rec(&cur2),
+ rec_get_data_size_old
+ (page_cur_get_rec(&cur2))));
heap_no = rec_get_heap_no(page_cur_get_rec(&cur1),
- comp);
+ comp);
if (lock_rec_get_nth_bit(lock, heap_no)) {
type_mode = lock->type_mode;
@@ -2763,8 +2774,8 @@ lock_move_rec_list_end(
}
lock_rec_add_to_queue(type_mode,
- page_cur_get_rec(&cur2),
- lock->index, lock->trx);
+ page_cur_get_rec(&cur2),
+ lock->index, lock->trx);
}
page_cur_move_to_next(&cur1);
@@ -2776,10 +2787,12 @@ lock_move_rec_list_end(
lock_mutex_exit_kernel();
-/* ut_ad(lock_rec_validate_page(buf_frame_get_space_id(page),
- buf_frame_get_page_no(page)));
+#if 0
+ ut_ad(lock_rec_validate_page(buf_frame_get_space_id(page),
+ buf_frame_get_page_no(page)));
ut_ad(lock_rec_validate_page(buf_frame_get_space_id(new_page),
- buf_frame_get_page_no(new_page))); */
+ buf_frame_get_page_no(new_page)));
+#endif
}
/*****************************************************************
@@ -2824,12 +2837,12 @@ lock_move_rec_list_start(
reset the lock bits on the old */
while (page_cur_get_rec(&cur1) != rec) {
- ut_ad(comp || 0 == ut_memcmp(page_cur_get_rec(&cur1),
- page_cur_get_rec(&cur2),
- rec_get_data_size_old(
- page_cur_get_rec(&cur2))));
+ ut_ad(comp || !memcmp(page_cur_get_rec(&cur1),
+ page_cur_get_rec(&cur2),
+ rec_get_data_size_old
+ (page_cur_get_rec(&cur2))));
heap_no = rec_get_heap_no(page_cur_get_rec(&cur1),
- comp);
+ comp);
if (lock_rec_get_nth_bit(lock, heap_no)) {
type_mode = lock->type_mode;
@@ -2841,8 +2854,8 @@ lock_move_rec_list_start(
}
lock_rec_add_to_queue(type_mode,
- page_cur_get_rec(&cur2),
- lock->index, lock->trx);
+ page_cur_get_rec(&cur2),
+ lock->index, lock->trx);
}
page_cur_move_to_next(&cur1);
@@ -2853,11 +2866,12 @@ lock_move_rec_list_start(
}
lock_mutex_exit_kernel();
-
-/* ut_ad(lock_rec_validate_page(buf_frame_get_space_id(page),
- buf_frame_get_page_no(page)));
+#if 0
+ ut_ad(lock_rec_validate_page(buf_frame_get_space_id(page),
+ buf_frame_get_page_no(page)));
ut_ad(lock_rec_validate_page(buf_frame_get_space_id(new_page),
- buf_frame_get_page_no(new_page))); */
+ buf_frame_get_page_no(new_page)));
+#endif
}
/*****************************************************************
@@ -2878,13 +2892,14 @@ lock_update_split_right(
of the right page */
lock_rec_move(page_get_supremum_rec(right_page),
- page_get_supremum_rec(left_page), comp);
+ page_get_supremum_rec(left_page), comp);
/* Inherit the locks to the supremum of left page from the successor
of the infimum on right page */
lock_rec_inherit_to_gap(page_get_supremum_rec(left_page),
- page_rec_get_next(page_get_infimum_rec(right_page)));
+ page_rec_get_next
+ (page_get_infimum_rec(right_page)));
lock_mutex_exit_kernel();
}
@@ -2941,7 +2956,7 @@ lock_update_root_raise(
of new_page */
lock_rec_move(page_get_supremum_rec(new_page),
- page_get_supremum_rec(root), comp);
+ page_get_supremum_rec(root), comp);
lock_mutex_exit_kernel();
}
@@ -2964,7 +2979,7 @@ lock_update_copy_and_discard(
of new_page */
lock_rec_move(page_get_supremum_rec(new_page),
- page_get_supremum_rec(page), comp);
+ page_get_supremum_rec(page), comp);
lock_rec_free_all_from_discard_page(page);
lock_mutex_exit_kernel();
@@ -2985,7 +3000,8 @@ lock_update_split_left(
successor of the infimum on the right page */
lock_rec_inherit_to_gap(page_get_supremum_rec(left_page),
- page_rec_get_next(page_get_infimum_rec(right_page)));
+ page_rec_get_next
+ (page_get_infimum_rec(right_page)));
lock_mutex_exit_kernel();
}
@@ -3245,7 +3261,7 @@ retry:
lock_deadlock_found = TRUE;
fputs("*** WE ROLL BACK TRANSACTION (2)\n",
- lock_latest_err_file);
+ lock_latest_err_file);
return(TRUE);
}
@@ -3297,7 +3313,7 @@ lock_deadlock_recursive(
*cost = *cost + 1;
if ((depth > LOCK_MAX_DEPTH_IN_DEADLOCK_CHECK)
- || (*cost > LOCK_MAX_N_STEPS_IN_DEADLOCK_CHECK)) {
+ || (*cost > LOCK_MAX_N_STEPS_IN_DEADLOCK_CHECK)) {
return(LOCK_VICTIM_IS_START);
}
@@ -3316,7 +3332,8 @@ lock_deadlock_recursive(
for (;;) {
if (lock_get_type(lock) & LOCK_TABLE) {
- lock = UT_LIST_GET_PREV(un_member.tab_lock.locks, lock);
+ lock = UT_LIST_GET_PREV(un_member.tab_lock.locks,
+ lock);
} else {
ut_ad(lock_get_type(lock) == LOCK_REC);
ut_a(bit_no != ULINT_UNDEFINED);
@@ -3347,8 +3364,8 @@ lock_deadlock_recursive(
trx_print(ef, wait_lock->trx, 3000);
- fputs(
- "*** (1) WAITING FOR THIS LOCK TO BE GRANTED:\n", ef);
+ fputs("*** (1) WAITING FOR THIS LOCK"
+ " TO BE GRANTED:\n", ef);
if (lock_get_type(wait_lock) == LOCK_REC) {
lock_rec_print(ef, wait_lock);
@@ -3368,11 +3385,11 @@ lock_deadlock_recursive(
lock_table_print(ef, lock);
}
- fputs(
- "*** (2) WAITING FOR THIS LOCK TO BE GRANTED:\n", ef);
+ fputs("*** (2) WAITING FOR THIS LOCK"
+ " TO BE GRANTED:\n", ef);
if (lock_get_type(start->wait_lock)
- == LOCK_REC) {
+ == LOCK_REC) {
lock_rec_print(ef, start->wait_lock);
} else {
lock_table_print(ef, start->wait_lock);
@@ -3383,7 +3400,7 @@ lock_deadlock_recursive(
}
#endif /* UNIV_DEBUG */
if (ut_dulint_cmp(wait_lock->trx->undo_no,
- start->undo_no) >= 0) {
+ start->undo_no) >= 0) {
/* Our recursion starting point
transaction is 'smaller', let us
choose 'start' as the victim and roll
@@ -3399,10 +3416,10 @@ lock_deadlock_recursive(
recursion starting point transaction */
fputs("*** WE ROLL BACK TRANSACTION (1)\n",
- ef);
+ ef);
wait_lock->trx->was_chosen_as_deadlock_victim
- = TRUE;
+ = TRUE;
lock_cancel_waiting_and_release(wait_lock);
@@ -3422,8 +3439,9 @@ lock_deadlock_recursive(
incompatible mode, and is itself waiting for
a lock */
- ret = lock_deadlock_recursive(start, lock_trx,
- lock_trx->wait_lock, cost, depth + 1);
+ ret = lock_deadlock_recursive
+ (start, lock_trx,
+ lock_trx->wait_lock, cost, depth + 1);
if (ret != 0) {
return(ret);
@@ -3552,13 +3570,14 @@ lock_table_enqueue_waiting(
if (trx->dict_operation) {
ut_print_timestamp(stderr);
- fputs(
-" InnoDB: Error: a table lock wait happens in a dictionary operation!\n"
-"InnoDB: Table name ", stderr);
+ fputs(" InnoDB: Error: a table lock wait happens"
+ " in a dictionary operation!\n"
+ "InnoDB: Table name ", stderr);
ut_print_name(stderr, trx, TRUE, table->name);
fputs(".\n"
-"InnoDB: Submit a detailed bug report to http://bugs.mysql.com\n",
- stderr);
+ "InnoDB: Submit a detailed bug report"
+ " to http://bugs.mysql.com\n",
+ stderr);
}
/* Enqueue the lock request that will wait to be granted */
@@ -3617,8 +3636,8 @@ lock_table_other_has_incompatible(
while (lock != NULL) {
if ((lock->trx != trx)
- && (!lock_mode_compatible(lock_get_mode(lock), mode))
- && (wait || !(lock_get_wait(lock)))) {
+ && (!lock_mode_compatible(lock_get_mode(lock), mode))
+ && (wait || !(lock_get_wait(lock)))) {
return(TRUE);
}
@@ -3779,7 +3798,7 @@ lock_table_dequeue(
while (lock != NULL) {
if (lock_get_wait(lock)
- && !lock_table_has_to_wait_in_queue(lock)) {
+ && !lock_table_has_to_wait_in_queue(lock)) {
/* Grant the lock */
lock_grant(lock);
@@ -3836,8 +3855,9 @@ lock_rec_unlock(
mutex_exit(&kernel_mutex);
ut_print_timestamp(stderr);
fprintf(stderr,
-" InnoDB: Error: unlock row could not find a %lu mode lock on the record\n",
- (ulong)lock_mode);
+ " InnoDB: Error: unlock row could not"
+ " find a %lu mode lock on the record\n",
+ (ulong) lock_mode);
return;
}
@@ -3848,7 +3868,7 @@ lock_rec_unlock(
while (lock != NULL) {
if (lock_get_wait(lock)
- && !lock_rec_has_to_wait_in_queue(lock)) {
+ && !lock_rec_has_to_wait_in_queue(lock)) {
/* Grant the lock */
lock_grant(lock);
@@ -3926,8 +3946,8 @@ lock_release_off_kernel(
ut_ad(lock_get_type(lock) & LOCK_TABLE);
if (lock_get_mode(lock) != LOCK_IS
- && 0 != ut_dulint_cmp(trx->undo_no,
- ut_dulint_zero)) {
+ && 0 != ut_dulint_cmp(trx->undo_no,
+ ut_dulint_zero)) {
/* The trx may have modified the table. We
block the use of the MySQL query cache for
@@ -3935,8 +3955,8 @@ lock_release_off_kernel(
table = lock->un_member.tab_lock.table;
- table->query_cache_inv_trx_id =
- trx_sys->max_trx_id;
+ table->query_cache_inv_trx_id
+ = trx_sys->max_trx_id;
}
lock_table_dequeue(lock);
@@ -4015,12 +4035,12 @@ lock_reset_all_on_table_for_trx(
prev_lock = UT_LIST_GET_PREV(trx_locks, lock);
if (lock_get_type(lock) == LOCK_REC
- && lock->index->table == table) {
+ && lock->index->table == table) {
ut_a(!lock_get_wait(lock));
lock_rec_discard(lock);
} else if (lock_get_type(lock) & LOCK_TABLE
- && lock->un_member.tab_lock.table == table) {
+ && lock->un_member.tab_lock.table == table) {
ut_a(!lock_get_wait(lock));
@@ -4075,7 +4095,7 @@ lock_table_print(
fputs("TABLE LOCK table ", file);
ut_print_name(file, lock->trx, TRUE,
- lock->un_member.tab_lock.table->name);
+ lock->un_member.tab_lock.table->name);
fprintf(file, " trx id %lu %lu",
(ulong) (lock->trx)->id.high, (ulong) (lock->trx)->id.low);
@@ -4090,7 +4110,8 @@ lock_table_print(
} else if (lock_get_mode(lock) == LOCK_AUTO_INC) {
fputs(" lock mode AUTO-INC", file);
} else {
- fprintf(file, " unknown lock mode %lu", (ulong) lock_get_mode(lock));
+ fprintf(file, " unknown lock mode %lu",
+ (ulong) lock_get_mode(lock));
}
if (lock_get_wait(lock)) {
@@ -4168,8 +4189,8 @@ lock_rec_print(
break the latching order */
page = buf_page_get_gen(space, page_no, RW_NO_LATCH,
- NULL, BUF_GET_IF_IN_POOL,
- __FILE__, __LINE__, &mtr);
+ NULL, BUF_GET_IF_IN_POOL,
+ __FILE__, __LINE__, &mtr);
if (page) {
page = buf_page_get_nowait(space, page_no, RW_S_LATCH, &mtr);
@@ -4179,7 +4200,7 @@ lock_rec_print(
S-latch. */
page = buf_page_get_nowait(space, page_no, RW_X_LATCH,
- &mtr);
+ &mtr);
}
}
@@ -4198,8 +4219,9 @@ lock_rec_print(
if (page) {
rec_t* rec
= page_find_rec_with_heap_no(page, i);
- offsets = rec_get_offsets(rec, lock->index,
- offsets, ULINT_UNDEFINED, &heap);
+ offsets = rec_get_offsets
+ (rec, lock->index, offsets,
+ ULINT_UNDEFINED, &heap);
rec_print_new(file, rec, offsets);
}
@@ -4259,36 +4281,35 @@ lock_print_info_summary(
lock_mutex_enter_kernel();
if (lock_deadlock_found) {
- fputs(
-"------------------------\n"
-"LATEST DETECTED DEADLOCK\n"
-"------------------------\n", file);
+ fputs("------------------------\n"
+ "LATEST DETECTED DEADLOCK\n"
+ "------------------------\n", file);
ut_copy_file(file, lock_latest_err_file);
}
- fputs(
-"------------\n"
-"TRANSACTIONS\n"
-"------------\n", file);
+ fputs("------------\n"
+ "TRANSACTIONS\n"
+ "------------\n", file);
fprintf(file, "Trx id counter %lu %lu\n",
(ulong) ut_dulint_get_high(trx_sys->max_trx_id),
(ulong) ut_dulint_get_low(trx_sys->max_trx_id));
fprintf(file,
- "Purge done for trx's n:o < %lu %lu undo n:o < %lu %lu\n",
+ "Purge done for trx's n:o < %lu %lu undo n:o < %lu %lu\n",
(ulong) ut_dulint_get_high(purge_sys->purge_trx_no),
(ulong) ut_dulint_get_low(purge_sys->purge_trx_no),
(ulong) ut_dulint_get_high(purge_sys->purge_undo_no),
(ulong) ut_dulint_get_low(purge_sys->purge_undo_no));
fprintf(file,
- "History list length %lu\n", (ulong) trx_sys->rseg_history_len);
+ "History list length %lu\n",
+ (ulong) trx_sys->rseg_history_len);
fprintf(file,
"Total number of lock structs in row lock hash table %lu\n",
- (ulong) lock_get_n_rec_locks());
+ (ulong) lock_get_n_rec_locks());
}
/*************************************************************************
@@ -4355,11 +4376,16 @@ loop:
if (trx->read_view) {
fprintf(file,
-"Trx read view will not see trx with id >= %lu %lu, sees < %lu %lu\n",
- (ulong) ut_dulint_get_high(trx->read_view->low_limit_id),
- (ulong) ut_dulint_get_low(trx->read_view->low_limit_id),
- (ulong) ut_dulint_get_high(trx->read_view->up_limit_id),
- (ulong) ut_dulint_get_low(trx->read_view->up_limit_id));
+ "Trx read view will not see trx with"
+ " id >= %lu %lu, sees < %lu %lu\n",
+ (ulong) ut_dulint_get_high
+ (trx->read_view->low_limit_id),
+ (ulong) ut_dulint_get_low
+ (trx->read_view->low_limit_id),
+ (ulong) ut_dulint_get_high
+ (trx->read_view->up_limit_id),
+ (ulong) ut_dulint_get_low
+ (trx->read_view->up_limit_id));
}
fprintf(file,
@@ -4368,8 +4394,10 @@ loop:
if (trx->que_state == TRX_QUE_LOCK_WAIT) {
fprintf(file,
- "------- TRX HAS BEEN WAITING %lu SEC FOR THIS LOCK TO BE GRANTED:\n",
- (ulong)difftime(time(NULL), trx->wait_started));
+ "------- TRX HAS BEEN WAITING %lu SEC"
+ " FOR THIS LOCK TO BE GRANTED:\n",
+ (ulong) difftime(time(NULL),
+ trx->wait_started));
if (lock_get_type(trx->wait_lock) == LOCK_REC) {
lock_rec_print(file, trx->wait_lock);
@@ -4415,7 +4443,8 @@ loop:
mtr_start(&mtr);
- page = buf_page_get_with_no_latch(space, page_no, &mtr);
+ page = buf_page_get_with_no_latch
+ (space, page_no, &mtr);
mtr_commit(&mtr);
@@ -4439,9 +4468,9 @@ loop:
nth_lock++;
if (nth_lock >= 10) {
- fputs(
- "10 LOCKS PRINTED FOR THIS TRX: SUPPRESSING FURTHER PRINTS\n",
- file);
+ fputs("10 LOCKS PRINTED FOR THIS TRX:"
+ " SUPPRESSING FURTHER PRINTS\n",
+ file);
nth_trx++;
nth_lock = 0;
@@ -4474,15 +4503,15 @@ lock_table_queue_validate(
while (lock) {
ut_a(((lock->trx)->conc_state == TRX_ACTIVE)
- || ((lock->trx)->conc_state == TRX_PREPARED)
- || ((lock->trx)->conc_state == TRX_COMMITTED_IN_MEMORY));
+ || ((lock->trx)->conc_state == TRX_PREPARED)
+ || ((lock->trx)->conc_state == TRX_COMMITTED_IN_MEMORY));
if (!lock_get_wait(lock)) {
ut_a(!is_waiting);
- ut_a(!lock_table_other_has_incompatible(lock->trx, 0,
- table, lock_get_mode(lock)));
+ ut_a(!lock_table_other_has_incompatible
+ (lock->trx, 0, table, lock_get_mode(lock)));
} else {
is_waiting = TRUE;
@@ -4520,9 +4549,14 @@ lock_rec_queue_validate(
lock = lock_rec_get_first(rec);
while (lock) {
- ut_a(lock->trx->conc_state == TRX_ACTIVE
- || lock->trx->conc_state == TRX_PREPARED
- || lock->trx->conc_state == TRX_COMMITTED_IN_MEMORY);
+ switch(lock->trx->conc_state) {
+ case TRX_ACTIVE:
+ case TRX_PREPARED:
+ case TRX_COMMITTED_IN_MEMORY:
+ break;
+ default:
+ ut_error;
+ }
ut_a(trx_in_trx_list(lock->trx));
@@ -4546,11 +4580,11 @@ lock_rec_queue_validate(
impl_trx = lock_clust_rec_some_has_impl(rec, index, offsets);
- if (impl_trx && lock_rec_other_has_expl_req(LOCK_S, 0,
- LOCK_WAIT, rec, impl_trx)) {
+ if (impl_trx && lock_rec_other_has_expl_req
+ (LOCK_S, 0, LOCK_WAIT, rec, impl_trx)) {
- ut_a(lock_rec_has_expl(LOCK_X | LOCK_REC_NOT_GAP, rec,
- impl_trx));
+ ut_a(lock_rec_has_expl(LOCK_X | LOCK_REC_NOT_GAP,
+ rec, impl_trx));
}
}
@@ -4560,14 +4594,14 @@ lock_rec_queue_validate(
next function call: we have to release lock table mutex
to obey the latching order */
- impl_trx = lock_sec_rec_some_has_impl_off_kernel(
- rec, index, offsets);
+ impl_trx = lock_sec_rec_some_has_impl_off_kernel
+ (rec, index, offsets);
- if (impl_trx && lock_rec_other_has_expl_req(LOCK_S, 0,
- LOCK_WAIT, rec, impl_trx)) {
+ if (impl_trx && lock_rec_other_has_expl_req
+ (LOCK_S, 0, LOCK_WAIT, rec, impl_trx)) {
ut_a(lock_rec_has_expl(LOCK_X | LOCK_REC_NOT_GAP,
- rec, impl_trx));
+ rec, impl_trx));
}
}
@@ -4575,8 +4609,8 @@ lock_rec_queue_validate(
while (lock) {
ut_a(lock->trx->conc_state == TRX_ACTIVE
- || lock->trx->conc_state == TRX_PREPARED
- || lock->trx->conc_state == TRX_COMMITTED_IN_MEMORY);
+ || lock->trx->conc_state == TRX_PREPARED
+ || lock->trx->conc_state == TRX_COMMITTED_IN_MEMORY);
ut_a(trx_in_trx_list(lock->trx));
if (index) {
@@ -4592,8 +4626,8 @@ lock_rec_queue_validate(
} else {
mode = LOCK_S;
}
- ut_a(!lock_rec_other_has_expl_req(mode,
- 0, 0, rec, lock->trx));
+ ut_a(!lock_rec_other_has_expl_req
+ (mode, 0, 0, rec, lock->trx));
} else if (lock_get_wait(lock) && !lock_rec_get_gap(lock)) {
@@ -4661,8 +4695,8 @@ loop:
ut_a(trx_in_trx_list(lock->trx));
ut_a(lock->trx->conc_state == TRX_ACTIVE
- || lock->trx->conc_state == TRX_PREPARED
- || lock->trx->conc_state == TRX_COMMITTED_IN_MEMORY);
+ || lock->trx->conc_state == TRX_PREPARED
+ || lock->trx->conc_state == TRX_COMMITTED_IN_MEMORY);
for (i = nth_bit; i < lock_rec_get_n_bits(lock); i++) {
@@ -4671,10 +4705,11 @@ loop:
index = lock->index;
rec = page_find_rec_with_heap_no(page, i);
offsets = rec_get_offsets(rec, index, offsets,
- ULINT_UNDEFINED, &heap);
+ ULINT_UNDEFINED, &heap);
fprintf(stderr,
- "Validating %lu %lu\n", (ulong) space, (ulong) page_no);
+ "Validating %lu %lu\n",
+ (ulong) space, (ulong) page_no);
lock_mutex_exit_kernel();
@@ -4729,8 +4764,8 @@ lock_validate(void)
while (lock) {
if (lock_get_type(lock) & LOCK_TABLE) {
- lock_table_queue_validate(
- lock->un_member.tab_lock.table);
+ lock_table_queue_validate
+ (lock->un_member.tab_lock.table);
}
lock = UT_LIST_GET_NEXT(trx_locks, lock);
@@ -4752,9 +4787,9 @@ lock_validate(void)
space = lock->un_member.rec_lock.space;
page_no = lock->un_member.rec_lock.page_no;
- if (ut_dulint_cmp(
- ut_dulint_create(space, page_no),
- limit) >= 0) {
+ if (ut_dulint_cmp
+ (ut_dulint_create(space, page_no),
+ limit) >= 0) {
break;
}
@@ -4836,7 +4871,7 @@ lock_rec_insert_check_and_lock(
/* Update the page max trx id field */
page_update_max_trx_id(buf_frame_align(rec),
- thr_get_trx(thr)->id);
+ thr_get_trx(thr)->id);
}
return(DB_SUCCESS);
@@ -4854,13 +4889,13 @@ lock_rec_insert_check_and_lock(
had to wait for their insert. Both had waiting gap type lock requests
on the successor, which produced an unnecessary deadlock. */
- if (lock_rec_other_has_conflicting(LOCK_X | LOCK_GAP
- | LOCK_INSERT_INTENTION, next_rec, trx)) {
+ if (lock_rec_other_has_conflicting
+ (LOCK_X | LOCK_GAP | LOCK_INSERT_INTENTION, next_rec, trx)) {
/* Note that we may get DB_SUCCESS also here! */
err = lock_rec_enqueue_waiting(LOCK_X | LOCK_GAP
- | LOCK_INSERT_INTENTION,
- next_rec, index, thr);
+ | LOCK_INSERT_INTENTION,
+ next_rec, index, thr);
} else {
err = DB_SUCCESS;
}
@@ -4871,7 +4906,7 @@ lock_rec_insert_check_and_lock(
/* Update the page max trx id field */
page_update_max_trx_id(buf_frame_align(rec),
- thr_get_trx(thr)->id);
+ thr_get_trx(thr)->id);
}
#ifdef UNIV_DEBUG
@@ -4882,7 +4917,7 @@ lock_rec_insert_check_and_lock(
*offsets_ = (sizeof offsets_) / sizeof *offsets_;
offsets = rec_get_offsets(next_rec, index, offsets_,
- ULINT_UNDEFINED, &heap);
+ ULINT_UNDEFINED, &heap);
ut_ad(lock_rec_queue_validate(next_rec, index, offsets));
if (UNIV_LIKELY_NULL(heap)) {
mem_heap_free(heap);
@@ -4917,8 +4952,8 @@ lock_rec_convert_impl_to_expl(
if (index->type & DICT_CLUSTERED) {
impl_trx = lock_clust_rec_some_has_impl(rec, index, offsets);
} else {
- impl_trx = lock_sec_rec_some_has_impl_off_kernel(
- rec, index, offsets);
+ impl_trx = lock_sec_rec_some_has_impl_off_kernel
+ (rec, index, offsets);
}
if (impl_trx) {
@@ -4926,10 +4961,11 @@ lock_rec_convert_impl_to_expl(
record, set one for it */
if (!lock_rec_has_expl(LOCK_X | LOCK_REC_NOT_GAP, rec,
- impl_trx)) {
+ impl_trx)) {
- lock_rec_add_to_queue(LOCK_REC | LOCK_X
- | LOCK_REC_NOT_GAP, rec, index, impl_trx);
+ lock_rec_add_to_queue
+ (LOCK_REC | LOCK_X | LOCK_REC_NOT_GAP,
+ rec, index, impl_trx);
}
}
}
@@ -5030,7 +5066,7 @@ lock_sec_rec_modify_check_and_lock(
*offsets_ = (sizeof offsets_) / sizeof *offsets_;
offsets = rec_get_offsets(rec, index, offsets_,
- ULINT_UNDEFINED, &heap);
+ ULINT_UNDEFINED, &heap);
ut_ad(lock_rec_queue_validate(rec, index, offsets));
if (UNIV_LIKELY_NULL(heap)) {
mem_heap_free(heap);
@@ -5042,7 +5078,7 @@ lock_sec_rec_modify_check_and_lock(
/* Update the page max trx id field */
page_update_max_trx_id(buf_frame_align(rec),
- thr_get_trx(thr)->id);
+ thr_get_trx(thr)->id);
}
return(err);
@@ -5085,18 +5121,18 @@ lock_sec_rec_read_check_and_lock(
lock_mutex_enter_kernel();
ut_ad(mode != LOCK_X
- || lock_table_has(thr_get_trx(thr), index->table, LOCK_IX));
+ || lock_table_has(thr_get_trx(thr), index->table, LOCK_IX));
ut_ad(mode != LOCK_S
- || lock_table_has(thr_get_trx(thr), index->table, LOCK_IS));
+ || lock_table_has(thr_get_trx(thr), index->table, LOCK_IS));
/* Some transaction may have an implicit x-lock on the record only
if the max trx id for the page >= min trx id for the trx list or a
database recovery is running. */
if (((ut_dulint_cmp(page_get_max_trx_id(buf_frame_align(rec)),
- trx_list_get_min_trx_id()) >= 0)
- || recv_recovery_is_on())
- && !page_rec_is_supremum(rec)) {
+ trx_list_get_min_trx_id()) >= 0)
+ || recv_recovery_is_on())
+ && !page_rec_is_supremum(rec)) {
lock_rec_convert_impl_to_expl(rec, index, offsets);
}
@@ -5142,7 +5178,7 @@ lock_clust_rec_read_check_and_lock(
ut_ad(index->type & DICT_CLUSTERED);
ut_ad(page_rec_is_user_rec(rec) || page_rec_is_supremum(rec));
ut_ad(gap_mode == LOCK_ORDINARY || gap_mode == LOCK_GAP
- || gap_mode == LOCK_REC_NOT_GAP);
+ || gap_mode == LOCK_REC_NOT_GAP);
ut_ad(rec_offs_validate(rec, index, offsets));
if (flags & BTR_NO_LOCKING_FLAG) {
@@ -5153,9 +5189,9 @@ lock_clust_rec_read_check_and_lock(
lock_mutex_enter_kernel();
ut_ad(mode != LOCK_X
- || lock_table_has(thr_get_trx(thr), index->table, LOCK_IX));
+ || lock_table_has(thr_get_trx(thr), index->table, LOCK_IX));
ut_ad(mode != LOCK_S
- || lock_table_has(thr_get_trx(thr), index->table, LOCK_IS));
+ || lock_table_has(thr_get_trx(thr), index->table, LOCK_IS));
if (!page_rec_is_supremum(rec)) {
@@ -5205,9 +5241,9 @@ lock_clust_rec_read_check_and_lock_alt(
*offsets_ = (sizeof offsets_) / sizeof *offsets_;
offsets = rec_get_offsets(rec, index, offsets,
- ULINT_UNDEFINED, &tmp_heap);
+ ULINT_UNDEFINED, &tmp_heap);
ret = lock_clust_rec_read_check_and_lock(flags, rec, index,
- offsets, mode, gap_mode, thr);
+ offsets, mode, gap_mode, thr);
if (tmp_heap) {
mem_heap_free(tmp_heap);
}
diff --git a/storage/innobase/log/log0log.c b/storage/innobase/log/log0log.c
index 2351c6055de..9ac9e40466c 100644
--- a/storage/innobase/log/log0log.c
+++ b/storage/innobase/log/log0log.c
@@ -228,9 +228,9 @@ loop:
if (log->archiving_state != LOG_ARCH_OFF) {
archived_lsn_age = ut_dulint_minus(log->lsn,
- log->archived_lsn);
+ log->archived_lsn);
if (archived_lsn_age + len_upper_limit
- > log->max_archived_lsn_age) {
+ > log->max_archived_lsn_age) {
/* Not enough free archived space in log groups: do a
synchronous archive write batch: */
@@ -296,14 +296,14 @@ part_loop:
str = str + len;
log_block = ut_align_down(log->buf + log->buf_free,
- OS_FILE_LOG_BLOCK_SIZE);
+ OS_FILE_LOG_BLOCK_SIZE);
log_block_set_data_len(log_block, data_len);
if (data_len == OS_FILE_LOG_BLOCK_SIZE - LOG_BLOCK_TRL_SIZE) {
/* This block became full */
log_block_set_data_len(log_block, OS_FILE_LOG_BLOCK_SIZE);
log_block_set_checkpoint_no(log_block,
- log_sys->next_checkpoint_no);
+ log_sys->next_checkpoint_no);
len += LOG_BLOCK_HDR_SIZE + LOG_BLOCK_TRL_SIZE;
log->lsn = ut_dulint_add(log->lsn, len);
@@ -347,7 +347,7 @@ log_close(void)
lsn = log->lsn;
log_block = ut_align_down(log->buf + log->buf_free,
- OS_FILE_LOG_BLOCK_SIZE);
+ OS_FILE_LOG_BLOCK_SIZE);
first_rec_group = log_block_get_first_rec_group(log_block);
if (first_rec_group == 0) {
@@ -355,8 +355,8 @@ log_close(void)
full by the current mtr: the next mtr log record group
will start within this block at the offset data_len */
- log_block_set_first_rec_group(log_block,
- log_block_get_data_len(log_block));
+ log_block_set_first_rec_group
+ (log_block, log_block_get_data_len(log_block));
}
if (log->buf_free > log->max_buf_free) {
@@ -374,18 +374,22 @@ log_close(void)
big_rec operations, but other operations are smaller. */
if (!log_has_printed_chkp_warning
- || difftime(time(NULL), log_last_warning_time) > 15) {
+ || difftime(time(NULL), log_last_warning_time) > 15) {
log_has_printed_chkp_warning = TRUE;
log_last_warning_time = time(NULL);
ut_print_timestamp(stderr);
fprintf(stderr,
-" InnoDB: ERROR: the age of the last checkpoint is %lu,\n"
-"InnoDB: which exceeds the log group capacity %lu.\n"
-"InnoDB: If you are using big BLOB or TEXT rows, you must set the\n"
-"InnoDB: combined size of log files at least 10 times bigger than the\n"
-"InnoDB: largest such row.\n",
+ " InnoDB: ERROR: the age of the last"
+ " checkpoint is %lu,\n"
+ "InnoDB: which exceeds the log group"
+ " capacity %lu.\n"
+ "InnoDB: If you are using big"
+ " BLOB or TEXT rows, you must set the\n"
+ "InnoDB: combined size of log files"
+ " at least 10 times bigger than the\n"
+ "InnoDB: largest such row.\n",
(ulong) checkpoint_age,
(ulong) log->log_group_capacity);
}
@@ -399,9 +403,9 @@ log_close(void)
oldest_lsn = buf_pool_get_oldest_modification();
if (ut_dulint_is_zero(oldest_lsn)
- || (ut_dulint_minus(lsn, oldest_lsn)
- > log->max_modified_age_async)
- || checkpoint_age > log->max_checkpoint_age_async) {
+ || (ut_dulint_minus(lsn, oldest_lsn)
+ > log->max_modified_age_async)
+ || checkpoint_age > log->max_checkpoint_age_async) {
log->check_flush_or_checkpoint = TRUE;
}
@@ -409,7 +413,7 @@ function_exit:
#ifdef UNIV_LOG_DEBUG
log_check_log_recs(log->buf + log->old_buf_free,
- log->buf_free - log->old_buf_free, log->old_lsn);
+ log->buf_free - log->old_buf_free, log->old_lsn);
#endif
return(lsn);
@@ -433,8 +437,8 @@ log_pad_current_log_block(void)
lsn = log_reserve_and_open(OS_FILE_LOG_BLOCK_SIZE);
pad_length = OS_FILE_LOG_BLOCK_SIZE
- - (log_sys->buf_free % OS_FILE_LOG_BLOCK_SIZE)
- - LOG_BLOCK_TRL_SIZE;
+ - (log_sys->buf_free % OS_FILE_LOG_BLOCK_SIZE)
+ - LOG_BLOCK_TRL_SIZE;
for (i = 0; i < pad_length; i++) {
log_write_low(&b, 1);
@@ -446,7 +450,7 @@ log_pad_current_log_block(void)
log_release();
ut_a((ut_dulint_get_low(lsn) % OS_FILE_LOG_BLOCK_SIZE)
- == LOG_BLOCK_HDR_SIZE);
+ == LOG_BLOCK_HDR_SIZE);
}
#endif /* UNIV_LOG_ARCHIVE */
@@ -501,7 +505,7 @@ log_group_calc_real_offset(
#endif /* UNIV_SYNC_DEBUG */
return(offset + LOG_FILE_HDR_SIZE
- * (1 + offset / (group->file_size - LOG_FILE_HDR_SIZE)));
+ * (1 + offset / (group->file_size - LOG_FILE_HDR_SIZE)));
}
/**********************************************************
@@ -551,8 +555,8 @@ log_group_calc_lsn_offset(
ut_a(offset < (((ib_longlong) 1) << 32)); /* offset must be < 4 GB */
/* fprintf(stderr,
- "Offset is %lu gr_lsn_offset is %lu difference is %lu\n",
- (ulint)offset,(ulint)gr_lsn_size_offset, (ulint)difference);
+ "Offset is %lu gr_lsn_offset is %lu difference is %lu\n",
+ (ulint)offset,(ulint)gr_lsn_size_offset, (ulint)difference);
*/
return(log_group_calc_real_offset((ulint)offset, group));
@@ -587,15 +591,15 @@ log_calc_where_lsn_is(
if (ib_lsn < ib_first_header_lsn) {
add_this_many = 1 + (ib_first_header_lsn - ib_lsn)
- / (capacity * (ib_longlong)n_log_files);
+ / (capacity * (ib_longlong)n_log_files);
ib_lsn += add_this_many
- * capacity * (ib_longlong)n_log_files;
+ * capacity * (ib_longlong)n_log_files;
}
ut_a(ib_lsn >= ib_first_header_lsn);
file_no = ((ulint)((ib_lsn - ib_first_header_lsn) / capacity))
- % n_log_files;
+ % n_log_files;
*log_file_offset = (ib_lsn - ib_first_header_lsn) % capacity;
*log_file_offset = *log_file_offset + LOG_FILE_HDR_SIZE;
@@ -658,8 +662,8 @@ log_calc_max_ages(void)
}
archive_margin = log_group_get_capacity(group)
- - (group->file_size - LOG_FILE_HDR_SIZE)
- - LOG_ARCHIVE_EXTRA_MARGIN;
+ - (group->file_size - LOG_FILE_HDR_SIZE)
+ - LOG_ARCHIVE_EXTRA_MARGIN;
if (archive_margin < smallest_archive_margin) {
@@ -678,7 +682,7 @@ log_calc_max_ages(void)
system error which requires rebooting the database. */
free = LOG_CHECKPOINT_FREE_PER_THREAD * (10 + srv_thread_concurrency)
- + LOG_CHECKPOINT_EXTRA_FREE;
+ + LOG_CHECKPOINT_EXTRA_FREE;
if (free >= smallest_capacity / 2) {
success = FALSE;
@@ -694,34 +698,40 @@ log_calc_max_ages(void)
log_sys->log_group_capacity = smallest_capacity;
log_sys->max_modified_age_async = margin
- - margin / LOG_POOL_PREFLUSH_RATIO_ASYNC;
+ - margin / LOG_POOL_PREFLUSH_RATIO_ASYNC;
log_sys->max_modified_age_sync = margin
- - margin / LOG_POOL_PREFLUSH_RATIO_SYNC;
+ - margin / LOG_POOL_PREFLUSH_RATIO_SYNC;
log_sys->max_checkpoint_age_async = margin - margin
- / LOG_POOL_CHECKPOINT_RATIO_ASYNC;
+ / LOG_POOL_CHECKPOINT_RATIO_ASYNC;
log_sys->max_checkpoint_age = margin;
#ifdef UNIV_LOG_ARCHIVE
log_sys->max_archived_lsn_age = smallest_archive_margin;
log_sys->max_archived_lsn_age_async = smallest_archive_margin
- - smallest_archive_margin /
- LOG_ARCHIVE_RATIO_ASYNC;
+ - smallest_archive_margin / LOG_ARCHIVE_RATIO_ASYNC;
#endif /* UNIV_LOG_ARCHIVE */
failure:
mutex_exit(&(log_sys->mutex));
if (!success) {
fprintf(stderr,
-"InnoDB: Error: ib_logfiles are too small for innodb_thread_concurrency %lu.\n"
-"InnoDB: The combined size of ib_logfiles should be bigger than\n"
-"InnoDB: 200 kB * innodb_thread_concurrency.\n"
-"InnoDB: To get mysqld to start up, set innodb_thread_concurrency in my.cnf\n"
-"InnoDB: to a lower value, for example, to 8. After an ERROR-FREE shutdown\n"
-"InnoDB: of mysqld you can adjust the size of ib_logfiles, as explained in\n"
-"InnoDB: http://dev.mysql.com/doc/refman/5.1/en/adding-and-removing.html\n"
-"InnoDB: Cannot continue operation. Calling exit(1).\n",
+ "InnoDB: Error: ib_logfiles are too small"
+ " for innodb_thread_concurrency %lu.\n"
+ "InnoDB: The combined size of ib_logfiles"
+ " should be bigger than\n"
+ "InnoDB: 200 kB * innodb_thread_concurrency.\n"
+ "InnoDB: To get mysqld to start up, set"
+ " innodb_thread_concurrency in my.cnf\n"
+ "InnoDB: to a lower value, for example, to 8."
+ " After an ERROR-FREE shutdown\n"
+ "InnoDB: of mysqld you can adjust the size of"
+ " ib_logfiles, as explained in\n"
+ "InnoDB: http://dev.mysql.com/doc/refman/5.1/en/"
+ "adding-and-removing.html\n"
+ "InnoDB: Cannot continue operation."
+ " Calling exit(1).\n",
(ulong)srv_thread_concurrency);
exit(1);
@@ -761,7 +771,7 @@ log_init(void)
memset(log_sys->buf, '\0', LOG_BUFFER_SIZE);
log_sys->max_buf_free = log_sys->buf_size / LOG_BUF_FLUSH_RATIO
- - LOG_BUF_FLUSH_MARGIN;
+ - LOG_BUF_FLUSH_MARGIN;
log_sys->check_flush_or_checkpoint = TRUE;
UT_LIST_INIT(log_sys->log_groups);
@@ -799,9 +809,9 @@ log_init(void)
rw_lock_create(&log_sys->checkpoint_lock, SYNC_NO_ORDER_CHECK);
- log_sys->checkpoint_buf = ut_align(
- mem_alloc(2 * OS_FILE_LOG_BLOCK_SIZE),
- OS_FILE_LOG_BLOCK_SIZE);
+ log_sys->checkpoint_buf
+ = ut_align(mem_alloc(2 * OS_FILE_LOG_BLOCK_SIZE),
+ OS_FILE_LOG_BLOCK_SIZE);
memset(log_sys->checkpoint_buf, '\0', OS_FILE_LOG_BLOCK_SIZE);
/*----------------------------*/
@@ -817,10 +827,10 @@ log_init(void)
log_sys->archive_buf = NULL;
- /* ut_align(
- ut_malloc(LOG_ARCHIVE_BUF_SIZE
- + OS_FILE_LOG_BLOCK_SIZE),
- OS_FILE_LOG_BLOCK_SIZE); */
+ /* ut_align(
+ ut_malloc(LOG_ARCHIVE_BUF_SIZE
+ + OS_FILE_LOG_BLOCK_SIZE),
+ OS_FILE_LOG_BLOCK_SIZE); */
log_sys->archive_buf_size = 0;
/* memset(log_sys->archive_buf, '\0', LOG_ARCHIVE_BUF_SIZE); */
@@ -890,19 +900,19 @@ log_group_init(
#endif /* UNIV_LOG_ARCHIVE */
for (i = 0; i < n_files; i++) {
- *(group->file_header_bufs + i) = ut_align(
- mem_alloc(LOG_FILE_HDR_SIZE + OS_FILE_LOG_BLOCK_SIZE),
- OS_FILE_LOG_BLOCK_SIZE);
+ *(group->file_header_bufs + i) = ut_align
+ (mem_alloc(LOG_FILE_HDR_SIZE + OS_FILE_LOG_BLOCK_SIZE),
+ OS_FILE_LOG_BLOCK_SIZE);
memset(*(group->file_header_bufs + i), '\0',
- LOG_FILE_HDR_SIZE);
+ LOG_FILE_HDR_SIZE);
#ifdef UNIV_LOG_ARCHIVE
- *(group->archive_file_header_bufs + i) = ut_align(
- mem_alloc(LOG_FILE_HDR_SIZE + OS_FILE_LOG_BLOCK_SIZE),
- OS_FILE_LOG_BLOCK_SIZE);
+ *(group->archive_file_header_bufs + i) = ut_align
+ (mem_alloc(LOG_FILE_HDR_SIZE + OS_FILE_LOG_BLOCK_SIZE),
+ OS_FILE_LOG_BLOCK_SIZE);
memset(*(group->archive_file_header_bufs + i), '\0',
- LOG_FILE_HDR_SIZE);
+ LOG_FILE_HDR_SIZE);
#endif /* UNIV_LOG_ARCHIVE */
}
@@ -913,9 +923,9 @@ log_group_init(
group->archived_offset = 0;
#endif /* UNIV_LOG_ARCHIVE */
- group->checkpoint_buf = ut_align(
- mem_alloc(2 * OS_FILE_LOG_BLOCK_SIZE),
- OS_FILE_LOG_BLOCK_SIZE);
+ group->checkpoint_buf = ut_align
+ (mem_alloc(2 * OS_FILE_LOG_BLOCK_SIZE),
+ OS_FILE_LOG_BLOCK_SIZE);
memset(group->checkpoint_buf, '\0', OS_FILE_LOG_BLOCK_SIZE);
@@ -944,7 +954,7 @@ log_flush_do_unlocks(
calling this function might be preempted for a while, and when it
resumed execution, it might be that a new flush had been started, and
this function would erroneously signal the NEW flush as completed.
- Thus, the changes in the state of these events are performed
+ Thus, the changes in the state of these events are performed
atomically in conjunction with the changes in the state of
log_sys->n_pending_writes etc. */
@@ -975,7 +985,8 @@ log_group_check_flush_completion(
#ifdef UNIV_DEBUG
if (log_debug_writes) {
fprintf(stderr,
- "Log flushed first to group %lu\n", (ulong) group->id);
+ "Log flushed first to group %lu\n",
+ (ulong) group->id);
}
#endif /* UNIV_DEBUG */
log_sys->written_to_some_lsn = log_sys->write_lsn;
@@ -987,7 +998,8 @@ log_group_check_flush_completion(
#ifdef UNIV_DEBUG
if (log_debug_writes && (group->n_pending_writes == 0)) {
- fprintf(stderr, "Log flushed to group %lu\n", (ulong) group->id);
+ fprintf(stderr, "Log flushed to group %lu\n",
+ (ulong) group->id);
}
#endif /* UNIV_DEBUG */
return(0);
@@ -1017,14 +1029,14 @@ log_sys_check_flush_completion(void)
/* Move the log buffer content to the start of the
buffer */
- move_start = ut_calc_align_down(
- log_sys->write_end_offset,
- OS_FILE_LOG_BLOCK_SIZE);
+ move_start = ut_calc_align_down
+ (log_sys->write_end_offset,
+ OS_FILE_LOG_BLOCK_SIZE);
move_end = ut_calc_align(log_sys->buf_free,
- OS_FILE_LOG_BLOCK_SIZE);
+ OS_FILE_LOG_BLOCK_SIZE);
ut_memmove(log_sys->buf, log_sys->buf + move_start,
- move_end - move_start);
+ move_end - move_start);
log_sys->buf_free -= move_start;
log_sys->buf_next_to_write -= move_start;
@@ -1061,7 +1073,7 @@ log_io_complete(
group = (log_group_t*)((ulint)group - 1);
if (srv_unix_file_flush_method != SRV_UNIX_O_DSYNC
- && srv_unix_file_flush_method != SRV_UNIX_NOSYNC) {
+ && srv_unix_file_flush_method != SRV_UNIX_NOSYNC) {
fil_flush(group->space_id);
}
@@ -1082,8 +1094,8 @@ log_io_complete(
logs and cannot end up here! */
if (srv_unix_file_flush_method != SRV_UNIX_O_DSYNC
- && srv_unix_file_flush_method != SRV_UNIX_NOSYNC
- && srv_flush_log_at_trx_commit != 2) {
+ && srv_unix_file_flush_method != SRV_UNIX_NOSYNC
+ && srv_flush_log_at_trx_commit != 2) {
fil_flush(group->space_id);
}
@@ -1147,10 +1159,10 @@ log_group_file_header_flush(
srv_os_log_pending_writes++;
fil_io(OS_FILE_WRITE | OS_FILE_LOG, TRUE, group->space_id,
- dest_offset / UNIV_PAGE_SIZE,
- dest_offset % UNIV_PAGE_SIZE,
- OS_FILE_LOG_BLOCK_SIZE,
- buf, group);
+ dest_offset / UNIV_PAGE_SIZE,
+ dest_offset % UNIV_PAGE_SIZE,
+ OS_FILE_LOG_BLOCK_SIZE,
+ buf, group);
srv_os_log_pending_writes--;
}
@@ -1212,11 +1224,12 @@ loop:
next_offset = log_group_calc_lsn_offset(start_lsn, group);
if ((next_offset % group->file_size == LOG_FILE_HDR_SIZE)
- && write_header) {
+ && write_header) {
/* We start to write a new log file instance in the group */
log_group_file_header_flush(group,
- next_offset / group->file_size, start_lsn);
+ next_offset / group->file_size,
+ start_lsn);
srv_os_log_written+= OS_FILE_LOG_BLOCK_SIZE;
srv_log_writes++;
}
@@ -1224,7 +1237,7 @@ loop:
if ((next_offset % group->file_size) + len > group->file_size) {
write_len = group->file_size
- - (next_offset % group->file_size);
+ - (next_offset % group->file_size);
} else {
write_len = len;
}
@@ -1233,24 +1246,25 @@ loop:
if (log_debug_writes) {
fprintf(stderr,
- "Writing log file segment to group %lu offset %lu len %lu\n"
- "start lsn %lu %lu\n"
- "First block n:o %lu last block n:o %lu\n",
+ "Writing log file segment to group %lu"
+ " offset %lu len %lu\n"
+ "start lsn %lu %lu\n"
+ "First block n:o %lu last block n:o %lu\n",
(ulong) group->id, (ulong) next_offset,
(ulong) write_len,
(ulong) ut_dulint_get_high(start_lsn),
(ulong) ut_dulint_get_low(start_lsn),
(ulong) log_block_get_hdr_no(buf),
- (ulong) log_block_get_hdr_no(
- buf + write_len - OS_FILE_LOG_BLOCK_SIZE));
+ (ulong) log_block_get_hdr_no
+ (buf + write_len - OS_FILE_LOG_BLOCK_SIZE));
ut_a(log_block_get_hdr_no(buf)
- == log_block_convert_lsn_to_no(start_lsn));
+ == log_block_convert_lsn_to_no(start_lsn));
for (i = 0; i < write_len / OS_FILE_LOG_BLOCK_SIZE; i++) {
ut_a(log_block_get_hdr_no(buf) + i
- == log_block_get_hdr_no(buf
- + i * OS_FILE_LOG_BLOCK_SIZE));
+ == log_block_get_hdr_no
+ (buf + i * OS_FILE_LOG_BLOCK_SIZE));
}
}
#endif /* UNIV_DEBUG */
@@ -1267,8 +1281,8 @@ loop:
srv_os_log_pending_writes++;
fil_io(OS_FILE_WRITE | OS_FILE_LOG, TRUE, group->space_id,
- next_offset / UNIV_PAGE_SIZE,
- next_offset % UNIV_PAGE_SIZE, write_len, buf, group);
+ next_offset / UNIV_PAGE_SIZE,
+ next_offset % UNIV_PAGE_SIZE, write_len, buf, group);
srv_os_log_pending_writes--;
@@ -1309,7 +1323,9 @@ log_write_up_to(
ulint end_offset;
ulint area_start;
ulint area_end;
- ulint loop_count;
+#ifdef UNIV_DEBUG
+ ulint loop_count = 0;
+#endif /* UNIV_DEBUG */
ulint unlock;
if (recv_no_ibuf_operations) {
@@ -1319,20 +1335,23 @@ log_write_up_to(
return;
}
- loop_count = 0;
loop:
+#ifdef UNIV_DEBUG
loop_count++;
ut_ad(loop_count < 5);
+# if 0
if (loop_count > 2) {
-/* fprintf(stderr, "Log loop count %lu\n", loop_count); */
+ fprintf(stderr, "Log loop count %lu\n", loop_count);
}
+# endif
+#endif
mutex_enter(&(log_sys->mutex));
if (flush_to_disk
- && ut_dulint_cmp(log_sys->flushed_to_disk_lsn, lsn) >= 0) {
+ && ut_dulint_cmp(log_sys->flushed_to_disk_lsn, lsn) >= 0) {
mutex_exit(&(log_sys->mutex));
@@ -1340,10 +1359,10 @@ loop:
}
if (!flush_to_disk
- && (ut_dulint_cmp(log_sys->written_to_all_lsn, lsn) >= 0
- || (ut_dulint_cmp(log_sys->written_to_some_lsn, lsn)
- >= 0
- && wait != LOG_WAIT_ALL_GROUPS))) {
+ && (ut_dulint_cmp(log_sys->written_to_all_lsn, lsn) >= 0
+ || (ut_dulint_cmp(log_sys->written_to_some_lsn, lsn)
+ >= 0
+ && wait != LOG_WAIT_ALL_GROUPS))) {
mutex_exit(&(log_sys->mutex));
@@ -1354,8 +1373,8 @@ loop:
/* A write (+ possibly flush to disk) is running */
if (flush_to_disk
- && ut_dulint_cmp(log_sys->current_flush_lsn, lsn)
- >= 0) {
+ && ut_dulint_cmp(log_sys->current_flush_lsn, lsn)
+ >= 0) {
/* The write + flush will write enough: wait for it to
complete */
@@ -1363,7 +1382,7 @@ loop:
}
if (!flush_to_disk
- && ut_dulint_cmp(log_sys->write_lsn, lsn) >= 0) {
+ && ut_dulint_cmp(log_sys->write_lsn, lsn) >= 0) {
/* The write will write enough: wait for it to
complete */
@@ -1381,7 +1400,7 @@ loop:
}
if (!flush_to_disk
- && log_sys->buf_free == log_sys->buf_next_to_write) {
+ && log_sys->buf_free == log_sys->buf_next_to_write) {
/* Nothing to write and no flush to disk requested */
mutex_exit(&(log_sys->mutex));
@@ -1393,8 +1412,10 @@ loop:
if (log_debug_writes) {
fprintf(stderr,
"Writing log from %lu %lu up to lsn %lu %lu\n",
- (ulong) ut_dulint_get_high(log_sys->written_to_all_lsn),
- (ulong) ut_dulint_get_low(log_sys->written_to_all_lsn),
+ (ulong) ut_dulint_get_high
+ (log_sys->written_to_all_lsn),
+ (ulong) ut_dulint_get_low
+ (log_sys->written_to_all_lsn),
(ulong) ut_dulint_get_high(log_sys->lsn),
(ulong) ut_dulint_get_low(log_sys->lsn));
}
@@ -1425,17 +1446,17 @@ loop:
log_sys->one_flushed = FALSE;
log_block_set_flush_bit(log_sys->buf + area_start, TRUE);
- log_block_set_checkpoint_no(
- log_sys->buf + area_end - OS_FILE_LOG_BLOCK_SIZE,
- log_sys->next_checkpoint_no);
+ log_block_set_checkpoint_no
+ (log_sys->buf + area_end - OS_FILE_LOG_BLOCK_SIZE,
+ log_sys->next_checkpoint_no);
/* Copy the last, incompletely written, log block a log block length
up, so that when the flush operation writes from the log buffer, the
segment to write will not be changed by writers to the log */
ut_memcpy(log_sys->buf + area_end,
- log_sys->buf + area_end - OS_FILE_LOG_BLOCK_SIZE,
- OS_FILE_LOG_BLOCK_SIZE);
+ log_sys->buf + area_end - OS_FILE_LOG_BLOCK_SIZE,
+ OS_FILE_LOG_BLOCK_SIZE);
log_sys->buf_free += OS_FILE_LOG_BLOCK_SIZE;
log_sys->write_end_offset = log_sys->buf_free;
@@ -1445,12 +1466,12 @@ loop:
/* Do the write to the log files */
while (group) {
- log_group_write_buf(group,
- log_sys->buf + area_start,
- area_end - area_start,
- ut_dulint_align_down(log_sys->written_to_all_lsn,
- OS_FILE_LOG_BLOCK_SIZE),
- start_offset - area_start);
+ log_group_write_buf
+ (group, log_sys->buf + area_start,
+ area_end - area_start,
+ ut_dulint_align_down(log_sys->written_to_all_lsn,
+ OS_FILE_LOG_BLOCK_SIZE),
+ start_offset - area_start);
log_group_set_fields(group, log_sys->write_lsn);
@@ -1612,7 +1633,7 @@ log_complete_checkpoint(void)
ut_ad(log_sys->n_pending_checkpoint_writes == 0);
log_sys->next_checkpoint_no
- = ut_dulint_add(log_sys->next_checkpoint_no, 1);
+ = ut_dulint_add(log_sys->next_checkpoint_no, 1);
log_sys->last_checkpoint_lsn = log_sys->next_checkpoint_lsn;
@@ -1672,9 +1693,9 @@ log_checkpoint_get_nth_group_info(
ut_ad(n < LOG_MAX_N_GROUPS);
*file_no = mach_read_from_4(buf + LOG_CHECKPOINT_GROUP_ARRAY
- + 8 * n + LOG_CHECKPOINT_ARCHIVED_FILE_NO);
+ + 8 * n + LOG_CHECKPOINT_ARCHIVED_FILE_NO);
*offset = mach_read_from_4(buf + LOG_CHECKPOINT_GROUP_ARRAY
- + 8 * n + LOG_CHECKPOINT_ARCHIVED_OFFSET);
+ + 8 * n + LOG_CHECKPOINT_ARCHIVED_OFFSET);
}
/**********************************************************
@@ -1706,11 +1727,11 @@ log_group_checkpoint(
mach_write_to_8(buf + LOG_CHECKPOINT_NO, log_sys->next_checkpoint_no);
mach_write_to_8(buf + LOG_CHECKPOINT_LSN,
- log_sys->next_checkpoint_lsn);
+ log_sys->next_checkpoint_lsn);
mach_write_to_4(buf + LOG_CHECKPOINT_OFFSET,
- log_group_calc_lsn_offset(
- log_sys->next_checkpoint_lsn, group));
+ log_group_calc_lsn_offset
+ (log_sys->next_checkpoint_lsn, group));
mach_write_to_4(buf + LOG_CHECKPOINT_LOG_BUF_SIZE, log_sys->buf_size);
@@ -1721,7 +1742,7 @@ log_group_checkpoint(
archived_lsn = log_sys->archived_lsn;
if (0 != ut_dulint_cmp(archived_lsn,
- log_sys->next_archived_lsn)) {
+ log_sys->next_archived_lsn)) {
next_archived_lsn = log_sys->next_archived_lsn;
/* For debugging only */
}
@@ -1741,12 +1762,12 @@ log_group_checkpoint(
while (group2) {
log_checkpoint_set_nth_group_info(buf, group2->id,
#ifdef UNIV_LOG_ARCHIVE
- group2->archived_file_no,
- group2->archived_offset
+ group2->archived_file_no,
+ group2->archived_offset
#else /* UNIV_LOG_ARCHIVE */
- 0, 0
+ 0, 0
#endif /* UNIV_LOG_ARCHIVE */
- );
+ );
group2 = UT_LIST_GET_NEXT(log_groups, group2);
}
@@ -1755,17 +1776,17 @@ log_group_checkpoint(
mach_write_to_4(buf + LOG_CHECKPOINT_CHECKSUM_1, fold);
fold = ut_fold_binary(buf + LOG_CHECKPOINT_LSN,
- LOG_CHECKPOINT_CHECKSUM_2 - LOG_CHECKPOINT_LSN);
+ LOG_CHECKPOINT_CHECKSUM_2 - LOG_CHECKPOINT_LSN);
mach_write_to_4(buf + LOG_CHECKPOINT_CHECKSUM_2, fold);
/* Starting from InnoDB-3.23.50, we also write info on allocated
size in the tablespace */
mach_write_to_4(buf + LOG_CHECKPOINT_FSP_FREE_LIMIT,
- log_fsp_current_free_limit);
+ log_fsp_current_free_limit);
mach_write_to_4(buf + LOG_CHECKPOINT_FSP_MAGIC_N,
- LOG_CHECKPOINT_FSP_MAGIC_N_VAL);
+ LOG_CHECKPOINT_FSP_MAGIC_N_VAL);
/* We alternate the physical place of the checkpoint info in the first
log file */
@@ -1780,7 +1801,7 @@ log_group_checkpoint(
if (log_sys->n_pending_checkpoint_writes == 0) {
rw_lock_x_lock_gen(&(log_sys->checkpoint_lock),
- LOG_CHECKPOINT);
+ LOG_CHECKPOINT);
}
log_sys->n_pending_checkpoint_writes++;
@@ -1792,10 +1813,10 @@ log_group_checkpoint(
file write and a checkpoint field write */
fil_io(OS_FILE_WRITE | OS_FILE_LOG, FALSE, group->space_id,
- write_offset / UNIV_PAGE_SIZE,
- write_offset % UNIV_PAGE_SIZE,
- OS_FILE_LOG_BLOCK_SIZE,
- buf, ((byte*)group + 1));
+ write_offset / UNIV_PAGE_SIZE,
+ write_offset % UNIV_PAGE_SIZE,
+ OS_FILE_LOG_BLOCK_SIZE,
+ buf, ((byte*)group + 1));
ut_ad(((ulint)group & 0x1UL) == 0);
}
@@ -1825,17 +1846,17 @@ log_reset_first_header_and_checkpoint(
/* Write the label of ibbackup --restore */
strcpy((char*) hdr_buf + LOG_FILE_WAS_CREATED_BY_HOT_BACKUP,
- "ibbackup ");
- ut_sprintf_timestamp(
- (char*) hdr_buf + (LOG_FILE_WAS_CREATED_BY_HOT_BACKUP
- + (sizeof "ibbackup ") - 1));
+ "ibbackup ");
+ ut_sprintf_timestamp((char*) hdr_buf
+ + (LOG_FILE_WAS_CREATED_BY_HOT_BACKUP
+ + (sizeof "ibbackup ") - 1));
buf = hdr_buf + LOG_CHECKPOINT_1;
mach_write_to_8(buf + LOG_CHECKPOINT_NO, ut_dulint_zero);
mach_write_to_8(buf + LOG_CHECKPOINT_LSN, lsn);
mach_write_to_4(buf + LOG_CHECKPOINT_OFFSET,
- LOG_FILE_HDR_SIZE + LOG_BLOCK_HDR_SIZE);
+ LOG_FILE_HDR_SIZE + LOG_BLOCK_HDR_SIZE);
mach_write_to_4(buf + LOG_CHECKPOINT_LOG_BUF_SIZE, 2 * 1024 * 1024);
@@ -1845,7 +1866,7 @@ log_reset_first_header_and_checkpoint(
mach_write_to_4(buf + LOG_CHECKPOINT_CHECKSUM_1, fold);
fold = ut_fold_binary(buf + LOG_CHECKPOINT_LSN,
- LOG_CHECKPOINT_CHECKSUM_2 - LOG_CHECKPOINT_LSN);
+ LOG_CHECKPOINT_CHECKSUM_2 - LOG_CHECKPOINT_LSN);
mach_write_to_4(buf + LOG_CHECKPOINT_CHECKSUM_2, fold);
/* Starting from InnoDB-3.23.50, we should also write info on
@@ -1869,8 +1890,8 @@ log_group_read_checkpoint_info(
log_sys->n_log_ios++;
fil_io(OS_FILE_READ | OS_FILE_LOG, TRUE, group->space_id,
- field / UNIV_PAGE_SIZE, field % UNIV_PAGE_SIZE,
- OS_FILE_LOG_BLOCK_SIZE, log_sys->checkpoint_buf, NULL);
+ field / UNIV_PAGE_SIZE, field % UNIV_PAGE_SIZE,
+ OS_FILE_LOG_BLOCK_SIZE, log_sys->checkpoint_buf, NULL);
}
/**********************************************************
@@ -1943,8 +1964,8 @@ log_checkpoint(
mutex_enter(&(log_sys->mutex));
- if (!write_always && ut_dulint_cmp(
- log_sys->last_checkpoint_lsn, oldest_lsn) >= 0) {
+ if (!write_always
+ && ut_dulint_cmp(log_sys->last_checkpoint_lsn, oldest_lsn) >= 0) {
mutex_exit(&(log_sys->mutex));
@@ -2173,8 +2194,8 @@ loop:
log_sys->n_log_ios++;
fil_io(OS_FILE_READ | OS_FILE_LOG, sync, group->space_id,
- source_offset / UNIV_PAGE_SIZE, source_offset % UNIV_PAGE_SIZE,
- len, buf, NULL);
+ source_offset / UNIV_PAGE_SIZE, source_offset % UNIV_PAGE_SIZE,
+ len, buf, NULL);
start_lsn = ut_dulint_add(start_lsn, len);
buf += len;
@@ -2236,10 +2257,10 @@ log_group_archive_file_header_write(
log_sys->n_log_ios++;
fil_io(OS_FILE_WRITE | OS_FILE_LOG, TRUE, group->archive_space_id,
- dest_offset / UNIV_PAGE_SIZE,
- dest_offset % UNIV_PAGE_SIZE,
- 2 * OS_FILE_LOG_BLOCK_SIZE,
- buf, &log_archive_io);
+ dest_offset / UNIV_PAGE_SIZE,
+ dest_offset % UNIV_PAGE_SIZE,
+ 2 * OS_FILE_LOG_BLOCK_SIZE,
+ buf, &log_archive_io);
}
/**********************************************************
@@ -2271,11 +2292,11 @@ log_group_archive_completed_header_write(
log_sys->n_log_ios++;
fil_io(OS_FILE_WRITE | OS_FILE_LOG, TRUE, group->archive_space_id,
- dest_offset / UNIV_PAGE_SIZE,
- dest_offset % UNIV_PAGE_SIZE,
- OS_FILE_LOG_BLOCK_SIZE,
- buf + LOG_FILE_ARCH_COMPLETED,
- &log_archive_io);
+ dest_offset / UNIV_PAGE_SIZE,
+ dest_offset % UNIV_PAGE_SIZE,
+ OS_FILE_LOG_BLOCK_SIZE,
+ buf + LOG_FILE_ARCH_COMPLETED,
+ &log_archive_io);
}
/**********************************************************
@@ -2316,7 +2337,7 @@ log_group_archive(
next_offset = group->archived_offset;
loop:
if ((next_offset % group->file_size == 0)
- || (fil_space_get_size(group->archive_space_id) == 0)) {
+ || (fil_space_get_size(group->archive_space_id) == 0)) {
/* Add the file to the archive file space; create or open the
file */
@@ -2328,23 +2349,26 @@ loop:
}
log_archived_file_name_gen(name, group->id,
- group->archived_file_no + n_files);
+ group->archived_file_no + n_files);
file_handle = os_file_create(name, open_mode, OS_FILE_AIO,
- OS_DATA_FILE, &ret);
+ OS_DATA_FILE, &ret);
if (!ret && (open_mode == OS_FILE_CREATE)) {
- file_handle = os_file_create(name, OS_FILE_OPEN,
- OS_FILE_AIO, OS_DATA_FILE, &ret);
+ file_handle = os_file_create
+ (name, OS_FILE_OPEN, OS_FILE_AIO,
+ OS_DATA_FILE, &ret);
}
if (!ret) {
fprintf(stderr,
- "InnoDB: Cannot create or open archive log file %s.\n"
- "InnoDB: Cannot continue operation.\n"
- "InnoDB: Check that the log archive directory exists,\n"
- "InnoDB: you have access rights to it, and\n"
- "InnoDB: there is space available.\n", name);
+ "InnoDB: Cannot create or open"
+ " archive log file %s.\n"
+ "InnoDB: Cannot continue operation.\n"
+ "InnoDB: Check that the log archive"
+ " directory exists,\n"
+ "InnoDB: you have access rights to it, and\n"
+ "InnoDB: there is space available.\n", name);
exit(1);
}
@@ -2361,12 +2385,13 @@ loop:
/* Add the archive file as a node to the space */
fil_node_create(name, group->file_size / UNIV_PAGE_SIZE,
- group->archive_space_id, FALSE);
+ group->archive_space_id, FALSE);
if (next_offset % group->file_size == 0) {
- log_group_archive_file_header_write(group, n_files,
- group->archived_file_no + n_files,
- start_lsn);
+ log_group_archive_file_header_write
+ (group, n_files,
+ group->archived_file_no + n_files,
+ start_lsn);
next_offset += LOG_FILE_HDR_SIZE;
}
@@ -2382,10 +2407,11 @@ loop:
#ifdef UNIV_DEBUG
if (log_debug_writes) {
fprintf(stderr,
- "Archiving starting at lsn %lu %lu, len %lu to group %lu\n",
- (ulong) ut_dulint_get_high(start_lsn),
- (ulong) ut_dulint_get_low(start_lsn),
- (ulong) len, (ulong) group->id);
+ "Archiving starting at lsn %lu %lu, len %lu"
+ " to group %lu\n",
+ (ulong) ut_dulint_get_high(start_lsn),
+ (ulong) ut_dulint_get_low(start_lsn),
+ (ulong) len, (ulong) group->id);
}
#endif /* UNIV_DEBUG */
@@ -2394,9 +2420,9 @@ loop:
log_sys->n_log_ios++;
fil_io(OS_FILE_WRITE | OS_FILE_LOG, FALSE, group->archive_space_id,
- next_offset / UNIV_PAGE_SIZE, next_offset % UNIV_PAGE_SIZE,
- ut_calc_align(len, OS_FILE_LOG_BLOCK_SIZE), buf,
- &log_archive_io);
+ next_offset / UNIV_PAGE_SIZE, next_offset % UNIV_PAGE_SIZE,
+ ut_calc_align(len, OS_FILE_LOG_BLOCK_SIZE), buf,
+ &log_archive_io);
start_lsn = ut_dulint_add(start_lsn, len);
next_offset += len;
@@ -2465,7 +2491,7 @@ log_archive_write_complete_groups(void)
file, or if it has been written full, all files */
n_files = (UNIV_PAGE_SIZE
- * fil_space_get_size(group->archive_space_id))
+ * fil_space_get_size(group->archive_space_id))
/ group->file_size;
ut_ad(n_files > 0);
@@ -2482,15 +2508,15 @@ log_archive_write_complete_groups(void)
if (log_debug_writes && trunc_files) {
fprintf(stderr,
"Complete file(s) archived to group %lu\n",
- (ulong) group->id);
+ (ulong) group->id);
}
#endif /* UNIV_DEBUG */
/* Calculate the archive file space start lsn */
- start_lsn = ut_dulint_subtract(log_sys->next_archived_lsn,
- end_offset - LOG_FILE_HDR_SIZE
- + trunc_files
- * (group->file_size - LOG_FILE_HDR_SIZE));
+ start_lsn = ut_dulint_subtract
+ (log_sys->next_archived_lsn,
+ end_offset - LOG_FILE_HDR_SIZE + trunc_files
+ * (group->file_size - LOG_FILE_HDR_SIZE));
end_lsn = start_lsn;
for (i = 0; i < trunc_files; i++) {
@@ -2505,7 +2531,7 @@ log_archive_write_complete_groups(void)
}
fil_space_truncate_start(group->archive_space_id,
- trunc_files * group->file_size);
+ trunc_files * group->file_size);
#ifdef UNIV_DEBUG
if (log_debug_writes) {
@@ -2526,7 +2552,7 @@ log_archive_check_completion_low(void)
#endif /* UNIV_SYNC_DEBUG */
if (log_sys->n_pending_archive_ios == 0
- && log_sys->archiving_phase == LOG_ARCHIVE_READ) {
+ && log_sys->archiving_phase == LOG_ARCHIVE_READ) {
#ifdef UNIV_DEBUG
if (log_debug_writes) {
@@ -2542,7 +2568,7 @@ log_archive_check_completion_low(void)
}
if (log_sys->n_pending_archive_ios == 0
- && log_sys->archiving_phase == LOG_ARCHIVE_WRITE) {
+ && log_sys->archiving_phase == LOG_ARCHIVE_WRITE) {
log_archive_write_complete_groups();
@@ -2624,14 +2650,14 @@ loop:
if (calc_new_limit) {
ut_a(log_sys->archive_buf_size % OS_FILE_LOG_BLOCK_SIZE == 0);
limit_lsn = ut_dulint_add(start_lsn,
- log_sys->archive_buf_size);
+ log_sys->archive_buf_size);
*n_bytes = log_sys->archive_buf_size;
if (ut_dulint_cmp(limit_lsn, log_sys->lsn) >= 0) {
- limit_lsn = ut_dulint_align_down(log_sys->lsn,
- OS_FILE_LOG_BLOCK_SIZE);
+ limit_lsn = ut_dulint_align_down
+ (log_sys->lsn, OS_FILE_LOG_BLOCK_SIZE);
}
}
@@ -2690,8 +2716,8 @@ loop:
/* Read the log segment to the archive buffer */
log_group_read_log_seg(LOG_ARCHIVE, log_sys->archive_buf,
- UT_LIST_GET_FIRST(log_sys->log_groups),
- start_lsn, limit_lsn);
+ UT_LIST_GET_FIRST(log_sys->log_groups),
+ start_lsn, limit_lsn);
mutex_exit(&(log_sys->mutex));
@@ -2778,11 +2804,11 @@ log_archive_close_groups(
/* Write a notice to the headers of archived log
files that the file write has been completed */
- log_group_archive_completed_header_write(group,
- 0, log_sys->archived_lsn);
+ log_group_archive_completed_header_write
+ (group, 0, log_sys->archived_lsn);
fil_space_truncate_start(group->archive_space_id,
- trunc_len);
+ trunc_len);
if (increment_file_count) {
group->archived_offset = 0;
group->archived_file_no += 2;
@@ -2791,7 +2817,8 @@ log_archive_close_groups(
#ifdef UNIV_DEBUG
if (log_debug_writes) {
fprintf(stderr,
- "Incrementing arch file no to %lu in log group %lu\n",
+ "Incrementing arch file no to %lu"
+ " in log group %lu\n",
(ulong) group->archived_file_no + 2,
(ulong) group->id);
}
@@ -2904,7 +2931,7 @@ loop:
mutex_enter(&(log_sys->mutex));
if (log_sys->archiving_state == LOG_ARCH_STOPPED
- || log_sys->archiving_state == LOG_ARCH_OFF) {
+ || log_sys->archiving_state == LOG_ARCH_OFF) {
log_sys->archiving_state = LOG_ARCH_OFF;
@@ -2938,8 +2965,9 @@ log_archive_archivelog(void)
log_sys->archiving_state = LOG_ARCH_ON;
- log_sys->archived_lsn = ut_dulint_align_down(log_sys->lsn,
- OS_FILE_LOG_BLOCK_SIZE);
+ log_sys->archived_lsn
+ = ut_dulint_align_down(log_sys->lsn,
+ OS_FILE_LOG_BLOCK_SIZE);
mutex_exit(&(log_sys->mutex));
return(DB_SUCCESS);
@@ -3068,7 +3096,7 @@ loop:
them. */
if (trx_n_mysql_transactions > 0
- || UT_LIST_GET_LEN(trx_sys->trx_list) > 0) {
+ || UT_LIST_GET_LEN(trx_sys->trx_list) > 0) {
mutex_exit(&kernel_mutex);
@@ -3102,12 +3130,11 @@ loop:
mutex_enter(&(log_sys->mutex));
- if (
+ if (log_sys->n_pending_checkpoint_writes
#ifdef UNIV_LOG_ARCHIVE
- log_sys->n_pending_archive_ios ||
+ || log_sys->n_pending_archive_ios
#endif /* UNIV_LOG_ARCHIVE */
- log_sys->n_pending_checkpoint_writes ||
- log_sys->n_pending_writes) {
+ || log_sys->n_pending_writes) {
mutex_exit(&(log_sys->mutex));
@@ -3125,7 +3152,7 @@ loop:
log_archive_all();
#endif /* UNIV_LOG_ARCHIVE */
- log_make_checkpoint_at(ut_dulint_max, TRUE);
+ log_make_checkpoint_at(ut_dulint_max, TRUE);
mutex_enter(&(log_sys->mutex));
@@ -3133,13 +3160,13 @@ loop:
if ((ut_dulint_cmp(lsn, log_sys->last_checkpoint_lsn) != 0)
#ifdef UNIV_LOG_ARCHIVE
- || (srv_log_archive_on
- && ut_dulint_cmp(lsn,
- ut_dulint_add(log_sys->archived_lsn,
- LOG_BLOCK_HDR_SIZE))
- != 0)
+ || (srv_log_archive_on
+ && ut_dulint_cmp(lsn,
+ ut_dulint_add(log_sys->archived_lsn,
+ LOG_BLOCK_HDR_SIZE))
+ != 0)
#endif /* UNIV_LOG_ARCHIVE */
- ) {
+ ) {
mutex_exit(&(log_sys->mutex));
@@ -3165,7 +3192,8 @@ loop:
/* Check that the master thread has stayed suspended */
if (srv_n_threads_active[SRV_MASTER] != 0) {
fprintf(stderr,
-"InnoDB: Warning: the master thread woke up during shutdown\n");
+ "InnoDB: Warning: the master thread woke up"
+ " during shutdown\n");
mutex_exit(&kernel_mutex);
@@ -3209,17 +3237,18 @@ loop:
if (ut_dulint_cmp(lsn, srv_start_lsn) < 0) {
fprintf(stderr,
-"InnoDB: Error: log sequence number at shutdown %lu %lu\n"
-"InnoDB: is lower than at startup %lu %lu!\n",
- (ulong) ut_dulint_get_high(lsn),
- (ulong) ut_dulint_get_low(lsn),
- (ulong) ut_dulint_get_high(srv_start_lsn),
- (ulong) ut_dulint_get_low(srv_start_lsn));
+ "InnoDB: Error: log sequence number"
+ " at shutdown %lu %lu\n"
+ "InnoDB: is lower than at startup %lu %lu!\n",
+ (ulong) ut_dulint_get_high(lsn),
+ (ulong) ut_dulint_get_low(lsn),
+ (ulong) ut_dulint_get_high(srv_start_lsn),
+ (ulong) ut_dulint_get_low(srv_start_lsn));
}
srv_shutdown_lsn = lsn;
- fil_write_flushed_lsn_to_data_files(lsn, arch_log_no);
+ fil_write_flushed_lsn_to_data_files(lsn, arch_log_no);
fil_flush_file_spaces(FIL_TABLESPACE);
@@ -3268,15 +3297,15 @@ log_check_log_recs(
ut_memcpy(scan_buf, start, end - start);
recv_scan_log_recs(TRUE,
- (buf_pool->n_frames -
- recv_n_pool_free_frames) * UNIV_PAGE_SIZE,
- FALSE, scan_buf, end - start,
- ut_dulint_align_down(buf_start_lsn,
+ (buf_pool->n_frames
+ - recv_n_pool_free_frames) * UNIV_PAGE_SIZE,
+ FALSE, scan_buf, end - start,
+ ut_dulint_align_down(buf_start_lsn,
OS_FILE_LOG_BLOCK_SIZE),
- &contiguous_lsn, &scanned_lsn);
+ &contiguous_lsn, &scanned_lsn);
ut_a(ut_dulint_cmp(scanned_lsn, ut_dulint_add(buf_start_lsn, len))
- == 0);
+ == 0);
ut_a(ut_dulint_cmp(recv_sys->recovered_lsn, scanned_lsn) == 0);
mem_free(buf1);
@@ -3322,24 +3351,25 @@ log_print(
"Log sequence number %lu %lu\n"
"Log flushed up to %lu %lu\n"
"Last checkpoint at %lu %lu\n",
- (ulong) ut_dulint_get_high(log_sys->lsn),
- (ulong) ut_dulint_get_low(log_sys->lsn),
- (ulong) ut_dulint_get_high(log_sys->flushed_to_disk_lsn),
- (ulong) ut_dulint_get_low(log_sys->flushed_to_disk_lsn),
- (ulong) ut_dulint_get_high(log_sys->last_checkpoint_lsn),
- (ulong) ut_dulint_get_low(log_sys->last_checkpoint_lsn));
+ (ulong) ut_dulint_get_high(log_sys->lsn),
+ (ulong) ut_dulint_get_low(log_sys->lsn),
+ (ulong) ut_dulint_get_high(log_sys->flushed_to_disk_lsn),
+ (ulong) ut_dulint_get_low(log_sys->flushed_to_disk_lsn),
+ (ulong) ut_dulint_get_high(log_sys->last_checkpoint_lsn),
+ (ulong) ut_dulint_get_low(log_sys->last_checkpoint_lsn));
current_time = time(NULL);
time_elapsed = 0.001 + difftime(current_time,
log_sys->last_printout_time);
fprintf(file,
- "%lu pending log writes, %lu pending chkp writes\n"
- "%lu log i/o's done, %.2f log i/o's/second\n",
- (ulong) log_sys->n_pending_writes,
- (ulong) log_sys->n_pending_checkpoint_writes,
- (ulong) log_sys->n_log_ios,
- ((log_sys->n_log_ios - log_sys->n_log_ios_old) / time_elapsed));
+ "%lu pending log writes, %lu pending chkp writes\n"
+ "%lu log i/o's done, %.2f log i/o's/second\n",
+ (ulong) log_sys->n_pending_writes,
+ (ulong) log_sys->n_pending_checkpoint_writes,
+ (ulong) log_sys->n_log_ios,
+ ((log_sys->n_log_ios - log_sys->n_log_ios_old)
+ / time_elapsed));
log_sys->n_log_ios_old = log_sys->n_log_ios;
log_sys->last_printout_time = current_time;
diff --git a/storage/innobase/log/log0recv.c b/storage/innobase/log/log0recv.c
index 8150dba165c..3a53e0eb6e5 100644
--- a/storage/innobase/log/log0recv.c
+++ b/storage/innobase/log/log0recv.c
@@ -155,7 +155,7 @@ recv_sys_init(
recv_sys->last_block_buf_start = mem_alloc(2 * OS_FILE_LOG_BLOCK_SIZE);
recv_sys->last_block = ut_align(recv_sys->last_block_buf_start,
- OS_FILE_LOG_BLOCK_SIZE);
+ OS_FILE_LOG_BLOCK_SIZE);
recv_sys->found_corrupt_log = FALSE;
recv_max_page_lsn = ut_dulint_zero;
@@ -175,8 +175,10 @@ recv_sys_empty_hash(void)
#endif /* UNIV_SYNC_DEBUG */
if (recv_sys->n_addrs != 0) {
fprintf(stderr,
-"InnoDB: Error: %lu pages with log records were left unprocessed!\n"
-"InnoDB: Maximum page number with log records on it %lu\n",
+ "InnoDB: Error: %lu pages with log records"
+ " were left unprocessed!\n"
+ "InnoDB: Maximum page number with"
+ " log records on it %lu\n",
(ulong) recv_sys->n_addrs,
(ulong) recv_max_parsed_page_no);
ut_error;
@@ -237,13 +239,13 @@ recv_truncate_group(
archived_lsn = checkpoint_lsn;
}
- finish_lsn1 = ut_dulint_add(ut_dulint_align_down(archived_lsn,
- OS_FILE_LOG_BLOCK_SIZE),
- log_group_get_capacity(group));
+ finish_lsn1 = ut_dulint_add(ut_dulint_align_down
+ (archived_lsn, OS_FILE_LOG_BLOCK_SIZE),
+ log_group_get_capacity(group));
- finish_lsn2 = ut_dulint_add(ut_dulint_align_up(recovered_lsn,
- OS_FILE_LOG_BLOCK_SIZE),
- recv_sys->last_log_buf_size);
+ finish_lsn2 = ut_dulint_add(ut_dulint_align_up
+ (recovered_lsn, OS_FILE_LOG_BLOCK_SIZE),
+ recv_sys->last_log_buf_size);
if (ut_dulint_cmp(limit_lsn, ut_dulint_max) != 0) {
/* We do not know how far we should erase log records: erase
@@ -264,16 +266,16 @@ recv_truncate_group(
}
start_lsn = ut_dulint_align_down(recovered_lsn,
- OS_FILE_LOG_BLOCK_SIZE);
+ OS_FILE_LOG_BLOCK_SIZE);
if (ut_dulint_cmp(start_lsn, recovered_lsn) != 0) {
/* Copy the last incomplete log block to the log buffer and
edit its data length: */
ut_memcpy(log_sys->buf, recv_sys->last_block,
- OS_FILE_LOG_BLOCK_SIZE);
- log_block_set_data_len(log_sys->buf,
- ut_dulint_minus(recovered_lsn, start_lsn));
+ OS_FILE_LOG_BLOCK_SIZE);
+ log_block_set_data_len(log_sys->buf, ut_dulint_minus
+ (recovered_lsn, start_lsn));
}
if (ut_dulint_cmp(start_lsn, finish_lsn) >= 0) {
@@ -333,17 +335,17 @@ recv_copy_group(
ut_a(RECV_SCAN_SIZE <= log_sys->buf_size);
start_lsn = ut_dulint_align_down(group->scanned_lsn,
- OS_FILE_LOG_BLOCK_SIZE);
+ OS_FILE_LOG_BLOCK_SIZE);
for (;;) {
end_lsn = ut_dulint_add(start_lsn, RECV_SCAN_SIZE);
if (ut_dulint_cmp(end_lsn, recovered_lsn) > 0) {
end_lsn = ut_dulint_align_up(recovered_lsn,
- OS_FILE_LOG_BLOCK_SIZE);
+ OS_FILE_LOG_BLOCK_SIZE);
}
log_group_read_log_seg(LOG_RECOVER, log_sys->buf,
- up_to_date_group, start_lsn, end_lsn);
+ up_to_date_group, start_lsn, end_lsn);
len = ut_dulint_minus(end_lsn, start_lsn);
@@ -383,13 +385,13 @@ recv_synchronize_groups(
the block is always incomplete */
start_lsn = ut_dulint_align_down(recovered_lsn,
- OS_FILE_LOG_BLOCK_SIZE);
+ OS_FILE_LOG_BLOCK_SIZE);
end_lsn = ut_dulint_align_up(recovered_lsn, OS_FILE_LOG_BLOCK_SIZE);
ut_a(ut_dulint_cmp(start_lsn, end_lsn) != 0);
log_group_read_log_seg(LOG_RECOVER, recv_sys->last_block,
- up_to_date_group, start_lsn, end_lsn);
+ up_to_date_group, start_lsn, end_lsn);
group = UT_LIST_GET_FIRST(log_sys->log_groups);
@@ -399,7 +401,7 @@ recv_synchronize_groups(
/* Copy log data if needed */
recv_copy_group(group, up_to_date_group,
- recovered_lsn);
+ recovered_lsn);
}
/* Update the fields in the group struct to correspond to
@@ -439,16 +441,16 @@ recv_check_cp_is_consistent(
fold = ut_fold_binary(buf, LOG_CHECKPOINT_CHECKSUM_1);
- if ((fold & 0xFFFFFFFFUL) != mach_read_from_4(buf
- + LOG_CHECKPOINT_CHECKSUM_1)) {
+ if ((fold & 0xFFFFFFFFUL) != mach_read_from_4
+ (buf + LOG_CHECKPOINT_CHECKSUM_1)) {
return(FALSE);
}
fold = ut_fold_binary(buf + LOG_CHECKPOINT_LSN,
- LOG_CHECKPOINT_CHECKSUM_2 - LOG_CHECKPOINT_LSN);
+ LOG_CHECKPOINT_CHECKSUM_2 - LOG_CHECKPOINT_LSN);
- if ((fold & 0xFFFFFFFFUL) != mach_read_from_4(buf
- + LOG_CHECKPOINT_CHECKSUM_2)) {
+ if ((fold & 0xFFFFFFFFUL) != mach_read_from_4
+ (buf + LOG_CHECKPOINT_CHECKSUM_2)) {
return(FALSE);
}
@@ -484,7 +486,7 @@ recv_find_max_checkpoint(
group->state = LOG_GROUP_CORRUPTED;
for (field = LOG_CHECKPOINT_1; field <= LOG_CHECKPOINT_2;
- field += LOG_CHECKPOINT_2 - LOG_CHECKPOINT_1) {
+ field += LOG_CHECKPOINT_2 - LOG_CHECKPOINT_1) {
log_group_read_checkpoint_info(group, field);
@@ -492,11 +494,13 @@ recv_find_max_checkpoint(
#ifdef UNIV_DEBUG
if (log_debug_writes) {
fprintf(stderr,
- "InnoDB: Checkpoint in group %lu at %lu invalid, %lu\n",
- (ulong) group->id,
- (ulong) field,
- (ulong) mach_read_from_4(buf
- + LOG_CHECKPOINT_CHECKSUM_1));
+ "InnoDB: Checkpoint in group"
+ " %lu at %lu invalid, %lu\n",
+ (ulong) group->id,
+ (ulong) field,
+ (ulong) mach_read_from_4
+ (buf
+ + LOG_CHECKPOINT_CHECKSUM_1));
}
#endif /* UNIV_DEBUG */
@@ -505,19 +509,21 @@ recv_find_max_checkpoint(
group->state = LOG_GROUP_OK;
- group->lsn = mach_read_from_8(buf
- + LOG_CHECKPOINT_LSN);
- group->lsn_offset = mach_read_from_4(buf
- + LOG_CHECKPOINT_OFFSET);
- checkpoint_no =
- mach_read_from_8(buf + LOG_CHECKPOINT_NO);
+ group->lsn = mach_read_from_8
+ (buf + LOG_CHECKPOINT_LSN);
+ group->lsn_offset = mach_read_from_4
+ (buf + LOG_CHECKPOINT_OFFSET);
+ checkpoint_no = mach_read_from_8
+ (buf + LOG_CHECKPOINT_NO);
#ifdef UNIV_DEBUG
if (log_debug_writes) {
fprintf(stderr,
- "InnoDB: Checkpoint number %lu found in group %lu\n",
- (ulong) ut_dulint_get_low(checkpoint_no),
- (ulong) group->id);
+ "InnoDB: Checkpoint number %lu"
+ " found in group %lu\n",
+ (ulong) ut_dulint_get_low
+ (checkpoint_no),
+ (ulong) group->id);
}
#endif /* UNIV_DEBUG */
@@ -527,7 +533,7 @@ recv_find_max_checkpoint(
max_no = checkpoint_no;
}
- not_consistent:
+not_consistent:
;
}
@@ -537,12 +543,16 @@ recv_find_max_checkpoint(
if (*max_group == NULL) {
fprintf(stderr,
-"InnoDB: No valid checkpoint found.\n"
-"InnoDB: If this error appears when you are creating an InnoDB database,\n"
-"InnoDB: the problem may be that during an earlier attempt you managed\n"
-"InnoDB: to create the InnoDB data files, but log file creation failed.\n"
-"InnoDB: If that is the case, please refer to\n"
-"InnoDB: http://dev.mysql.com/doc/refman/5.1/en/error-creating-innodb.html\n");
+ "InnoDB: No valid checkpoint found.\n"
+ "InnoDB: If this error appears when you are"
+ " creating an InnoDB database,\n"
+ "InnoDB: the problem may be that during"
+ " an earlier attempt you managed\n"
+ "InnoDB: to create the InnoDB data files,"
+ " but log file creation failed.\n"
+ "InnoDB: If that is the case, please refer to\n"
+ "InnoDB: http://dev.mysql.com/doc/refman/5.1/en/"
+ "error-creating-innodb.html\n");
return(DB_ERROR);
}
@@ -580,7 +590,7 @@ recv_read_cp_info_for_backup(
if (recv_check_cp_is_consistent(cp_buf)) {
if (ut_dulint_cmp(mach_read_from_8(cp_buf + LOG_CHECKPOINT_NO),
- max_cp_no) > 0) {
+ max_cp_no) > 0) {
max_cp = LOG_CHECKPOINT_2;
}
}
@@ -597,10 +607,10 @@ recv_read_cp_info_for_backup(
/* If the user is running a pre-3.23.50 version of InnoDB, its
checkpoint data does not contain the fsp limit info */
if (mach_read_from_4(cp_buf + LOG_CHECKPOINT_FSP_MAGIC_N)
- == LOG_CHECKPOINT_FSP_MAGIC_N_VAL) {
+ == LOG_CHECKPOINT_FSP_MAGIC_N_VAL) {
- *fsp_limit = mach_read_from_4(
- cp_buf + LOG_CHECKPOINT_FSP_FREE_LIMIT);
+ *fsp_limit = mach_read_from_4
+ (cp_buf + LOG_CHECKPOINT_FSP_FREE_LIMIT);
if (*fsp_limit == 0) {
*fsp_limit = 1000000000;
@@ -609,7 +619,7 @@ recv_read_cp_info_for_backup(
*fsp_limit = 1000000000;
}
-/* fprintf(stderr, "fsp limit %lu MB\n", *fsp_limit); */
+ /* fprintf(stderr, "fsp limit %lu MB\n", *fsp_limit); */
*cp_no = mach_read_from_8(cp_buf + LOG_CHECKPOINT_NO);
@@ -642,11 +652,12 @@ log_block_checksum_is_ok_or_old_format(
/* We assume the log block is in the format of
InnoDB version < 3.23.52 and the block is ok */
-/*
+#if 0
fprintf(stderr,
-"InnoDB: Scanned old format < InnoDB-3.23.52 log block number %lu\n",
+ "InnoDB: Scanned old format < InnoDB-3.23.52"
+ " log block number %lu\n",
log_block_get_hdr_no(block));
-*/
+#endif
return(TRUE);
}
@@ -679,52 +690,54 @@ recv_scan_log_seg_for_backup(
*n_bytes_scanned = 0;
for (log_block = buf; log_block < buf + buf_len;
- log_block += OS_FILE_LOG_BLOCK_SIZE) {
+ log_block += OS_FILE_LOG_BLOCK_SIZE) {
no = log_block_get_hdr_no(log_block);
-/* fprintf(stderr, "Log block header no %lu\n", no); */
+#if 0
+ fprintf(stderr, "Log block header no %lu\n", no);
+#endif
if (no != log_block_convert_lsn_to_no(*scanned_lsn)
- || !log_block_checksum_is_ok_or_old_format(log_block)) {
-/*
+ || !log_block_checksum_is_ok_or_old_format(log_block)) {
+#if 0
fprintf(stderr,
-"Log block n:o %lu, scanned lsn n:o %lu\n",
- no, log_block_convert_lsn_to_no(*scanned_lsn));
-*/
+ "Log block n:o %lu, scanned lsn n:o %lu\n",
+ no, log_block_convert_lsn_to_no(*scanned_lsn));
+#endif
/* Garbage or an incompletely written log block */
log_block += OS_FILE_LOG_BLOCK_SIZE;
-/*
+#if 0
fprintf(stderr,
-"Next log block n:o %lu\n",
- log_block_get_hdr_no(log_block));
-*/
+ "Next log block n:o %lu\n",
+ log_block_get_hdr_no(log_block));
+#endif
break;
}
if (*scanned_checkpoint_no > 0
- && log_block_get_checkpoint_no(log_block)
- < *scanned_checkpoint_no
- && *scanned_checkpoint_no
- - log_block_get_checkpoint_no(log_block)
- > 0x80000000UL) {
+ && log_block_get_checkpoint_no(log_block)
+ < *scanned_checkpoint_no
+ && *scanned_checkpoint_no
+ - log_block_get_checkpoint_no(log_block)
+ > 0x80000000UL) {
/* Garbage from a log buffer flush which was made
before the most recent database recovery */
-/*
+#if 0
fprintf(stderr,
"Scanned cp n:o %lu, block cp n:o %lu\n",
*scanned_checkpoint_no,
log_block_get_checkpoint_no(log_block));
-*/
+#endif
break;
}
data_len = log_block_get_data_len(log_block);
*scanned_checkpoint_no
- = log_block_get_checkpoint_no(log_block);
+ = log_block_get_checkpoint_no(log_block);
*scanned_lsn = ut_dulint_add(*scanned_lsn, data_len);
*n_bytes_scanned += data_len;
@@ -732,9 +745,10 @@ recv_scan_log_seg_for_backup(
if (data_len < OS_FILE_LOG_BLOCK_SIZE) {
/* Log data ends here */
- /* fprintf(stderr, "Log block data len %lu\n",
- data_len); */
-
+#if 0
+ fprintf(stderr, "Log block data len %lu\n",
+ data_len);
+#endif
break;
}
}
@@ -765,23 +779,27 @@ recv_parse_or_apply_log_rec_body(
ptr = mlog_parse_nbytes(type, ptr, end_ptr, page);
break;
case MLOG_REC_INSERT: case MLOG_COMP_REC_INSERT:
- if (NULL != (ptr = mlog_parse_index(ptr, end_ptr,
- type == MLOG_COMP_REC_INSERT, &index))) {
+ if (NULL != (ptr = mlog_parse_index
+ (ptr, end_ptr,
+ type == MLOG_COMP_REC_INSERT,
+ &index))) {
ut_a(!page
- || (ibool)!!page_is_comp(page)
- == dict_table_is_comp(index->table));
+ || (ibool)!!page_is_comp(page)
+ == dict_table_is_comp(index->table));
ptr = page_cur_parse_insert_rec(FALSE, ptr, end_ptr,
index, page, mtr);
}
break;
case MLOG_REC_CLUST_DELETE_MARK: case MLOG_COMP_REC_CLUST_DELETE_MARK:
- if (NULL != (ptr = mlog_parse_index(ptr, end_ptr,
- type == MLOG_COMP_REC_CLUST_DELETE_MARK, &index))) {
+ if (NULL != (ptr = mlog_parse_index
+ (ptr, end_ptr,
+ type == MLOG_COMP_REC_CLUST_DELETE_MARK,
+ &index))) {
ut_a(!page
- || (ibool)!!page_is_comp(page)
- == dict_table_is_comp(index->table));
- ptr = btr_cur_parse_del_mark_set_clust_rec(ptr,
- end_ptr, index, page);
+ || (ibool)!!page_is_comp(page)
+ == dict_table_is_comp(index->table));
+ ptr = btr_cur_parse_del_mark_set_clust_rec
+ (ptr, end_ptr, index, page);
}
break;
case MLOG_COMP_REC_SEC_DELETE_MARK:
@@ -797,50 +815,59 @@ recv_parse_or_apply_log_rec_body(
ptr = btr_cur_parse_del_mark_set_sec_rec(ptr, end_ptr, page);
break;
case MLOG_REC_UPDATE_IN_PLACE: case MLOG_COMP_REC_UPDATE_IN_PLACE:
- if (NULL != (ptr = mlog_parse_index(ptr, end_ptr,
- type == MLOG_COMP_REC_UPDATE_IN_PLACE, &index))) {
+ if (NULL != (ptr = mlog_parse_index
+ (ptr, end_ptr,
+ type == MLOG_COMP_REC_UPDATE_IN_PLACE,
+ &index))) {
ut_a(!page
- || (ibool)!!page_is_comp(page)
- == dict_table_is_comp(index->table));
+ || (ibool)!!page_is_comp(page)
+ == dict_table_is_comp(index->table));
ptr = btr_cur_parse_update_in_place(ptr, end_ptr,
- page, index);
+ page, index);
}
break;
case MLOG_LIST_END_DELETE: case MLOG_COMP_LIST_END_DELETE:
case MLOG_LIST_START_DELETE: case MLOG_COMP_LIST_START_DELETE:
- if (NULL != (ptr = mlog_parse_index(ptr, end_ptr,
- type == MLOG_COMP_LIST_END_DELETE
- || type == MLOG_COMP_LIST_START_DELETE, &index))) {
+ if (NULL != (ptr = mlog_parse_index
+ (ptr, end_ptr,
+ type == MLOG_COMP_LIST_END_DELETE
+ || type == MLOG_COMP_LIST_START_DELETE,
+ &index))) {
ut_a(!page
- || (ibool)!!page_is_comp(page)
- == dict_table_is_comp(index->table));
+ || (ibool)!!page_is_comp(page)
+ == dict_table_is_comp(index->table));
ptr = page_parse_delete_rec_list(type, ptr, end_ptr,
- index, page, mtr);
+ index, page, mtr);
}
break;
case MLOG_LIST_END_COPY_CREATED: case MLOG_COMP_LIST_END_COPY_CREATED:
- if (NULL != (ptr = mlog_parse_index(ptr, end_ptr,
- type == MLOG_COMP_LIST_END_COPY_CREATED, &index))) {
+ if (NULL != (ptr = mlog_parse_index
+ (ptr, end_ptr,
+ type == MLOG_COMP_LIST_END_COPY_CREATED,
+ &index))) {
ut_a(!page
- || (ibool)!!page_is_comp(page)
- == dict_table_is_comp(index->table));
- ptr = page_parse_copy_rec_list_to_created_page(ptr,
- end_ptr, index, page, mtr);
+ || (ibool)!!page_is_comp(page)
+ == dict_table_is_comp(index->table));
+ ptr = page_parse_copy_rec_list_to_created_page
+ (ptr, end_ptr, index, page, mtr);
}
break;
case MLOG_PAGE_REORGANIZE: case MLOG_COMP_PAGE_REORGANIZE:
- if (NULL != (ptr = mlog_parse_index(ptr, end_ptr,
- type == MLOG_COMP_PAGE_REORGANIZE, &index))) {
+ if (NULL != (ptr = mlog_parse_index
+ (ptr, end_ptr,
+ type == MLOG_COMP_PAGE_REORGANIZE,
+ &index))) {
ut_a(!page
- || (ibool)!!page_is_comp(page)
- == dict_table_is_comp(index->table));
+ || (ibool)!!page_is_comp(page)
+ == dict_table_is_comp(index->table));
ptr = btr_parse_page_reorganize(ptr, end_ptr, index,
- page, mtr);
+ page, mtr);
}
break;
case MLOG_PAGE_CREATE: case MLOG_COMP_PAGE_CREATE:
ptr = page_parse_create(ptr, end_ptr,
- type == MLOG_COMP_PAGE_CREATE, page, mtr);
+ type == MLOG_COMP_PAGE_CREATE,
+ page, mtr);
break;
case MLOG_UNDO_INSERT:
ptr = trx_undo_parse_add_undo_rec(ptr, end_ptr, page);
@@ -857,18 +884,21 @@ recv_parse_or_apply_log_rec_body(
case MLOG_UNDO_HDR_CREATE:
case MLOG_UNDO_HDR_REUSE:
ptr = trx_undo_parse_page_header(type, ptr, end_ptr,
- page, mtr);
+ page, mtr);
break;
case MLOG_REC_MIN_MARK: case MLOG_COMP_REC_MIN_MARK:
- ptr = btr_parse_set_min_rec_mark(ptr, end_ptr,
- type == MLOG_COMP_REC_MIN_MARK, page, mtr);
+ ptr = btr_parse_set_min_rec_mark
+ (ptr, end_ptr, type == MLOG_COMP_REC_MIN_MARK,
+ page, mtr);
break;
case MLOG_REC_DELETE: case MLOG_COMP_REC_DELETE:
- if (NULL != (ptr = mlog_parse_index(ptr, end_ptr,
- type == MLOG_COMP_REC_DELETE, &index))) {
+ if (NULL != (ptr = mlog_parse_index
+ (ptr, end_ptr,
+ type == MLOG_COMP_REC_DELETE,
+ &index))) {
ut_a(!page
- || (ibool)!!page_is_comp(page)
- == dict_table_is_comp(index->table));
+ || (ibool)!!page_is_comp(page)
+ == dict_table_is_comp(index->table));
ptr = page_cur_parse_delete_rec(ptr, end_ptr,
index, page, mtr);
}
@@ -886,7 +916,7 @@ recv_parse_or_apply_log_rec_body(
case MLOG_FILE_RENAME:
case MLOG_FILE_DELETE:
ptr = fil_op_log_parse_or_replay(ptr, end_ptr, type, FALSE,
- ULINT_UNDEFINED);
+ ULINT_UNDEFINED);
break;
default:
ptr = NULL;
@@ -945,10 +975,10 @@ recv_get_fil_addr_struct(
recv_addr_t* recv_addr;
recv_addr = HASH_GET_FIRST(recv_sys->addr_hash,
- recv_hash(space, page_no));
+ recv_hash(space, page_no));
while (recv_addr) {
if ((recv_addr->space == space)
- && (recv_addr->page_no == page_no)) {
+ && (recv_addr->page_no == page_no)) {
break;
}
@@ -998,7 +1028,7 @@ recv_add_to_hash_table(
if (recv_addr == NULL) {
recv_addr = mem_heap_alloc(recv_sys->heap,
- sizeof(recv_addr_t));
+ sizeof(recv_addr_t));
recv_addr->space = space;
recv_addr->page_no = page_no;
recv_addr->state = RECV_NOT_PROCESSED;
@@ -1006,11 +1036,12 @@ recv_add_to_hash_table(
UT_LIST_INIT(recv_addr->rec_list);
HASH_INSERT(recv_addr_t, addr_hash, recv_sys->addr_hash,
- recv_fold(space, page_no), recv_addr);
+ recv_fold(space, page_no), recv_addr);
recv_sys->n_addrs++;
-
- /* fprintf(stderr, "Inserting log rec for space %lu, page %lu\n",
- space, page_no); */
+#if 0
+ fprintf(stderr, "Inserting log rec for space %lu, page %lu\n",
+ space, page_no);
+#endif
}
UT_LIST_ADD_LAST(rec_list, recv_addr->rec_list, recv);
@@ -1030,7 +1061,7 @@ recv_add_to_hash_table(
}
recv_data = mem_heap_alloc(recv_sys->heap,
- sizeof(recv_data_t) + len);
+ sizeof(recv_data_t) + len);
*prev_field = recv_data;
ut_memcpy(((byte*)recv_data) + sizeof(recv_data_t), body, len);
@@ -1067,7 +1098,7 @@ recv_data_copy_to_buf(
}
ut_memcpy(buf, ((byte*)recv_data) + sizeof(recv_data_t),
- part_len);
+ part_len);
buf += part_len;
len -= part_len;
@@ -1119,15 +1150,17 @@ recv_recover_page(
recv_addr = recv_get_fil_addr_struct(space, page_no);
if ((recv_addr == NULL)
- || (recv_addr->state == RECV_BEING_PROCESSED)
- || (recv_addr->state == RECV_PROCESSED)) {
+ || (recv_addr->state == RECV_BEING_PROCESSED)
+ || (recv_addr->state == RECV_PROCESSED)) {
mutex_exit(&(recv_sys->mutex));
return;
}
- /* fprintf(stderr, "Recovering space %lu, page %lu\n", space, page_no); */
+#if 0
+ fprintf(stderr, "Recovering space %lu, page %lu\n", space, page_no);
+#endif
recv_addr->state = RECV_BEING_PROCESSED;
@@ -1140,18 +1173,19 @@ recv_recover_page(
block = buf_block_align(page);
if (just_read_in) {
- /* Move the ownership of the x-latch on the page to this OS
- thread, so that we can acquire a second x-latch on it. This
- is needed for the operations to the page to pass the debug
- checks. */
+ /* Move the ownership of the x-latch on the
+ page to this OS thread, so that we can acquire
+ a second x-latch on it. This is needed for the
+ operations to the page to pass the debug
+ checks. */
rw_lock_x_lock_move_ownership(&(block->lock));
}
success = buf_page_get_known_nowait(RW_X_LATCH, page,
- BUF_KEEP_OLD,
- __FILE__, __LINE__,
- &mtr);
+ BUF_KEEP_OLD,
+ __FILE__, __LINE__,
+ &mtr);
ut_a(success);
#ifdef UNIV_SYNC_DEBUG
@@ -1202,7 +1236,8 @@ recv_recover_page(
page_lsn = page_newest_lsn;
mach_write_to_8(page + UNIV_PAGE_SIZE
- - FIL_PAGE_END_LSN_OLD_CHKSUM, ut_dulint_zero);
+ - FIL_PAGE_END_LSN_OLD_CHKSUM,
+ ut_dulint_zero);
mach_write_to_8(page + FIL_PAGE_LSN, ut_dulint_zero);
}
@@ -1217,7 +1252,9 @@ recv_recover_page(
#ifdef UNIV_DEBUG
if (log_debug_writes) {
fprintf(stderr,
- "InnoDB: Applying log rec type %lu len %lu to space %lu page no %lu\n",
+ "InnoDB: Applying log rec"
+ " type %lu len %lu"
+ " to space %lu page no %lu\n",
(ulong) recv->type, (ulong) recv->len,
(ulong) recv_addr->space,
(ulong) recv_addr->page_no);
@@ -1225,14 +1262,15 @@ recv_recover_page(
#endif /* UNIV_DEBUG */
recv_parse_or_apply_log_rec_body(recv->type, buf,
- buf + recv->len, page, &mtr);
+ buf + recv->len,
+ page, &mtr);
mach_write_to_8(page + UNIV_PAGE_SIZE
- FIL_PAGE_END_LSN_OLD_CHKSUM,
ut_dulint_add(recv->start_lsn,
- recv->len));
+ recv->len));
mach_write_to_8(page + FIL_PAGE_LSN,
ut_dulint_add(recv->start_lsn,
- recv->len));
+ recv->len));
}
if (recv->len > RECV_DATA_BLOCK_SIZE) {
@@ -1290,7 +1328,7 @@ recv_read_in_area(
n = 0;
for (page_no = low_limit; page_no < low_limit + RECV_READ_AHEAD_AREA;
- page_no++) {
+ page_no++) {
recv_addr = recv_get_fil_addr_struct(space, page_no);
if (recv_addr && !buf_page_peek(space, page_no)) {
@@ -1374,9 +1412,11 @@ loop:
if (recv_addr->state == RECV_NOT_PROCESSED) {
if (!has_printed) {
ut_print_timestamp(stderr);
- fputs(
-" InnoDB: Starting an apply batch of log records to the database...\n"
-"InnoDB: Progress in percents: ",stderr);
+ fputs(" InnoDB: Starting an"
+ " apply batch of log records"
+ " to the database...\n"
+ "InnoDB: Progress in percents: ",
+ stderr);
has_printed = TRUE;
}
@@ -1387,14 +1427,14 @@ loop:
mtr_start(&mtr);
page = buf_page_get(space, page_no,
- RW_X_LATCH, &mtr);
+ RW_X_LATCH, &mtr);
#ifdef UNIV_SYNC_DEBUG
- buf_page_dbg_add_level(page,
- SYNC_NO_ORDER_CHECK);
+ buf_page_dbg_add_level
+ (page, SYNC_NO_ORDER_CHECK);
#endif /* UNIV_SYNC_DEBUG */
recv_recover_page(FALSE, FALSE, page,
- space, page_no);
+ space, page_no);
mtr_commit(&mtr);
} else {
recv_read_in_area(space, page_no);
@@ -1407,12 +1447,13 @@ loop:
}
if (has_printed
- && (i * 100) / hash_get_n_cells(recv_sys->addr_hash)
- != ((i + 1) * 100)
- / hash_get_n_cells(recv_sys->addr_hash)) {
+ && (i * 100) / hash_get_n_cells(recv_sys->addr_hash)
+ != ((i + 1) * 100)
+ / hash_get_n_cells(recv_sys->addr_hash)) {
- fprintf(stderr, "%lu ",
- (ulong) ((i * 100) / hash_get_n_cells(recv_sys->addr_hash)));
+ fprintf(stderr, "%lu ", (ulong)
+ ((i * 100)
+ / hash_get_n_cells(recv_sys->addr_hash)));
}
}
@@ -1440,7 +1481,7 @@ loop:
mutex_exit(&(log_sys->mutex));
n_pages = buf_flush_batch(BUF_FLUSH_LIST, ULINT_MAX,
- ut_dulint_max);
+ ut_dulint_max);
ut_a(n_pages != ULINT_UNDEFINED);
buf_flush_wait_batch_end(BUF_FLUSH_LIST);
@@ -1493,9 +1534,9 @@ recv_apply_log_recs_for_backup(void)
page = recv_backup_application_page;
- fputs(
-"InnoDB: Starting an apply batch of log records to the database...\n"
-"InnoDB: Progress in percents: ", stderr);
+ fputs("InnoDB: Starting an apply batch of log records"
+ " to the database...\n"
+ "InnoDB: Progress in percents: ", stderr);
n_hash_cells = hash_get_n_cells(recv_sys->addr_hash);
@@ -1506,12 +1547,15 @@ recv_apply_log_recs_for_backup(void)
while (recv_addr != NULL) {
if (!fil_tablespace_exists_in_mem(recv_addr->space)) {
-/*
+#if 0
fprintf(stderr,
-"InnoDB: Warning: cannot apply log record to tablespace %lu page %lu,\n"
-"InnoDB: because tablespace with that id does not exist.\n",
-recv_addr->space, recv_addr->page_no);
-*/
+ "InnoDB: Warning: cannot apply"
+ " log record to"
+ " tablespace %lu page %lu,\n"
+ "InnoDB: because tablespace with"
+ " that id does not exist.\n",
+ recv_addr->space, recv_addr->page_no);
+#endif
recv_addr->state = RECV_PROCESSED;
ut_a(recv_sys->n_addrs);
@@ -1526,19 +1570,18 @@ recv_addr->space, recv_addr->page_no);
the block corresponding to buf_pool->frame_zero
(== page). */
- buf_page_init_for_backup_restore(recv_addr->space,
- recv_addr->page_no,
- buf_block_align(page));
+ buf_page_init_for_backup_restore
+ (recv_addr->space, recv_addr->page_no,
+ buf_block_align(page));
/* Extend the tablespace's last file if the page_no
does not fall inside its bounds; we assume the last
file is auto-extending, and ibbackup copied the file
when it still was smaller */
- success = fil_extend_space_to_desired_size(
- &actual_size,
- recv_addr->space,
- recv_addr->page_no + 1);
+ success = fil_extend_space_to_desired_size
+ (&actual_size,
+ recv_addr->space, recv_addr->page_no + 1);
if (!success) {
fprintf(stderr,
"InnoDB: Fatal error: cannot extend"
@@ -1552,12 +1595,13 @@ recv_addr->space, recv_addr->page_no);
fil0fil.c routines */
error = fil_io(OS_FILE_READ, TRUE, recv_addr->space,
- recv_addr->page_no, 0, UNIV_PAGE_SIZE,
- page, NULL);
+ recv_addr->page_no, 0, UNIV_PAGE_SIZE,
+ page, NULL);
if (error != DB_SUCCESS) {
fprintf(stderr,
- "InnoDB: Fatal error: cannot read from tablespace"
- " %lu page number %lu\n",
+ "InnoDB: Fatal error: cannot read"
+ " from tablespace"
+ " %lu page number %lu\n",
(ulong) recv_addr->space,
(ulong) recv_addr->page_no);
@@ -1566,24 +1610,24 @@ recv_addr->space, recv_addr->page_no);
/* Apply the log records to this page */
recv_recover_page(TRUE, FALSE, page, recv_addr->space,
- recv_addr->page_no);
+ recv_addr->page_no);
/* Write the page back to the tablespace file using the
fil0fil.c routines */
- buf_flush_init_for_writing(page,
- mach_read_from_8(page + FIL_PAGE_LSN),
- recv_addr->space, recv_addr->page_no);
+ buf_flush_init_for_writing
+ (page, mach_read_from_8(page + FIL_PAGE_LSN),
+ recv_addr->space, recv_addr->page_no);
error = fil_io(OS_FILE_WRITE, TRUE, recv_addr->space,
- recv_addr->page_no, 0, UNIV_PAGE_SIZE,
- page, NULL);
+ recv_addr->page_no, 0, UNIV_PAGE_SIZE,
+ page, NULL);
skip_this_recv_addr:
recv_addr = HASH_GET_NEXT(addr_hash, recv_addr);
}
if ((100 * i) / n_hash_cells
- != (100 * (i + 1)) / n_hash_cells) {
+ != (100 * (i + 1)) / n_hash_cells) {
fprintf(stderr, "%lu ",
(ulong) ((100 * i) / n_hash_cells));
fflush(stderr);
@@ -1593,208 +1637,6 @@ skip_this_recv_addr:
recv_sys_empty_hash();
}
-#ifdef notdefined
-/***********************************************************************
-In the debug version, updates the replica of a file page, based on a log
-record. */
-static
-void
-recv_update_replicate(
-/*==================*/
- byte type, /* in: log record type */
- ulint space, /* in: space id */
- ulint page_no,/* in: page number */
- byte* body, /* in: log record body */
- byte* end_ptr)/* in: log record end */
-{
- page_t* replica;
- mtr_t mtr;
- byte* ptr;
-
- mtr_start(&mtr);
-
- mtr_set_log_mode(&mtr, MTR_LOG_NONE);
-
- replica = buf_page_get(space + RECV_REPLICA_SPACE_ADD, page_no,
- RW_X_LATCH, &mtr);
-#ifdef UNIV_SYNC_DEBUG
- buf_page_dbg_add_level(replica, SYNC_NO_ORDER_CHECK);
-#endif /* UNIV_SYNC_DEBUG */
-
- ptr = recv_parse_or_apply_log_rec_body(type, body, end_ptr, replica,
- &mtr);
- ut_a(ptr == end_ptr);
-
- /* Notify the buffer manager that the page has been updated */
-
- buf_flush_recv_note_modification(buf_block_align(replica),
- log_sys->old_lsn, log_sys->old_lsn);
-
- /* Make sure that committing mtr does not call log routines, as
- we currently own the log mutex */
-
- mtr.modifications = FALSE;
-
- mtr_commit(&mtr);
-}
-
-/***********************************************************************
-Checks that two strings are identical. */
-static
-void
-recv_check_identical(
-/*=================*/
- byte* str1, /* in: first string */
- byte* str2, /* in: second string */
- ulint len) /* in: length of strings */
-{
- ulint i;
-
- for (i = 0; i < len; i++) {
-
- if (str1[i] != str2[i]) {
- fprintf(stderr,
- "Strings do not match at offset %lu\n", i);
- ut_print_buf(str1 + i, 16);
- fprintf(stderr, "\n");
- ut_print_buf(str2 + i, 16);
-
- ut_error;
- }
- }
-}
-
-/***********************************************************************
-In the debug version, checks that the replica of a file page is identical
-to the original page. */
-static
-void
-recv_compare_replicate(
-/*===================*/
- ulint space, /* in: space id */
- ulint page_no)/* in: page number */
-{
- page_t* replica;
- page_t* page;
- mtr_t mtr;
-
- mtr_start(&mtr);
-
- mutex_enter(&(buf_pool->mutex));
-
- page = buf_page_hash_get(space, page_no)->frame;
-
- mutex_exit(&(buf_pool->mutex));
-
- replica = buf_page_get(space + RECV_REPLICA_SPACE_ADD, page_no,
- RW_X_LATCH, &mtr);
-#ifdef UNIV_SYNC_DEBUG
- buf_page_dbg_add_level(replica, SYNC_NO_ORDER_CHECK);
-#endif /* UNIV_SYNC_DEBUG */
-
- recv_check_identical(page + FIL_PAGE_DATA,
- replica + FIL_PAGE_DATA,
- PAGE_HEADER + PAGE_MAX_TRX_ID - FIL_PAGE_DATA);
-
- recv_check_identical(page + PAGE_HEADER + PAGE_MAX_TRX_ID + 8,
- replica + PAGE_HEADER + PAGE_MAX_TRX_ID + 8,
- UNIV_PAGE_SIZE - FIL_PAGE_DATA_END
- - PAGE_HEADER - PAGE_MAX_TRX_ID - 8);
- mtr_commit(&mtr);
-}
-
-/***********************************************************************
-Checks that a replica of a space is identical to the original space. */
-
-void
-recv_compare_spaces(
-/*================*/
- ulint space1, /* in: space id */
- ulint space2, /* in: space id */
- ulint n_pages)/* in: number of pages */
-{
- page_t* replica;
- page_t* page;
- mtr_t mtr;
- page_t* frame;
- ulint page_no;
-
- replica = buf_frame_alloc();
- page = buf_frame_alloc();
-
- for (page_no = 0; page_no < n_pages; page_no++) {
-
- mtr_start(&mtr);
-
- frame = buf_page_get_gen(space1, page_no, RW_S_LATCH, NULL,
- BUF_GET_IF_IN_POOL,
- __FILE__, __LINE__,
- &mtr);
- if (frame) {
-#ifdef UNIV_SYNC_DEBUG
- buf_page_dbg_add_level(frame, SYNC_NO_ORDER_CHECK);
-#endif /* UNIV_SYNC_DEBUG */
- ut_memcpy(page, frame, UNIV_PAGE_SIZE);
- } else {
- /* Read it from file */
- fil_io(OS_FILE_READ, TRUE, space1, page_no, 0,
- UNIV_PAGE_SIZE, page, NULL);
- }
-
- frame = buf_page_get_gen(space2, page_no, RW_S_LATCH, NULL,
- BUF_GET_IF_IN_POOL,
- __FILE__, __LINE__,
- &mtr);
- if (frame) {
-#ifdef UNIV_SYNC_DEBUG
- buf_page_dbg_add_level(frame, SYNC_NO_ORDER_CHECK);
-#endif /* UNIV_SYNC_DEBUG */
- ut_memcpy(replica, frame, UNIV_PAGE_SIZE);
- } else {
- /* Read it from file */
- fil_io(OS_FILE_READ, TRUE, space2, page_no, 0,
- UNIV_PAGE_SIZE, replica, NULL);
- }
-
- recv_check_identical(page + FIL_PAGE_DATA,
- replica + FIL_PAGE_DATA,
- PAGE_HEADER + PAGE_MAX_TRX_ID - FIL_PAGE_DATA);
-
- recv_check_identical(page + PAGE_HEADER + PAGE_MAX_TRX_ID + 8,
- replica + PAGE_HEADER + PAGE_MAX_TRX_ID + 8,
- UNIV_PAGE_SIZE - FIL_PAGE_DATA_END
- - PAGE_HEADER - PAGE_MAX_TRX_ID - 8);
-
- mtr_commit(&mtr);
- }
-
- buf_frame_free(replica);
- buf_frame_free(page);
-}
-
-/***********************************************************************
-Checks that a replica of a space is identical to the original space. Disables
-ibuf operations and flushes and invalidates the buffer pool pages after the
-test. This function can be used to check the recovery before dict or trx
-systems are initialized. */
-
-void
-recv_compare_spaces_low(
-/*====================*/
- ulint space1, /* in: space id */
- ulint space2, /* in: space id */
- ulint n_pages)/* in: number of pages */
-{
- mutex_enter(&(log_sys->mutex));
-
- recv_apply_hashed_log_recs(FALSE);
-
- mutex_exit(&(log_sys->mutex));
-
- recv_compare_spaces(space1, space2, n_pages);
-}
-#endif /* UNIV_LOG_REPLICATE */
-
/***********************************************************************
Tries to parse a single log record and returns its length. */
static
@@ -1835,7 +1677,7 @@ recv_parse_log_rec(
}
new_ptr = mlog_parse_initial_log_record(ptr, end_ptr, type, space,
- page_no);
+ page_no);
*body = new_ptr;
if (UNIV_UNLIKELY(!new_ptr)) {
@@ -1853,7 +1695,7 @@ recv_parse_log_rec(
}
new_ptr = recv_parse_or_apply_log_rec_body(*type, new_ptr, end_ptr,
- NULL, NULL);
+ NULL, NULL);
if (UNIV_UNLIKELY(new_ptr == NULL)) {
return(0);
@@ -1880,13 +1722,13 @@ recv_calc_lsn_on_data_add(
ulint lsn_len;
frag_len = (ut_dulint_get_low(lsn) % OS_FILE_LOG_BLOCK_SIZE)
- - LOG_BLOCK_HDR_SIZE;
+ - LOG_BLOCK_HDR_SIZE;
ut_ad(frag_len < OS_FILE_LOG_BLOCK_SIZE - LOG_BLOCK_HDR_SIZE
- - LOG_BLOCK_TRL_SIZE);
+ - LOG_BLOCK_TRL_SIZE);
lsn_len = len + ((len + frag_len)
/ (OS_FILE_LOG_BLOCK_SIZE - LOG_BLOCK_HDR_SIZE
- - LOG_BLOCK_TRL_SIZE))
- * (LOG_BLOCK_HDR_SIZE + LOG_BLOCK_TRL_SIZE);
+ - LOG_BLOCK_TRL_SIZE))
+ * (LOG_BLOCK_HDR_SIZE + LOG_BLOCK_TRL_SIZE);
return(ut_dulint_add(lsn, lsn_len));
}
@@ -1909,7 +1751,7 @@ recv_check_incomplete_log_recs(
for (i = 0; i < len; i++) {
ut_a(0 == recv_parse_log_rec(ptr, ptr + i, &type, &space,
- &page_no, &body));
+ &page_no, &body));
}
}
@@ -1925,11 +1767,11 @@ recv_report_corrupt_log(
ulint page_no)/* in: page number, this may also be garbage */
{
fprintf(stderr,
-"InnoDB: ############### CORRUPT LOG RECORD FOUND\n"
-"InnoDB: Log record type %lu, space id %lu, page number %lu\n"
-"InnoDB: Log parsing proceeded successfully up to %lu %lu\n"
-"InnoDB: Previous log record type %lu, is multi %lu\n"
-"InnoDB: Recv offset %lu, prev %lu\n",
+ "InnoDB: ############### CORRUPT LOG RECORD FOUND\n"
+ "InnoDB: Log record type %lu, space id %lu, page number %lu\n"
+ "InnoDB: Log parsing proceeded successfully up to %lu %lu\n"
+ "InnoDB: Previous log record type %lu, is multi %lu\n"
+ "InnoDB: Recv offset %lu, prev %lu\n",
(ulong) type, (ulong) space, (ulong) page_no,
(ulong) ut_dulint_get_high(recv_sys->recovered_lsn),
(ulong) ut_dulint_get_low(recv_sys->recovered_lsn),
@@ -1939,31 +1781,33 @@ recv_report_corrupt_log(
(ulong) recv_previous_parsed_rec_offset);
if ((ulint)(ptr - recv_sys->buf + 100)
- > recv_previous_parsed_rec_offset
- && (ulint)(ptr - recv_sys->buf + 100
- - recv_previous_parsed_rec_offset)
- < 200000) {
- fputs(
-"InnoDB: Hex dump of corrupt log starting 100 bytes before the start\n"
-"InnoDB: of the previous log rec,\n"
-"InnoDB: and ending 100 bytes after the start of the corrupt rec:\n",
- stderr);
+ > recv_previous_parsed_rec_offset
+ && (ulint)(ptr - recv_sys->buf + 100
+ - recv_previous_parsed_rec_offset)
+ < 200000) {
+ fputs("InnoDB: Hex dump of corrupt log starting"
+ " 100 bytes before the start\n"
+ "InnoDB: of the previous log rec,\n"
+ "InnoDB: and ending 100 bytes after the start"
+ " of the corrupt rec:\n",
+ stderr);
ut_print_buf(stderr,
- recv_sys->buf + recv_previous_parsed_rec_offset - 100,
- ptr - recv_sys->buf + 200 -
- recv_previous_parsed_rec_offset);
+ recv_sys->buf
+ + recv_previous_parsed_rec_offset - 100,
+ ptr - recv_sys->buf + 200
+ - recv_previous_parsed_rec_offset);
putc('\n', stderr);
}
- fputs(
- "InnoDB: WARNING: the log file may have been corrupt and it\n"
- "InnoDB: is possible that the log scan did not proceed\n"
- "InnoDB: far enough in recovery! Please run CHECK TABLE\n"
- "InnoDB: on your InnoDB tables to check that they are ok!\n"
- "InnoDB: If mysqld crashes after this recovery, look at\n"
- "InnoDB: http://dev.mysql.com/doc/refman/5.1/en/forcing-recovery.html\n"
- "InnoDB: about forcing recovery.\n", stderr);
+ fputs("InnoDB: WARNING: the log file may have been corrupt and it\n"
+ "InnoDB: is possible that the log scan did not proceed\n"
+ "InnoDB: far enough in recovery! Please run CHECK TABLE\n"
+ "InnoDB: on your InnoDB tables to check that they are ok!\n"
+ "InnoDB: If mysqld crashes after this recovery, look at\n"
+ "InnoDB: http://dev.mysql.com/doc/refman/5.1/en/"
+ "forcing-recovery.html\n"
+ "InnoDB: about forcing recovery.\n", stderr);
fflush(stderr);
}
@@ -2018,13 +1862,13 @@ loop:
page no, and a pointer to the body of the log record */
len = recv_parse_log_rec(ptr, end_ptr, &type, &space,
- &page_no, &body);
+ &page_no, &body);
if (len == 0 || recv_sys->found_corrupt_log) {
if (recv_sys->found_corrupt_log) {
recv_report_corrupt_log(ptr,
- type, space, page_no);
+ type, space, page_no);
}
return(FALSE);
@@ -2033,7 +1877,7 @@ loop:
new_recovered_lsn = recv_calc_lsn_on_data_add(old_lsn, len);
if (ut_dulint_cmp(new_recovered_lsn, recv_sys->scanned_lsn)
- > 0) {
+ > 0) {
/* The log record filled a log block, and we require
that also the next log block should have been scanned
in */
@@ -2051,7 +1895,8 @@ loop:
#ifdef UNIV_DEBUG
if (log_debug_writes) {
fprintf(stderr,
-"InnoDB: Parsed a single log rec type %lu len %lu space %lu page no %lu\n",
+ "InnoDB: Parsed a single log rec"
+ " type %lu len %lu space %lu page no %lu\n",
(ulong) type, (ulong) len, (ulong) space,
(ulong) page_no);
}
@@ -2061,8 +1906,8 @@ loop:
/* Do nothing */
} else if (store_to_hash && (type == MLOG_FILE_CREATE
- || type == MLOG_FILE_RENAME
- || type == MLOG_FILE_DELETE)) {
+ || type == MLOG_FILE_RENAME
+ || type == MLOG_FILE_DELETE)) {
#ifdef UNIV_HOTBACKUP
if (recv_replay_file_ops) {
@@ -2071,11 +1916,16 @@ loop:
fil_path_to_mysql_datadir is set in ibbackup to
point to the datadir we should use there */
- if (NULL == fil_op_log_parse_or_replay(body,
- end_ptr, type, TRUE, space)) {
+ if (NULL == fil_op_log_parse_or_replay
+ (body, end_ptr, type, TRUE, space)) {
fprintf(stderr,
-"InnoDB: Error: file op log record of type %lu space %lu not complete in\n"
-"InnoDB: the replay phase. Path %s\n", (ulint)type, space, (char*)(body + 2));
+ "InnoDB: Error: file op"
+ " log record of type %lu"
+ " space %lu not complete in\n"
+ "InnoDB: the replay phase."
+ " Path %s\n",
+ (ulint)type, space,
+ (char*)(body + 2));
ut_a(0);
}
@@ -2085,21 +1935,12 @@ loop:
replay file operations */
} else if (store_to_hash) {
recv_add_to_hash_table(type, space, page_no, body,
- ptr + len, old_lsn,
- recv_sys->recovered_lsn);
+ ptr + len, old_lsn,
+ recv_sys->recovered_lsn);
} else {
- /* In debug checking, update a replicate page
- according to the log record, and check that it
- becomes identical with the original page */
#ifdef UNIV_LOG_DEBUG
recv_check_incomplete_log_recs(ptr, len);
#endif/* UNIV_LOG_DEBUG */
-#ifdef UNIV_LOG_REPLICATE
- recv_update_replicate(type, space, page_no, body,
- ptr + len);
- recv_compare_replicate(space, page_no);
-#endif /* UNIV_LOG_REPLICATE */
-
}
} else {
/* Check that all the records associated with the single mtr
@@ -2110,13 +1951,13 @@ loop:
for (;;) {
len = recv_parse_log_rec(ptr, end_ptr, &type, &space,
- &page_no, &body);
+ &page_no, &body);
if (len == 0 || recv_sys->found_corrupt_log) {
if (recv_sys->found_corrupt_log) {
- recv_report_corrupt_log(ptr,
- type, space, page_no);
+ recv_report_corrupt_log
+ (ptr, type, space, page_no);
}
return(FALSE);
@@ -2128,23 +1969,19 @@ loop:
recv_previous_parsed_rec_is_multi = 1;
if ((!store_to_hash) && (type != MLOG_MULTI_REC_END)) {
- /* In debug checking, update a replicate page
- according to the log record */
#ifdef UNIV_LOG_DEBUG
recv_check_incomplete_log_recs(ptr, len);
#endif /* UNIV_LOG_DEBUG */
-#ifdef UNIV_LOG_REPLICATE
- recv_update_replicate(type, space, page_no,
- body, ptr + len);
-#endif /* UNIV_LOG_REPLICATE */
}
#ifdef UNIV_DEBUG
if (log_debug_writes) {
fprintf(stderr,
-"InnoDB: Parsed a multi log rec type %lu len %lu space %lu page no %lu\n",
- (ulong) type, (ulong) len, (ulong) space,
- (ulong) page_no);
+ "InnoDB: Parsed a multi log rec"
+ " type %lu len %lu"
+ " space %lu page no %lu\n",
+ (ulong) type, (ulong) len,
+ (ulong) space, (ulong) page_no);
}
#endif /* UNIV_DEBUG */
@@ -2161,11 +1998,11 @@ loop:
}
}
- new_recovered_lsn = recv_calc_lsn_on_data_add(
- recv_sys->recovered_lsn, total_len);
+ new_recovered_lsn = recv_calc_lsn_on_data_add
+ (recv_sys->recovered_lsn, total_len);
if (ut_dulint_cmp(new_recovered_lsn, recv_sys->scanned_lsn)
- > 0) {
+ > 0) {
/* The log record filled a log block, and we require
that also the next log block should have been scanned
in */
@@ -2180,7 +2017,7 @@ loop:
for (;;) {
old_lsn = recv_sys->recovered_lsn;
len = recv_parse_log_rec(ptr, end_ptr, &type, &space,
- &page_no, &body);
+ &page_no, &body);
if (recv_sys->found_corrupt_log) {
recv_report_corrupt_log(ptr,
@@ -2191,8 +2028,8 @@ loop:
ut_a(0 == ((ulint)*ptr & MLOG_SINGLE_REC_FLAG));
recv_sys->recovered_offset += len;
- recv_sys->recovered_lsn = recv_calc_lsn_on_data_add(
- old_lsn, len);
+ recv_sys->recovered_lsn
+ = recv_calc_lsn_on_data_add(old_lsn, len);
if (type == MLOG_MULTI_REC_END) {
/* Found the end mark for the records */
@@ -2202,15 +2039,9 @@ loop:
if (store_to_hash) {
recv_add_to_hash_table(type, space, page_no,
- body, ptr + len, old_lsn,
- new_recovered_lsn);
-#ifdef UNIV_LOG_REPLICATE
- } else {
- /* In debug checking, check that the replicate
- page has become identical with the original
- page */
- recv_compare_replicate(space, page_no);
-#endif /* UNIV_LOG_REPLICATE */
+ body, ptr + len,
+ old_lsn,
+ new_recovered_lsn);
}
ptr += len;
@@ -2257,9 +2088,9 @@ recv_sys_add_to_parsing_buf(
return(FALSE);
} else if (ut_dulint_cmp(recv_sys->parse_start_lsn,
- recv_sys->scanned_lsn) > 0) {
+ recv_sys->scanned_lsn) > 0) {
more_len = ut_dulint_minus(scanned_lsn,
- recv_sys->parse_start_lsn);
+ recv_sys->parse_start_lsn);
} else {
more_len = ut_dulint_minus(scanned_lsn, recv_sys->scanned_lsn);
}
@@ -2287,7 +2118,7 @@ recv_sys_add_to_parsing_buf(
if (start_offset < end_offset) {
ut_memcpy(recv_sys->buf + recv_sys->len,
- log_block + start_offset, end_offset - start_offset);
+ log_block + start_offset, end_offset - start_offset);
recv_sys->len += end_offset - start_offset;
@@ -2305,7 +2136,7 @@ recv_sys_justify_left_parsing_buf(void)
/*===================================*/
{
ut_memmove(recv_sys->buf, recv_sys->buf + recv_sys->recovered_offset,
- recv_sys->len - recv_sys->recovered_offset);
+ recv_sys->len - recv_sys->recovered_offset);
recv_sys->len -= recv_sys->recovered_offset;
@@ -2361,26 +2192,32 @@ recv_scan_log_recs(
while (log_block < buf + len && !finished) {
no = log_block_get_hdr_no(log_block);
-/*
+ /*
fprintf(stderr, "Log block header no %lu\n", no);
fprintf(stderr, "Scanned lsn no %lu\n",
- log_block_convert_lsn_to_no(scanned_lsn));
-*/
+ log_block_convert_lsn_to_no(scanned_lsn));
+ */
if (no != log_block_convert_lsn_to_no(scanned_lsn)
- || !log_block_checksum_is_ok_or_old_format(log_block)) {
+ || !log_block_checksum_is_ok_or_old_format(log_block)) {
if (no == log_block_convert_lsn_to_no(scanned_lsn)
- && !log_block_checksum_is_ok_or_old_format(
- log_block)) {
+ && !log_block_checksum_is_ok_or_old_format
+ (log_block)) {
fprintf(stderr,
-"InnoDB: Log block no %lu at lsn %lu %lu has\n"
-"InnoDB: ok header, but checksum field contains %lu, should be %lu\n",
- (ulong) no,
- (ulong) ut_dulint_get_high(scanned_lsn),
- (ulong) ut_dulint_get_low(scanned_lsn),
- (ulong) log_block_get_checksum(log_block),
- (ulong) log_block_calc_checksum(log_block));
+ "InnoDB: Log block no %lu at"
+ " lsn %lu %lu has\n"
+ "InnoDB: ok header, but checksum field"
+ " contains %lu, should be %lu\n",
+ (ulong) no,
+ (ulong) ut_dulint_get_high
+ (scanned_lsn),
+ (ulong) ut_dulint_get_low
+ (scanned_lsn),
+ (ulong) log_block_get_checksum
+ (log_block),
+ (ulong) log_block_calc_checksum
+ (log_block));
}
/* Garbage or an incompletely written log block */
@@ -2406,14 +2243,14 @@ recv_scan_log_recs(
data_len = log_block_get_data_len(log_block);
if ((store_to_hash || (data_len == OS_FILE_LOG_BLOCK_SIZE))
- && (ut_dulint_cmp(ut_dulint_add(scanned_lsn, data_len),
- recv_sys->scanned_lsn) > 0)
- && (recv_sys->scanned_checkpoint_no > 0)
- && (log_block_get_checkpoint_no(log_block)
- < recv_sys->scanned_checkpoint_no)
- && (recv_sys->scanned_checkpoint_no
- - log_block_get_checkpoint_no(log_block)
- > 0x80000000UL)) {
+ && (ut_dulint_cmp(ut_dulint_add(scanned_lsn, data_len),
+ recv_sys->scanned_lsn) > 0)
+ && (recv_sys->scanned_checkpoint_no > 0)
+ && (log_block_get_checkpoint_no(log_block)
+ < recv_sys->scanned_checkpoint_no)
+ && (recv_sys->scanned_checkpoint_no
+ - log_block_get_checkpoint_no(log_block)
+ > 0x80000000UL)) {
/* Garbage from a log buffer flush which was made
before the most recent database recovery */
@@ -2429,14 +2266,15 @@ recv_scan_log_recs(
}
if (ut_dulint_is_zero(recv_sys->parse_start_lsn)
- && (log_block_get_first_rec_group(log_block) > 0)) {
+ && (log_block_get_first_rec_group(log_block) > 0)) {
/* We found a point from which to start the parsing
of log records */
- recv_sys->parse_start_lsn =
- ut_dulint_add(scanned_lsn,
- log_block_get_first_rec_group(log_block));
+ recv_sys->parse_start_lsn
+ = ut_dulint_add(scanned_lsn,
+ log_block_get_first_rec_group
+ (log_block));
recv_sys->scanned_lsn = recv_sys->parse_start_lsn;
recv_sys->recovered_lsn = recv_sys->parse_start_lsn;
}
@@ -2450,20 +2288,22 @@ recv_scan_log_recs(
non-zero */
if (recv_sys->len + 4 * OS_FILE_LOG_BLOCK_SIZE
- >= RECV_PARSING_BUF_SIZE) {
+ >= RECV_PARSING_BUF_SIZE) {
fprintf(stderr,
-"InnoDB: Error: log parsing buffer overflow. Recovery may have failed!\n");
+ "InnoDB: Error: log parsing"
+ " buffer overflow."
+ " Recovery may have failed!\n");
recv_sys->found_corrupt_log = TRUE;
} else if (!recv_sys->found_corrupt_log) {
- more_data = recv_sys_add_to_parsing_buf(
- log_block, scanned_lsn);
+ more_data = recv_sys_add_to_parsing_buf
+ (log_block, scanned_lsn);
}
recv_sys->scanned_lsn = scanned_lsn;
- recv_sys->scanned_checkpoint_no =
- log_block_get_checkpoint_no(log_block);
+ recv_sys->scanned_checkpoint_no
+ = log_block_get_checkpoint_no(log_block);
}
if (data_len < OS_FILE_LOG_BLOCK_SIZE) {
@@ -2478,13 +2318,14 @@ recv_scan_log_recs(
*group_scanned_lsn = scanned_lsn;
if (recv_needed_recovery
- || (recv_is_from_backup && !recv_is_making_a_backup)) {
+ || (recv_is_from_backup && !recv_is_making_a_backup)) {
recv_scan_print_counter++;
if (finished || (recv_scan_print_counter % 80 == 0)) {
fprintf(stderr,
-"InnoDB: Doing recovery: scanned up to log sequence number %lu %lu\n",
+ "InnoDB: Doing recovery: scanned up to"
+ " log sequence number %lu %lu\n",
(ulong) ut_dulint_get_high(*group_scanned_lsn),
(ulong) ut_dulint_get_low(*group_scanned_lsn));
}
@@ -2496,8 +2337,8 @@ recv_scan_log_recs(
recv_parse_log_recs(store_to_hash);
if (store_to_hash && mem_heap_get_size(recv_sys->heap)
- > available_memory
- && apply_automatically) {
+ > available_memory
+ && apply_automatically) {
/* Hash table of log records has grown too big:
empty it; FALSE means no ibuf operations
@@ -2542,24 +2383,24 @@ recv_group_scan_log_recs(
end_lsn = ut_dulint_add(start_lsn, RECV_SCAN_SIZE);
log_group_read_log_seg(LOG_RECOVER, log_sys->buf,
- group, start_lsn, end_lsn);
-
- finished = recv_scan_log_recs(TRUE,
- (buf_pool->n_frames
- - recv_n_pool_free_frames) * UNIV_PAGE_SIZE,
- TRUE, log_sys->buf,
- RECV_SCAN_SIZE, start_lsn,
- contiguous_lsn, group_scanned_lsn);
+ group, start_lsn, end_lsn);
+
+ finished = recv_scan_log_recs
+ (TRUE, (buf_pool->n_frames - recv_n_pool_free_frames)
+ * UNIV_PAGE_SIZE, TRUE, log_sys->buf,
+ RECV_SCAN_SIZE, start_lsn,
+ contiguous_lsn, group_scanned_lsn);
start_lsn = end_lsn;
}
#ifdef UNIV_DEBUG
if (log_debug_writes) {
fprintf(stderr,
- "InnoDB: Scanned group %lu up to log sequence number %lu %lu\n",
- (ulong) group->id,
- (ulong) ut_dulint_get_high(*group_scanned_lsn),
- (ulong) ut_dulint_get_low(*group_scanned_lsn));
+ "InnoDB: Scanned group %lu up to"
+ " log sequence number %lu %lu\n",
+ (ulong) group->id,
+ (ulong) ut_dulint_get_high(*group_scanned_lsn),
+ (ulong) ut_dulint_get_low(*group_scanned_lsn));
}
#endif /* UNIV_DEBUG */
}
@@ -2595,7 +2436,7 @@ recv_recovery_from_checkpoint_start(
ulint err;
ut_ad((type != LOG_CHECKPOINT)
- || (ut_dulint_cmp(limit_lsn, ut_dulint_max) == 0));
+ || (ut_dulint_cmp(limit_lsn, ut_dulint_max) == 0));
if (type == LOG_CHECKPOINT) {
recv_sys_create();
@@ -2604,9 +2445,9 @@ recv_recovery_from_checkpoint_start(
if (srv_force_recovery >= SRV_FORCE_NO_LOG_REDO) {
fprintf(stderr,
- "InnoDB: The user has set SRV_FORCE_NO_LOG_REDO on\n");
+ "InnoDB: The user has set SRV_FORCE_NO_LOG_REDO on\n");
fprintf(stderr,
- "InnoDB: Skipping log redo\n");
+ "InnoDB: Skipping log redo\n");
return(DB_SUCCESS);
}
@@ -2640,29 +2481,32 @@ recv_recovery_from_checkpoint_start(
a recovery from a restored InnoDB Hot Backup */
fil_io(OS_FILE_READ | OS_FILE_LOG, TRUE, max_cp_group->space_id,
- 0, 0, LOG_FILE_HDR_SIZE,
- log_hdr_buf, max_cp_group);
+ 0, 0, LOG_FILE_HDR_SIZE,
+ log_hdr_buf, max_cp_group);
if (0 == ut_memcmp(log_hdr_buf + LOG_FILE_WAS_CREATED_BY_HOT_BACKUP,
- (byte*)"ibbackup", (sizeof "ibbackup") - 1)) {
+ (byte*)"ibbackup", (sizeof "ibbackup") - 1)) {
/* This log file was created by ibbackup --restore: print
a note to the user about it */
fprintf(stderr,
- "InnoDB: The log file was created by ibbackup --apply-log at\n"
- "InnoDB: %s\n", log_hdr_buf + LOG_FILE_WAS_CREATED_BY_HOT_BACKUP);
+ "InnoDB: The log file was created by"
+ " ibbackup --apply-log at\n"
+ "InnoDB: %s\n",
+ log_hdr_buf + LOG_FILE_WAS_CREATED_BY_HOT_BACKUP);
fprintf(stderr,
-"InnoDB: NOTE: the following crash recovery is part of a normal restore.\n");
+ "InnoDB: NOTE: the following crash recovery"
+ " is part of a normal restore.\n");
/* Wipe over the label now */
memset(log_hdr_buf + LOG_FILE_WAS_CREATED_BY_HOT_BACKUP,
- ' ', 4);
+ ' ', 4);
/* Write to the log file to wipe over the label */
fil_io(OS_FILE_WRITE | OS_FILE_LOG, TRUE,
- max_cp_group->space_id,
- 0, 0, OS_FILE_LOG_BLOCK_SIZE,
- log_hdr_buf, max_cp_group);
+ max_cp_group->space_id,
+ 0, 0, OS_FILE_LOG_BLOCK_SIZE,
+ log_hdr_buf, max_cp_group);
}
#ifdef UNIV_LOG_ARCHIVE
@@ -2670,8 +2514,8 @@ recv_recovery_from_checkpoint_start(
while (group) {
log_checkpoint_get_nth_group_info(buf, group->id,
- &(group->archived_file_no),
- &(group->archived_offset));
+ &(group->archived_file_no),
+ &(group->archived_offset));
group = UT_LIST_GET_NEXT(log_groups, group);
}
@@ -2694,26 +2538,41 @@ recv_recovery_from_checkpoint_start(
user about recovery: */
if (ut_dulint_cmp(checkpoint_lsn, max_flushed_lsn) != 0
- || ut_dulint_cmp(checkpoint_lsn, min_flushed_lsn) != 0) {
+ || ut_dulint_cmp(checkpoint_lsn, min_flushed_lsn) != 0) {
if (ut_dulint_cmp(checkpoint_lsn, max_flushed_lsn)
- < 0) {
+ < 0) {
fprintf(stderr,
-"InnoDB: ##########################################################\n"
-"InnoDB: WARNING!\n"
-"InnoDB: The log sequence number in ibdata files is higher\n"
-"InnoDB: than the log sequence number in the ib_logfiles! Are you sure\n"
-"InnoDB: you are using the right ib_logfiles to start up the database?\n"
-"InnoDB: Log sequence number in ib_logfiles is %lu %lu, log\n"
-"InnoDB: sequence numbers stamped to ibdata file headers are between\n"
-"InnoDB: %lu %lu and %lu %lu.\n"
-"InnoDB: ##########################################################\n",
- (ulong) ut_dulint_get_high(checkpoint_lsn),
- (ulong) ut_dulint_get_low(checkpoint_lsn),
- (ulong) ut_dulint_get_high(min_flushed_lsn),
- (ulong) ut_dulint_get_low(min_flushed_lsn),
- (ulong) ut_dulint_get_high(max_flushed_lsn),
- (ulong) ut_dulint_get_low(max_flushed_lsn));
+ "InnoDB: #########################"
+ "#################################\n"
+ "InnoDB: "
+ "WARNING!\n"
+ "InnoDB: The log sequence number"
+ " in ibdata files is higher\n"
+ "InnoDB: than the log sequence number"
+ " in the ib_logfiles! Are you sure\n"
+ "InnoDB: you are using the right"
+ " ib_logfiles to start up"
+ " the database?\n"
+ "InnoDB: Log sequence number in"
+ " ib_logfiles is %lu %lu, log\n"
+ "InnoDB: sequence numbers stamped"
+ " to ibdata file headers are between\n"
+ "InnoDB: %lu %lu and %lu %lu.\n"
+ "InnoDB: #########################"
+ "#################################\n",
+ (ulong) ut_dulint_get_high
+ (checkpoint_lsn),
+ (ulong) ut_dulint_get_low
+ (checkpoint_lsn),
+ (ulong) ut_dulint_get_high
+ (min_flushed_lsn),
+ (ulong) ut_dulint_get_low
+ (min_flushed_lsn),
+ (ulong) ut_dulint_get_high
+ (max_flushed_lsn),
+ (ulong) ut_dulint_get_low
+ (max_flushed_lsn));
}
recv_needed_recovery = TRUE;
@@ -2721,11 +2580,13 @@ recv_recovery_from_checkpoint_start(
ut_print_timestamp(stderr);
fprintf(stderr,
-" InnoDB: Database was not shut down normally!\n"
-"InnoDB: Starting crash recovery.\n");
+ " InnoDB: Database was not"
+ " shut down normally!\n"
+ "InnoDB: Starting crash recovery.\n");
fprintf(stderr,
-"InnoDB: Reading tablespace information from the .ibd files...\n");
+ "InnoDB: Reading tablespace information"
+ " from the .ibd files...\n");
fil_load_single_table_tablespaces();
@@ -2737,19 +2598,22 @@ recv_recovery_from_checkpoint_start(
if (srv_force_recovery < SRV_FORCE_NO_LOG_REDO) {
fprintf(stderr,
-"InnoDB: Restoring possible half-written data pages from the doublewrite\n"
-"InnoDB: buffer...\n");
- trx_sys_doublewrite_init_or_restore_pages(
- TRUE);
+ "InnoDB: Restoring possible"
+ " half-written data pages from"
+ " the doublewrite\n"
+ "InnoDB: buffer...\n");
+ trx_sys_doublewrite_init_or_restore_pages
+ (TRUE);
}
ut_print_timestamp(stderr);
fprintf(stderr,
-" InnoDB: Starting log scan based on checkpoint at\n"
-"InnoDB: log sequence number %lu %lu.\n",
- (ulong) ut_dulint_get_high(checkpoint_lsn),
- (ulong) ut_dulint_get_low(checkpoint_lsn));
+ " InnoDB: Starting log scan"
+ " based on checkpoint at\n"
+ "InnoDB: log sequence number %lu %lu.\n",
+ (ulong) ut_dulint_get_high(checkpoint_lsn),
+ (ulong) ut_dulint_get_low(checkpoint_lsn));
} else {
/* Init the doublewrite buffer memory structure */
trx_sys_doublewrite_init_or_restore_pages(FALSE);
@@ -2757,7 +2621,7 @@ recv_recovery_from_checkpoint_start(
}
contiguous_lsn = ut_dulint_align_down(recv_sys->scanned_lsn,
- OS_FILE_LOG_BLOCK_SIZE);
+ OS_FILE_LOG_BLOCK_SIZE);
if (type == LOG_ARCHIVE) {
/* Try to recover the remaining part from logs: first from
the logs of the archived group */
@@ -2765,10 +2629,11 @@ recv_recovery_from_checkpoint_start(
group = recv_sys->archive_group;
capacity = log_group_get_capacity(group);
- if ((ut_dulint_cmp(recv_sys->scanned_lsn,
- ut_dulint_add(checkpoint_lsn, capacity)) > 0)
- || (ut_dulint_cmp(checkpoint_lsn,
- ut_dulint_add(recv_sys->scanned_lsn, capacity)) > 0)) {
+ if ((ut_dulint_cmp(recv_sys->scanned_lsn, ut_dulint_add
+ (checkpoint_lsn, capacity)) > 0)
+ || (ut_dulint_cmp(checkpoint_lsn, ut_dulint_add
+ (recv_sys->scanned_lsn, capacity))
+ > 0)) {
mutex_exit(&(log_sys->mutex));
@@ -2779,7 +2644,7 @@ recv_recovery_from_checkpoint_start(
}
recv_group_scan_log_recs(group, &contiguous_lsn,
- &group_scanned_lsn);
+ &group_scanned_lsn);
if (ut_dulint_cmp(recv_sys->scanned_lsn, checkpoint_lsn) < 0) {
mutex_exit(&(log_sys->mutex));
@@ -2809,7 +2674,7 @@ recv_recovery_from_checkpoint_start(
old_scanned_lsn = recv_sys->scanned_lsn;
recv_group_scan_log_recs(group, &contiguous_lsn,
- &group_scanned_lsn);
+ &group_scanned_lsn);
group->scanned_lsn = group_scanned_lsn;
if (ut_dulint_cmp(old_scanned_lsn, group_scanned_lsn) < 0) {
@@ -2819,7 +2684,7 @@ recv_recovery_from_checkpoint_start(
}
if ((type == LOG_ARCHIVE)
- && (group == recv_sys->archive_group)) {
+ && (group == recv_sys->archive_group)) {
group = UT_LIST_GET_NEXT(log_groups, group);
}
@@ -2830,25 +2695,29 @@ recv_recovery_from_checkpoint_start(
if (ut_dulint_cmp(group_scanned_lsn, checkpoint_lsn) < 0) {
ut_print_timestamp(stderr);
fprintf(stderr,
-" InnoDB: ERROR: We were only able to scan the log up to\n"
-"InnoDB: %lu %lu, but a checkpoint was at %lu %lu.\n"
-"InnoDB: It is possible that the database is now corrupt!\n",
- (ulong) ut_dulint_get_high(group_scanned_lsn),
- (ulong) ut_dulint_get_low(group_scanned_lsn),
- (ulong) ut_dulint_get_high(checkpoint_lsn),
- (ulong) ut_dulint_get_low(checkpoint_lsn));
+ " InnoDB: ERROR: We were only able to scan the log"
+ " up to\n"
+ "InnoDB: %lu %lu, but a checkpoint was at %lu %lu.\n"
+ "InnoDB: It is possible that"
+ " the database is now corrupt!\n",
+ (ulong) ut_dulint_get_high(group_scanned_lsn),
+ (ulong) ut_dulint_get_low(group_scanned_lsn),
+ (ulong) ut_dulint_get_high(checkpoint_lsn),
+ (ulong) ut_dulint_get_low(checkpoint_lsn));
}
if (ut_dulint_cmp(group_scanned_lsn, recv_max_page_lsn) < 0) {
ut_print_timestamp(stderr);
fprintf(stderr,
-" InnoDB: ERROR: We were only able to scan the log up to %lu %lu\n"
-"InnoDB: but a database page a had an lsn %lu %lu. It is possible that the\n"
-"InnoDB: database is now corrupt!\n",
- (ulong) ut_dulint_get_high(group_scanned_lsn),
- (ulong) ut_dulint_get_low(group_scanned_lsn),
- (ulong) ut_dulint_get_high(recv_max_page_lsn),
- (ulong) ut_dulint_get_low(recv_max_page_lsn));
+ " InnoDB: ERROR: We were only able to scan the log"
+ " up to %lu %lu\n"
+ "InnoDB: but a database page a had an lsn %lu %lu."
+ " It is possible that the\n"
+ "InnoDB: database is now corrupt!\n",
+ (ulong) ut_dulint_get_high(group_scanned_lsn),
+ (ulong) ut_dulint_get_low(group_scanned_lsn),
+ (ulong) ut_dulint_get_high(recv_max_page_lsn),
+ (ulong) ut_dulint_get_low(recv_max_page_lsn));
}
if (ut_dulint_cmp(recv_sys->recovered_lsn, checkpoint_lsn) < 0) {
@@ -2879,14 +2748,18 @@ recv_recovery_from_checkpoint_start(
if (!recv_needed_recovery) {
if (ut_dulint_cmp(checkpoint_lsn, recv_sys->recovered_lsn)
- != 0) {
+ != 0) {
fprintf(stderr,
-"InnoDB: Warning: we did not need to do crash recovery, but log scan\n"
-"InnoDB: progressed past the checkpoint lsn %lu %lu up to lsn %lu %lu\n",
- (ulong) ut_dulint_get_high(checkpoint_lsn),
- (ulong) ut_dulint_get_low(checkpoint_lsn),
- (ulong) ut_dulint_get_high(recv_sys->recovered_lsn),
- (ulong) ut_dulint_get_low(recv_sys->recovered_lsn));
+ "InnoDB: Warning: we did not need to do"
+ " crash recovery, but log scan\n"
+ "InnoDB: progressed past the checkpoint"
+ " lsn %lu %lu up to lsn %lu %lu\n",
+ (ulong) ut_dulint_get_high(checkpoint_lsn),
+ (ulong) ut_dulint_get_low(checkpoint_lsn),
+ (ulong) ut_dulint_get_high
+ (recv_sys->recovered_lsn),
+ (ulong) ut_dulint_get_low
+ (recv_sys->recovered_lsn));
}
} else {
srv_start_lsn = recv_sys->recovered_lsn;
@@ -2897,7 +2770,7 @@ recv_recovery_from_checkpoint_start(
ut_memcpy(log_sys->buf, recv_sys->last_block, OS_FILE_LOG_BLOCK_SIZE);
log_sys->buf_free = ut_dulint_get_low(log_sys->lsn)
- % OS_FILE_LOG_BLOCK_SIZE;
+ % OS_FILE_LOG_BLOCK_SIZE;
log_sys->buf_next_to_write = log_sys->buf_free;
log_sys->written_to_some_lsn = log_sys->lsn;
log_sys->written_to_all_lsn = log_sys->lsn;
@@ -2949,7 +2822,7 @@ recv_recovery_from_checkpoint_finish(void)
#ifdef UNIV_DEBUG
if (log_debug_writes) {
fprintf(stderr,
- "InnoDB: Log records applied to the database\n");
+ "InnoDB: Log records applied to the database\n");
}
#endif /* UNIV_DEBUG */
@@ -2961,12 +2834,17 @@ recv_recovery_from_checkpoint_finish(void)
if (recv_sys->found_corrupt_log) {
fprintf(stderr,
- "InnoDB: WARNING: the log file may have been corrupt and it\n"
- "InnoDB: is possible that the log scan or parsing did not proceed\n"
- "InnoDB: far enough in recovery. Please run CHECK TABLE\n"
- "InnoDB: on your InnoDB tables to check that they are ok!\n"
- "InnoDB: It may be safest to recover your InnoDB database from\n"
- "InnoDB: a backup!\n");
+ "InnoDB: WARNING: the log file may have been"
+ " corrupt and it\n"
+ "InnoDB: is possible that the log scan or parsing"
+ " did not proceed\n"
+ "InnoDB: far enough in recovery. Please run"
+ " CHECK TABLE\n"
+ "InnoDB: on your InnoDB tables to check that"
+ " they are ok!\n"
+ "InnoDB: It may be safest to recover your"
+ " InnoDB database from\n"
+ "InnoDB: a backup!\n");
}
/* Free the resources of the recovery system */
@@ -2981,7 +2859,7 @@ recv_recovery_from_checkpoint_finish(void)
session */
os_thread_create(trx_rollback_or_clean_all_without_sess,
- (void *)&i, NULL);
+ (void *)&i, NULL);
}
}
@@ -3020,7 +2898,7 @@ recv_reset_logs(
if (!new_logs_created) {
recv_truncate_group(group, group->lsn, group->lsn,
- group->lsn, group->lsn);
+ group->lsn, group->lsn);
}
group = UT_LIST_GET_NEXT(log_groups, group);
@@ -3076,7 +2954,7 @@ recv_reset_log_files_for_backup(
log_dir_len = strlen(log_dir);
/* full path name of ib_logfile consists of log dir path + basename
- + number. This must fit in the name buffer.
+ + number. This must fit in the name buffer.
*/
ut_a(log_dir_len + strlen(ib_logfile_basename) + 11 < sizeof(name));
@@ -3089,10 +2967,11 @@ recv_reset_log_files_for_backup(
ib_logfile_basename, (ulong)i);
log_file = os_file_create_simple(name, OS_FILE_CREATE,
- OS_FILE_READ_WRITE, &success);
+ OS_FILE_READ_WRITE, &success);
if (!success) {
fprintf(stderr,
-"InnoDB: Cannot create %s. Check that the file does not exist yet.\n", name);
+ "InnoDB: Cannot create %s. Check that"
+ " the file does not exist yet.\n", name);
exit(1);
}
@@ -3103,13 +2982,14 @@ recv_reset_log_files_for_backup(
(ulong) log_file_size & 0xFFFFFFFFUL);
success = os_file_set_size(name, log_file,
- log_file_size & 0xFFFFFFFFUL,
- ut_get_high32(log_file_size));
+ log_file_size & 0xFFFFFFFFUL,
+ ut_get_high32(log_file_size));
if (!success) {
fprintf(stderr,
-"InnoDB: Cannot set %s size to %lu %lu\n", name, (ulong) ut_get_high32(log_file_size),
- (ulong) (log_file_size & 0xFFFFFFFFUL));
+ "InnoDB: Cannot set %s size to %lu %lu\n",
+ name, (ulong) ut_get_high32(log_file_size),
+ (ulong) (log_file_size & 0xFFFFFFFFUL));
exit(1);
}
@@ -3123,11 +3003,11 @@ recv_reset_log_files_for_backup(
log_block_init_in_old_format(buf + LOG_FILE_HDR_SIZE, lsn);
log_block_set_first_rec_group(buf + LOG_FILE_HDR_SIZE,
- LOG_BLOCK_HDR_SIZE);
+ LOG_BLOCK_HDR_SIZE);
sprintf(name, "%s%s%lu", log_dir, ib_logfile_basename, (ulong)0);
log_file = os_file_create_simple(name, OS_FILE_OPEN,
- OS_FILE_READ_WRITE, &success);
+ OS_FILE_READ_WRITE, &success);
if (!success) {
fprintf(stderr, "InnoDB: Cannot open %s.\n", name);
@@ -3135,7 +3015,7 @@ recv_reset_log_files_for_backup(
}
os_file_write(name, log_file, buf, 0, 0,
- LOG_FILE_HDR_SIZE + OS_FILE_LOG_BLOCK_SIZE);
+ LOG_FILE_HDR_SIZE + OS_FILE_LOG_BLOCK_SIZE);
os_file_flush(log_file);
os_file_close(log_file);
@@ -3178,17 +3058,19 @@ try_open_again:
log_archived_file_name_gen(name, group->id, group->archived_file_no);
file_handle = os_file_create(name, OS_FILE_OPEN,
- OS_FILE_LOG, OS_FILE_AIO, &ret);
+ OS_FILE_LOG, OS_FILE_AIO, &ret);
if (ret == FALSE) {
ask_again:
fprintf(stderr,
- "InnoDB: Do you want to copy additional archived log files\n"
- "InnoDB: to the directory\n");
+ "InnoDB: Do you want to copy additional"
+ " archived log files\n"
+ "InnoDB: to the directory\n");
fprintf(stderr,
- "InnoDB: or were these all the files needed in recovery?\n");
+ "InnoDB: or were these all the files needed"
+ " in recovery?\n");
fprintf(stderr,
- "InnoDB: (Y == copy more files; N == this is all)?");
+ "InnoDB: (Y == copy more files; N == this is all)?");
input_char = getchar();
@@ -3224,29 +3106,30 @@ ask_again:
/* Add the archive file as a node to the space */
fil_node_create(name, 1 + file_size / UNIV_PAGE_SIZE,
- group->archive_space_id, FALSE);
+ group->archive_space_id, FALSE);
#if RECV_SCAN_SIZE < LOG_FILE_HDR_SIZE
# error "RECV_SCAN_SIZE < LOG_FILE_HDR_SIZE"
#endif
/* Read the archive file header */
fil_io(OS_FILE_READ | OS_FILE_LOG, TRUE, group->archive_space_id, 0, 0,
- LOG_FILE_HDR_SIZE, buf, NULL);
+ LOG_FILE_HDR_SIZE, buf, NULL);
/* Check if the archive file header is consistent */
if (mach_read_from_4(buf + LOG_GROUP_ID) != group->id
- || mach_read_from_4(buf + LOG_FILE_NO)
- != group->archived_file_no) {
+ || mach_read_from_4(buf + LOG_FILE_NO)
+ != group->archived_file_no) {
fprintf(stderr,
- "InnoDB: Archive file header inconsistent %s\n", name);
+ "InnoDB: Archive file header inconsistent %s\n", name);
return(TRUE);
}
if (!mach_read_from_4(buf + LOG_FILE_ARCH_COMPLETED)) {
fprintf(stderr,
- "InnoDB: Archive file not completely written %s\n", name);
+ "InnoDB: Archive file not completely written %s\n",
+ name);
return(TRUE);
}
@@ -3258,7 +3141,8 @@ ask_again:
if (ut_dulint_cmp(recv_sys->parse_start_lsn, start_lsn) < 0) {
fprintf(stderr,
- "InnoDB: Archive log file %s starts from too big a lsn\n",
+ "InnoDB: Archive log file %s"
+ " starts from too big a lsn\n",
name);
return(TRUE);
}
@@ -3269,8 +3153,9 @@ ask_again:
if (ut_dulint_cmp(recv_sys->scanned_lsn, start_lsn) != 0) {
fprintf(stderr,
- "InnoDB: Archive log file %s starts from a wrong lsn\n",
- name);
+ "InnoDB: Archive log file %s starts from"
+ " a wrong lsn\n",
+ name);
return(TRUE);
}
@@ -3281,7 +3166,7 @@ ask_again:
if (read_offset + len > file_size) {
len = ut_calc_align_down(file_size - read_offset,
- OS_FILE_LOG_BLOCK_SIZE);
+ OS_FILE_LOG_BLOCK_SIZE);
}
if (len == 0) {
@@ -3292,22 +3177,22 @@ ask_again:
#ifdef UNIV_DEBUG
if (log_debug_writes) {
fprintf(stderr,
-"InnoDB: Archive read starting at lsn %lu %lu, len %lu from file %s\n",
- (ulong) ut_dulint_get_high(start_lsn),
- (ulong) ut_dulint_get_low(start_lsn),
- (ulong) len, name);
+ "InnoDB: Archive read starting at"
+ " lsn %lu %lu, len %lu from file %s\n",
+ (ulong) ut_dulint_get_high(start_lsn),
+ (ulong) ut_dulint_get_low(start_lsn),
+ (ulong) len, name);
}
#endif /* UNIV_DEBUG */
fil_io(OS_FILE_READ | OS_FILE_LOG, TRUE,
- group->archive_space_id, read_offset / UNIV_PAGE_SIZE,
- read_offset % UNIV_PAGE_SIZE, len, buf, NULL);
+ group->archive_space_id, read_offset / UNIV_PAGE_SIZE,
+ read_offset % UNIV_PAGE_SIZE, len, buf, NULL);
- ret = recv_scan_log_recs(TRUE,
- (buf_pool->n_frames -
- recv_n_pool_free_frames) * UNIV_PAGE_SIZE,
- TRUE, buf, len, start_lsn,
- &dummy_lsn, &scanned_lsn);
+ ret = recv_scan_log_recs
+ (TRUE, (buf_pool->n_frames - recv_n_pool_free_frames)
+ * UNIV_PAGE_SIZE, TRUE, buf, len, start_lsn,
+ &dummy_lsn, &scanned_lsn);
if (ut_dulint_cmp(scanned_lsn, file_end_lsn) == 0) {
@@ -3316,7 +3201,8 @@ ask_again:
if (ret) {
fprintf(stderr,
- "InnoDB: Archive log file %s does not scan right\n",
+ "InnoDB: Archive log file %s"
+ " does not scan right\n",
name);
return(TRUE);
}
@@ -3376,8 +3262,8 @@ recv_recovery_from_archive_start(
if (!group) {
fprintf(stderr,
- "InnoDB: There is no log group defined with id %lu!\n",
- (ulong) group_id);
+ "InnoDB: There is no log group defined with id %lu!\n",
+ (ulong) group_id);
return(DB_ERROR);
}
@@ -3405,7 +3291,7 @@ recv_recovery_from_archive_start(
* fil_space_get_size(group->archive_space_id);
if (trunc_len > 0) {
fil_space_truncate_start(group->archive_space_id,
- trunc_len);
+ trunc_len);
}
group->archived_file_no++;
@@ -3421,9 +3307,9 @@ recv_recovery_from_archive_start(
mutex_exit(&(log_sys->mutex));
err = recv_recovery_from_checkpoint_start(LOG_ARCHIVE,
- limit_lsn,
- ut_dulint_max,
- ut_dulint_max);
+ limit_lsn,
+ ut_dulint_max,
+ ut_dulint_max);
if (err != DB_SUCCESS) {
return(err);
diff --git a/storage/innobase/mem/mem0dbg.c b/storage/innobase/mem/mem0dbg.c
index 1220c2c8e82..3cab454e3ac 100644
--- a/storage/innobase/mem/mem0dbg.c
+++ b/storage/innobase/mem/mem0dbg.c
@@ -103,8 +103,8 @@ mem_field_trailer_set_check(byte* field, ulint check)
ulint
mem_field_trailer_get_check(byte* field)
{
- return(mach_read_from_4(field +
- mem_field_header_get_len(field)));
+ return(mach_read_from_4(field
+ + mem_field_header_get_len(field)));
}
/**********************************************************************
@@ -337,7 +337,8 @@ mem_hash_remove(
if (node == NULL) {
fprintf(stderr,
- "Memory heap or buffer freed in %s line %lu did not exist.\n",
+ "Memory heap or buffer freed in %s line %lu"
+ " did not exist.\n",
file_name, (ulong) line);
ut_error;
}
@@ -349,18 +350,20 @@ mem_hash_remove(
/* Validate the heap which will be freed */
mem_heap_validate_or_print(node->heap, NULL, FALSE, &error, &size,
- NULL, NULL);
+ NULL, NULL);
if (error) {
fprintf(stderr,
- "Inconsistency in memory heap or buffer n:o %lu created\n"
- "in %s line %lu and tried to free in %s line %lu.\n"
- "Hex dump of 400 bytes around memory heap first block start:\n",
+ "Inconsistency in memory heap or"
+ " buffer n:o %lu created\n"
+ "in %s line %lu and tried to free in %s line %lu.\n"
+ "Hex dump of 400 bytes around memory heap"
+ " first block start:\n",
node->nth_heap, node->file_name, (ulong) node->line,
file_name, (ulong) line);
ut_print_buf(stderr, (byte*)node->heap - 200, 400);
fputs("\nDump of the mem heap:\n", stderr);
mem_heap_validate_or_print(node->heap, NULL, TRUE, &error,
- &size, NULL, NULL);
+ &size, NULL, NULL);
ut_error;
}
@@ -441,10 +444,12 @@ mem_heap_validate_or_print(
phys_len += mem_block_get_len(block);
if ((block->type == MEM_HEAP_BUFFER)
- && (mem_block_get_len(block) > UNIV_PAGE_SIZE)) {
+ && (mem_block_get_len(block) > UNIV_PAGE_SIZE)) {
fprintf(stderr,
-"InnoDB: Error: mem block %p length %lu > UNIV_PAGE_SIZE\n", (void*) block,
+ "InnoDB: Error: mem block %p"
+ " length %lu > UNIV_PAGE_SIZE\n",
+ (void*) block,
(ulong) mem_block_get_len(block));
/* error */
@@ -481,15 +486,19 @@ mem_heap_validate_or_print(
total_len += len;
check_field = mem_field_header_get_check(user_field);
- if (check_field !=
- mem_field_trailer_get_check(user_field)) {
+ if (check_field
+ != mem_field_trailer_get_check(user_field)) {
/* error */
fprintf(stderr,
-"InnoDB: Error: block %lx mem field %lx len %lu\n"
-"InnoDB: header check field is %lx but trailer %lx\n", (ulint)block,
- (ulint)field, len, check_field,
- mem_field_trailer_get_check(user_field));
+ "InnoDB: Error: block %lx mem"
+ " field %lx len %lu\n"
+ "InnoDB: header check field is"
+ " %lx but trailer %lx\n",
+ (ulint)block,
+ (ulint)field, len, check_field,
+ mem_field_trailer_get_check
+ (user_field));
return;
}
@@ -511,9 +520,12 @@ mem_heap_validate_or_print(
/* error */
fprintf(stderr,
-"InnoDB: Error: block %lx end of mem fields %lx\n"
-"InnoDB: but block free at %lx\n", (ulint)block, (ulint)field,
- (ulint)((byte*)block + mem_block_get_free(block)));
+ "InnoDB: Error: block %lx end of"
+ " mem fields %lx\n"
+ "InnoDB: but block free at %lx\n",
+ (ulint)block, (ulint)field,
+ (ulint)((byte*)block
+ + mem_block_get_free(block)));
return;
}
@@ -554,11 +566,12 @@ mem_heap_print(
ut_ad(mem_heap_check(heap));
mem_heap_validate_or_print(heap, NULL, TRUE, &error,
- &us_size, &phys_size, &n_blocks);
+ &us_size, &phys_size, &n_blocks);
fprintf(stderr,
- "\nheap type: %lu; size: user size %lu; physical size %lu; blocks %lu.\n",
- (ulong) heap->type, (ulong) us_size,
- (ulong) phys_size, (ulong) n_blocks);
+ "\nheap type: %lu; size: user size %lu;"
+ " physical size %lu; blocks %lu.\n",
+ (ulong) heap->type, (ulong) us_size,
+ (ulong) phys_size, (ulong) n_blocks);
ut_a(!error);
}
@@ -593,7 +606,7 @@ mem_heap_validate(
ut_ad(mem_heap_check(heap));
mem_heap_validate_or_print(heap, NULL, FALSE, &error, &us_size,
- &phys_size, &n_blocks);
+ &phys_size, &n_blocks);
if (error) {
mem_heap_print(heap);
}
@@ -670,14 +683,17 @@ mem_validate_no_assert(void)
n_heaps++;
mem_heap_validate_or_print(node->heap, NULL,
- FALSE, &error, &allocated_mem,
- &ph_size, &n_blocks);
+ FALSE, &error,
+ &allocated_mem,
+ &ph_size, &n_blocks);
if (error) {
fprintf(stderr,
- "\nERROR!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n\n"
- "Inconsistency in memory heap or buffer created\n"
- "in %s line %lu.\n",
+ "\nERROR!!!!!!!!!!!!!!!!!!!"
+ "!!!!!!!!!!!!!!!!!!!!!!!\n\n"
+ "Inconsistency in memory heap"
+ " or buffer created\n"
+ "in %s line %lu.\n",
node->file_name, node->line);
mutex_exit(&mem_hash_mutex);
@@ -741,7 +757,8 @@ mem_analyze_corruption(
fputs("InnoDB: Apparent memory corruption: mem dump ", stderr);
ut_print_buf(stderr, (byte*)ptr - 250, 500);
- fputs("\nInnoDB: Scanning backward trying to find previous allocated mem blocks\n", stderr);
+ fputs("\nInnoDB: Scanning backward trying to find"
+ " previous allocated mem blocks\n", stderr);
p = (byte*)ptr;
dist = 0;
@@ -752,18 +769,26 @@ mem_analyze_corruption(
if (*((ulint*)p) == MEM_BLOCK_MAGIC_N) {
fprintf(stderr,
- "Mem block at - %lu, file %s, line %lu\n",
- (ulong) dist, (p + sizeof(ulint)),
- (ulong) (*(ulint*)(p + 8 + sizeof(ulint))));
+ "Mem block at - %lu,"
+ " file %s, line %lu\n",
+ (ulong) dist,
+ (p + sizeof(ulint)),
+ (ulong)
+ (*(ulint*)(p + 8
+ + sizeof(ulint))));
break;
}
if (*((ulint*)p) == MEM_FREED_BLOCK_MAGIC_N) {
fprintf(stderr,
- "Freed mem block at - %lu, file %s, line %lu\n",
- (ulong) dist, (p + sizeof(ulint)),
- (ulong) (*(ulint*)(p + 8 + sizeof(ulint))));
+ "Freed mem block at - %lu,"
+ " file %s, line %lu\n",
+ (ulong) dist,
+ (p + sizeof(ulint)),
+ (ulong)
+ (*(ulint*)(p + 8
+ + sizeof(ulint))));
break;
}
@@ -778,7 +803,8 @@ mem_analyze_corruption(
}
fprintf(stderr,
- "InnoDB: Scanning forward trying to find next allocated mem blocks\n");
+ "InnoDB: Scanning forward trying to find next"
+ " allocated mem blocks\n");
p = (byte*)ptr;
dist = 0;
@@ -789,18 +815,26 @@ mem_analyze_corruption(
if (*((ulint*)p) == MEM_BLOCK_MAGIC_N) {
fprintf(stderr,
- "Mem block at + %lu, file %s, line %lu\n",
- (ulong) dist, (p + sizeof(ulint)),
- (ulong) (*(ulint*)(p + 8 + sizeof(ulint))));
+ "Mem block at + %lu, file %s,"
+ " line %lu\n",
+ (ulong) dist,
+ (p + sizeof(ulint)),
+ (ulong)
+ (*(ulint*)(p + 8
+ + sizeof(ulint))));
break;
}
if (*((ulint*)p) == MEM_FREED_BLOCK_MAGIC_N) {
fprintf(stderr,
- "Freed mem block at + %lu, file %s, line %lu\n",
- (ulong) dist, (p + sizeof(ulint)),
- (ulong) (*(ulint*)(p + 8 + sizeof(ulint))));
+ "Freed mem block at + %lu,"
+ " file %s, line %lu\n",
+ (ulong) dist,
+ (p + sizeof(ulint)),
+ (ulong)
+ (*(ulint*)(p + 8
+ + sizeof(ulint))));
break;
}
@@ -878,33 +912,34 @@ mem_print_info_low(
}
mem_heap_validate_or_print(node->heap, NULL,
- FALSE, &error, &allocated_mem,
- &ph_size, &n_blocks);
+ FALSE, &error, &allocated_mem,
+ &ph_size, &n_blocks);
total_allocated_mem += allocated_mem;
fprintf(outfile,
- "%lu: file %s line %lu of size %lu phys.size %lu with %lu blocks, type %lu\n",
- node->nth_heap, node->file_name, node->line,
- allocated_mem, ph_size, n_blocks,
- (node->heap)->type);
- next_heap:
+ "%lu: file %s line %lu of size %lu phys.size %lu"
+ " with %lu blocks, type %lu\n",
+ node->nth_heap, node->file_name, node->line,
+ allocated_mem, ph_size, n_blocks,
+ (node->heap)->type);
+next_heap:
node = UT_LIST_GET_NEXT(all_list, node);
}
fprintf(outfile, "\n");
fprintf(outfile, "Current allocated memory : %lu\n",
- mem_current_allocated_memory);
+ mem_current_allocated_memory);
fprintf(outfile, "Current allocated heaps and buffers : %lu\n",
- n_heaps);
+ n_heaps);
fprintf(outfile, "Cumulative allocated memory : %lu\n",
- mem_total_allocated_memory);
+ mem_total_allocated_memory);
fprintf(outfile, "Maximum allocated memory : %lu\n",
- mem_max_allocated_memory);
+ mem_max_allocated_memory);
fprintf(outfile, "Cumulative created heaps and buffers : %lu\n",
- mem_n_created_heaps);
+ mem_n_created_heaps);
fprintf(outfile, "Cumulative number of allocations : %lu\n",
- mem_n_allocations);
+ mem_n_allocations);
mem_last_print_info = mem_n_created_heaps;
@@ -912,9 +947,9 @@ mem_print_info_low(
mem_pool_print_info(outfile, mem_comm_pool);
-/* mem_validate(); */
+ /* mem_validate(); */
-/* fclose(outfile); */
+ /* fclose(outfile); */
#endif
}
diff --git a/storage/innobase/mem/mem0mem.c b/storage/innobase/mem/mem0mem.c
index b11b574d80d..10b359e8e67 100644
--- a/storage/innobase/mem/mem0mem.c
+++ b/storage/innobase/mem/mem0mem.c
@@ -342,7 +342,7 @@ mem_heap_create_block(
ulint len;
ut_ad((type == MEM_HEAP_DYNAMIC) || (type == MEM_HEAP_BUFFER)
- || (type == MEM_HEAP_BUFFER + MEM_HEAP_BTR_SEARCH));
+ || (type == MEM_HEAP_BUFFER + MEM_HEAP_BTR_SEARCH));
if (heap && heap->magic_n != MEM_BLOCK_MAGIC_N) {
mem_analyze_corruption(heap);
@@ -463,7 +463,7 @@ mem_heap_add_block(
}
new_block = mem_heap_create_block(heap, new_size, NULL, heap->type,
- heap->file_name, heap->line);
+ heap->file_name, heap->line);
if (new_block == NULL) {
return(NULL);
diff --git a/storage/innobase/mem/mem0pool.c b/storage/innobase/mem/mem0pool.c
index 5606921758c..91e7532aba8 100644
--- a/storage/innobase/mem/mem0pool.c
+++ b/storage/innobase/mem/mem0pool.c
@@ -145,7 +145,7 @@ mem_area_set_size(
ulint size) /* in: size */
{
area->size_and_free = (area->size_and_free & MEM_AREA_FREE)
- | size;
+ | size;
}
/************************************************************************
@@ -176,7 +176,7 @@ mem_area_set_free(
# error "TRUE != MEM_AREA_FREE"
#endif
area->size_and_free = (area->size_and_free & ~MEM_AREA_FREE)
- | free;
+ | free;
}
/************************************************************************
@@ -276,10 +276,12 @@ mem_pool_fill_free_list(
ut_print_timestamp(stderr);
fprintf(stderr,
-" InnoDB: Error: mem pool free list %lu length is %lu\n"
-"InnoDB: though the list is empty!\n",
- (ulong) i + 1,
- (ulong) UT_LIST_GET_LEN(pool->free_list[i + 1]));
+ " InnoDB: Error: mem pool free list %lu"
+ " length is %lu\n"
+ "InnoDB: though the list is empty!\n",
+ (ulong) i + 1,
+ (ulong)
+ UT_LIST_GET_LEN(pool->free_list[i + 1]));
}
ret = mem_pool_fill_free_list(i + 1, pool);
@@ -358,8 +360,9 @@ mem_area_alloc(
if (!mem_area_get_free(area)) {
fprintf(stderr,
-"InnoDB: Error: Removing element from mem pool free list %lu though the\n"
-"InnoDB: element is not marked free!\n",
+ "InnoDB: Error: Removing element from mem pool"
+ " free list %lu though the\n"
+ "InnoDB: element is not marked free!\n",
(ulong) n);
mem_analyze_corruption(area);
@@ -370,7 +373,8 @@ mem_area_alloc(
if (mem_area_get_free(area)) {
fprintf(stderr,
-"InnoDB: Probably a race condition because now the area is marked free!\n");
+ "InnoDB: Probably a race condition"
+ " because now the area is marked free!\n");
}
ut_error;
@@ -378,8 +382,9 @@ mem_area_alloc(
if (UT_LIST_GET_LEN(pool->free_list[n]) == 0) {
fprintf(stderr,
-"InnoDB: Error: Removing element from mem pool free list %lu\n"
-"InnoDB: though the list length is 0!\n",
+ "InnoDB: Error: Removing element from mem pool"
+ " free list %lu\n"
+ "InnoDB: though the list length is 0!\n",
(ulong) n);
mem_analyze_corruption(area);
@@ -471,8 +476,9 @@ mem_area_free(
if (mem_area_get_free(area)) {
fprintf(stderr,
-"InnoDB: Error: Freeing element to mem pool free list though the\n"
-"InnoDB: element is marked free!\n");
+ "InnoDB: Error: Freeing element to mem pool"
+ " free list though the\n"
+ "InnoDB: element is marked free!\n");
mem_analyze_corruption(area);
ut_error;
@@ -482,8 +488,9 @@ mem_area_free(
if (size == 0) {
fprintf(stderr,
-"InnoDB: Error: Mem area size is 0. Possibly a memory overrun of the\n"
-"InnoDB: previous allocated area!\n");
+ "InnoDB: Error: Mem area size is 0. Possibly a"
+ " memory overrun of the\n"
+ "InnoDB: previous allocated area!\n");
mem_analyze_corruption(area);
ut_error;
@@ -494,13 +501,15 @@ mem_area_free(
ulint next_size;
- next_size = mem_area_get_size(
- (mem_area_t*)(((byte*)area) + size));
+ next_size = mem_area_get_size
+ ((mem_area_t*)(((byte*)area) + size));
if (ut_2_power_up(next_size) != next_size) {
fprintf(stderr,
-"InnoDB: Error: Memory area size %lu, next area size %lu not a power of 2!\n"
-"InnoDB: Possibly a memory overrun of the buffer being freed here.\n",
- (ulong) size, (ulong) next_size);
+ "InnoDB: Error: Memory area size %lu,"
+ " next area size %lu not a power of 2!\n"
+ "InnoDB: Possibly a memory overrun of"
+ " the buffer being freed here.\n",
+ (ulong) size, (ulong) next_size);
mem_analyze_corruption(area);
ut_error;
@@ -517,7 +526,7 @@ mem_area_free(
ut_a(mem_n_threads_inside == 1);
if (buddy && mem_area_get_free(buddy)
- && (size == mem_area_get_size(buddy))) {
+ && (size == mem_area_get_size(buddy))) {
/* The buddy is in a free list */
@@ -591,7 +600,7 @@ mem_pool_validate(
buddy = mem_area_get_buddy(area, ut_2_exp(i), pool);
ut_a(!buddy || !mem_area_get_free(buddy)
- || (ut_2_exp(i) != mem_area_get_size(buddy)));
+ || (ut_2_exp(i) != mem_area_get_size(buddy)));
area = UT_LIST_GET_NEXT(free_list, area);
@@ -627,9 +636,10 @@ mem_pool_print_info(
if (UT_LIST_GET_LEN(pool->free_list[i]) > 0) {
fprintf(outfile,
- "Free list length %lu for blocks of size %lu\n",
- (ulong) UT_LIST_GET_LEN(pool->free_list[i]),
- (ulong) ut_2_exp(i));
+ "Free list length %lu for"
+ " blocks of size %lu\n",
+ (ulong) UT_LIST_GET_LEN(pool->free_list[i]),
+ (ulong) ut_2_exp(i));
}
}
diff --git a/storage/innobase/mtr/mtr0log.c b/storage/innobase/mtr/mtr0log.c
index c47c73e188b..ba5284d9169 100644
--- a/storage/innobase/mtr/mtr0log.c
+++ b/storage/innobase/mtr/mtr0log.c
@@ -59,7 +59,8 @@ mlog_write_initial_log_record(
if (ptr < buf_pool->frame_zero || ptr >= buf_pool->high_end) {
fprintf(stderr,
- "InnoDB: Error: trying to write to a stray memory location %p\n", ptr);
+ "InnoDB: Error: trying to write to"
+ " a stray memory location %p\n", (void*) ptr);
ut_error;
}
@@ -222,7 +223,8 @@ mlog_write_ulint(
if (ptr < buf_pool->frame_zero || ptr >= buf_pool->high_end) {
fprintf(stderr,
- "InnoDB: Error: trying to write to a stray memory location %p\n", ptr);
+ "InnoDB: Error: trying to write to"
+ " a stray memory location %p\n", (void*) ptr);
ut_error;
}
@@ -266,9 +268,11 @@ mlog_write_dulint(
{
byte* log_ptr;
- if (ptr < buf_pool->frame_zero || ptr >= buf_pool->high_end) {
+ if (UNIV_UNLIKELY(ptr < buf_pool->frame_zero)
+ || UNIV_UNLIKELY(ptr >= buf_pool->high_end)) {
fprintf(stderr,
- "InnoDB: Error: trying to write to a stray memory location %p\n", ptr);
+ "InnoDB: Error: trying to write to"
+ " a stray memory location %p\n", (void*) ptr);
ut_error;
}
@@ -285,7 +289,7 @@ mlog_write_dulint(
}
log_ptr = mlog_write_initial_log_record_fast(ptr, MLOG_8BYTES,
- log_ptr, mtr);
+ log_ptr, mtr);
mach_write_to_2(log_ptr, ptr - buf_frame_align(ptr));
log_ptr += 2;
@@ -310,9 +314,10 @@ mlog_write_string(
byte* log_ptr;
if (UNIV_UNLIKELY(ptr < buf_pool->frame_zero)
- || UNIV_UNLIKELY(ptr >= buf_pool->high_end)) {
+ || UNIV_UNLIKELY(ptr >= buf_pool->high_end)) {
fprintf(stderr,
- "InnoDB: Error: trying to write to a stray memory location %p\n", ptr);
+ "InnoDB: Error: trying to write to"
+ " a stray memory location %p\n", (void*) ptr);
ut_error;
}
ut_ad(ptr && mtr);
@@ -329,7 +334,7 @@ mlog_write_string(
}
log_ptr = mlog_write_initial_log_record_fast(ptr, MLOG_WRITE_STRING,
- log_ptr, mtr);
+ log_ptr, mtr);
mach_write_to_2(log_ptr, ptr - buf_frame_align(ptr));
log_ptr += 2;
@@ -415,7 +420,7 @@ mlog_open_and_write_index(
return(NULL); /* logging is disabled */
}
log_ptr = mlog_write_initial_log_record_fast(rec, type,
- log_ptr, mtr);
+ log_ptr, mtr);
log_end = log_ptr + 11 + size;
} else {
ulint i;
@@ -433,7 +438,7 @@ mlog_open_and_write_index(
}
log_end = log_ptr + alloc;
log_ptr = mlog_write_initial_log_record_fast(rec, type,
- log_ptr, mtr);
+ log_ptr, mtr);
mach_write_to_2(log_ptr, n);
log_ptr += 2;
mach_write_to_2(log_ptr,
@@ -447,7 +452,8 @@ mlog_open_and_write_index(
type = dict_col_get_type(dict_field_get_col(field));
len = field->fixed_len;
ut_ad(len < 0x7fff);
- if (len == 0 && (dtype_get_len(type) > 255
+ if (len == 0
+ && (dtype_get_len(type) > 255
|| dtype_get_mtype(type) == DATA_BLOB)) {
/* variable-length field
with maximum length > 255 */
@@ -519,9 +525,9 @@ mlog_parse_index(
n = n_uniq = 1;
}
table = dict_mem_table_create("LOG_DUMMY", DICT_HDR_SPACE, n,
- comp ? DICT_TF_COMPACT : 0);
+ comp ? DICT_TF_COMPACT : 0);
ind = dict_mem_index_create("LOG_DUMMY", "LOG_DUMMY",
- DICT_HDR_SPACE, 0, n);
+ DICT_HDR_SPACE, 0, n);
ind->table = table;
ind->n_uniq = n_uniq;
if (n_uniq != n) {
@@ -535,14 +541,14 @@ mlog_parse_index(
/* The high-order bit of len is the NOT NULL flag;
the rest is 0 or 0x7fff for variable-length fields,
and 1..0x7ffe for fixed-length fields. */
- dict_mem_table_add_col(table, "DUMMY",
- ((len + 1) & 0x7fff) <= 1
- ? DATA_BINARY
- : DATA_FIXBINARY,
- len & 0x8000 ? DATA_NOT_NULL : 0,
- len & 0x7fff, 0);
- dict_index_add_col(ind,
- dict_table_get_nth_col(table, i), 0);
+ dict_mem_table_add_col
+ (table, "DUMMY",
+ ((len + 1) & 0x7fff) <= 1
+ ? DATA_BINARY : DATA_FIXBINARY,
+ len & 0x8000 ? DATA_NOT_NULL : 0,
+ len & 0x7fff, 0);
+ dict_index_add_col
+ (ind, dict_table_get_nth_col(table, i), 0);
}
ptr += 2;
}
diff --git a/storage/innobase/mtr/mtr0mtr.c b/storage/innobase/mtr/mtr0mtr.c
index c27a97f6028..13c579c646b 100644
--- a/storage/innobase/mtr/mtr0mtr.c
+++ b/storage/innobase/mtr/mtr0mtr.c
@@ -90,7 +90,7 @@ mtr_memo_pop_all(
ut_ad(mtr);
ut_ad(mtr->magic_n == MTR_MAGIC_N);
ut_ad(mtr->state == MTR_COMMITTING); /* Currently only used in
- commit */
+ commit */
memo = &(mtr->memo);
offset = dyn_array_get_data_size(memo);
@@ -126,13 +126,14 @@ mtr_log_reserve_and_write(
if (mtr->n_log_recs > 1) {
mlog_catenate_ulint(mtr, MLOG_MULTI_REC_END, MLOG_1BYTE);
} else {
- *first_data = (byte)((ulint)*first_data | MLOG_SINGLE_REC_FLAG);
+ *first_data = (byte)((ulint)*first_data
+ | MLOG_SINGLE_REC_FLAG);
}
if (mlog->heap == NULL) {
- mtr->end_lsn = log_reserve_and_write_fast(first_data,
- dyn_block_get_used(mlog),
- &(mtr->start_lsn), &success);
+ mtr->end_lsn = log_reserve_and_write_fast
+ (first_data, dyn_block_get_used(mlog),
+ &(mtr->start_lsn), &success);
if (success) {
return;
@@ -150,7 +151,7 @@ mtr_log_reserve_and_write(
while (block != NULL) {
log_write_low(dyn_block_get_data(block),
- dyn_block_get_used(block));
+ dyn_block_get_used(block));
block = dyn_array_get_next_block(mlog, block);
}
} else {
@@ -284,9 +285,9 @@ mtr_read_ulint(
{
ut_ad(mtr->state == MTR_ACTIVE);
ut_ad(mtr_memo_contains(mtr, buf_block_align(ptr),
- MTR_MEMO_PAGE_S_FIX) ||
- mtr_memo_contains(mtr, buf_block_align(ptr),
- MTR_MEMO_PAGE_X_FIX));
+ MTR_MEMO_PAGE_S_FIX)
+ || mtr_memo_contains(mtr, buf_block_align(ptr),
+ MTR_MEMO_PAGE_X_FIX));
if (type == MLOG_1BYTE) {
return(mach_read_from_1(ptr));
} else if (type == MLOG_2BYTES) {
@@ -311,9 +312,9 @@ mtr_read_dulint(
ut_ad(mtr->state == MTR_ACTIVE);
ut_ad(ptr && mtr);
ut_ad(mtr_memo_contains(mtr, buf_block_align(ptr),
- MTR_MEMO_PAGE_S_FIX) ||
- mtr_memo_contains(mtr, buf_block_align(ptr),
- MTR_MEMO_PAGE_X_FIX));
+ MTR_MEMO_PAGE_S_FIX)
+ || mtr_memo_contains(mtr, buf_block_align(ptr),
+ MTR_MEMO_PAGE_X_FIX));
return(mach_read_from_8(ptr));
}
@@ -326,7 +327,8 @@ mtr_print(
mtr_t* mtr) /* in: mtr */
{
fprintf(stderr,
- "Mini-transaction handle: memo size %lu bytes log size %lu bytes\n",
+ "Mini-transaction handle: memo size %lu bytes"
+ " log size %lu bytes\n",
(ulong) dyn_array_get_data_size(&(mtr->memo)),
(ulong) dyn_array_get_data_size(&(mtr->log)));
}
diff --git a/storage/innobase/os/os0file.c b/storage/innobase/os/os0file.c
index 3aebf20ac41..65903717cfb 100644
--- a/storage/innobase/os/os0file.c
+++ b/storage/innobase/os/os0file.c
@@ -224,31 +224,39 @@ os_file_get_last_error(
err = (ulint) GetLastError();
if (report_all_errors
- || (err != ERROR_DISK_FULL && err != ERROR_FILE_EXISTS)) {
+ || (err != ERROR_DISK_FULL && err != ERROR_FILE_EXISTS)) {
ut_print_timestamp(stderr);
fprintf(stderr,
- " InnoDB: Operating system error number %lu in a file operation.\n", (ulong) err);
+ " InnoDB: Operating system error number %lu"
+ " in a file operation.\n", (ulong) err);
if (err == ERROR_PATH_NOT_FOUND) {
fprintf(stderr,
- "InnoDB: The error means the system cannot find the path specified.\n");
+ "InnoDB: The error means the system"
+ " cannot find the path specified.\n");
if (srv_is_being_started) {
fprintf(stderr,
- "InnoDB: If you are installing InnoDB, remember that you must create\n"
- "InnoDB: directories yourself, InnoDB does not create them.\n");
+ "InnoDB: If you are installing InnoDB,"
+ " remember that you must create\n"
+ "InnoDB: directories yourself, InnoDB"
+ " does not create them.\n");
}
} else if (err == ERROR_ACCESS_DENIED) {
fprintf(stderr,
- "InnoDB: The error means mysqld does not have the access rights to\n"
- "InnoDB: the directory. It may also be you have created a subdirectory\n"
- "InnoDB: of the same name as a data file.\n");
+ "InnoDB: The error means mysqld does not have"
+ " the access rights to\n"
+ "InnoDB: the directory. It may also be"
+ " you have created a subdirectory\n"
+ "InnoDB: of the same name as a data file.\n");
} else {
fprintf(stderr,
- "InnoDB: Some operating system error numbers are described at\n"
- "InnoDB: "
- "http://dev.mysql.com/doc/refman/5.1/en/operating-system-error-codes.html\n");
+ "InnoDB: Some operating system error numbers"
+ " are described at\n"
+ "InnoDB: "
+ "http://dev.mysql.com/doc/refman/5.1/en/"
+ "operating-system-error-codes.html\n");
}
}
@@ -267,35 +275,44 @@ os_file_get_last_error(
err = (ulint) errno;
if (report_all_errors
- || (err != ENOSPC && err != EEXIST)) {
+ || (err != ENOSPC && err != EEXIST)) {
ut_print_timestamp(stderr);
fprintf(stderr,
- " InnoDB: Operating system error number %lu in a file operation.\n", (ulong) err);
+ " InnoDB: Operating system error number %lu"
+ " in a file operation.\n", (ulong) err);
if (err == ENOENT) {
fprintf(stderr,
- "InnoDB: The error means the system cannot find the path specified.\n");
+ "InnoDB: The error means the system"
+ " cannot find the path specified.\n");
if (srv_is_being_started) {
fprintf(stderr,
- "InnoDB: If you are installing InnoDB, remember that you must create\n"
- "InnoDB: directories yourself, InnoDB does not create them.\n");
+ "InnoDB: If you are installing InnoDB,"
+ " remember that you must create\n"
+ "InnoDB: directories yourself, InnoDB"
+ " does not create them.\n");
}
} else if (err == EACCES) {
fprintf(stderr,
- "InnoDB: The error means mysqld does not have the access rights to\n"
- "InnoDB: the directory.\n");
+ "InnoDB: The error means mysqld does not have"
+ " the access rights to\n"
+ "InnoDB: the directory.\n");
} else {
if (strerror((int)err) != NULL) {
fprintf(stderr,
- "InnoDB: Error number %lu means '%s'.\n", err, strerror((int)err));
+ "InnoDB: Error number %lu"
+ " means '%s'.\n",
+ err, strerror((int)err));
}
fprintf(stderr,
- "InnoDB: Some operating system error numbers are described at\n"
- "InnoDB: "
- "http://dev.mysql.com/doc/refman/5.1/en/operating-system-error-codes.html\n");
+ "InnoDB: Some operating system"
+ " error numbers are described at\n"
+ "InnoDB: "
+ "http://dev.mysql.com/doc/refman/5.1/en/"
+ "operating-system-error-codes.html\n");
}
}
@@ -345,12 +362,14 @@ os_file_handle_error(
if (name) {
ut_print_timestamp(stderr);
fprintf(stderr,
- " InnoDB: Encountered a problem with file %s\n", name);
+ " InnoDB: Encountered a problem with"
+ " file %s\n", name);
}
ut_print_timestamp(stderr);
fprintf(stderr,
- " InnoDB: Disk is full. Try to clean the disk to free space.\n");
+ " InnoDB: Disk is full. Try to clean the disk"
+ " to free space.\n");
os_has_said_disk_full = TRUE;
@@ -363,7 +382,7 @@ os_file_handle_error(
return(TRUE);
} else if (err == OS_FILE_ALREADY_EXISTS
- || err == OS_FILE_PATH_ERROR) {
+ || err == OS_FILE_PATH_ERROR) {
return(FALSE);
} else {
@@ -413,8 +432,10 @@ os_file_lock(
if (errno == EAGAIN || errno == EACCES) {
fprintf(stderr,
-"InnoDB: Check that you do not already have another mysqld process\n"
-"InnoDB: using the same InnoDB data or log files.\n");
+ "InnoDB: Check that you do not already have"
+ " another mysqld process\n"
+ "InnoDB: using the same InnoDB data"
+ " or log files.\n");
}
return(-1);
@@ -450,12 +471,14 @@ os_file_handle_error_no_exit(
if (name) {
ut_print_timestamp(stderr);
fprintf(stderr,
- " InnoDB: Encountered a problem with file %s\n", name);
+ " InnoDB: Encountered a problem with"
+ " file %s\n", name);
}
ut_print_timestamp(stderr);
fprintf(stderr,
- " InnoDB: Disk is full. Try to clean the disk to free space.\n");
+ " InnoDB: Disk is full. Try to clean the disk"
+ " to free space.\n");
os_has_said_disk_full = TRUE;
@@ -468,7 +491,7 @@ os_file_handle_error_no_exit(
return(TRUE);
} else if (err == OS_FILE_ALREADY_EXISTS
- || err == OS_FILE_PATH_ERROR) {
+ || err == OS_FILE_PATH_ERROR) {
return(FALSE);
} else {
@@ -670,10 +693,11 @@ next_file:
ret = FindNextFile(dir, lpFindFileData);
if (ret) {
- ut_a(strlen((char *) lpFindFileData->cFileName) < OS_FILE_MAX_PATH);
+ ut_a(strlen((char *) lpFindFileData->cFileName)
+ < OS_FILE_MAX_PATH);
if (strcmp((char *) lpFindFileData->cFileName, ".") == 0
- || strcmp((char *) lpFindFileData->cFileName, "..") == 0) {
+ || strcmp((char *) lpFindFileData->cFileName, "..") == 0) {
goto next_file;
}
@@ -681,17 +705,20 @@ next_file:
strcpy(info->name, (char *) lpFindFileData->cFileName);
info->size = (ib_longlong)(lpFindFileData->nFileSizeLow)
- + (((ib_longlong)(lpFindFileData->nFileSizeHigh)) << 32);
+ + (((ib_longlong)(lpFindFileData->nFileSizeHigh))
+ << 32);
if (lpFindFileData->dwFileAttributes
- & FILE_ATTRIBUTE_REPARSE_POINT) {
-/* TODO: test Windows symlinks */
-/* TODO: MySQL has apparently its own symlink implementation in Windows,
-dbname.sym can redirect a database directory:
-http://dev.mysql.com/doc/refman/5.1/en/windows-symbolic-links.html */
+ & FILE_ATTRIBUTE_REPARSE_POINT) {
+ /* TODO: test Windows symlinks */
+ /* TODO: MySQL has apparently its own symlink
+ implementation in Windows, dbname.sym can
+ redirect a database directory:
+ http://dev.mysql.com/doc/refman/5.1/en/
+ windows-symbolic-links.html */
info->type = OS_FILE_TYPE_LINK;
} else if (lpFindFileData->dwFileAttributes
- & FILE_ATTRIBUTE_DIRECTORY) {
+ & FILE_ATTRIBUTE_DIRECTORY) {
info->type = OS_FILE_TYPE_DIR;
} else {
/* It is probably safest to assume that all other
@@ -711,7 +738,7 @@ http://dev.mysql.com/doc/refman/5.1/en/windows-symbolic-links.html */
return(1);
} else {
os_file_handle_error_no_exit(dirname,
- "readdir_next_file");
+ "readdir_next_file");
return(-1);
}
#else
@@ -720,11 +747,11 @@ http://dev.mysql.com/doc/refman/5.1/en/windows-symbolic-links.html */
int ret;
struct stat statinfo;
#ifdef HAVE_READDIR_R
- char dirent_buf[sizeof(struct dirent) + _POSIX_PATH_MAX +
- 100];
- /* In /mysys/my_lib.c, _POSIX_PATH_MAX + 1 is used as
- the max file name len; but in most standards, the
- length is NAME_MAX; we add 100 to be even safer */
+ char dirent_buf[sizeof(struct dirent)
+ + _POSIX_PATH_MAX + 100];
+ /* In /mysys/my_lib.c, _POSIX_PATH_MAX + 1 is used as
+ the max file name len; but in most standards, the
+ length is NAME_MAX; we add 100 to be even safer */
#endif
next_file:
@@ -734,7 +761,8 @@ next_file:
if (ret != 0) {
fprintf(stderr,
-"InnoDB: cannot read directory %s, error %lu\n", dirname, (ulong)ret);
+ "InnoDB: cannot read directory %s, error %lu\n",
+ dirname, (ulong)ret);
return(-1);
}
@@ -815,8 +843,9 @@ os_file_create_directory(
BOOL rcode;
rcode = CreateDirectory((LPCTSTR) pathname, NULL);
- if (!(rcode != 0 ||
- (GetLastError() == ERROR_ALREADY_EXISTS && !fail_if_exists))) {
+ if (!(rcode != 0
+ || (GetLastError() == ERROR_ALREADY_EXISTS
+ && !fail_if_exists))) {
/* failure */
os_file_handle_error(pathname, "CreateDirectory");
@@ -899,21 +928,21 @@ try_again:
}
file = CreateFile((LPCTSTR) name,
- access,
- FILE_SHARE_READ | FILE_SHARE_WRITE,
- /* file can be read ansd written also
- by other processes */
- NULL, /* default security attributes */
- create_flag,
- attributes,
- NULL); /* no template file */
+ access,
+ FILE_SHARE_READ | FILE_SHARE_WRITE,
+ /* file can be read ansd written also
+ by other processes */
+ NULL, /* default security attributes */
+ create_flag,
+ attributes,
+ NULL); /* no template file */
if (file == INVALID_HANDLE_VALUE) {
*success = FALSE;
retry = os_file_handle_error(name,
- create_mode == OS_FILE_OPEN ?
- "open" : "create");
+ create_mode == OS_FILE_OPEN ?
+ "open" : "create");
if (retry) {
goto try_again;
}
@@ -953,7 +982,7 @@ try_again:
if (create_mode == OS_FILE_CREATE) {
file = open(name, create_flag, S_IRUSR | S_IWUSR
- | S_IRGRP | S_IWGRP);
+ | S_IRGRP | S_IWGRP);
} else {
file = open(name, create_flag);
}
@@ -962,14 +991,14 @@ try_again:
*success = FALSE;
retry = os_file_handle_error(name,
- create_mode == OS_FILE_OPEN ?
- "open" : "create");
+ create_mode == OS_FILE_OPEN ?
+ "open" : "create");
if (retry) {
goto try_again;
}
#ifdef USE_FILE_LOCK
} else if (access_type == OS_FILE_READ_WRITE
- && os_file_lock(file, name)) {
+ && os_file_lock(file, name)) {
*success = FALSE;
close(file);
file = -1;
@@ -1028,7 +1057,7 @@ os_file_create_simple_no_error_handling(
} else if (access_type == OS_FILE_READ_ALLOW_DELETE) {
access = GENERIC_READ;
share_mode = FILE_SHARE_DELETE | FILE_SHARE_READ
- | FILE_SHARE_WRITE; /* A backup program has to give
+ | FILE_SHARE_WRITE; /* A backup program has to give
mysqld the maximum freedom to
do what it likes with the
file */
@@ -1038,12 +1067,12 @@ os_file_create_simple_no_error_handling(
}
file = CreateFile((LPCTSTR) name,
- access,
- share_mode,
- NULL, /* default security attributes */
- create_flag,
- attributes,
- NULL); /* no template file */
+ access,
+ share_mode,
+ NULL, /* default security attributes */
+ create_flag,
+ attributes,
+ NULL); /* no template file */
if (file == INVALID_HANDLE_VALUE) {
*success = FALSE;
@@ -1073,7 +1102,7 @@ os_file_create_simple_no_error_handling(
if (create_mode == OS_FILE_CREATE) {
file = open(name, create_flag, S_IRUSR | S_IWUSR
- | S_IRGRP | S_IWGRP);
+ | S_IRGRP | S_IWGRP);
} else {
file = open(name, create_flag);
}
@@ -1082,7 +1111,7 @@ os_file_create_simple_no_error_handling(
*success = FALSE;
#ifdef USE_FILE_LOCK
} else if (access_type == OS_FILE_READ_WRITE
- && os_file_lock(file, name)) {
+ && os_file_lock(file, name)) {
*success = FALSE;
close(file);
file = -1;
@@ -1137,7 +1166,7 @@ try_again:
create_flag = OPEN_EXISTING;
share_mode = FILE_SHARE_WRITE;
} else if (create_mode == OS_FILE_OPEN
- || create_mode == OS_FILE_OPEN_RETRY) {
+ || create_mode == OS_FILE_OPEN_RETRY) {
create_flag = OPEN_EXISTING;
} else if (create_mode == OS_FILE_CREATE) {
create_flag = CREATE_NEW;
@@ -1162,8 +1191,8 @@ try_again:
/* Do not use unbuffered i/o to log files because
value 2 denotes that we do not flush the log at every
commit, but only once per second */
- } else if (srv_win_file_flush_method ==
- SRV_WIN_IO_UNBUFFERED) {
+ } else if (srv_win_file_flush_method
+ == SRV_WIN_IO_UNBUFFERED) {
attributes = attributes | FILE_FLAG_NO_BUFFERING;
}
#endif
@@ -1174,8 +1203,8 @@ try_again:
/* Do not use unbuffered i/o to log files because
value 2 denotes that we do not flush the log at every
commit, but only once per second */
- } else if (srv_win_file_flush_method ==
- SRV_WIN_IO_UNBUFFERED) {
+ } else if (srv_win_file_flush_method
+ == SRV_WIN_IO_UNBUFFERED) {
attributes = attributes | FILE_FLAG_NO_BUFFERING;
}
#endif
@@ -1185,9 +1214,9 @@ try_again:
}
file = CreateFile((LPCTSTR) name,
- GENERIC_READ | GENERIC_WRITE, /* read and write
+ GENERIC_READ | GENERIC_WRITE, /* read and write
access */
- share_mode, /* File can be read also by other
+ share_mode, /* File can be read also by other
processes; we must give the read
permission because of ibbackup. We do
not give the write permission to
@@ -1198,17 +1227,17 @@ try_again:
raw disk partitions, Microsoft manuals
say that we must give also the write
permission. */
- NULL, /* default security attributes */
- create_flag,
- attributes,
- NULL); /* no template file */
+ NULL, /* default security attributes */
+ create_flag,
+ attributes,
+ NULL); /* no template file */
if (file == INVALID_HANDLE_VALUE) {
*success = FALSE;
retry = os_file_handle_error(name,
- create_mode == OS_FILE_CREATE ?
- "create" : "open");
+ create_mode == OS_FILE_CREATE ?
+ "create" : "open");
if (retry) {
goto try_again;
}
@@ -1229,7 +1258,7 @@ try_again:
ut_a(name);
if (create_mode == OS_FILE_OPEN || create_mode == OS_FILE_OPEN_RAW
- || create_mode == OS_FILE_OPEN_RETRY) {
+ || create_mode == OS_FILE_OPEN_RETRY) {
mode_str = "OPEN";
create_flag = O_RDWR;
} else if (create_mode == OS_FILE_CREATE) {
@@ -1259,30 +1288,34 @@ try_again:
ut_error;
}
-/* fprintf(stderr, "Opening file %s, mode %s, type %s, purpose %s\n",
- name, mode_str, type_str, purpose_str); */
+#if 0
+ fprintf(stderr, "Opening file %s, mode %s, type %s, purpose %s\n",
+ name, mode_str, type_str, purpose_str);
+#endif
#ifdef O_SYNC
/* We let O_SYNC only affect log files; note that we map O_DSYNC to
O_SYNC because the datasync options seemed to corrupt files in 2001
in both Linux and Solaris */
if (type == OS_LOG_FILE
- && srv_unix_file_flush_method == SRV_UNIX_O_DSYNC) {
+ && srv_unix_file_flush_method == SRV_UNIX_O_DSYNC) {
-/* fprintf(stderr, "Using O_SYNC for file %s\n", name); */
+# if 0
+ fprintf(stderr, "Using O_SYNC for file %s\n", name);
+# endif
create_flag = create_flag | O_SYNC;
}
-#endif
+#endif /* O_SYNC */
#ifdef O_DIRECT
/* We let O_DIRECT only affect data files */
if (type != OS_LOG_FILE
- && srv_unix_file_flush_method == SRV_UNIX_O_DIRECT) {
-
-/* fprintf(stderr, "Using O_DIRECT for file %s\n", name); */
-
+ && srv_unix_file_flush_method == SRV_UNIX_O_DIRECT) {
+# if 0
+ fprintf(stderr, "Using O_DIRECT for file %s\n", name);
+# endif
create_flag = create_flag | O_DIRECT;
}
-#endif
+#endif /* O_DIRECT */
if (create_mode == OS_FILE_CREATE) {
file = open(name, create_flag, os_innodb_umask);
} else {
@@ -1293,20 +1326,21 @@ try_again:
*success = FALSE;
retry = os_file_handle_error(name,
- create_mode == OS_FILE_CREATE ?
- "create" : "open");
+ create_mode == OS_FILE_CREATE ?
+ "create" : "open");
if (retry) {
goto try_again;
}
#ifdef USE_FILE_LOCK
} else if (create_mode != OS_FILE_OPEN_RAW
- && os_file_lock(file, name)) {
+ && os_file_lock(file, name)) {
*success = FALSE;
if (create_mode == OS_FILE_OPEN_RETRY) {
int i;
ut_print_timestamp(stderr);
- fputs(" InnoDB: Retrying to lock the first data file\n",
- stderr);
+ fputs(" InnoDB: Retrying to lock"
+ " the first data file\n",
+ stderr);
for (i = 0; i < 100; i++) {
os_thread_sleep(1000000);
if (!os_file_lock(file, name)) {
@@ -1316,7 +1350,7 @@ try_again:
}
ut_print_timestamp(stderr);
fputs(" InnoDB: Unable to open the first data file\n",
- stderr);
+ stderr);
}
close(file);
file = -1;
@@ -1361,8 +1395,9 @@ loop:
if (count > 100 && 0 == (count % 10)) {
fprintf(stderr,
-"InnoDB: Warning: cannot delete file %s\n"
-"InnoDB: Are you running ibbackup to back up the file?\n", name);
+ "InnoDB: Warning: cannot delete file %s\n"
+ "InnoDB: Are you running ibbackup"
+ " to back up the file?\n", name);
os_file_get_last_error(TRUE); /* print error information */
}
@@ -1423,8 +1458,9 @@ loop:
if (count > 100 && 0 == (count % 10)) {
fprintf(stderr,
-"InnoDB: Warning: cannot delete file %s\n"
-"InnoDB: Are you running ibbackup to back up the file?\n", name);
+ "InnoDB: Warning: cannot delete file %s\n"
+ "InnoDB: Are you running ibbackup"
+ " to back up the file?\n", name);
os_file_get_last_error(TRUE); /* print error information */
}
@@ -1664,7 +1700,7 @@ os_file_set_size(
/* Write up to 1 megabyte at a time. */
buf_size = ut_min(64, (ulint) (desired_size / UNIV_PAGE_SIZE))
- * UNIV_PAGE_SIZE;
+ * UNIV_PAGE_SIZE;
buf2 = ut_malloc(buf_size + UNIV_PAGE_SIZE);
/* Align the buffer for possible raw i/o */
@@ -1688,9 +1724,9 @@ os_file_set_size(
}
ret = os_file_write(name, file, buf,
- (ulint)(current_size & 0xFFFFFFFF),
- (ulint)(current_size >> 32),
- n_bytes);
+ (ulint)(current_size & 0xFFFFFFFF),
+ (ulint)(current_size >> 32),
+ n_bytes);
if (!ret) {
ut_free(buf2);
goto error_handling;
@@ -1698,11 +1734,11 @@ os_file_set_size(
/* Print about progress for each 100 MB written */
if ((current_size + n_bytes) / (ib_longlong)(100 * 1024 * 1024)
- != current_size / (ib_longlong)(100 * 1024 * 1024)) {
+ != current_size / (ib_longlong)(100 * 1024 * 1024)) {
fprintf(stderr, " %lu00",
(ulong) ((current_size + n_bytes)
- / (ib_longlong)(100 * 1024 * 1024)));
+ / (ib_longlong)(100 * 1024 * 1024)));
}
current_size += n_bytes;
@@ -1769,7 +1805,7 @@ os_file_flush(
raw disks */
if (srv_start_raw_disk_in_use && GetLastError()
- == ERROR_INVALID_FUNCTION) {
+ == ERROR_INVALID_FUNCTION) {
return(TRUE);
}
@@ -1812,7 +1848,7 @@ os_file_flush(
#elif HAVE_FDATASYNC
ret = fdatasync(file);
#else
-/* fprintf(stderr, "Flushing to file %p\n", file); */
+ /* fprintf(stderr, "Flushing to file %p\n", file); */
ret = fsync(file);
#endif
os_n_fsyncs++;
@@ -1876,7 +1912,7 @@ os_file_pread(
if (offset_high > 0) {
fprintf(stderr,
- "InnoDB: Error: file read at offset > 4 GB\n");
+ "InnoDB: Error: file read at offset > 4 GB\n");
}
}
@@ -1898,34 +1934,34 @@ os_file_pread(
return(n_bytes);
#else
{
- off_t ret_offset;
- ssize_t ret;
- ulint i;
+ off_t ret_offset;
+ ssize_t ret;
+ ulint i;
- os_mutex_enter(os_file_count_mutex);
- os_n_pending_reads++;
- os_mutex_exit(os_file_count_mutex);
+ os_mutex_enter(os_file_count_mutex);
+ os_n_pending_reads++;
+ os_mutex_exit(os_file_count_mutex);
- /* Protect the seek / read operation with a mutex */
- i = ((ulint) file) % OS_FILE_N_SEEK_MUTEXES;
+ /* Protect the seek / read operation with a mutex */
+ i = ((ulint) file) % OS_FILE_N_SEEK_MUTEXES;
- os_mutex_enter(os_file_seek_mutexes[i]);
+ os_mutex_enter(os_file_seek_mutexes[i]);
- ret_offset = lseek(file, offs, SEEK_SET);
+ ret_offset = lseek(file, offs, SEEK_SET);
- if (ret_offset < 0) {
- ret = -1;
- } else {
- ret = read(file, buf, (ssize_t)n);
- }
+ if (ret_offset < 0) {
+ ret = -1;
+ } else {
+ ret = read(file, buf, (ssize_t)n);
+ }
- os_mutex_exit(os_file_seek_mutexes[i]);
+ os_mutex_exit(os_file_seek_mutexes[i]);
- os_mutex_enter(os_file_count_mutex);
- os_n_pending_reads--;
- os_mutex_exit(os_file_count_mutex);
+ os_mutex_enter(os_file_count_mutex);
+ os_n_pending_reads--;
+ os_mutex_exit(os_file_count_mutex);
- return(ret);
+ return(ret);
}
#endif
}
@@ -1960,7 +1996,8 @@ os_file_pwrite(
if (offset_high > 0) {
fprintf(stderr,
- "InnoDB: Error: file write at offset > 4 GB\n");
+ "InnoDB: Error: file write"
+ " at offset > 4 GB\n");
}
}
@@ -1981,8 +2018,8 @@ os_file_pwrite(
# ifdef UNIV_DO_FLUSH
if (srv_unix_file_flush_method != SRV_UNIX_LITTLESYNC
- && srv_unix_file_flush_method != SRV_UNIX_NOSYNC
- && !os_do_not_call_flush_at_each_write) {
+ && srv_unix_file_flush_method != SRV_UNIX_NOSYNC
+ && !os_do_not_call_flush_at_each_write) {
/* Always do fsync to reduce the probability that when
the OS crashes, a database page is only partially
@@ -1995,49 +2032,49 @@ os_file_pwrite(
return(ret);
#else
{
- off_t ret_offset;
- ulint i;
+ off_t ret_offset;
+ ulint i;
- os_mutex_enter(os_file_count_mutex);
- os_n_pending_writes++;
- os_mutex_exit(os_file_count_mutex);
+ os_mutex_enter(os_file_count_mutex);
+ os_n_pending_writes++;
+ os_mutex_exit(os_file_count_mutex);
- /* Protect the seek / write operation with a mutex */
- i = ((ulint) file) % OS_FILE_N_SEEK_MUTEXES;
+ /* Protect the seek / write operation with a mutex */
+ i = ((ulint) file) % OS_FILE_N_SEEK_MUTEXES;
- os_mutex_enter(os_file_seek_mutexes[i]);
+ os_mutex_enter(os_file_seek_mutexes[i]);
- ret_offset = lseek(file, offs, SEEK_SET);
+ ret_offset = lseek(file, offs, SEEK_SET);
- if (ret_offset < 0) {
- ret = -1;
+ if (ret_offset < 0) {
+ ret = -1;
- goto func_exit;
- }
+ goto func_exit;
+ }
- ret = write(file, buf, (ssize_t)n);
+ ret = write(file, buf, (ssize_t)n);
# ifdef UNIV_DO_FLUSH
- if (srv_unix_file_flush_method != SRV_UNIX_LITTLESYNC
- && srv_unix_file_flush_method != SRV_UNIX_NOSYNC
- && !os_do_not_call_flush_at_each_write) {
+ if (srv_unix_file_flush_method != SRV_UNIX_LITTLESYNC
+ && srv_unix_file_flush_method != SRV_UNIX_NOSYNC
+ && !os_do_not_call_flush_at_each_write) {
- /* Always do fsync to reduce the probability that when
- the OS crashes, a database page is only partially
- physically written to disk. */
+ /* Always do fsync to reduce the probability that when
+ the OS crashes, a database page is only partially
+ physically written to disk. */
- ut_a(TRUE == os_file_flush(file));
- }
+ ut_a(TRUE == os_file_flush(file));
+ }
# endif /* UNIV_DO_FLUSH */
func_exit:
- os_mutex_exit(os_file_seek_mutexes[i]);
+ os_mutex_exit(os_file_seek_mutexes[i]);
- os_mutex_enter(os_file_count_mutex);
- os_n_pending_writes--;
- os_mutex_exit(os_file_count_mutex);
+ os_mutex_enter(os_file_count_mutex);
+ os_n_pending_writes--;
+ os_mutex_exit(os_file_count_mutex);
- return(ret);
+ return(ret);
}
#endif
}
@@ -2129,9 +2166,10 @@ try_again:
}
fprintf(stderr,
-"InnoDB: Error: tried to read %lu bytes at offset %lu %lu.\n"
-"InnoDB: Was only able to read %ld.\n", (ulong)n, (ulong)offset_high,
- (ulong)offset, (long)ret);
+ "InnoDB: Error: tried to read %lu bytes at offset %lu %lu.\n"
+ "InnoDB: Was only able to read %ld.\n",
+ (ulong)n, (ulong)offset_high,
+ (ulong)offset, (long)ret);
#endif
#ifdef __WIN__
error_handling:
@@ -2143,7 +2181,8 @@ error_handling:
}
fprintf(stderr,
-"InnoDB: Fatal error: cannot read from file. OS error number %lu.\n",
+ "InnoDB: Fatal error: cannot read from file."
+ " OS error number %lu.\n",
#ifdef __WIN__
(ulong) GetLastError()
#else
@@ -2339,11 +2378,15 @@ retry:
ut_print_timestamp(stderr);
fprintf(stderr,
-" InnoDB: Error: File pointer positioning to file %s failed at\n"
-"InnoDB: offset %lu %lu. Operating system error number %lu.\n"
-"InnoDB: Some operating system error numbers are described at\n"
-"InnoDB: "
-"http://dev.mysql.com/doc/refman/5.1/en/operating-system-error-codes.html\n",
+ " InnoDB: Error: File pointer positioning to"
+ " file %s failed at\n"
+ "InnoDB: offset %lu %lu. Operating system"
+ " error number %lu.\n"
+ "InnoDB: Some operating system error numbers"
+ " are described at\n"
+ "InnoDB: "
+ "http://dev.mysql.com/doc/refman/5.1/en/"
+ "operating-system-error-codes.html\n",
name, (ulong) offset_high, (ulong) offset,
(ulong) GetLastError());
@@ -2392,23 +2435,30 @@ retry:
ut_print_timestamp(stderr);
fprintf(stderr,
-" InnoDB: Error: Write to file %s failed at offset %lu %lu.\n"
-"InnoDB: %lu bytes should have been written, only %lu were written.\n"
-"InnoDB: Operating system error number %lu.\n"
-"InnoDB: Check that your OS and file system support files of this size.\n"
-"InnoDB: Check also that the disk is not full or a disk quota exceeded.\n",
+ " InnoDB: Error: Write to file %s failed"
+ " at offset %lu %lu.\n"
+ "InnoDB: %lu bytes should have been written,"
+ " only %lu were written.\n"
+ "InnoDB: Operating system error number %lu.\n"
+ "InnoDB: Check that your OS and file system"
+ " support files of this size.\n"
+ "InnoDB: Check also that the disk is not full"
+ " or a disk quota exceeded.\n",
name, (ulong) offset_high, (ulong) offset,
(ulong) n, (ulong) len, (ulong) err);
if (strerror((int)err) != NULL) {
fprintf(stderr,
-"InnoDB: Error number %lu means '%s'.\n", (ulong) err, strerror((int)err));
+ "InnoDB: Error number %lu means '%s'.\n",
+ (ulong) err, strerror((int)err));
}
fprintf(stderr,
-"InnoDB: Some operating system error numbers are described at\n"
-"InnoDB: "
-"http://dev.mysql.com/doc/refman/5.1/en/operating-system-error-codes.html\n");
+ "InnoDB: Some operating system error numbers"
+ " are described at\n"
+ "InnoDB: "
+ "http://dev.mysql.com/doc/refman/5.1/en/"
+ "operating-system-error-codes.html\n");
os_has_said_disk_full = TRUE;
}
@@ -2429,22 +2479,29 @@ retry:
ut_print_timestamp(stderr);
fprintf(stderr,
-" InnoDB: Error: Write to file %s failed at offset %lu %lu.\n"
-"InnoDB: %lu bytes should have been written, only %ld were written.\n"
-"InnoDB: Operating system error number %lu.\n"
-"InnoDB: Check that your OS and file system support files of this size.\n"
-"InnoDB: Check also that the disk is not full or a disk quota exceeded.\n",
+ " InnoDB: Error: Write to file %s failed"
+ " at offset %lu %lu.\n"
+ "InnoDB: %lu bytes should have been written,"
+ " only %ld were written.\n"
+ "InnoDB: Operating system error number %lu.\n"
+ "InnoDB: Check that your OS and file system"
+ " support files of this size.\n"
+ "InnoDB: Check also that the disk is not full"
+ " or a disk quota exceeded.\n",
name, offset_high, offset, n, (long int)ret,
- (ulint)errno);
+ (ulint)errno);
if (strerror(errno) != NULL) {
fprintf(stderr,
-"InnoDB: Error number %lu means '%s'.\n", (ulint)errno, strerror(errno));
+ "InnoDB: Error number %lu means '%s'.\n",
+ (ulint)errno, strerror(errno));
}
fprintf(stderr,
-"InnoDB: Some operating system error numbers are described at\n"
-"InnoDB: "
-"http://dev.mysql.com/doc/refman/5.1/en/operating-system-error-codes.html\n");
+ "InnoDB: Some operating system error numbers"
+ " are described at\n"
+ "InnoDB: "
+ "http://dev.mysql.com/doc/refman/5.1/en/"
+ "operating-system-error-codes.html\n");
os_has_said_disk_full = TRUE;
}
@@ -2531,9 +2588,11 @@ This function returns information about the specified file */
ibool
os_file_get_status(
/*===============*/
- /* out: TRUE if stat information found */
- const char* path, /* in: pathname of the file */
- os_file_stat_t* stat_info) /* information of a file in a directory */
+ /* out: TRUE if stat
+ information found */
+ const char* path, /* in: pathname of the file */
+ os_file_stat_t* stat_info) /* information of a file in a
+ directory */
{
#ifdef __WIN__
int ret;
@@ -2613,7 +2672,7 @@ os_file_get_status(
The function os_file_dirname returns a directory component of a
null-terminated pathname string. In the usual case, dirname returns
the string up to, but not including, the final '/', and basename
-is the component following the final '/'. Trailing '/' charac­
+is the component following the final '/'. Trailing '/' charac­
ters are not counted as part of the pathname.
If path does not contain a slash, dirname returns the string ".".
@@ -2681,7 +2740,7 @@ os_file_create_subdirs_if_needed(
subdir = os_file_dirname(path);
if (strlen(subdir) == 1
- && (*subdir == OS_FILE_PATH_SEPARATOR || *subdir == '.')) {
+ && (*subdir == OS_FILE_PATH_SEPARATOR || *subdir == '.')) {
/* subdir is root or cwd, nothing to do */
mem_free(subdir);
@@ -2825,14 +2884,14 @@ os_aio_init(
srv_io_thread_function[1] = "log thread";
os_aio_read_array = os_aio_array_create(n_read_segs * n_per_seg,
- n_read_segs);
+ n_read_segs);
for (i = 2; i < 2 + n_read_segs; i++) {
ut_a(i < SRV_MAX_N_IO_THREADS);
srv_io_thread_function[i] = "read thread";
}
os_aio_write_array = os_aio_array_create(n_write_segs * n_per_seg,
- n_write_segs);
+ n_write_segs);
for (i = 2 + n_read_segs; i < n_segments; i++) {
ut_a(i < SRV_MAX_N_IO_THREADS);
srv_io_thread_function[i] = "write thread";
@@ -2868,7 +2927,7 @@ os_aio_init(
pthread_sigmask(SIG_BLOCK, &sigset, NULL); */
#endif
-}
+ }
#ifdef WIN_ASYNC_IO
/****************************************************************************
@@ -2946,17 +3005,17 @@ os_aio_get_segment_no_from_slot(
segment = 1;
} else if (array == os_aio_read_array) {
- seg_len = os_aio_read_array->n_slots /
- os_aio_read_array->n_segments;
+ seg_len = os_aio_read_array->n_slots
+ / os_aio_read_array->n_segments;
segment = 2 + slot->pos / seg_len;
} else {
ut_a(array == os_aio_write_array);
- seg_len = os_aio_write_array->n_slots /
- os_aio_write_array->n_segments;
+ seg_len = os_aio_write_array->n_slots
+ / os_aio_write_array->n_segments;
segment = os_aio_read_array->n_segments + 2
- + slot->pos / seg_len;
+ + slot->pos / seg_len;
}
return(segment);
@@ -3161,13 +3220,13 @@ loop:
control->aio_offset = offset;
control->aio_reqprio = 0;
control->aio_sigevent.sigev_notify = SIGEV_SIGNAL;
- control->aio_sigevent.sigev_signo =
- SIGRTMIN + 1 + os_aio_get_array_no(array);
- /* TODO: How to choose the signal numbers? */
-/*
+ control->aio_sigevent.sigev_signo
+ = SIGRTMIN + 1 + os_aio_get_array_no(array);
+ /* TODO: How to choose the signal numbers? */
+ /*
fprintf(stderr, "AIO signal number %lu\n",
- (ulint) control->aio_sigevent.sigev_signo);
-*/
+ (ulint) control->aio_sigevent.sigev_signo);
+ */
control->aio_sigevent.sigev_value.sival_ptr = slot;
#endif
os_mutex_exit(array->mutex);
@@ -3362,9 +3421,9 @@ os_aio(
if (mode == OS_AIO_SYNC
#ifdef WIN_ASYNC_IO
- && !os_aio_use_native_aio
+ && !os_aio_use_native_aio
#endif
- ) {
+ ) {
/* This is actually an ordinary synchronous read or write:
no need to use an i/o-handler thread. NOTE that if we use
Windows async i/o, Windows does not allow us to use
@@ -3374,7 +3433,7 @@ os_aio(
if (type == OS_FILE_READ) {
return(os_file_read(file, buf, offset,
- offset_high, n));
+ offset_high, n));
}
ut_a(type == OS_FILE_WRITE);
@@ -3408,7 +3467,7 @@ try_again:
}
slot = os_aio_array_reserve_slot(type, array, message1, message2, file,
- name, buf, offset, offset_high, n);
+ name, buf, offset, offset_high, n);
if (type == OS_FILE_READ) {
if (os_aio_use_native_aio) {
#ifdef WIN_ASYNC_IO
@@ -3416,7 +3475,7 @@ try_again:
os_bytes_read_since_printout += len;
ret = ReadFile(file, buf, (DWORD)n, &len,
- &(slot->control));
+ &(slot->control));
#elif defined(POSIX_ASYNC_IO)
slot->control.aio_lio_opcode = LIO_READ;
err = (ulint) aio_read(&(slot->control));
@@ -3424,8 +3483,9 @@ try_again:
#endif
} else {
if (!wake_later) {
- os_aio_simulated_wake_handler_thread(
- os_aio_get_segment_no_from_slot(array, slot));
+ os_aio_simulated_wake_handler_thread
+ (os_aio_get_segment_no_from_slot
+ (array, slot));
}
}
} else if (type == OS_FILE_WRITE) {
@@ -3433,7 +3493,7 @@ try_again:
#ifdef WIN_ASYNC_IO
os_n_file_writes++;
ret = WriteFile(file, buf, (DWORD)n, &len,
- &(slot->control));
+ &(slot->control));
#elif defined(POSIX_ASYNC_IO)
slot->control.aio_lio_opcode = LIO_WRITE;
err = (ulint) aio_write(&(slot->control));
@@ -3441,8 +3501,9 @@ try_again:
#endif
} else {
if (!wake_later) {
- os_aio_simulated_wake_handler_thread(
- os_aio_get_segment_no_from_slot(array, slot));
+ os_aio_simulated_wake_handler_thread
+ (os_aio_get_segment_no_from_slot
+ (array, slot));
}
}
} else {
@@ -3452,7 +3513,7 @@ try_again:
#ifdef WIN_ASYNC_IO
if (os_aio_use_native_aio) {
if ((ret && len == n)
- || (!ret && GetLastError() == ERROR_IO_PENDING)) {
+ || (!ret && GetLastError() == ERROR_IO_PENDING)) {
/* aio was queued successfully! */
if (mode == OS_AIO_SYNC) {
@@ -3462,9 +3523,10 @@ try_again:
async i/o */
retval = os_aio_windows_handle(ULINT_UNDEFINED,
- slot->pos,
- &dummy_mess1, &dummy_mess2,
- &dummy_type);
+ slot->pos,
+ &dummy_mess1,
+ &dummy_mess2,
+ &dummy_type);
return(retval);
}
@@ -3484,7 +3546,8 @@ try_again:
os_aio_array_free_slot(array, slot);
retry = os_file_handle_error(name,
- type == OS_FILE_READ ? "aio read" : "aio write");
+ type == OS_FILE_READ
+ ? "aio read" : "aio write");
if (retry) {
goto try_again;
@@ -3554,7 +3617,8 @@ os_aio_windows_handle(
} else {
srv_set_io_thread_op_info(orig_seg, "wait Windows aio");
i = os_event_wait_multiple(n,
- (array->native_events) + segment * n);
+ (array->native_events)
+ + segment * n);
}
os_mutex_enter(array->mutex);
@@ -3565,7 +3629,7 @@ os_aio_windows_handle(
if (orig_seg != ULINT_UNDEFINED) {
srv_set_io_thread_op_info(orig_seg,
- "get windows aio return value");
+ "get windows aio return value");
}
ret = GetOverlappedResult(slot->file, &(slot->control), &len, TRUE);
@@ -3580,8 +3644,8 @@ os_aio_windows_handle(
# ifdef UNIV_DO_FLUSH
if (slot->type == OS_FILE_WRITE
- && !os_do_not_call_flush_at_each_write) {
- ut_a(TRUE == os_file_flush(slot->file));
+ && !os_do_not_call_flush_at_each_write) {
+ ut_a(TRUE == os_file_flush(slot->file));
}
# endif /* UNIV_DO_FLUSH */
} else {
@@ -3631,16 +3695,16 @@ os_aio_posix_handle(
pthread_sigmask(SIG_UNBLOCK, &sigset, NULL);
- /*
+#if 0
sigprocmask(0, NULL, &proc_sigset);
pthread_sigmask(0, NULL, &thr_sigset);
for (i = 32 ; i < 40; i++) {
fprintf(stderr, "%lu : %lu %lu\n", (ulint)i,
- (ulint)sigismember(&proc_sigset, i),
- (ulint)sigismember(&thr_sigset, i));
+ (ulint) sigismember(&proc_sigset, i),
+ (ulint) sigismember(&thr_sigset, i));
}
- */
+#endif
ret = sigwaitinfo(&sigset, &info);
@@ -3666,7 +3730,7 @@ os_aio_posix_handle(
# ifdef UNIV_DO_FLUSH
if (slot->type == OS_FILE_WRITE
- && !os_do_not_call_flush_at_each_write) {
+ && !os_do_not_call_flush_at_each_write) {
ut_a(TRUE == os_file_flush(slot->file));
}
# endif /* UNIV_DO_FLUSH */
@@ -3693,19 +3757,24 @@ os_file_check_page_trailers(
ulint len;
for (len = 0; len + UNIV_PAGE_SIZE <= total_len;
- len += UNIV_PAGE_SIZE) {
+ len += UNIV_PAGE_SIZE) {
byte* buf = combined_buf + len;
- if (memcmp(buf + (FIL_PAGE_LSN + 4), buf + (UNIV_PAGE_SIZE
- - FIL_PAGE_END_LSN_OLD_CHKSUM + 4), 4)) {
+ if (UNIV_UNLIKELY
+ (memcmp(buf + (FIL_PAGE_LSN + 4),
+ buf + (UNIV_PAGE_SIZE
+ - FIL_PAGE_END_LSN_OLD_CHKSUM + 4), 4))) {
ut_print_timestamp(stderr);
fprintf(stderr,
-" InnoDB: ERROR: The page to be written seems corrupt!\n"
-"InnoDB: Writing a block of %lu bytes, currently at offset %lu\n",
- (ulong)total_len, (ulong)len);
+ " InnoDB: ERROR: The page to be written"
+ " seems corrupt!\n"
+ "InnoDB: Writing a block of %lu bytes,"
+ " currently at offset %lu\n",
+ (ulong)total_len, (ulong)len);
buf_page_print(buf);
fprintf(stderr,
-"InnoDB: ERROR: The page to be written seems corrupt!\n");
+ "InnoDB: ERROR: The page to be written"
+ " seems corrupt!\n");
}
}
}
@@ -3755,7 +3824,7 @@ restart:
we do not have to acquire the protecting mutex yet */
srv_set_io_thread_op_info(global_segment,
- "looking for i/o requests (a)");
+ "looking for i/o requests (a)");
ut_ad(os_aio_validate());
ut_ad(segment < array->n_segments);
@@ -3764,7 +3833,7 @@ restart:
/* Look through n slots after the segment * n'th slot */
if (array == os_aio_read_array
- && os_aio_recommend_sleep_for_read_threads) {
+ && os_aio_recommend_sleep_for_read_threads) {
/* Give other threads chance to add several i/os to the array
at once. */
@@ -3775,7 +3844,7 @@ restart:
os_mutex_enter(array->mutex);
srv_set_io_thread_op_info(global_segment,
- "looking for i/o requests (b)");
+ "looking for i/o requests (b)");
/* Check if there is a slot for which the i/o has already been
done */
@@ -3787,7 +3856,9 @@ restart:
if (os_aio_print_debug) {
fprintf(stderr,
-"InnoDB: i/o for slot %lu already done, returning\n", (ulong) i);
+ "InnoDB: i/o for slot %lu"
+ " already done, returning\n",
+ (ulong) i);
}
ret = TRUE;
@@ -3810,11 +3881,11 @@ restart:
if (slot->reserved) {
age = (ulint)difftime(time(NULL),
- slot->reservation_time);
+ slot->reservation_time);
if ((age >= 2 && age > biggest_age)
- || (age >= 2 && age == biggest_age
- && slot->offset < lowest_offset)) {
+ || (age >= 2 && age == biggest_age
+ && slot->offset < lowest_offset)) {
/* Found an i/o request */
consecutive_ios[0] = slot;
@@ -3836,7 +3907,7 @@ restart:
for (i = 0; i < n; i++) {
slot = os_aio_array_get_nth_slot(array,
- i + segment * n);
+ i + segment * n);
if (slot->reserved && slot->offset < lowest_offset) {
@@ -3866,12 +3937,12 @@ consecutive_loop:
slot2 = os_aio_array_get_nth_slot(array, i + segment * n);
if (slot2->reserved && slot2 != slot
- && slot2->offset == slot->offset + slot->len
- /* check that sum does not wrap over */
- && slot->offset + slot->len > slot->offset
- && slot2->offset_high == slot->offset_high
- && slot2->type == slot->type
- && slot2->file == slot->file) {
+ && slot2->offset == slot->offset + slot->len
+ /* check that sum does not wrap over */
+ && slot->offset + slot->len > slot->offset
+ && slot2->offset_high == slot->offset_high
+ && slot2->type == slot->type
+ && slot2->file == slot->file) {
/* Found a consecutive i/o request */
@@ -3927,7 +3998,7 @@ consecutive_loop:
for (i = 0; i < n_consecutive; i++) {
ut_memcpy(combined_buf + offs, consecutive_ios[i]->buf,
- consecutive_ios[i]->len);
+ consecutive_ios[i]->len);
offs += consecutive_ios[i]->len;
}
}
@@ -3936,7 +4007,8 @@ consecutive_loop:
if (os_aio_print_debug) {
fprintf(stderr,
-"InnoDB: doing i/o of type %lu at offset %lu %lu, length %lu\n",
+ "InnoDB: doing i/o of type %lu at offset %lu %lu,"
+ " length %lu\n",
(ulong) slot->type, (ulong) slot->offset_high,
(ulong) slot->offset, (ulong) total_len);
}
@@ -3945,9 +4017,10 @@ consecutive_loop:
if (slot->type == OS_FILE_WRITE) {
if (array == os_aio_write_array) {
if ((total_len % UNIV_PAGE_SIZE != 0)
- || (slot->offset % UNIV_PAGE_SIZE != 0)) {
+ || (slot->offset % UNIV_PAGE_SIZE != 0)) {
fprintf(stderr,
-"InnoDB: Error: trying a displaced write to %s %lu %lu, len %lu\n",
+ "InnoDB: Error: trying a displaced"
+ " write to %s %lu %lu, len %lu\n",
slot->name, (ulong) slot->offset_high,
(ulong) slot->offset,
(ulong) total_len);
@@ -3958,22 +4031,25 @@ consecutive_loop:
}
ret = os_file_write(slot->name, slot->file, combined_buf,
- slot->offset, slot->offset_high, total_len);
+ slot->offset, slot->offset_high,
+ total_len);
if (array == os_aio_write_array) {
os_file_check_page_trailers(combined_buf, total_len);
}
} else {
ret = os_file_read(slot->file, combined_buf,
- slot->offset, slot->offset_high, total_len);
+ slot->offset, slot->offset_high, total_len);
}
ut_a(ret);
srv_set_io_thread_op_info(global_segment, "file i/o done");
-/* fprintf(stderr,
- "aio: %lu consecutive %lu:th segment, first offs %lu blocks\n",
- n_consecutive, global_segment, slot->offset / UNIV_PAGE_SIZE); */
+#if 0
+ fprintf(stderr,
+ "aio: %lu consecutive %lu:th segment, first offs %lu blocks\n",
+ n_consecutive, global_segment, slot->offset / UNIV_PAGE_SIZE);
+#endif
if (slot->type == OS_FILE_READ && n_consecutive > 1) {
/* Copy the combined buffer to individual buffers */
@@ -3982,7 +4058,7 @@ consecutive_loop:
for (i = 0; i < n_consecutive; i++) {
ut_memcpy(consecutive_ios[i]->buf, combined_buf + offs,
- consecutive_ios[i]->len);
+ consecutive_ios[i]->len);
offs += consecutive_ios[i]->len;
}
}
@@ -4035,7 +4111,8 @@ recommended_sleep:
if (os_aio_print_debug) {
fprintf(stderr,
-"InnoDB: i/o handler thread for i/o segment %lu wakes up\n",
+ "InnoDB: i/o handler thread for i/o"
+ " segment %lu wakes up\n",
(ulong) global_segment);
}
@@ -4113,8 +4190,8 @@ os_aio_print(
for (i = 0; i < srv_n_file_io_threads; i++) {
fprintf(file, "I/O thread %lu state: %s (%s)", (ulong) i,
- srv_io_thread_op_info[i],
- srv_io_thread_function[i]);
+ srv_io_thread_op_info[i],
+ srv_io_thread_function[i]);
#ifndef __WIN__
if (os_aio_segment_wait_events[i]->is_set) {
@@ -4143,8 +4220,11 @@ loop:
if (slot->reserved) {
n_reserved++;
- /* fprintf(stderr, "Reserved slot, messages %p %p\n",
- slot->message1, slot->message2); */
+#if 0
+ fprintf(stderr, "Reserved slot, messages %p %p\n",
+ (void*) slot->message1,
+ (void*) slot->message2);
+#endif
ut_a(slot->len > 0);
}
}
@@ -4206,12 +4286,13 @@ loop:
if (os_n_file_reads == os_n_file_reads_old) {
avg_bytes_read = 0.0;
} else {
- avg_bytes_read = (double) os_bytes_read_since_printout /
- (os_n_file_reads - os_n_file_reads_old);
+ avg_bytes_read = (double) os_bytes_read_since_printout
+ / (os_n_file_reads - os_n_file_reads_old);
}
fprintf(file,
-"%.2f reads/s, %lu avg bytes/read, %.2f writes/s, %.2f fsyncs/s\n",
+ "%.2f reads/s, %lu avg bytes/read,"
+ " %.2f writes/s, %.2f fsyncs/s\n",
(os_n_file_reads - os_n_file_reads_old)
/ time_elapsed,
(ulong)avg_bytes_read,
diff --git a/storage/innobase/os/os0proc.c b/storage/innobase/os/os0proc.c
index fc1b2d0d2dd..a99fe8b6a0e 100644
--- a/storage/innobase/os/os0proc.c
+++ b/storage/innobase/os/os0proc.c
@@ -90,8 +90,8 @@ os_awe_enable_lock_pages_in_mem(void)
#elif defined(__WIN2000__)
struct {
- DWORD Count;
- LUID_AND_ATTRIBUTES Privilege[1];
+ DWORD Count;
+ LUID_AND_ATTRIBUTES Privilege[1];
} Info;
HANDLE hProcess;
HANDLE Token;
@@ -102,7 +102,7 @@ os_awe_enable_lock_pages_in_mem(void)
/* Open the token of the current process */
Result = OpenProcessToken(hProcess,
- TOKEN_ADJUST_PRIVILEGES, &Token);
+ TOKEN_ADJUST_PRIVILEGES, &Token);
if (Result != TRUE) {
fprintf(stderr,
"InnoDB: AWE: Cannot open process token, error %lu\n",
@@ -118,10 +118,11 @@ os_awe_enable_lock_pages_in_mem(void)
privilege */
Result = LookupPrivilegeValue(NULL, SE_LOCK_MEMORY_NAME,
- &(Info.Privilege[0].Luid));
+ &(Info.Privilege[0].Luid));
if (Result != TRUE) {
fprintf(stderr,
- "InnoDB: AWE: Cannot get local privilege value for %s, error %lu.\n",
+ "InnoDB: AWE: Cannot get local privilege"
+ " value for %s, error %lu.\n",
SE_LOCK_MEMORY_NAME, (ulint)GetLastError());
return(FALSE);
@@ -130,23 +131,29 @@ os_awe_enable_lock_pages_in_mem(void)
/* Try to adjust the privilege */
Result = AdjustTokenPrivileges(Token, FALSE,
- (PTOKEN_PRIVILEGES)&Info,
- 0, NULL, NULL);
+ (PTOKEN_PRIVILEGES)&Info,
+ 0, NULL, NULL);
/* Check the result */
if (Result != TRUE) {
fprintf(stderr,
- "InnoDB: AWE: Cannot adjust process token privileges, error %u.\n",
+ "InnoDB: AWE: Cannot adjust process token privileges,"
+ " error %u.\n",
GetLastError());
return(FALSE);
} else if (GetLastError() != ERROR_SUCCESS) {
fprintf(stderr,
-"InnoDB: AWE: Cannot enable SE_LOCK_MEMORY privilege, error %lu.\n"
-"InnoDB: In Windows XP Home you cannot use AWE. In Windows 2000 and XP\n"
-"InnoDB: Professional you must go to the Control Panel, to\n"
-"InnoDB: Security Settings, to Local Policies, and enable\n"
-"InnoDB: the 'lock pages in memory' privilege for the user who runs\n"
-"InnoDB: the MySQL server.\n", GetLastError());
+ "InnoDB: AWE: Cannot enable SE_LOCK_MEMORY privilege,"
+ " error %lu.\n"
+ "InnoDB: In Windows XP Home you cannot use AWE."
+ " In Windows 2000 and XP\n"
+ "InnoDB: Professional you must go to the"
+ " Control Panel, to\n"
+ "InnoDB: Security Settings, to Local Policies,"
+ " and enable\n"
+ "InnoDB: the 'lock pages in memory' privilege"
+ " for the user who runs\n"
+ "InnoDB: the MySQL server.\n", GetLastError());
return(FALSE);
}
@@ -157,7 +164,8 @@ os_awe_enable_lock_pages_in_mem(void)
#else
#ifdef __WIN__
fprintf(stderr,
-"InnoDB: AWE: Error: to use AWE you must use a ...-nt MySQL executable.\n");
+ "InnoDB: AWE: Error: to use AWE you must use"
+ " a ...-nt MySQL executable.\n");
#endif
return(FALSE);
#endif
@@ -178,12 +186,12 @@ os_awe_allocate_physical_mem(
ulint n_megabytes) /* in: number of megabytes to allocate */
{
#ifdef UNIV_SIMULATE_AWE
- os_awe_simulate_page_info = ut_malloc(sizeof(os_awe_t) *
- n_megabytes * ((1024 * 1024) / OS_AWE_X86_PAGE_SIZE));
+ os_awe_simulate_page_info = ut_malloc
+ (sizeof(os_awe_t) * n_megabytes
+ * ((1024 * 1024) / OS_AWE_X86_PAGE_SIZE));
- os_awe_simulate_mem = ut_align(ut_malloc(
- 4096 + 1024 * 1024 * n_megabytes),
- 4096);
+ os_awe_simulate_mem
+ = ut_align(ut_malloc(4096 + 1024 * 1024 * n_megabytes), 4096);
os_awe_simulate_mem_size = n_megabytes * 1024 * 1024;
*page_info = os_awe_simulate_page_info;
@@ -204,8 +212,9 @@ os_awe_allocate_physical_mem(
if (n_megabytes > 64 * 1024) {
fprintf(stderr,
-"InnoDB: AWE: Error: tried to allocate %lu MB.\n"
-"InnoDB: AWE cannot allocate more than 64 GB in any computer.\n", n_megabytes);
+ "InnoDB: AWE: Error: tried to allocate %lu MB.\n"
+ "InnoDB: AWE cannot allocate more than"
+ " 64 GB in any computer.\n", n_megabytes);
return(FALSE);
}
@@ -214,8 +223,10 @@ os_awe_allocate_physical_mem(
if ((ulint)OS_AWE_X86_PAGE_SIZE != (ulint)sSysInfo.dwPageSize) {
fprintf(stderr,
-"InnoDB: AWE: Error: this computer has a page size of %lu.\n"
-"InnoDB: Should be 4096 bytes for InnoDB AWE support to work.\n",
+ "InnoDB: AWE: Error: this computer has a page size"
+ " of %lu.\n"
+ "InnoDB: Should be 4096 bytes for"
+ " InnoDB AWE support to work.\n",
(ulint)sSysInfo.dwPageSize);
return(FALSE);
@@ -233,7 +244,8 @@ os_awe_allocate_physical_mem(
if (*page_info == NULL) {
fprintf(stderr,
-"InnoDB: AWE: Failed to allocate page info array from process heap, error %lu\n",
+ "InnoDB: AWE: Failed to allocate page info"
+ " array from process heap, error %lu\n",
(ulint)GetLastError());
return(FALSE);
@@ -259,10 +271,11 @@ os_awe_allocate_physical_mem(
defined, see the note at the start of this file */
bResult = AllocateUserPhysicalPages(GetCurrentProcess(),
- &NumberOfPages, *page_info);
+ &NumberOfPages, *page_info);
if (bResult != TRUE) {
fprintf(stderr,
-"InnoDB: AWE: Cannot allocate physical pages, error %lu.\n",
+ "InnoDB: AWE: Cannot allocate physical pages,"
+ " error %lu.\n",
(ulint)GetLastError());
return(FALSE);
@@ -270,14 +283,19 @@ os_awe_allocate_physical_mem(
if (NumberOfPagesInitial != NumberOfPages) {
fprintf(stderr,
-"InnoDB: AWE: Error: allocated only %lu pages of %lu requested.\n"
-"InnoDB: Check that you have enough free RAM.\n"
-"InnoDB: In Windows XP Professional and 2000 Professional\n"
-"InnoDB: Windows PAE size is max 4 GB. In 2000 and .NET\n"
-"InnoDB: Advanced Servers and 2000 Datacenter Server it is 32 GB,\n"
-"InnoDB: and in .NET Datacenter Server it is 64 GB.\n"
-"InnoDB: A Microsoft web page said that the processor must be an Intel\n"
-"InnoDB: processor.\n",
+ "InnoDB: AWE: Error: allocated only %lu pages"
+ " of %lu requested.\n"
+ "InnoDB: Check that you have enough free RAM.\n"
+ "InnoDB: In Windows XP Professional and"
+ " 2000 Professional\n"
+ "InnoDB: Windows PAE size is max 4 GB."
+ " In 2000 and .NET\n"
+ "InnoDB: Advanced Servers and 2000 Datacenter Server"
+ " it is 32 GB,\n"
+ "InnoDB: and in .NET Datacenter Server it is 64 GB.\n"
+ "InnoDB: A Microsoft web page said that"
+ " the processor must be an Intel\n"
+ "InnoDB: processor.\n",
(ulint)NumberOfPages,
(ulint)NumberOfPagesInitial);
@@ -285,7 +303,8 @@ os_awe_allocate_physical_mem(
}
fprintf(stderr,
-"InnoDB: Using Address Windowing Extensions (AWE); allocated %lu MB\n",
+ "InnoDB: Using Address Windowing Extensions (AWE);"
+ " allocated %lu MB\n",
n_megabytes);
return(TRUE);
@@ -328,17 +347,19 @@ os_awe_allocate_virtual_mem_window(
if (size > (ulint)0x7FFFFFFFUL) {
fprintf(stderr,
-"InnoDB: AWE: Cannot allocate %lu bytes of virtual memory\n", size);
+ "InnoDB: AWE: Cannot allocate %lu bytes"
+ " of virtual memory\n", size);
return(NULL);
}
ptr = VirtualAlloc(NULL, (SIZE_T)size, MEM_RESERVE | MEM_PHYSICAL,
- PAGE_READWRITE);
+ PAGE_READWRITE);
if (ptr == NULL) {
fprintf(stderr,
-"InnoDB: AWE: Cannot allocate %lu bytes of virtual memory, error %lu\n",
- size, (ulint)GetLastError());
+ "InnoDB: AWE: Cannot allocate %lu bytes"
+ " of virtual memory, error %lu\n",
+ size, (ulint)GetLastError());
return(NULL);
}
@@ -390,14 +411,14 @@ os_awe_map_physical_mem_to_window(
ut_a(ptr >= os_awe_simulate_window);
ut_a(ptr < os_awe_simulate_window + os_awe_simulate_window_size);
ut_a(page_info >= os_awe_simulate_page_info);
- ut_a(page_info < os_awe_simulate_page_info +
- (os_awe_simulate_mem_size / 4096));
+ ut_a(page_info < os_awe_simulate_page_info
+ + (os_awe_simulate_mem_size / 4096));
/* First look if some other 'physical pages' are mapped at ptr,
and copy them back to where they were if yes */
map = os_awe_simulate_map
- + ((ulint)(ptr - os_awe_simulate_window)) / 4096;
+ + ((ulint)(ptr - os_awe_simulate_window)) / 4096;
page = ptr;
for (i = 0; i < n_mem_pages; i++) {
@@ -412,15 +433,15 @@ os_awe_map_physical_mem_to_window(
assume page_info is a segment of the array we created at the start */
phys_page = os_awe_simulate_mem
- + (ulint)(page_info - os_awe_simulate_page_info)
- * 4096;
+ + (ulint)(page_info - os_awe_simulate_page_info)
+ * 4096;
ut_memcpy(ptr, phys_page, n_mem_pages * 4096);
/* Update the map */
map = os_awe_simulate_map
- + ((ulint)(ptr - os_awe_simulate_window)) / 4096;
+ + ((ulint)(ptr - os_awe_simulate_window)) / 4096;
for (i = 0; i < n_mem_pages; i++) {
*map = phys_page;
@@ -439,29 +460,34 @@ os_awe_map_physical_mem_to_window(
if (!(ptr >= os_awe_window)) {
fprintf(stderr,
-"InnoDB: AWE: Error: trying to map to address %lx but AWE window start %lx\n",
- (ulint)ptr, (ulint)os_awe_window);
+ "InnoDB: AWE: Error: trying to map to address %lx"
+ " but AWE window start %lx\n",
+ (ulint)ptr, (ulint)os_awe_window);
ut_a(0);
}
if (!(ptr <= os_awe_window + os_awe_window_size - UNIV_PAGE_SIZE)) {
fprintf(stderr,
-"InnoDB: AWE: Error: trying to map to address %lx but AWE window end %lx\n",
- (ulint)ptr, (ulint)os_awe_window + os_awe_window_size);
+ "InnoDB: AWE: Error: trying to map to address %lx"
+ " but AWE window end %lx\n",
+ (ulint)ptr, (ulint)os_awe_window + os_awe_window_size);
ut_a(0);
}
if (!(page_info >= os_awe_page_info)) {
fprintf(stderr,
-"InnoDB: AWE: Error: trying to map page info at %lx but array start %lx\n",
- (ulint)page_info, (ulint)os_awe_page_info);
+ "InnoDB: AWE: Error: trying to map page info"
+ " at %lx but array start %lx\n",
+ (ulint)page_info, (ulint)os_awe_page_info);
ut_a(0);
}
if (!(page_info <= os_awe_page_info + (os_awe_n_pages - 4))) {
fprintf(stderr,
-"InnoDB: AWE: Error: trying to map page info at %lx but array end %lx\n",
- (ulint)page_info, (ulint)(os_awe_page_info + os_awe_n_pages));
+ "InnoDB: AWE: Error: trying to map page info"
+ " at %lx but array end %lx\n",
+ (ulint)page_info,
+ (ulint)(os_awe_page_info + os_awe_n_pages));
ut_a(0);
}
@@ -470,9 +496,10 @@ os_awe_map_physical_mem_to_window(
if (bResult != TRUE) {
ut_print_timestamp(stderr);
fprintf(stderr,
-" InnoDB: AWE: Mapping of %lu physical pages to address %lx failed,\n"
-"InnoDB: error %lu.\n"
-"InnoDB: Cannot continue operation.\n",
+ " InnoDB: AWE: Mapping of %lu physical pages"
+ " to address %lx failed,\n"
+ "InnoDB: error %lu.\n"
+ "InnoDB: Cannot continue operation.\n",
n_mem_pages, (ulint)ptr, (ulint)GetLastError());
exit(1);
}
@@ -517,7 +544,7 @@ os_mem_alloc_nocache(
void* ptr;
ptr = VirtualAlloc(NULL, n, MEM_COMMIT,
- PAGE_READWRITE | PAGE_NOCACHE);
+ PAGE_READWRITE | PAGE_NOCACHE);
ut_a(ptr);
return(ptr);
@@ -541,47 +568,50 @@ os_mem_alloc_large(
the memory cannot be allocated */
{
#ifdef HAVE_LARGE_PAGES
- ulint size;
- int shmid;
- void *ptr = NULL;
- struct shmid_ds buf;
+ ulint size;
+ int shmid;
+ void *ptr = NULL;
+ struct shmid_ds buf;
- if (!os_use_large_pages || !os_large_page_size) {
- goto skip;
- }
+ if (!os_use_large_pages || !os_large_page_size) {
+ goto skip;
+ }
#ifdef UNIV_LINUX
- /* Align block size to os_large_page_size */
- size = ((n - 1) & ~(os_large_page_size - 1)) + os_large_page_size;
-
- shmid = shmget(IPC_PRIVATE, (size_t)size, SHM_HUGETLB | SHM_R | SHM_W);
- if (shmid < 0) {
- fprintf(stderr, "InnoDB: HugeTLB: Warning: Failed to allocate"
- " %lu bytes. errno %d\n", n, errno);
- } else {
- ptr = shmat(shmid, NULL, 0);
- if (ptr == (void *)-1) {
- fprintf(stderr, "InnoDB: HugeTLB: Warning: Failed to"
- " attach shared memory segment, errno %d\n", errno);
- }
-
- /* Remove the shared memory segment so that it will be
- automatically freed after memory is detached or process exits */
- shmctl(shmid, IPC_RMID, &buf);
- }
+ /* Align block size to os_large_page_size */
+ size = ((n - 1) & ~(os_large_page_size - 1)) + os_large_page_size;
+
+ shmid = shmget(IPC_PRIVATE, (size_t)size, SHM_HUGETLB | SHM_R | SHM_W);
+ if (shmid < 0) {
+ fprintf(stderr, "InnoDB: HugeTLB: Warning: Failed to allocate"
+ " %lu bytes. errno %d\n", n, errno);
+ } else {
+ ptr = shmat(shmid, NULL, 0);
+ if (ptr == (void *)-1) {
+ fprintf(stderr, "InnoDB: HugeTLB: Warning: Failed to"
+ " attach shared memory segment, errno %d\n",
+ errno);
+ }
+
+ /* Remove the shared memory segment so that it will be
+ automatically freed after memory is detached or
+ process exits */
+ shmctl(shmid, IPC_RMID, &buf);
+ }
#endif
- if (ptr) {
- if (set_to_zero) {
+ if (ptr) {
+ if (set_to_zero) {
#ifdef UNIV_SET_MEM_TO_ZERO
- memset(ptr, '\0', size);
+ memset(ptr, '\0', size);
#endif
- }
+ }
- return(ptr);
- }
+ return(ptr);
+ }
- fprintf(stderr, "InnoDB HugeTLB: Warning: Using conventional memory pool\n");
+ fprintf(stderr, "InnoDB HugeTLB: Warning: Using conventional"
+ " memory pool\n");
skip:
#endif /* HAVE_LARGE_PAGES */
@@ -597,16 +627,16 @@ os_mem_free_large(
void *ptr) /* in: number of bytes */
{
#ifdef HAVE_LARGE_PAGES
- if (os_use_large_pages && os_large_page_size
+ if (os_use_large_pages && os_large_page_size
#ifdef UNIV_LINUX
- && !shmdt(ptr)
+ && !shmdt(ptr)
#endif
- ) {
- return;
- }
+ ) {
+ return;
+ }
#endif
- ut_free(ptr);
+ ut_free(ptr);
}
/********************************************************************
@@ -632,11 +662,12 @@ os_process_set_priority_boost(
# error "TRUE != 1"
#endif
-/* Does not do anything currently!
+ /* Does not do anything currently!
SetProcessPriorityBoost(GetCurrentProcess(), no_boost);
-*/
- fputs("Warning: process priority boost setting currently not functional!\n",
- stderr);
+ */
+ fputs("Warning: process priority boost setting"
+ " currently not functional!\n",
+ stderr);
#else
UT_NOT_USED(do_boost);
#endif
diff --git a/storage/innobase/os/os0sync.c b/storage/innobase/os/os0sync.c
index eceedcb66b2..9c6b1134e12 100644
--- a/storage/innobase/os/os0sync.c
+++ b/storage/innobase/os/os0sync.c
@@ -90,8 +90,8 @@ os_sync_free(void)
while (mutex) {
if (mutex == os_sync_mutex) {
/* Set the flag to FALSE so that we do not try to
- reserve os_sync_mutex any more in remaining freeing
- operations in shutdown */
+ reserve os_sync_mutex any more in remaining freeing
+ operations in shutdown */
os_sync_mutex_inited = FALSE;
}
@@ -118,14 +118,15 @@ os_event_create(
event = ut_malloc(sizeof(struct os_event_struct));
- event->handle = CreateEvent(NULL,/* No security attributes */
- TRUE, /* Manual reset */
- FALSE, /* Initial state nonsignaled */
- (LPCTSTR) name);
+ event->handle = CreateEvent(NULL, /* No security attributes */
+ TRUE, /* Manual reset */
+ FALSE, /* Initial state nonsignaled */
+ (LPCTSTR) name);
if (!event->handle) {
fprintf(stderr,
-"InnoDB: Could not create a Windows event semaphore; Windows error %lu\n",
- (ulong) GetLastError());
+ "InnoDB: Could not create a Windows event semaphore;"
+ " Windows error %lu\n",
+ (ulong) GetLastError());
}
#else /* Unix */
os_event_t event;
@@ -138,7 +139,7 @@ os_event_create(
#if defined(UNIV_HOTBACKUP) && defined(UNIV_HPUX10)
ut_a(0 == pthread_cond_init(&(event->cond_var),
- pthread_condattr_default));
+ pthread_condattr_default));
#else
ut_a(0 == pthread_cond_init(&(event->cond_var), NULL));
#endif
@@ -174,15 +175,16 @@ os_event_create_auto(
event = ut_malloc(sizeof(struct os_event_struct));
- event->handle = CreateEvent(NULL,/* No security attributes */
- FALSE, /* Auto-reset */
- FALSE, /* Initial state nonsignaled */
- (LPCTSTR) name);
+ event->handle = CreateEvent(NULL, /* No security attributes */
+ FALSE, /* Auto-reset */
+ FALSE, /* Initial state nonsignaled */
+ (LPCTSTR) name);
if (!event->handle) {
fprintf(stderr,
-"InnoDB: Could not create a Windows auto event semaphore; Windows error %lu\n",
- (ulong) GetLastError());
+ "InnoDB: Could not create a Windows auto"
+ " event semaphore; Windows error %lu\n",
+ (ulong) GetLastError());
}
/* Put to the list of events */
@@ -320,7 +322,7 @@ os_event_wait(
for (;;) {
if (event->is_set == TRUE
- || event->signal_count != old_signal_count) {
+ || event->signal_count != old_signal_count) {
os_fast_mutex_unlock(&(event->os_mutex));
@@ -409,9 +411,9 @@ os_event_wait_multiple(
ut_a(n > 0);
index = WaitForMultipleObjects((DWORD) n, native_event_array,
- FALSE, /* Wait for any 1 event */
- INFINITE); /* Infinite wait time
- limit */
+ FALSE, /* Wait for any 1 event */
+ INFINITE); /* Infinite wait time
+ limit */
ut_a(index >= WAIT_OBJECT_0); /* NOTE: Pointless comparision */
ut_a(index < WAIT_OBJECT_0 + n);
@@ -439,8 +441,8 @@ os_mutex_create(
os_mutex_t mutex_str;
mutex = CreateMutex(NULL, /* No security attributes */
- FALSE, /* Initial state: no owner */
- (LPCTSTR) name);
+ FALSE, /* Initial state: no owner */
+ (LPCTSTR) name);
ut_a(mutex);
#else
os_fast_mutex_t* mutex;
@@ -638,10 +640,11 @@ os_fast_mutex_free(
if (ret != 0) {
ut_print_timestamp(stderr);
fprintf(stderr,
-" InnoDB: error: return value %lu when calling\n"
-"InnoDB: pthread_mutex_destroy().\n", (ulint)ret);
+ " InnoDB: error: return value %lu when calling\n"
+ "InnoDB: pthread_mutex_destroy().\n", (ulint)ret);
fprintf(stderr,
-"InnoDB: Byte contents of the pthread mutex at %p:\n", (void*) fast_mutex);
+ "InnoDB: Byte contents of the pthread mutex at %p:\n",
+ (void*) fast_mutex);
ut_print_buf(stderr, fast_mutex, sizeof(os_fast_mutex_t));
fprintf(stderr, "\n");
}
diff --git a/storage/innobase/os/os0thread.c b/storage/innobase/os/os0thread.c
index 138db6426ea..0c9434ccc7f 100644
--- a/storage/innobase/os/os0thread.c
+++ b/storage/innobase/os/os0thread.c
@@ -107,11 +107,11 @@ os_thread_create(
os_mutex_exit(os_sync_mutex);
thread = CreateThread(NULL, /* no security attributes */
- 0, /* default size stack */
- (LPTHREAD_START_ROUTINE)start_f,
- arg,
- 0, /* thread runs immediately */
- &win_thread_id);
+ 0, /* default size stack */
+ (LPTHREAD_START_ROUTINE)start_f,
+ arg,
+ 0, /* thread runs immediately */
+ &win_thread_id);
if (srv_set_thread_priorities) {
@@ -142,21 +142,23 @@ os_thread_create(
AIX is always big enough. An empirical test on AIX-4.3 suggested
the size was 96 kB, though. */
- ret = pthread_attr_setstacksize(&attr,
- (size_t)(PTHREAD_STACK_MIN + 32 * 1024));
+ ret = pthread_attr_setstacksize
+ (&attr, (size_t)(PTHREAD_STACK_MIN + 32 * 1024));
if (ret) {
- fprintf(stderr,
- "InnoDB: Error: pthread_attr_setstacksize returned %d\n", ret);
- exit(1);
+ fprintf(stderr,
+ "InnoDB: Error: pthread_attr_setstacksize"
+ " returned %d\n", ret);
+ exit(1);
}
#endif
#ifdef __NETWARE__
ret = pthread_attr_setstacksize(&attr,
(size_t) NW_THD_STACKSIZE);
if (ret) {
- fprintf(stderr,
- "InnoDB: Error: pthread_attr_setstacksize returned %d\n", ret);
- exit(1);
+ fprintf(stderr,
+ "InnoDB: Error: pthread_attr_setstacksize"
+ " returned %d\n", ret);
+ exit(1);
}
#endif
os_mutex_enter(os_sync_mutex);
@@ -169,9 +171,9 @@ os_thread_create(
ret = pthread_create(&pthread, &attr, start_f, arg);
#endif
if (ret) {
- fprintf(stderr,
- "InnoDB: Error: pthread_create returned %d\n", ret);
- exit(1);
+ fprintf(stderr,
+ "InnoDB: Error: pthread_create returned %d\n", ret);
+ exit(1);
}
#if !(defined(UNIV_HOTBACKUP) && defined(UNIV_HPUX10))
@@ -220,7 +222,7 @@ os_thread_join(
/*===========*/
os_thread_id_t thread_id) /* in: id of the thread to join */
{
- return(pthread_join(thread_id, NULL));
+ return(pthread_join(thread_id, NULL));
}
#endif
/*********************************************************************
diff --git a/storage/innobase/page/page0cur.c b/storage/innobase/page/page0cur.c
index 70943ec3c8a..2a440c4f479 100644
--- a/storage/innobase/page/page0cur.c
+++ b/storage/innobase/page/page0cur.c
@@ -66,29 +66,29 @@ page_cur_try_search_shortcut(
rec = page_header_get_ptr(page, PAGE_LAST_INSERT);
offsets = rec_get_offsets(rec, index, offsets,
- dtuple_get_n_fields(tuple), &heap);
+ dtuple_get_n_fields(tuple), &heap);
ut_ad(rec);
ut_ad(page_rec_is_user_rec(rec));
ut_pair_min(&low_match, &low_bytes,
- *ilow_matched_fields, *ilow_matched_bytes,
- *iup_matched_fields, *iup_matched_bytes);
+ *ilow_matched_fields, *ilow_matched_bytes,
+ *iup_matched_fields, *iup_matched_bytes);
up_match = low_match;
up_bytes = low_bytes;
if (page_cmp_dtuple_rec_with_match(tuple, rec, offsets,
- &low_match, &low_bytes) < 0) {
+ &low_match, &low_bytes) < 0) {
goto exit_func;
}
next_rec = page_rec_get_next(rec);
offsets = rec_get_offsets(next_rec, index, offsets,
- dtuple_get_n_fields(tuple), &heap);
+ dtuple_get_n_fields(tuple), &heap);
if (page_cmp_dtuple_rec_with_match(tuple, next_rec, offsets,
- &up_match, &up_bytes) >= 0) {
+ &up_match, &up_bytes) >= 0) {
goto exit_func;
}
@@ -96,11 +96,11 @@ page_cur_try_search_shortcut(
#ifdef UNIV_SEARCH_DEBUG
page_cur_search_with_match(page, index, tuple, PAGE_CUR_DBG,
- iup_matched_fields,
- iup_matched_bytes,
- ilow_matched_fields,
- ilow_matched_bytes,
- &cursor2);
+ iup_matched_fields,
+ iup_matched_bytes,
+ ilow_matched_fields,
+ ilow_matched_bytes,
+ &cursor2);
ut_a(cursor2.rec == cursor->rec);
if (next_rec != page_get_supremum_rec(page)) {
@@ -163,20 +163,20 @@ page_cur_rec_field_extends(
rec_f = rec_get_nth_field(rec, offsets, n, &rec_f_len);
if (type->mtype == DATA_VARCHAR
- || type->mtype == DATA_CHAR
- || type->mtype == DATA_FIXBINARY
- || type->mtype == DATA_BINARY
- || type->mtype == DATA_BLOB
- || type->mtype == DATA_VARMYSQL
- || type->mtype == DATA_MYSQL) {
+ || type->mtype == DATA_CHAR
+ || type->mtype == DATA_FIXBINARY
+ || type->mtype == DATA_BINARY
+ || type->mtype == DATA_BLOB
+ || type->mtype == DATA_VARMYSQL
+ || type->mtype == DATA_MYSQL) {
if (dfield_get_len(dfield) != UNIV_SQL_NULL
- && rec_f_len != UNIV_SQL_NULL
- && rec_f_len >= dfield_get_len(dfield)
- && 0 == cmp_data_data_slow(type,
- dfield_get_data(dfield),
- dfield_get_len(dfield),
- rec_f, dfield_get_len(dfield))) {
+ && rec_f_len != UNIV_SQL_NULL
+ && rec_f_len >= dfield_get_len(dfield)
+ && !cmp_data_data_slow(type,
+ dfield_get_data(dfield),
+ dfield_get_len(dfield),
+ rec_f, dfield_get_len(dfield))) {
return(TRUE);
}
@@ -236,7 +236,7 @@ page_cur_search_with_match(
*offsets_ = (sizeof offsets_) / sizeof *offsets_;
ut_ad(page && tuple && iup_matched_fields && iup_matched_bytes
- && ilow_matched_fields && ilow_matched_bytes && cursor);
+ && ilow_matched_fields && ilow_matched_bytes && cursor);
ut_ad(dtuple_validate(tuple));
ut_ad(dtuple_check_typed(tuple));
#ifdef UNIV_DEBUG
@@ -246,23 +246,24 @@ page_cur_search_with_match(
# ifdef PAGE_CUR_LE_OR_EXTENDS
if (mode != PAGE_CUR_LE_OR_EXTENDS)
# endif /* PAGE_CUR_LE_OR_EXTENDS */
- ut_ad((mode == PAGE_CUR_L) || (mode == PAGE_CUR_LE)
- || (mode == PAGE_CUR_G) || (mode == PAGE_CUR_GE));
+ ut_ad(mode == PAGE_CUR_L || mode == PAGE_CUR_LE
+ || mode == PAGE_CUR_G || mode == PAGE_CUR_GE);
#endif /* UNIV_DEBUG */
page_check_dir(page);
#ifdef PAGE_CUR_ADAPT
if ((page_header_get_field(page, PAGE_LEVEL) == 0)
- && (mode == PAGE_CUR_LE)
- && (page_header_get_field(page, PAGE_N_DIRECTION) > 3)
- && (page_header_get_ptr(page, PAGE_LAST_INSERT))
- && (page_header_get_field(page, PAGE_DIRECTION) == PAGE_RIGHT)) {
-
- if (page_cur_try_search_shortcut(page, index, tuple,
- iup_matched_fields, iup_matched_bytes,
- ilow_matched_fields, ilow_matched_bytes,
- cursor)) {
+ && (mode == PAGE_CUR_LE)
+ && (page_header_get_field(page, PAGE_N_DIRECTION) > 3)
+ && (page_header_get_ptr(page, PAGE_LAST_INSERT))
+ && (page_header_get_field(page, PAGE_DIRECTION) == PAGE_RIGHT)) {
+
+ if (page_cur_try_search_shortcut
+ (page, index, tuple,
+ iup_matched_fields, iup_matched_bytes,
+ ilow_matched_fields, ilow_matched_bytes,
+ cursor)) {
return;
}
}
@@ -306,11 +307,12 @@ page_cur_search_with_match(
mid_rec = page_dir_slot_get_rec(slot);
ut_pair_min(&cur_matched_fields, &cur_matched_bytes,
- low_matched_fields, low_matched_bytes,
- up_matched_fields, up_matched_bytes);
+ low_matched_fields, low_matched_bytes,
+ up_matched_fields, up_matched_bytes);
offsets = rec_get_offsets(mid_rec, index, offsets,
- dtuple_get_n_fields_cmp(tuple), &heap);
+ dtuple_get_n_fields_cmp(tuple),
+ &heap);
cmp = cmp_dtuple_rec_with_match(tuple, mid_rec, offsets,
&cur_matched_fields,
@@ -321,11 +323,11 @@ low_slot_match:
low_matched_fields = cur_matched_fields;
low_matched_bytes = cur_matched_bytes;
- } else if (UNIV_LIKELY(cmp /* == -1 */)) {
+ } else if (UNIV_EXPECT(cmp, -1)) {
#ifdef PAGE_CUR_LE_OR_EXTENDS
if (mode == PAGE_CUR_LE_OR_EXTENDS
- && page_cur_rec_field_extends(tuple, mid_rec,
- offsets, cur_matched_fields)) {
+ && page_cur_rec_field_extends
+ (tuple, mid_rec, offsets, cur_matched_fields)) {
goto low_slot_match;
}
@@ -339,7 +341,7 @@ up_slot_match:
#ifdef PAGE_CUR_LE_OR_EXTENDS
|| mode == PAGE_CUR_LE_OR_EXTENDS
#endif /* PAGE_CUR_LE_OR_EXTENDS */
- ) {
+ ) {
goto low_slot_match;
} else {
@@ -361,11 +363,12 @@ up_slot_match:
mid_rec = page_rec_get_next(low_rec);
ut_pair_min(&cur_matched_fields, &cur_matched_bytes,
- low_matched_fields, low_matched_bytes,
- up_matched_fields, up_matched_bytes);
+ low_matched_fields, low_matched_bytes,
+ up_matched_fields, up_matched_bytes);
offsets = rec_get_offsets(mid_rec, index, offsets,
- dtuple_get_n_fields_cmp(tuple), &heap);
+ dtuple_get_n_fields_cmp(tuple),
+ &heap);
cmp = cmp_dtuple_rec_with_match(tuple, mid_rec, offsets,
&cur_matched_fields,
@@ -376,11 +379,11 @@ low_rec_match:
low_matched_fields = cur_matched_fields;
low_matched_bytes = cur_matched_bytes;
- } else if (UNIV_LIKELY(cmp /* == -1 */)) {
+ } else if (UNIV_EXPECT(cmp, -1)) {
#ifdef PAGE_CUR_LE_OR_EXTENDS
if (mode == PAGE_CUR_LE_OR_EXTENDS
- && page_cur_rec_field_extends(tuple, mid_rec,
- offsets, cur_matched_fields)) {
+ && page_cur_rec_field_extends
+ (tuple, mid_rec, offsets, cur_matched_fields)) {
goto low_rec_match;
}
@@ -393,7 +396,7 @@ up_rec_match:
#ifdef PAGE_CUR_LE_OR_EXTENDS
|| mode == PAGE_CUR_LE_OR_EXTENDS
#endif /* PAGE_CUR_LE_OR_EXTENDS */
- ) {
+ ) {
goto low_rec_match;
} else {
@@ -410,10 +413,10 @@ up_rec_match:
dbg_matched_bytes = 0;
offsets = rec_get_offsets(low_rec, index, offsets,
- ULINT_UNDEFINED, &heap);
+ ULINT_UNDEFINED, &heap);
dbg_cmp = page_cmp_dtuple_rec_with_match(tuple, low_rec, offsets,
- &dbg_matched_fields,
- &dbg_matched_bytes);
+ &dbg_matched_fields,
+ &dbg_matched_bytes);
if (mode == PAGE_CUR_G) {
ut_a(dbg_cmp >= 0);
} else if (mode == PAGE_CUR_GE) {
@@ -434,10 +437,10 @@ up_rec_match:
dbg_matched_bytes = 0;
offsets = rec_get_offsets(up_rec, index, offsets,
- ULINT_UNDEFINED, &heap);
+ ULINT_UNDEFINED, &heap);
dbg_cmp = page_cmp_dtuple_rec_with_match(tuple, up_rec, offsets,
- &dbg_matched_fields,
- &dbg_matched_bytes);
+ &dbg_matched_fields,
+ &dbg_matched_bytes);
if (mode == PAGE_CUR_G) {
ut_a(dbg_cmp == -1);
} else if (mode == PAGE_CUR_GE) {
@@ -533,7 +536,7 @@ page_cur_insert_rec_write_log(
ut_a(rec_size < UNIV_PAGE_SIZE);
ut_ad(buf_frame_align(insert_rec) == buf_frame_align(cursor_rec));
ut_ad(!page_rec_is_comp(insert_rec)
- == !dict_table_is_comp(index->table));
+ == !dict_table_is_comp(index->table));
comp = page_rec_is_comp(insert_rec);
{
@@ -548,9 +551,9 @@ page_cur_insert_rec_write_log(
*ins_offs_ = (sizeof ins_offs_) / sizeof *ins_offs_;
cur_offs = rec_get_offsets(cursor_rec, index, cur_offs_,
- ULINT_UNDEFINED, &heap);
+ ULINT_UNDEFINED, &heap);
ins_offs = rec_get_offsets(insert_rec, index, ins_offs_,
- ULINT_UNDEFINED, &heap);
+ ULINT_UNDEFINED, &heap);
extra_size = rec_offs_extra_size(ins_offs);
cur_extra_size = rec_offs_extra_size(cur_offs);
@@ -583,9 +586,10 @@ page_cur_insert_rec_write_log(
ins_ptr++;
cur_ptr++;
} else if ((i < extra_size)
- && (i >= extra_size - (comp
- ? REC_N_NEW_EXTRA_BYTES
- : REC_N_OLD_EXTRA_BYTES))) {
+ && (i >= extra_size
+ - (comp
+ ? REC_N_NEW_EXTRA_BYTES
+ : REC_N_OLD_EXTRA_BYTES))) {
i = extra_size;
ins_ptr = insert_rec;
cur_ptr = cursor_rec;
@@ -598,9 +602,11 @@ page_cur_insert_rec_write_log(
if (mtr_get_log_mode(mtr) != MTR_LOG_SHORT_INSERTS) {
log_ptr = mlog_open_and_write_index(mtr, insert_rec, index,
- comp
- ? MLOG_COMP_REC_INSERT : MLOG_REC_INSERT,
- 2 + 5 + 1 + 5 + 5 + MLOG_BUF_MARGIN);
+ comp
+ ? MLOG_COMP_REC_INSERT
+ : MLOG_REC_INSERT,
+ 2 + 5 + 1 + 5 + 5
+ + MLOG_BUF_MARGIN);
if (!log_ptr) {
/* Logging in mtr is switched off during crash
@@ -611,7 +617,7 @@ page_cur_insert_rec_write_log(
log_end = &log_ptr[2 + 5 + 1 + 5 + 5 + MLOG_BUF_MARGIN];
/* Write the cursor rec offset as a 2-byte ulint */
mach_write_to_2(log_ptr, cursor_rec
- - buf_frame_align(cursor_rec));
+ - buf_frame_align(cursor_rec));
log_ptr += 2;
} else {
log_ptr = mlog_open(mtr, 5 + 1 + 5 + 5 + MLOG_BUF_MARGIN);
@@ -623,10 +629,10 @@ page_cur_insert_rec_write_log(
log_end = &log_ptr[5 + 1 + 5 + 5 + MLOG_BUF_MARGIN];
}
- if ((rec_get_info_and_status_bits(insert_rec, comp) !=
- rec_get_info_and_status_bits(cursor_rec, comp))
- || (extra_size != cur_extra_size)
- || (rec_size != cur_rec_size)) {
+ if ((rec_get_info_and_status_bits(insert_rec, comp)
+ != rec_get_info_and_status_bits(cursor_rec, comp))
+ || (extra_size != cur_extra_size)
+ || (rec_size != cur_rec_size)) {
extra_info_yes = 1;
} else {
@@ -636,11 +642,12 @@ page_cur_insert_rec_write_log(
/* Write the record end segment length and the extra info storage
flag */
log_ptr += mach_write_compressed(log_ptr, 2 * (rec_size - i)
- + extra_info_yes);
+ + extra_info_yes);
if (extra_info_yes) {
/* Write the info bits */
- mach_write_to_1(log_ptr,
- rec_get_info_and_status_bits(insert_rec, comp));
+ mach_write_to_1
+ (log_ptr,
+ rec_get_info_and_status_bits(insert_rec, comp));
log_ptr++;
/* Write the record origin offset */
@@ -786,11 +793,11 @@ page_cur_parse_insert_rec(
}
offsets = rec_get_offsets(cursor_rec, index, offsets,
- ULINT_UNDEFINED, &heap);
+ ULINT_UNDEFINED, &heap);
if (extra_info_yes == 0) {
- info_and_status_bits = rec_get_info_and_status_bits(
- cursor_rec, page_is_comp(page));
+ info_and_status_bits = rec_get_info_and_status_bits
+ (cursor_rec, page_is_comp(page));
origin_offset = rec_offs_extra_size(offsets);
mismatch_index = rec_offs_size(offsets) - end_seg_len;
}
@@ -827,12 +834,12 @@ page_cur_parse_insert_rec(
ut_memcpy(buf + mismatch_index, ptr, end_seg_len);
rec_set_info_and_status_bits(buf + origin_offset, page_is_comp(page),
- info_and_status_bits);
+ info_and_status_bits);
page_cur_position(cursor_rec, &cursor);
offsets = rec_get_offsets(buf + origin_offset, index, offsets,
- ULINT_UNDEFINED, &heap);
+ ULINT_UNDEFINED, &heap);
page_cur_rec_insert(&cursor, buf + origin_offset, index, offsets, mtr);
if (buf != buf1) {
@@ -868,9 +875,11 @@ page_cur_insert_rec_low(
byte* insert_buf = NULL;
ulint rec_size;
byte* page; /* the relevant page */
- rec_t* last_insert; /* cursor position at previous insert */
+ rec_t* last_insert; /* cursor position at previous
+ insert */
rec_t* insert_rec; /* inserted record */
- ulint heap_no; /* heap number of the inserted record */
+ ulint heap_no; /* heap number of the inserted
+ record */
rec_t* current_rec; /* current record after which the
new record is inserted */
rec_t* next_rec; /* next record after current before
@@ -899,7 +908,7 @@ page_cur_insert_rec_low(
} else {
if (!offsets) {
offsets = rec_get_offsets(rec, index, offsets,
- ULINT_UNDEFINED, &heap);
+ ULINT_UNDEFINED, &heap);
}
ut_ad(rec_offs_validate(rec, index, offsets));
rec_size = rec_offs_size(offsets);
@@ -918,9 +927,9 @@ page_cur_insert_rec_low(
/* 3. Create the record */
if (tuple != NULL) {
insert_rec = rec_convert_dtuple_to_rec(insert_buf,
- index, tuple);
+ index, tuple);
offsets = rec_get_offsets(insert_rec, index, offsets,
- ULINT_UNDEFINED, &heap);
+ ULINT_UNDEFINED, &heap);
} else {
insert_rec = rec_copy(insert_buf, rec, offsets);
ut_ad(rec_offs_validate(rec, index, offsets));
@@ -953,26 +962,30 @@ page_cur_insert_rec_low(
last_insert = page_header_get_ptr(page, PAGE_LAST_INSERT);
ut_ad(!last_insert || !comp
- || rec_get_node_ptr_flag(last_insert)
- == rec_get_node_ptr_flag(insert_rec));
+ || rec_get_node_ptr_flag(last_insert)
+ == rec_get_node_ptr_flag(insert_rec));
if (last_insert == NULL) {
page_header_set_field(page, PAGE_DIRECTION, PAGE_NO_DIRECTION);
page_header_set_field(page, PAGE_N_DIRECTION, 0);
} else if ((last_insert == current_rec)
- && (page_header_get_field(page, PAGE_DIRECTION) != PAGE_LEFT)) {
+ && (page_header_get_field(page, PAGE_DIRECTION)
+ != PAGE_LEFT)) {
page_header_set_field(page, PAGE_DIRECTION, PAGE_RIGHT);
page_header_set_field(page, PAGE_N_DIRECTION,
- page_header_get_field(page, PAGE_N_DIRECTION) + 1);
+ page_header_get_field
+ (page, PAGE_N_DIRECTION) + 1);
} else if ((page_rec_get_next(insert_rec) == last_insert)
- && (page_header_get_field(page, PAGE_DIRECTION) != PAGE_RIGHT)) {
+ && (page_header_get_field(page, PAGE_DIRECTION)
+ != PAGE_RIGHT)) {
page_header_set_field(page, PAGE_DIRECTION, PAGE_LEFT);
page_header_set_field(page, PAGE_N_DIRECTION,
- page_header_get_field(page, PAGE_N_DIRECTION) + 1);
+ page_header_get_field
+ (page, PAGE_N_DIRECTION) + 1);
} else {
page_header_set_field(page, PAGE_DIRECTION, PAGE_NO_DIRECTION);
page_header_set_field(page, PAGE_N_DIRECTION, 0);
@@ -997,7 +1010,7 @@ page_cur_insert_rec_low(
/* 9. Write log record of the insert */
page_cur_insert_rec_write_log(insert_rec, rec_size, current_rec,
- index, mtr);
+ index, mtr);
if (UNIV_LIKELY_NULL(heap)) {
mem_heap_free(heap);
@@ -1022,9 +1035,9 @@ page_copy_rec_list_to_created_page_write_log(
ut_ad(!!page_is_comp(page) == dict_table_is_comp(index->table));
log_ptr = mlog_open_and_write_index(mtr, page, index,
- page_is_comp(page)
- ? MLOG_COMP_LIST_END_COPY_CREATED
- : MLOG_LIST_END_COPY_CREATED, 4);
+ page_is_comp(page)
+ ? MLOG_COMP_LIST_END_COPY_CREATED
+ : MLOG_LIST_END_COPY_CREATED, 4);
ut_a(log_ptr);
mlog_close(mtr, log_ptr + 4);
@@ -1069,7 +1082,7 @@ page_parse_copy_rec_list_to_created_page(
while (ptr < rec_end) {
ptr = page_cur_parse_insert_rec(TRUE, ptr, end_ptr,
- index, page, mtr);
+ index, page, mtr);
}
ut_a(ptr == rec_end);
@@ -1130,11 +1143,11 @@ page_copy_rec_list_end_to_created_page(
in the debug version */
page_dir_set_n_slots(new_page, UNIV_PAGE_SIZE / 2);
page_header_set_ptr(new_page, PAGE_HEAP_TOP,
- new_page + UNIV_PAGE_SIZE - 1);
+ new_page + UNIV_PAGE_SIZE - 1);
#endif
log_ptr = page_copy_rec_list_to_created_page_write_log(new_page,
- index, mtr);
+ index, mtr);
log_data_len = dyn_array_get_data_size(&(mtr->log));
@@ -1155,7 +1168,7 @@ page_copy_rec_list_end_to_created_page(
/* should be do ... until, comment by Jani */
while (rec != page_get_supremum_rec(page)) {
offsets = rec_get_offsets(rec, index, offsets,
- ULINT_UNDEFINED, &heap);
+ ULINT_UNDEFINED, &heap);
insert_rec = rec_copy(heap_top, rec, offsets);
rec_set_next_offs(prev_rec, comp, insert_rec - new_page);
@@ -1185,13 +1198,13 @@ page_copy_rec_list_end_to_created_page(
}
page_cur_insert_rec_write_log(insert_rec, rec_size, prev_rec,
- index, mtr);
+ index, mtr);
prev_rec = insert_rec;
rec = page_rec_get_next(rec);
}
if ((slot_index > 0) && (count + 1
- + (PAGE_DIR_SLOT_MAX_N_OWNED + 1) / 2
+ + (PAGE_DIR_SLOT_MAX_N_OWNED + 1) / 2
<= PAGE_DIR_SLOT_MAX_N_OWNED)) {
/* We can merge the two last dir slots. This operation is
here to make this function imitate exactly the equivalent
@@ -1218,7 +1231,7 @@ page_copy_rec_list_end_to_created_page(
mach_write_to_4(log_ptr, log_data_len);
rec_set_next_offs(insert_rec, comp,
- comp ? PAGE_NEW_SUPREMUM : PAGE_OLD_SUPREMUM);
+ comp ? PAGE_NEW_SUPREMUM : PAGE_OLD_SUPREMUM);
slot = page_dir_get_nth_slot(new_page, 1 + slot_index);
@@ -1254,9 +1267,9 @@ page_cur_delete_rec_write_log(
ut_ad(!!page_rec_is_comp(rec) == dict_table_is_comp(index->table));
log_ptr = mlog_open_and_write_index(mtr, rec, index,
- page_rec_is_comp(rec)
- ? MLOG_COMP_REC_DELETE
- : MLOG_REC_DELETE, 2);
+ page_rec_is_comp(rec)
+ ? MLOG_COMP_REC_DELETE
+ : MLOG_REC_DELETE, 2);
if (!log_ptr) {
/* Logging in mtr is switched off during crash recovery:
@@ -1306,8 +1319,9 @@ page_cur_parse_delete_rec(
page_cur_position(rec, &cursor);
page_cur_delete_rec(&cursor, index,
- rec_get_offsets(rec, index, offsets_,
- ULINT_UNDEFINED, &heap), mtr);
+ rec_get_offsets(rec, index, offsets_,
+ ULINT_UNDEFINED, &heap),
+ mtr);
if (UNIV_LIKELY_NULL(heap)) {
mem_heap_free(heap);
}
@@ -1390,7 +1404,7 @@ page_cur_delete_rec(
page_rec_set_next(prev_rec, next_rec);
page_header_set_field(page, PAGE_N_RECS,
- (ulint)(page_get_n_recs(page) - 1));
+ (ulint)(page_get_n_recs(page) - 1));
/* 4. If the deleted record is pointed to by a dir slot, update the
record pointer in slot. In the following if-clause we assume that
diff --git a/storage/innobase/page/page0page.c b/storage/innobase/page/page0page.c
index a7a0dd4b788..0c869445546 100644
--- a/storage/innobase/page/page0page.c
+++ b/storage/innobase/page/page0page.c
@@ -104,9 +104,10 @@ page_dir_find_owner_slot(
if (UNIV_UNLIKELY(slot == first_slot)) {
fprintf(stderr,
- "InnoDB: Probable data corruption on page %lu\n"
- "InnoDB: Original record ",
- (ulong) buf_frame_get_page_no(page));
+ "InnoDB: Probable data corruption on"
+ " page %lu\n"
+ "InnoDB: Original record ",
+ (ulong) buf_frame_get_page_no(page));
if (page_is_comp(page)) {
fputs("(compact record)", stderr);
@@ -115,17 +116,17 @@ page_dir_find_owner_slot(
}
fputs("\n"
- "InnoDB: on that page.\n"
- "InnoDB: Cannot find the dir slot for record ",
- stderr);
+ "InnoDB: on that page.\n"
+ "InnoDB: Cannot find the dir slot for record ",
+ stderr);
if (page_is_comp(page)) {
fputs("(compact record)", stderr);
} else {
rec_print_old(stderr, page
- + mach_decode_2(rec_offs_bytes));
+ + mach_decode_2(rec_offs_bytes));
}
fputs("\n"
- "InnoDB: on that page!\n", stderr);
+ "InnoDB: on that page!\n", stderr);
buf_page_print(page);
@@ -163,7 +164,7 @@ page_dir_slot_check(
ut_a(page_rec_check(page_dir_slot_get_rec(slot)));
n_owned = rec_get_n_owned(page_dir_slot_get_rec(slot),
- page_is_comp(page));
+ page_is_comp(page));
if (slot == page_dir_get_nth_slot(page, 0)) {
ut_a(n_owned == 1);
@@ -242,17 +243,17 @@ page_mem_alloc(
*offsets_ = (sizeof offsets_) / sizeof *offsets_;
offsets = rec_get_offsets(rec, index, offsets,
- ULINT_UNDEFINED, &heap);
+ ULINT_UNDEFINED, &heap);
if (rec_offs_size(offsets) >= need) {
page_header_set_ptr(page, PAGE_FREE,
- page_rec_get_next(rec));
+ page_rec_get_next(rec));
garbage = page_header_get_field(page, PAGE_GARBAGE);
ut_ad(garbage >= need);
page_header_set_field(page, PAGE_GARBAGE,
- garbage - need);
+ garbage - need);
*heap_no = rec_get_heap_no(rec, page_is_comp(page));
@@ -297,8 +298,9 @@ page_create_write_log(
mtr_t* mtr, /* in: mini-transaction handle */
ulint comp) /* in: nonzero=compact page format */
{
- mlog_write_initial_log_record(frame,
- comp ? MLOG_COMP_PAGE_CREATE : MLOG_PAGE_CREATE, mtr);
+ mlog_write_initial_log_record(frame, comp
+ ? MLOG_COMP_PAGE_CREATE
+ : MLOG_PAGE_CREATE, mtr);
}
/***************************************************************
@@ -379,7 +381,7 @@ page_create(
dfield_set_data(field, "infimum", 8);
dtype_set(dfield_get_type(field),
- DATA_VARCHAR, DATA_ENGLISH | DATA_NOT_NULL, 8, 0);
+ DATA_VARCHAR, DATA_ENGLISH | DATA_NOT_NULL, 8, 0);
/* Set the corresponding physical record to its place in the page
record heap */
@@ -387,13 +389,13 @@ page_create(
infimum_rec = rec_convert_dtuple_to_rec(heap_top, index, tuple);
- ut_a(infimum_rec ==
- page + (comp ? PAGE_NEW_INFIMUM : PAGE_OLD_INFIMUM));
+ ut_a(infimum_rec == page
+ + (comp ? PAGE_NEW_INFIMUM : PAGE_OLD_INFIMUM));
rec_set_n_owned(infimum_rec, comp, 1);
rec_set_heap_no(infimum_rec, comp, 0);
offsets = rec_get_offsets(infimum_rec, index, NULL,
- ULINT_UNDEFINED, &heap);
+ ULINT_UNDEFINED, &heap);
heap_top = rec_get_end(infimum_rec, offsets);
@@ -405,22 +407,22 @@ page_create(
dfield_set_data(field, "supremum", comp ? 8 : 9);
dtype_set(dfield_get_type(field),
- DATA_VARCHAR, DATA_ENGLISH | DATA_NOT_NULL, comp ? 8 : 9, 0);
+ DATA_VARCHAR, DATA_ENGLISH | DATA_NOT_NULL, comp ? 8 : 9, 0);
supremum_rec = rec_convert_dtuple_to_rec(heap_top, index, tuple);
- ut_a(supremum_rec ==
- page + (comp ? PAGE_NEW_SUPREMUM : PAGE_OLD_SUPREMUM));
+ ut_a(supremum_rec == page
+ + (comp ? PAGE_NEW_SUPREMUM : PAGE_OLD_SUPREMUM));
rec_set_n_owned(supremum_rec, comp, 1);
rec_set_heap_no(supremum_rec, comp, 1);
offsets = rec_get_offsets(supremum_rec, index, offsets,
- ULINT_UNDEFINED, &heap);
+ ULINT_UNDEFINED, &heap);
heap_top = rec_get_end(supremum_rec, offsets);
- ut_ad(heap_top ==
- page + (comp ? PAGE_NEW_SUPREMUM_END : PAGE_OLD_SUPREMUM_END));
+ ut_ad(heap_top == page
+ + (comp ? PAGE_NEW_SUPREMUM_END : PAGE_OLD_SUPREMUM_END));
mem_heap_free(heap);
@@ -437,7 +439,7 @@ page_create(
page_header_set_field(page, PAGE_N_RECS, 0);
page_set_max_trx_id(page, ut_dulint_zero);
memset(heap_top, 0, UNIV_PAGE_SIZE - PAGE_EMPTY_DIR_START
- - (heap_top - page));
+ - (heap_top - page));
/* 5. SET POINTERS IN RECORDS AND DIR SLOTS */
@@ -486,11 +488,11 @@ page_copy_rec_list_end_no_locks(
}
ut_a((ibool)!!page_is_comp(new_page)
- == dict_table_is_comp(index->table));
+ == dict_table_is_comp(index->table));
ut_a(page_is_comp(new_page) == page_is_comp(page));
ut_a(mach_read_from_2(new_page + UNIV_PAGE_SIZE - 10) == (ulint)
- (page_is_comp(new_page)
- ? PAGE_NEW_INFIMUM : PAGE_OLD_INFIMUM));
+ (page_is_comp(new_page)
+ ? PAGE_NEW_INFIMUM : PAGE_OLD_INFIMUM));
page_cur_set_before_first(new_page, &cur2);
@@ -504,9 +506,9 @@ page_copy_rec_list_end_no_locks(
break;
}
offsets = rec_get_offsets(cur1_rec, index, offsets,
- ULINT_UNDEFINED, &heap);
+ ULINT_UNDEFINED, &heap);
if (UNIV_UNLIKELY(!page_cur_rec_insert(&cur2, cur1_rec, index,
- offsets, mtr))) {
+ offsets, mtr))) {
/* Track an assertion failure reported on the mailing
list on June 18th, 2003 */
@@ -515,7 +517,8 @@ page_copy_rec_list_end_no_locks(
ut_print_timestamp(stderr);
fprintf(stderr,
-"InnoDB: rec offset %lu, cur1 offset %lu, cur2 offset %lu\n",
+ "InnoDB: rec offset %lu, cur1 offset %lu,"
+ " cur2 offset %lu\n",
(ulong)(rec - page),
(ulong)(page_cur_get_rec(&cur1) - page),
(ulong)(page_cur_get_rec(&cur2) - new_page));
@@ -548,10 +551,10 @@ page_copy_rec_list_end(
{
if (page_dir_get_n_heap(new_page) == 2) {
page_copy_rec_list_end_to_created_page(new_page, page, rec,
- index, mtr);
+ index, mtr);
} else {
page_copy_rec_list_end_no_locks(new_page, page, rec,
- index, mtr);
+ index, mtr);
}
/* Update the lock table, MAX_TRX_ID, and possible hash index */
@@ -604,9 +607,9 @@ page_copy_rec_list_start(
rec_t* ins_rec;
rec_t* cur1_rec = page_cur_get_rec(&cur1);
offsets = rec_get_offsets(cur1_rec, index, offsets,
- ULINT_UNDEFINED, &heap);
+ ULINT_UNDEFINED, &heap);
ins_rec = page_cur_rec_insert(&cur2, cur1_rec, index,
- offsets, mtr);
+ offsets, mtr);
ut_a(ins_rec);
page_cur_move_to_next(&cur1);
@@ -640,9 +643,9 @@ page_delete_rec_list_write_log(
{
byte* log_ptr;
ut_ad(type == MLOG_LIST_END_DELETE
- || type == MLOG_LIST_START_DELETE
- || type == MLOG_COMP_LIST_END_DELETE
- || type == MLOG_COMP_LIST_START_DELETE);
+ || type == MLOG_LIST_START_DELETE
+ || type == MLOG_COMP_LIST_END_DELETE
+ || type == MLOG_COMP_LIST_START_DELETE);
log_ptr = mlog_open_and_write_index(mtr, rec, index, type, 2);
if (log_ptr) {
@@ -672,9 +675,9 @@ page_parse_delete_rec_list(
ulint offset;
ut_ad(type == MLOG_LIST_END_DELETE
- || type == MLOG_LIST_START_DELETE
- || type == MLOG_COMP_LIST_END_DELETE
- || type == MLOG_COMP_LIST_START_DELETE);
+ || type == MLOG_LIST_START_DELETE
+ || type == MLOG_COMP_LIST_END_DELETE
+ || type == MLOG_COMP_LIST_START_DELETE);
/* Read the record offset as a 2-byte ulint */
@@ -694,9 +697,10 @@ page_parse_delete_rec_list(
ut_ad(!!page_is_comp(page) == dict_table_is_comp(index->table));
if (type == MLOG_LIST_END_DELETE
- || type == MLOG_COMP_LIST_END_DELETE) {
+ || type == MLOG_COMP_LIST_END_DELETE) {
page_delete_rec_list_end(page, page + offset, index,
- ULINT_UNDEFINED, ULINT_UNDEFINED, mtr);
+ ULINT_UNDEFINED,
+ ULINT_UNDEFINED, mtr);
} else {
page_delete_rec_list_start(page, page + offset, index, mtr);
}
@@ -750,8 +754,9 @@ page_delete_rec_list_end(
rec = page_rec_get_next(rec);
}
- page_delete_rec_list_write_log(rec, index,
- comp ? MLOG_COMP_LIST_END_DELETE : MLOG_LIST_END_DELETE, mtr);
+ page_delete_rec_list_write_log(rec, index, comp
+ ? MLOG_COMP_LIST_END_DELETE
+ : MLOG_LIST_END_DELETE, mtr);
if (rec == sup) {
@@ -775,10 +780,10 @@ page_delete_rec_list_end(
while (rec2 != sup) {
ulint s;
offsets = rec_get_offsets(rec2, index, offsets,
- ULINT_UNDEFINED, &heap);
+ ULINT_UNDEFINED, &heap);
s = rec_offs_size(offsets);
ut_ad(rec2 - page + s - rec_offs_extra_size(offsets)
- < UNIV_PAGE_SIZE);
+ < UNIV_PAGE_SIZE);
ut_ad(size + s < UNIV_PAGE_SIZE);
size += s;
n_recs++;
@@ -828,11 +833,11 @@ page_delete_rec_list_end(
page_rec_set_next(last_rec, free);
page_header_set_ptr(page, PAGE_FREE, rec);
- page_header_set_field(page, PAGE_GARBAGE,
- size + page_header_get_field(page, PAGE_GARBAGE));
+ page_header_set_field(page, PAGE_GARBAGE, size
+ + page_header_get_field(page, PAGE_GARBAGE));
page_header_set_field(page, PAGE_N_RECS,
- (ulint)(page_get_n_recs(page) - n_recs));
+ (ulint)(page_get_n_recs(page) - n_recs));
}
/*****************************************************************
@@ -880,7 +885,7 @@ page_delete_rec_list_start(
while (page_cur_get_rec(&cur1) != rec) {
offsets = rec_get_offsets(page_cur_get_rec(&cur1), index,
- offsets, ULINT_UNDEFINED, &heap);
+ offsets, ULINT_UNDEFINED, &heap);
page_cur_delete_rec(&cur1, index, offsets, mtr);
}
@@ -922,7 +927,8 @@ page_move_rec_list_end(
ut_ad(new_data_size >= old_data_size);
page_delete_rec_list_end(page, split_rec, index,
- new_n_recs - old_n_recs, new_data_size - old_data_size, mtr);
+ new_n_recs - old_n_recs,
+ new_data_size - old_data_size, mtr);
}
/*****************************************************************
@@ -1002,7 +1008,7 @@ page_dir_delete_slots(
slot = page_dir_get_nth_slot(page, start + n);
page_dir_slot_set_n_owned(slot,
- sum_owned + page_dir_slot_get_n_owned(slot));
+ sum_owned + page_dir_slot_get_n_owned(slot));
/* 3. Destroy start and other slots by copying slots */
for (i = start + n; i < n_slots; i++) {
@@ -1314,7 +1320,8 @@ page_dir_print(
"PAGE DIRECTORY\n"
"Page address %p\n"
"Directory stack top at offs: %lu; number of slots: %lu\n",
- page, (ulong)(page_dir_get_nth_slot(page, n - 1) - page), (ulong) n);
+ page, (ulong)(page_dir_get_nth_slot(page, n - 1) - page),
+ (ulong) n);
for (i = 0; i < n; i++) {
slot = page_dir_get_nth_slot(page, i);
if ((i == pr_n) && (i < n - pr_n)) {
@@ -1322,9 +1329,11 @@ page_dir_print(
}
if ((i < pr_n) || (i >= n - pr_n)) {
fprintf(stderr,
- "Contents of slot: %lu: n_owned: %lu, rec offs: %lu\n",
- (ulong) i, (ulong) page_dir_slot_get_n_owned(slot),
- (ulong)(page_dir_slot_get_rec(slot) - page));
+ "Contents of slot: %lu: n_owned: %lu,"
+ " rec offs: %lu\n",
+ (ulong) i,
+ (ulong) page_dir_slot_get_n_owned(slot),
+ (ulong)(page_dir_slot_get_rec(slot) - page));
}
}
fprintf(stderr, "Total of %lu records\n"
@@ -1364,7 +1373,7 @@ page_print_list(
count = 0;
for (;;) {
offsets = rec_get_offsets(cur.rec, index, offsets,
- ULINT_UNDEFINED, &heap);
+ ULINT_UNDEFINED, &heap);
page_rec_print(cur.rec, offsets);
if (count == pr_n) {
@@ -1386,7 +1395,7 @@ page_print_list(
if (count + pr_n >= n_recs) {
offsets = rec_get_offsets(cur.rec, index, offsets,
- ULINT_UNDEFINED, &heap);
+ ULINT_UNDEFINED, &heap);
page_rec_print(cur.rec, offsets);
}
count++;
@@ -1478,15 +1487,15 @@ page_rec_validate(
if (!(n_owned <= PAGE_DIR_SLOT_MAX_N_OWNED)) {
fprintf(stderr,
"InnoDB: Dir slot of rec %lu, n owned too big %lu\n",
- (ulong)(rec - page), (ulong) n_owned);
+ (ulong)(rec - page), (ulong) n_owned);
return(FALSE);
}
if (!(heap_no < page_dir_get_n_heap(page))) {
fprintf(stderr,
- "InnoDB: Heap no of rec %lu too big %lu %lu\n",
- (ulong)(rec - page), (ulong) heap_no,
- (ulong) page_dir_get_n_heap(page));
+ "InnoDB: Heap no of rec %lu too big %lu %lu\n",
+ (ulong)(rec - page), (ulong) heap_no,
+ (ulong) page_dir_get_n_heap(page));
return(FALSE);
}
@@ -1508,18 +1517,20 @@ page_check_dir(
n_slots = page_dir_get_n_slots(page);
if (page_dir_slot_get_rec(page_dir_get_nth_slot(page, 0))
- != page_get_infimum_rec(page)) {
+ != page_get_infimum_rec(page)) {
fprintf(stderr,
-"InnoDB: Page directory corruption: supremum not pointed to\n");
+ "InnoDB: Page directory corruption:"
+ " infimum not pointed to\n");
buf_page_print(page);
}
if (page_dir_slot_get_rec(page_dir_get_nth_slot(page, n_slots - 1))
- != page_get_supremum_rec(page)) {
+ != page_get_supremum_rec(page)) {
fprintf(stderr,
-"InnoDB: Page directory corruption: supremum not pointed to\n");
+ "InnoDB: Page directory corruption:"
+ " supremum not pointed to\n");
buf_page_print(page);
}
}
@@ -1553,7 +1564,8 @@ page_simple_validate(
if (n_slots > UNIV_PAGE_SIZE / 4) {
fprintf(stderr,
- "InnoDB: Nonsensical number %lu of page dir slots\n", (ulong) n_slots);
+ "InnoDB: Nonsensical number %lu of page dir slots\n",
+ (ulong) n_slots);
goto func_exit;
}
@@ -1563,9 +1575,12 @@ page_simple_validate(
if (rec_heap_top > page_dir_get_nth_slot(page, n_slots - 1)) {
fprintf(stderr,
- "InnoDB: Record heap and dir overlap on a page, heap top %lu, dir %lu\n",
- (ulong)(page_header_get_ptr(page, PAGE_HEAP_TOP) - page),
- (ulong)(page_dir_get_nth_slot(page, n_slots - 1) - page));
+ "InnoDB: Record heap and dir overlap on a page,"
+ " heap top %lu, dir %lu\n",
+ (ulong)
+ (page_header_get_ptr(page, PAGE_HEAP_TOP) - page),
+ (ulong)
+ (page_dir_get_nth_slot(page, n_slots - 1) - page));
goto func_exit;
}
@@ -1585,8 +1600,10 @@ page_simple_validate(
if (rec > rec_heap_top) {
fprintf(stderr,
- "InnoDB: Record %lu is above rec heap top %lu\n",
- (ulong)(rec - page), (ulong)(rec_heap_top - page));
+ "InnoDB: Record %lu is above"
+ " rec heap top %lu\n",
+ (ulong)(rec - page),
+ (ulong)(rec_heap_top - page));
goto func_exit;
}
@@ -1596,17 +1613,19 @@ page_simple_validate(
if (rec_get_n_owned(rec, comp) != own_count) {
fprintf(stderr,
- "InnoDB: Wrong owned count %lu, %lu, rec %lu\n",
- (ulong) rec_get_n_owned(rec, comp),
- (ulong) own_count,
- (ulong)(rec - page));
+ "InnoDB: Wrong owned count %lu, %lu,"
+ " rec %lu\n",
+ (ulong) rec_get_n_owned(rec, comp),
+ (ulong) own_count,
+ (ulong)(rec - page));
goto func_exit;
}
if (page_dir_slot_get_rec(slot) != rec) {
fprintf(stderr,
- "InnoDB: Dir slot does not point to right rec %lu\n",
+ "InnoDB: Dir slot does not point"
+ " to right rec %lu\n",
(ulong)(rec - page));
goto func_exit;
@@ -1626,11 +1645,12 @@ page_simple_validate(
}
if (rec_get_next_offs(rec, comp) < FIL_PAGE_DATA
- || rec_get_next_offs(rec, comp) >= UNIV_PAGE_SIZE) {
+ || rec_get_next_offs(rec, comp) >= UNIV_PAGE_SIZE) {
fprintf(stderr,
- "InnoDB: Next record offset nonsensical %lu for rec %lu\n",
- (ulong) rec_get_next_offs(rec, comp),
- (ulong)(rec - page));
+ "InnoDB: Next record offset"
+ " nonsensical %lu for rec %lu\n",
+ (ulong) rec_get_next_offs(rec, comp),
+ (ulong)(rec - page));
goto func_exit;
}
@@ -1639,8 +1659,9 @@ page_simple_validate(
if (count > UNIV_PAGE_SIZE) {
fprintf(stderr,
- "InnoDB: Page record list appears to be circular %lu\n",
- (ulong) count);
+ "InnoDB: Page record list appears"
+ " to be circular %lu\n",
+ (ulong) count);
goto func_exit;
}
@@ -1662,8 +1683,8 @@ page_simple_validate(
if (page_header_get_field(page, PAGE_N_RECS) + 2 != count + 1) {
fprintf(stderr, "InnoDB: n recs wrong %lu %lu\n",
- (ulong) page_header_get_field(page, PAGE_N_RECS) + 2,
- (ulong) (count + 1));
+ (ulong) page_header_get_field(page, PAGE_N_RECS) + 2,
+ (ulong) (count + 1));
goto func_exit;
}
@@ -1673,18 +1694,21 @@ page_simple_validate(
while (rec != NULL) {
if (rec < page + FIL_PAGE_DATA
- || rec >= page + UNIV_PAGE_SIZE) {
+ || rec >= page + UNIV_PAGE_SIZE) {
fprintf(stderr,
- "InnoDB: Free list record has a nonsensical offset %lu\n",
- (ulong)(rec - page));
+ "InnoDB: Free list record has"
+ " a nonsensical offset %lu\n",
+ (ulong) (rec - page));
goto func_exit;
}
if (rec > rec_heap_top) {
fprintf(stderr,
- "InnoDB: Free list record %lu is above rec heap top %lu\n",
- (ulong)(rec - page), (ulong)(rec_heap_top - page));
+ "InnoDB: Free list record %lu"
+ " is above rec heap top %lu\n",
+ (ulong) (rec - page),
+ (ulong) (rec_heap_top - page));
goto func_exit;
}
@@ -1693,7 +1717,8 @@ page_simple_validate(
if (count > UNIV_PAGE_SIZE) {
fprintf(stderr,
- "InnoDB: Page free list appears to be circular %lu\n",
+ "InnoDB: Page free list appears"
+ " to be circular %lu\n",
(ulong) count);
goto func_exit;
}
@@ -1704,8 +1729,8 @@ page_simple_validate(
if (page_dir_get_n_heap(page) != count + 1) {
fprintf(stderr, "InnoDB: N heap is wrong %lu, %lu\n",
- (ulong) page_dir_get_n_heap(page),
- (ulong) (count + 1));
+ (ulong) page_dir_get_n_heap(page),
+ (ulong) (count + 1));
goto func_exit;
}
@@ -1766,14 +1791,14 @@ page_validate(
n_slots = page_dir_get_n_slots(page);
- if (!(page_header_get_ptr(page, PAGE_HEAP_TOP) <=
- page_dir_get_nth_slot(page, n_slots - 1))) {
+ if (!(page_header_get_ptr(page, PAGE_HEAP_TOP)
+ <= page_dir_get_nth_slot(page, n_slots - 1))) {
fputs("InnoDB: Record heap and dir overlap on a page ",
- stderr);
+ stderr);
dict_index_name_print(stderr, NULL, index);
fprintf(stderr, ", %p, %p\n",
- page_header_get_ptr(page, PAGE_HEAP_TOP),
+ page_header_get_ptr(page, PAGE_HEAP_TOP),
page_dir_get_nth_slot(page, n_slots - 1));
goto func_exit;
@@ -1792,12 +1817,12 @@ page_validate(
for (;;) {
rec = cur.rec;
offsets = rec_get_offsets(rec, index, offsets,
- ULINT_UNDEFINED, &heap);
+ ULINT_UNDEFINED, &heap);
if (comp && page_rec_is_user_rec(rec)
- && rec_get_node_ptr_flag(rec)
- != (ibool)
- (btr_page_get_level_low(page) != 0)) {
+ && rec_get_node_ptr_flag(rec)
+ != (ibool)
+ (btr_page_get_level_low(page) != 0)) {
fputs("InnoDB: node_ptr flag mismatch\n", stderr);
goto func_exit;
}
@@ -1809,9 +1834,10 @@ page_validate(
/* Check that the records are in the ascending order */
if ((count >= 2) && (!page_cur_is_after_last(&cur))) {
if (!(1 == cmp_rec_rec(rec, old_rec,
- offsets, old_offsets, index))) {
+ offsets, old_offsets, index))) {
fprintf(stderr,
- "InnoDB: Records in wrong order on page %lu",
+ "InnoDB: Records in wrong order"
+ " on page %lu ",
(ulong) buf_frame_get_page_no(page));
dict_index_name_print(stderr, NULL, index);
fputs("\nInnoDB: previous record ", stderr);
@@ -1836,7 +1862,7 @@ page_validate(
/* No other record may overlap this */
fputs("InnoDB: Record overlaps another\n",
- stderr);
+ stderr);
goto func_exit;
}
@@ -1847,16 +1873,16 @@ page_validate(
/* This is a record pointed to by a dir slot */
if (rec_get_n_owned(rec, comp) != own_count) {
fprintf(stderr,
- "InnoDB: Wrong owned count %lu, %lu\n",
- (ulong) rec_get_n_owned(rec, comp),
- (ulong) own_count);
+ "InnoDB: Wrong owned count %lu, %lu\n",
+ (ulong) rec_get_n_owned(rec, comp),
+ (ulong) own_count);
goto func_exit;
}
if (page_dir_slot_get_rec(slot) != rec) {
- fputs(
- "InnoDB: Dir slot does not point to right rec\n",
- stderr);
+ fputs("InnoDB: Dir slot does not"
+ " point to right rec\n",
+ stderr);
goto func_exit;
}
@@ -1874,7 +1900,7 @@ page_validate(
}
if (rec_get_next_offs(rec, comp) < FIL_PAGE_DATA
- || rec_get_next_offs(rec, comp) >= UNIV_PAGE_SIZE) {
+ || rec_get_next_offs(rec, comp) >= UNIV_PAGE_SIZE) {
fprintf(stderr,
"InnoDB: Next record offset wrong %lu\n",
(ulong) rec_get_next_offs(rec, comp));
@@ -1906,14 +1932,14 @@ page_validate(
if (page_header_get_field(page, PAGE_N_RECS) + 2 != count + 1) {
fprintf(stderr, "InnoDB: n recs wrong %lu %lu\n",
- (ulong) page_header_get_field(page, PAGE_N_RECS) + 2,
- (ulong) (count + 1));
+ (ulong) page_header_get_field(page, PAGE_N_RECS) + 2,
+ (ulong) (count + 1));
goto func_exit;
}
if (data_size != page_get_data_size(page)) {
fprintf(stderr,
- "InnoDB: Summed data size %lu, returned by func %lu\n",
+ "InnoDB: Summed data size %lu, returned by func %lu\n",
(ulong) data_size, (ulong) page_get_data_size(page));
goto func_exit;
}
@@ -1923,7 +1949,7 @@ page_validate(
while (rec != NULL) {
offsets = rec_get_offsets(rec, index, offsets,
- ULINT_UNDEFINED, &heap);
+ ULINT_UNDEFINED, &heap);
if (!page_rec_validate(rec, offsets)) {
goto func_exit;
@@ -1935,8 +1961,8 @@ page_validate(
for (i = 0; i < rec_offs_size(offsets); i++) {
if (buf[offs + i] != 0) {
- fputs(
- "InnoDB: Record overlaps another in free list\n", stderr);
+ fputs("InnoDB: Record overlaps another"
+ " in free list\n", stderr);
goto func_exit;
}
@@ -1959,7 +1985,7 @@ func_exit:
mem_heap_free(heap);
if (ret == FALSE) {
- func_exit2:
+func_exit2:
fprintf(stderr, "InnoDB: Apparent corruption in page %lu in ",
(ulong) buf_frame_get_page_no(page));
dict_index_name_print(stderr, NULL, index);
diff --git a/storage/innobase/pars/pars0opt.c b/storage/innobase/pars/pars0opt.c
index 4037f50cb5c..7c564d3ee4c 100644
--- a/storage/innobase/pars/pars0opt.c
+++ b/storage/innobase/pars/pars0opt.c
@@ -86,7 +86,7 @@ opt_check_exp_determined_before(
while (arg) {
if (!opt_check_exp_determined_before(arg, sel_node,
- nth_table)) {
+ nth_table)) {
return(FALSE);
}
@@ -148,10 +148,10 @@ opt_look_for_col_in_comparison_before(
ut_ad(search_cond);
ut_a((search_cond->func == '<')
- || (search_cond->func == '>')
- || (search_cond->func == '=')
- || (search_cond->func == PARS_GE_TOKEN)
- || (search_cond->func == PARS_LE_TOKEN));
+ || (search_cond->func == '>')
+ || (search_cond->func == '=')
+ || (search_cond->func == PARS_GE_TOKEN)
+ || (search_cond->func == PARS_LE_TOKEN));
table = sel_node_get_nth_plan(sel_node, nth_table)->table;
@@ -160,10 +160,10 @@ opt_look_for_col_in_comparison_before(
return(NULL);
} else if ((cmp_type == OPT_COMPARISON)
- && (search_cond->func != '<')
- && (search_cond->func != '>')
- && (search_cond->func != PARS_GE_TOKEN)
- && (search_cond->func != PARS_LE_TOKEN)) {
+ && (search_cond->func != '<')
+ && (search_cond->func != '>')
+ && (search_cond->func != PARS_GE_TOKEN)
+ && (search_cond->func != PARS_LE_TOKEN)) {
return(NULL);
}
@@ -174,8 +174,8 @@ opt_look_for_col_in_comparison_before(
sym_node = arg;
if ((sym_node->token_type == SYM_COLUMN)
- && (sym_node->table == table)
- && (sym_node->col_no == col_no)) {
+ && (sym_node->table == table)
+ && (sym_node->col_no == col_no)) {
/* sym_node contains the desired column id */
@@ -185,7 +185,7 @@ opt_look_for_col_in_comparison_before(
exp = que_node_get_next(arg);
if (opt_check_exp_determined_before(exp, sel_node,
- nth_table)) {
+ nth_table)) {
*op = search_cond->func;
return(exp);
@@ -200,11 +200,11 @@ opt_look_for_col_in_comparison_before(
sym_node = arg;
if ((sym_node->token_type == SYM_COLUMN)
- && (sym_node->table == table)
- && (sym_node->col_no == col_no)) {
+ && (sym_node->table == table)
+ && (sym_node->col_no == col_no)) {
if (opt_check_exp_determined_before(exp, sel_node,
- nth_table)) {
+ nth_table)) {
*op = opt_invert_cmp_op(search_cond->func);
return(exp);
@@ -253,7 +253,8 @@ opt_look_for_col_in_cond_before(
new_cond = search_cond->args;
exp = opt_look_for_col_in_cond_before(cmp_type, col_no,
- new_cond, sel_node, nth_table, op);
+ new_cond, sel_node,
+ nth_table, op);
if (exp) {
return(exp);
@@ -262,12 +263,14 @@ opt_look_for_col_in_cond_before(
new_cond = que_node_get_next(new_cond);
exp = opt_look_for_col_in_cond_before(cmp_type, col_no,
- new_cond, sel_node, nth_table, op);
+ new_cond, sel_node,
+ nth_table, op);
return(exp);
}
exp = opt_look_for_col_in_comparison_before(cmp_type, col_no,
- search_cond, sel_node, nth_table, op);
+ search_cond, sel_node,
+ nth_table, op);
if (exp == NULL) {
return(NULL);
@@ -281,7 +284,8 @@ opt_look_for_col_in_cond_before(
return(NULL);
- } else if (!sel_node->asc && ((*op == '>') || (*op == PARS_GE_TOKEN))) {
+ } else if (!sel_node->asc
+ && ((*op == '>') || (*op == PARS_GE_TOKEN))) {
return(NULL);
}
@@ -329,9 +333,9 @@ opt_calc_index_goodness(
col_no = dict_index_get_nth_col_no(index, j);
- exp = opt_look_for_col_in_cond_before(OPT_EQUAL, col_no,
- sel_node->search_cond,
- sel_node, nth_table, &op);
+ exp = opt_look_for_col_in_cond_before
+ (OPT_EQUAL, col_no, sel_node->search_cond,
+ sel_node, nth_table, &op);
if (exp) {
/* The value for this column is exactly known already
at this stage of the join */
@@ -342,9 +346,9 @@ opt_calc_index_goodness(
} else {
/* Look for non-equality comparisons */
- exp = opt_look_for_col_in_cond_before(OPT_COMPARISON,
- col_no, sel_node->search_cond,
- sel_node, nth_table, &op);
+ exp = opt_look_for_col_in_cond_before
+ (OPT_COMPARISON, col_no, sel_node->search_cond,
+ sel_node, nth_table, &op);
if (exp) {
index_plan[j] = exp;
*last_op = op;
@@ -488,15 +492,15 @@ opt_check_order_by(
if (i < sel_node->n_tables - 1) {
ut_a(dict_index_get_n_unique(plan->index)
- <= plan->n_exact_match);
+ <= plan->n_exact_match);
} else {
ut_a(plan->table == order_table);
ut_a((dict_index_get_n_unique(plan->index)
- <= plan->n_exact_match)
- || (dict_index_get_nth_col_no(plan->index,
- plan->n_exact_match)
- == order_col_no));
+ <= plan->n_exact_match)
+ || (dict_index_get_nth_col_no(plan->index,
+ plan->n_exact_match)
+ == order_col_no));
}
}
}
@@ -541,7 +545,7 @@ opt_search_plan_for_table(
/* should be do ... until ? comment by Jani */
while (index) {
goodness = opt_calc_index_goodness(index, sel_node, i,
- index_plan, &last_op);
+ index_plan, &last_op);
if (goodness > best_goodness) {
best_index = index;
@@ -549,7 +553,7 @@ opt_search_plan_for_table(
n_fields = opt_calc_n_fields_from_goodness(goodness);
ut_memcpy(best_index_plan, index_plan,
- n_fields * sizeof(void*));
+ n_fields * sizeof(void*));
best_last_op = last_op;
}
@@ -565,14 +569,14 @@ opt_search_plan_for_table(
plan->n_exact_match = 0;
} else {
plan->tuple = dtuple_create(pars_sym_tab_global->heap,
- n_fields);
+ n_fields);
dict_index_copy_types(plan->tuple, plan->index, n_fields);
plan->tuple_exps = mem_heap_alloc(pars_sym_tab_global->heap,
- n_fields * sizeof(void*));
+ n_fields * sizeof(void*));
ut_memcpy(plan->tuple_exps, best_index_plan,
- n_fields * sizeof(void*));
+ n_fields * sizeof(void*));
if (best_last_op == '=') {
plan->n_exact_match = n_fields;
} else {
@@ -580,11 +584,11 @@ opt_search_plan_for_table(
}
plan->mode = opt_op_to_search_mode(sel_node->asc,
- best_last_op);
+ best_last_op);
}
if ((best_index->type & DICT_CLUSTERED)
- && (plan->n_exact_match >= dict_index_get_n_unique(best_index))) {
+ && (plan->n_exact_match >= dict_index_get_n_unique(best_index))) {
plan->unique_search = TRUE;
} else {
@@ -660,7 +664,7 @@ opt_classify_comparison(
the testing is necessary when the cursor is reversed. */
if ((n_fields > plan->n_exact_match)
- && opt_is_arg(plan->tuple_exps[n_fields - 1], cond)) {
+ && opt_is_arg(plan->tuple_exps[n_fields - 1], cond)) {
return(OPT_SCROLL_COND);
}
@@ -671,11 +675,10 @@ opt_classify_comparison(
access the table, it is classified as OPT_END_COND */
if ((dict_index_get_n_fields(plan->index) > plan->n_exact_match)
- && opt_look_for_col_in_comparison_before(
- OPT_COMPARISON,
- dict_index_get_nth_col_no(plan->index,
- plan->n_exact_match),
- cond, sel_node, i, &op)) {
+ && opt_look_for_col_in_comparison_before
+ (OPT_COMPARISON,
+ dict_index_get_nth_col_no(plan->index, plan->n_exact_match),
+ cond, sel_node, i, &op)) {
if (sel_node->asc && ((op == '<') || (op == PARS_LE_TOKEN))) {
@@ -763,7 +766,7 @@ opt_normalize_cmp_conds(
sym_node = arg2;
if ((sym_node->token_type == SYM_COLUMN)
- && (sym_node->table == table)) {
+ && (sym_node->table == table)) {
/* Switch the order of the arguments */
@@ -803,7 +806,7 @@ opt_determine_and_normalize_test_conds(
opt_find_test_conds(sel_node, i, sel_node->search_cond);
opt_normalize_cmp_conds(UT_LIST_GET_FIRST(plan->end_conds),
- plan->table);
+ plan->table);
ut_a(UT_LIST_GET_LEN(plan->end_conds) >= plan->n_exact_match);
}
@@ -846,7 +849,7 @@ opt_find_all_cols(
while (arg) {
opt_find_all_cols(copy_val, index, col_list, plan,
- arg);
+ arg);
arg = que_node_get_next(arg);
}
@@ -900,10 +903,8 @@ opt_find_all_cols(
/* Fill in the field_no fields in sym_node */
- sym_node->field_nos[SYM_CLUST_FIELD_NO]
- = dict_index_get_nth_col_pos(
- dict_table_get_first_index(index->table),
- sym_node->col_no);
+ sym_node->field_nos[SYM_CLUST_FIELD_NO] = dict_index_get_nth_col_pos
+ (dict_table_get_first_index(index->table), sym_node->col_no);
if (!(index->type & DICT_CLUSTERED)) {
ut_a(plan);
@@ -963,7 +964,7 @@ opt_find_copy_cols(
plan = sel_node_get_nth_plan(sel_node, i);
opt_find_all_cols(TRUE, plan->index, &(plan->columns), plan,
- search_cond);
+ search_cond);
}
}
@@ -998,7 +999,7 @@ opt_classify_cols(
while (exp) {
opt_find_all_cols(TRUE, plan->index, &(plan->columns), plan,
- exp);
+ exp);
exp = que_node_get_next(exp);
}
@@ -1008,7 +1009,7 @@ opt_classify_cols(
columns: therefore FALSE */
opt_find_all_cols(FALSE, plan->index, &(plan->columns), plan,
- sel_node->search_cond);
+ sel_node->search_cond);
}
/***********************************************************************
@@ -1069,10 +1070,11 @@ opt_clust_access(
tables, and they should not contain column prefix indexes. */
if (dict_index_get_nth_field(index, pos)->prefix_len != 0
- || dict_index_get_nth_field(clust_index, i)
- ->prefix_len != 0) {
+ || dict_index_get_nth_field(clust_index, i)
+ ->prefix_len != 0) {
fprintf(stderr,
-"InnoDB: Error in pars0opt.c: table %s has prefix_len != 0\n",
+ "InnoDB: Error in pars0opt.c:"
+ " table %s has prefix_len != 0\n",
index->table_name);
}
@@ -1098,7 +1100,7 @@ opt_search_plan(
ulint i;
sel_node->plans = mem_heap_alloc(pars_sym_tab_global->heap,
- sel_node->n_tables * sizeof(plan_t));
+ sel_node->n_tables * sizeof(plan_t));
/* Analyze the search condition to find out what we know at each
join stage about the conditions that the columns of a table should
diff --git a/storage/innobase/pars/pars0pars.c b/storage/innobase/pars/pars0pars.c
index 1ba28fa4fe3..214fff68c55 100644
--- a/storage/innobase/pars/pars0pars.c
+++ b/storage/innobase/pars/pars0pars.c
@@ -156,7 +156,7 @@ pars_func_low(
node->args = arg;
UT_LIST_ADD_LAST(func_node_list, pars_sym_tab_global->func_node_list,
- node);
+ node);
return(node);
}
@@ -241,17 +241,17 @@ pars_resolve_func_data_type(
func = node->func;
if ((func == PARS_SUM_TOKEN)
- || (func == '+') || (func == '-') || (func == '*')
- || (func == '/') || (func == '+')) {
+ || (func == '+') || (func == '-') || (func == '*')
+ || (func == '/') || (func == '+')) {
/* Inherit the data type from the first argument (which must
not be the SQL null literal whose type is DATA_ERROR) */
dtype_copy(que_node_get_data_type(node),
- que_node_get_data_type(arg));
+ que_node_get_data_type(arg));
ut_a(dtype_get_mtype(que_node_get_data_type(node))
- == DATA_INT);
+ == DATA_INT);
} else if (func == PARS_COUNT_TOKEN) {
ut_a(arg);
dtype_set(que_node_get_data_type(node), DATA_INT, 0, 4, 0);
@@ -259,33 +259,33 @@ pars_resolve_func_data_type(
} else if (func == PARS_TO_CHAR_TOKEN) {
ut_a(dtype_get_mtype(que_node_get_data_type(arg)) == DATA_INT);
dtype_set(que_node_get_data_type(node), DATA_VARCHAR,
- DATA_ENGLISH, 0, 0);
+ DATA_ENGLISH, 0, 0);
} else if (func == PARS_TO_BINARY_TOKEN) {
if (dtype_get_mtype(que_node_get_data_type(arg)) == DATA_INT) {
dtype_set(que_node_get_data_type(node), DATA_VARCHAR,
- DATA_ENGLISH, 0, 0);
+ DATA_ENGLISH, 0, 0);
} else {
dtype_set(que_node_get_data_type(node), DATA_BINARY,
- 0, 0, 0);
+ 0, 0, 0);
}
} else if (func == PARS_TO_NUMBER_TOKEN) {
ut_a(dtype_get_mtype(que_node_get_data_type(arg))
- == DATA_VARCHAR);
+ == DATA_VARCHAR);
dtype_set(que_node_get_data_type(node), DATA_INT, 0, 4, 0);
} else if (func == PARS_BINARY_TO_NUMBER_TOKEN) {
ut_a(dtype_get_mtype(que_node_get_data_type(arg))
- == DATA_VARCHAR);
+ == DATA_VARCHAR);
dtype_set(que_node_get_data_type(node), DATA_INT, 0, 4, 0);
} else if (func == PARS_LENGTH_TOKEN) {
ut_a(dtype_get_mtype(que_node_get_data_type(arg))
- == DATA_VARCHAR);
+ == DATA_VARCHAR);
dtype_set(que_node_get_data_type(node), DATA_INT, 0, 4, 0);
} else if (func == PARS_INSTR_TOKEN) {
ut_a(dtype_get_mtype(que_node_get_data_type(arg))
- == DATA_VARCHAR);
+ == DATA_VARCHAR);
dtype_set(que_node_get_data_type(node), DATA_INT, 0, 4, 0);
} else if (func == PARS_SYSDATE_TOKEN) {
@@ -293,12 +293,12 @@ pars_resolve_func_data_type(
dtype_set(que_node_get_data_type(node), DATA_INT, 0, 4, 0);
} else if ((func == PARS_SUBSTR_TOKEN)
- || (func == PARS_CONCAT_TOKEN)) {
+ || (func == PARS_CONCAT_TOKEN)) {
ut_a(dtype_get_mtype(que_node_get_data_type(arg))
- == DATA_VARCHAR);
+ == DATA_VARCHAR);
dtype_set(que_node_get_data_type(node), DATA_VARCHAR,
- DATA_ENGLISH, 0, 0);
+ DATA_ENGLISH, 0, 0);
} else if ((func == '>') || (func == '<') || (func == '=')
|| (func == PARS_GE_TOKEN)
@@ -321,7 +321,7 @@ pars_resolve_func_data_type(
ut_a(dtype_get_mtype(que_node_get_data_type(arg)) == DATA_INT);
dtype_set(que_node_get_data_type(node), DATA_VARCHAR,
- DATA_ENGLISH, 0, 0);
+ DATA_ENGLISH, 0, 0);
} else {
ut_error;
}
@@ -379,18 +379,18 @@ pars_resolve_exp_variables_and_types(
while (node) {
if (node->resolved
- && ((node->token_type == SYM_VAR)
- || (node->token_type == SYM_CURSOR)
- || (node->token_type == SYM_FUNCTION))
- && node->name
- && (sym_node->name_len == node->name_len)
- && (ut_memcmp(sym_node->name, node->name,
- node->name_len) == 0)) {
-
- /* Found a variable or a cursor declared with
- the same name */
-
- break;
+ && ((node->token_type == SYM_VAR)
+ || (node->token_type == SYM_CURSOR)
+ || (node->token_type == SYM_FUNCTION))
+ && node->name
+ && (sym_node->name_len == node->name_len)
+ && (ut_memcmp(sym_node->name, node->name,
+ node->name_len) == 0)) {
+
+ /* Found a variable or a cursor declared with
+ the same name */
+
+ break;
}
node = UT_LIST_GET_NEXT(sym_list, node);
@@ -398,7 +398,7 @@ pars_resolve_exp_variables_and_types(
if (!node) {
fprintf(stderr, "PARSER ERROR: Unresolved identifier %s\n",
- sym_node->name);
+ sym_node->name);
}
ut_a(node);
@@ -410,11 +410,11 @@ pars_resolve_exp_variables_and_types(
if (select_node) {
UT_LIST_ADD_LAST(col_var_list, select_node->copy_variables,
- sym_node);
+ sym_node);
}
dfield_set_type(que_node_get_val(sym_node),
- que_node_get_data_type(node));
+ que_node_get_data_type(node));
}
/*************************************************************************
@@ -493,8 +493,8 @@ pars_resolve_exp_columns(
col = dict_table_get_nth_col(table, i);
if ((sym_node->name_len == ut_strlen(col->name))
- && (0 == ut_memcmp(sym_node->name, col->name,
- sym_node->name_len))) {
+ && (0 == ut_memcmp(sym_node->name, col->name,
+ sym_node->name_len))) {
/* Found */
sym_node->resolved = TRUE;
sym_node->token_type = SYM_COLUMN;
@@ -607,12 +607,11 @@ pars_select_all_columns(
col = dict_table_get_nth_col(table, i);
col_node = sym_tab_add_id(pars_sym_tab_global,
- (byte*)col->name,
- ut_strlen(col->name));
+ (byte*)col->name,
+ ut_strlen(col->name));
select_node->select_list
- = que_node_list_add_last(
- select_node->select_list,
- col_node);
+ = que_node_list_add_last
+ (select_node->select_list, col_node);
}
table_node = que_node_get_next(table_node);
@@ -715,14 +714,14 @@ pars_select_statement(
if (select_node->into_list) {
ut_a(que_node_list_get_len(select_node->into_list)
- == que_node_list_get_len(select_node->select_list));
+ == que_node_list_get_len(select_node->select_list));
}
UT_LIST_INIT(select_node->copy_variables);
pars_resolve_exp_list_columns(table_list, select_node->select_list);
pars_resolve_exp_list_variables_and_types(select_node,
- select_node->select_list);
+ select_node->select_list);
pars_check_aggregate(select_node);
select_node->search_cond = search_cond;
@@ -806,7 +805,7 @@ pars_function_declaration(
/* Check that the function exists. */
ut_a(pars_info_get_user_func(pars_sym_tab_global->info,
- sym_node->name));
+ sym_node->name));
return(sym_node);
}
@@ -849,7 +848,7 @@ pars_column_assignment(
col_assign_node_t* node;
node = mem_heap_alloc(pars_sym_tab_global->heap,
- sizeof(col_assign_node_t));
+ sizeof(col_assign_node_t));
node->common.type = QUE_NODE_COL_ASSIGNMENT;
node->col = column;
@@ -888,17 +887,18 @@ pars_process_assign_list(
pars_resolve_exp_columns(table_sym, assign_node->col);
pars_resolve_exp_columns(table_sym, assign_node->val);
pars_resolve_exp_variables_and_types(NULL, assign_node->val);
-
- /* ut_a(dtype_get_mtype(dfield_get_type(
- que_node_get_val(assign_node->col)))
- == dtype_get_mtype(dfield_get_type(
- que_node_get_val(assign_node->val)))); */
+#if 0
+ ut_a(dtype_get_mtype
+ (dfield_get_type(que_node_get_val(assign_node->col)))
+ == dtype_get_mtype
+ (dfield_get_type(que_node_get_val(assign_node->val))));
+#endif
/* Add to the update node all the columns found in assignment
values as columns to copy: therefore, TRUE */
opt_find_all_cols(TRUE, clust_index, &(node->columns), NULL,
- assign_node->val);
+ assign_node->val);
n_assigns++;
assign_node = que_node_get_next(assign_node);
@@ -915,15 +915,13 @@ pars_process_assign_list(
col_sym = assign_node->col;
- upd_field_set_field_no(upd_field,
- dict_index_get_nth_col_pos(clust_index,
- col_sym->col_no),
- clust_index, NULL);
+ upd_field_set_field_no(upd_field, dict_index_get_nth_col_pos
+ (clust_index, col_sym->col_no),
+ clust_index, NULL);
upd_field->exp = assign_node->val;
- if (!dtype_is_fixed_size(
- dict_index_get_nth_type(clust_index,
- upd_field->field_no))) {
+ if (!dtype_is_fixed_size(dict_index_get_nth_type
+ (clust_index, upd_field->field_no))) {
changes_field_size = 0;
}
@@ -980,7 +978,7 @@ pars_update_statement(
sel_node = pars_select_list(NULL, NULL);
pars_select_statement(sel_node, table_sym, search_cond, NULL,
- &pars_share_token, NULL);
+ &pars_share_token, NULL);
node->searched_update = TRUE;
sel_node->common.parent = node;
}
@@ -1027,8 +1025,8 @@ pars_update_statement(
}
if (!node->is_delete && node->searched_update
- && (node->cmpl_info & UPD_NODE_NO_SIZE_CHANGE)
- && (node->cmpl_info & UPD_NODE_NO_ORD_CHANGE)) {
+ && (node->cmpl_info & UPD_NODE_NO_SIZE_CHANGE)
+ && (node->cmpl_info & UPD_NODE_NO_ORD_CHANGE)) {
/* The select node can perform the update in-place */
@@ -1070,10 +1068,10 @@ pars_insert_statement(
pars_retrieve_table_def(table_sym);
node = ins_node_create(ins_type, table_sym->table,
- pars_sym_tab_global->heap);
+ pars_sym_tab_global->heap);
row = dtuple_create(pars_sym_tab_global->heap,
- dict_table_get_n_cols(node->table));
+ dict_table_get_n_cols(node->table));
dict_table_copy_types(row, table_sym->table);
@@ -1085,7 +1083,7 @@ pars_insert_statement(
select->common.parent = node;
ut_a(que_node_list_get_len(select->select_list)
- == dict_table_get_n_user_cols(table_sym->table));
+ == dict_table_get_n_user_cols(table_sym->table));
}
node->values_list = values_list;
@@ -1094,7 +1092,7 @@ pars_insert_statement(
pars_resolve_exp_list_variables_and_types(NULL, values_list);
ut_a(que_node_list_get_len(values_list)
- == dict_table_get_n_user_cols(table_sym->table));
+ == dict_table_get_n_user_cols(table_sym->table));
}
return(node);
@@ -1134,17 +1132,17 @@ pars_set_dfield_type(
ut_a(len == 0);
dtype_set(dfield_get_type(dfield), DATA_VARCHAR,
- DATA_ENGLISH | flags, 0, 0);
+ DATA_ENGLISH | flags, 0, 0);
} else if (type == &pars_binary_token) {
ut_a(len != 0);
dtype_set(dfield_get_type(dfield), DATA_FIXBINARY,
- DATA_BINARY_TYPE | flags, len, 0);
+ DATA_BINARY_TYPE | flags, len, 0);
} else if (type == &pars_blob_token) {
ut_a(len == 0);
dtype_set(dfield_get_type(dfield), DATA_BLOB,
- DATA_BINARY_TYPE | flags, 0, 0);
+ DATA_BINARY_TYPE | flags, 0, 0);
} else {
ut_error;
}
@@ -1382,7 +1380,7 @@ pars_return_statement(void)
return_node_t* node;
node = mem_heap_alloc(pars_sym_tab_global->heap,
- sizeof(return_node_t));
+ sizeof(return_node_t));
node->common.type = QUE_NODE_RETURN;
return(node);
@@ -1401,7 +1399,7 @@ pars_assignment_statement(
assign_node_t* node;
node = mem_heap_alloc(pars_sym_tab_global->heap,
- sizeof(assign_node_t));
+ sizeof(assign_node_t));
node->common.type = QUE_NODE_ASSIGNMENT;
node->var = var;
@@ -1411,7 +1409,7 @@ pars_assignment_statement(
pars_resolve_exp_variables_and_types(NULL, val);
ut_a(dtype_get_mtype(dfield_get_type(que_node_get_val(var)))
- == dtype_get_mtype(dfield_get_type(que_node_get_val(val))));
+ == dtype_get_mtype(dfield_get_type(que_node_get_val(val))));
return(node);
}
@@ -1467,7 +1465,7 @@ pars_fetch_statement(
pars_resolve_exp_variables_and_types(NULL, user_func);
node->func = pars_info_get_user_func(pars_sym_tab_global->info,
- user_func->name);
+ user_func->name);
ut_a(node->func);
node->into_list = NULL;
@@ -1481,8 +1479,7 @@ pars_fetch_statement(
if (into_list) {
ut_a(que_node_list_get_len(into_list)
- == que_node_list_get_len(
- node->cursor_def->select_list));
+ == que_node_list_get_len(node->cursor_def->select_list));
}
return(node);
@@ -1530,7 +1527,7 @@ pars_row_printf_statement(
row_printf_node_t* node;
node = mem_heap_alloc(pars_sym_tab_global->heap,
- sizeof(row_printf_node_t));
+ sizeof(row_printf_node_t));
node->common.type = QUE_NODE_ROW_PRINTF;
node->sel_node = sel_node;
@@ -1587,7 +1584,7 @@ pars_column_def(
}
pars_set_dfield_type(que_node_get_val(sym_node), type, len2,
- is_unsigned != NULL, is_not_null != NULL);
+ is_unsigned != NULL, is_not_null != NULL);
return(sym_node);
}
@@ -1636,8 +1633,8 @@ pars_create_table(
dtype = dfield_get_type(que_node_get_val(column));
dict_mem_table_add_col(table, column->name, dtype->mtype,
- dtype->prtype, dtype->len,
- dtype->prec);
+ dtype->prtype, dtype->len,
+ dtype->prec);
column->resolved = TRUE;
column->token_type = SYM_COLUMN;
@@ -1686,7 +1683,7 @@ pars_create_index(
}
index = dict_mem_index_create(table_sym->name, index_sym->name, 0,
- ind_type, n_fields);
+ ind_type, n_fields);
column = column_list;
while (column) {
@@ -1787,7 +1784,7 @@ pars_get_lex_chars(
int len;
len = pars_sym_tab_global->string_len
- - pars_sym_tab_global->next_char_pos;
+ - pars_sym_tab_global->next_char_pos;
if (len == 0) {
#ifdef YYDEBUG
/* fputs("SQL string ends\n", stderr); */
@@ -1808,14 +1805,14 @@ pars_get_lex_chars(
len = 5;
}
- fwrite(pars_sym_tab_global->sql_string +
- pars_sym_tab_global->next_char_pos,
- 1, len, stderr);
+ fwrite(pars_sym_tab_global->sql_string
+ + pars_sym_tab_global->next_char_pos,
+ 1, len, stderr);
}
#endif /* UNIV_SQL_DEBUG */
- ut_memcpy(buf, pars_sym_tab_global->sql_string +
- pars_sym_tab_global->next_char_pos, len);
+ ut_memcpy(buf, pars_sym_tab_global->sql_string
+ + pars_sym_tab_global->next_char_pos, len);
*result = len;
pars_sym_tab_global->next_char_pos += len;
@@ -1862,8 +1859,8 @@ pars_sql(
pars_sym_tab_global = sym_tab_create(heap);
pars_sym_tab_global->string_len = strlen(str);
- pars_sym_tab_global->sql_string = mem_heap_dup(heap, str,
- pars_sym_tab_global->string_len + 1);
+ pars_sym_tab_global->sql_string = mem_heap_dup
+ (heap, str, pars_sym_tab_global->string_len + 1);
pars_sym_tab_global->next_char_pos = 0;
pars_sym_tab_global->info = info;
@@ -1998,7 +1995,7 @@ pars_info_add_str_literal(
const char* str) /* in: string */
{
pars_info_add_literal(info, name, str, strlen(str),
- DATA_VARCHAR, DATA_ENGLISH);
+ DATA_VARCHAR, DATA_ENGLISH);
}
/********************************************************************
diff --git a/storage/innobase/que/que0que.c b/storage/innobase/que/que0que.c
index 74f331c29f2..b2663e30879 100644
--- a/storage/innobase/que/que0que.c
+++ b/storage/innobase/que/que0que.c
@@ -209,7 +209,7 @@ que_thr_create(
thr->run_node = NULL;
thr->resource = 0;
- thr->lock_state = QUE_THR_LOCK_NOLOCK;
+ thr->lock_state = QUE_THR_LOCK_NOLOCK;
UT_LIST_ADD_LAST(thrs, parent->thrs, thr);
@@ -243,8 +243,8 @@ que_thr_end_wait(
#endif /* UNIV_SYNC_DEBUG */
ut_ad(thr);
ut_ad((thr->state == QUE_THR_LOCK_WAIT)
- || (thr->state == QUE_THR_PROCEDURE_WAIT)
- || (thr->state == QUE_THR_SIG_REPLY_WAIT));
+ || (thr->state == QUE_THR_PROCEDURE_WAIT)
+ || (thr->state == QUE_THR_SIG_REPLY_WAIT));
ut_ad(thr->run_node);
thr->prev_node = thr->run_node;
@@ -285,8 +285,8 @@ que_thr_end_wait_no_next_thr(
#endif /* UNIV_SYNC_DEBUG */
ut_ad(thr);
ut_ad((thr->state == QUE_THR_LOCK_WAIT)
- || (thr->state == QUE_THR_PROCEDURE_WAIT)
- || (thr->state == QUE_THR_SIG_REPLY_WAIT));
+ || (thr->state == QUE_THR_PROCEDURE_WAIT)
+ || (thr->state == QUE_THR_SIG_REPLY_WAIT));
was_active = thr->is_active;
@@ -345,7 +345,8 @@ que_fork_start_command(
there may be several to choose from */
/*---------------------------------------------------------------
- First we try to find a query thread in the QUE_THR_COMMAND_WAIT state */
+ First we try to find a query thread in the QUE_THR_COMMAND_WAIT state
+ */
thr = UT_LIST_GET_FIRST(fork->thrs);
@@ -531,7 +532,8 @@ que_graph_free_recursive(
if (thr->magic_n != QUE_THR_MAGIC_N) {
fprintf(stderr,
- "que_thr struct appears corrupt; magic n %lu\n",
+ "que_thr struct appears corrupt;"
+ " magic n %lu\n",
(unsigned long) thr->magic_n);
mem_analyze_corruption(thr);
ut_error;
@@ -644,7 +646,7 @@ que_graph_free_recursive(
break;
default:
fprintf(stderr,
- "que_node struct appears corrupt; type %lu\n",
+ "que_node struct appears corrupt; type %lu\n",
(unsigned long) que_node_get_type(node));
mem_analyze_corruption(node);
ut_error;
@@ -702,7 +704,7 @@ que_graph_try_free(
sess = (graph->trx)->sess;
if ((graph->state == QUE_FORK_BEING_FREED)
- && (graph->n_active_thrs == 0)) {
+ && (graph->n_active_thrs == 0)) {
UT_LIST_REMOVE(graphs, sess->graphs, graph);
que_graph_free(graph);
@@ -831,7 +833,7 @@ que_thr_dec_refer_count(
running the thread */
/* fputs("!!!!!!!! Wait already ended: continue thr\n",
- stderr); */
+ stderr); */
if (next_thr && *next_thr == NULL) {
/* Normally srv_suspend_mysql_thread resets
@@ -944,13 +946,13 @@ que_thr_stop(
thr->state = QUE_THR_LOCK_WAIT;
} else if (trx->error_state != DB_SUCCESS
- && trx->error_state != DB_LOCK_WAIT) {
+ && trx->error_state != DB_LOCK_WAIT) {
/* Error handling built for the MySQL interface */
thr->state = QUE_THR_COMPLETED;
} else if (UT_LIST_GET_LEN(trx->signals) > 0
- && graph->fork_type != QUE_FORK_ROLLBACK) {
+ && graph->fork_type != QUE_FORK_ROLLBACK) {
thr->state = QUE_THR_SUSPENDED;
} else {
@@ -982,7 +984,7 @@ que_thr_stop_for_mysql(
if (thr->state == QUE_THR_RUNNING) {
if (trx->error_state != DB_SUCCESS
- && trx->error_state != DB_LOCK_WAIT) {
+ && trx->error_state != DB_LOCK_WAIT) {
/* Error handling built for the MySQL interface */
thr->state = QUE_THR_COMPLETED;
@@ -1022,7 +1024,7 @@ que_thr_move_to_run_state_for_mysql(
{
if (thr->magic_n != QUE_THR_MAGIC_N) {
fprintf(stderr,
- "que_thr struct appears corrupt; magic n %lu\n",
+ "que_thr struct appears corrupt; magic n %lu\n",
(unsigned long) thr->magic_n);
mem_analyze_corruption(thr);
@@ -1059,7 +1061,7 @@ que_thr_stop_for_mysql_no_error(
if (thr->magic_n != QUE_THR_MAGIC_N) {
fprintf(stderr,
- "que_thr struct appears corrupt; magic n %lu\n",
+ "que_thr struct appears corrupt; magic n %lu\n",
(unsigned long) thr->magic_n);
mem_analyze_corruption(thr);
@@ -1165,7 +1167,8 @@ que_node_print_info(
str = "UNKNOWN NODE TYPE";
}
- fprintf(stderr, "Node type %lu: %s, address %p\n", (ulong) type, str, node);
+ fprintf(stderr, "Node type %lu: %s, address %p\n",
+ (ulong) type, str, (void*) node);
}
/**************************************************************************
@@ -1204,7 +1207,7 @@ que_thr_step(
#endif
if (type & QUE_NODE_CONTROL_STAT) {
if ((thr->prev_node != que_node_get_parent(node))
- && que_node_get_next(thr->prev_node)) {
+ && que_node_get_next(thr->prev_node)) {
/* The control statements, like WHILE, always pass the
control to the next child statement if there is any
@@ -1224,7 +1227,7 @@ que_thr_step(
if (thr->prev_node == que_node_get_parent(node)) {
trx->last_sql_stat_start.least_undo_no
- = trx->undo_no;
+ = trx->undo_no;
}
proc_step(thr);
@@ -1251,9 +1254,9 @@ que_thr_step(
} else if (type == QUE_NODE_LOCK) {
ut_error;
-/*
+ /*
thr = que_lock_step(thr);
-*/
+ */
} else if (type == QUE_NODE_THR) {
thr = que_thr_node_step(thr);
} else if (type == QUE_NODE_COMMIT) {
diff --git a/storage/innobase/read/read0read.c b/storage/innobase/read/read0read.c
index 1d6809ae5b7..4b9a116c3c1 100644
--- a/storage/innobase/read/read0read.c
+++ b/storage/innobase/read/read0read.c
@@ -175,7 +175,7 @@ read_view_oldest_copy_or_open_new(
n = old_view->n_trx_ids;
if (ut_dulint_cmp(old_view->creator_trx_id,
- ut_dulint_create(0,0)) != 0) {
+ ut_dulint_create(0,0)) != 0) {
n++;
} else {
needs_insert = FALSE;
@@ -189,19 +189,19 @@ read_view_oldest_copy_or_open_new(
i = 0;
while (i < n) {
if (needs_insert
- && (i >= old_view->n_trx_ids
- || ut_dulint_cmp(old_view->creator_trx_id,
- read_view_get_nth_trx_id(old_view, i))
- > 0)) {
+ && (i >= old_view->n_trx_ids
+ || ut_dulint_cmp(old_view->creator_trx_id,
+ read_view_get_nth_trx_id(old_view, i))
+ > 0)) {
read_view_set_nth_trx_id(view_copy, i,
- old_view->creator_trx_id);
+ old_view->creator_trx_id);
needs_insert = FALSE;
insert_done = 1;
} else {
read_view_set_nth_trx_id(view_copy, i,
- read_view_get_nth_trx_id(old_view,
- i - insert_done));
+ read_view_get_nth_trx_id
+ (old_view, i - insert_done));
}
i++;
@@ -216,8 +216,8 @@ read_view_oldest_copy_or_open_new(
if (n > 0) {
/* The last active transaction has the smallest id: */
- view_copy->up_limit_id = read_view_get_nth_trx_id(
- view_copy, n - 1);
+ view_copy->up_limit_id = read_view_get_nth_trx_id
+ (view_copy, n - 1);
} else {
view_copy->up_limit_id = old_view->up_limit_id;
}
@@ -267,8 +267,8 @@ read_view_open_now(
while (trx) {
if (ut_dulint_cmp(trx->id, cr_trx_id) != 0
- && (trx->conc_state == TRX_ACTIVE
- || trx->conc_state == TRX_PREPARED)) {
+ && (trx->conc_state == TRX_ACTIVE
+ || trx->conc_state == TRX_PREPARED)) {
read_view_set_nth_trx_id(view, n, trx->id);
@@ -362,16 +362,16 @@ read_view_print(
}
fprintf(stderr, "Read view low limit trx n:o %lu %lu\n",
- (ulong) ut_dulint_get_high(view->low_limit_no),
- (ulong) ut_dulint_get_low(view->low_limit_no));
+ (ulong) ut_dulint_get_high(view->low_limit_no),
+ (ulong) ut_dulint_get_low(view->low_limit_no));
fprintf(stderr, "Read view up limit trx id %lu %lu\n",
- (ulong) ut_dulint_get_high(view->up_limit_id),
- (ulong) ut_dulint_get_low(view->up_limit_id));
+ (ulong) ut_dulint_get_high(view->up_limit_id),
+ (ulong) ut_dulint_get_low(view->up_limit_id));
fprintf(stderr, "Read view low limit trx id %lu %lu\n",
- (ulong) ut_dulint_get_high(view->low_limit_id),
- (ulong) ut_dulint_get_low(view->low_limit_id));
+ (ulong) ut_dulint_get_high(view->low_limit_id),
+ (ulong) ut_dulint_get_low(view->low_limit_id));
fprintf(stderr, "Read view individually stored trx ids:\n");
@@ -379,8 +379,10 @@ read_view_print(
for (i = 0; i < n_ids; i++) {
fprintf(stderr, "Read view trx id %lu %lu\n",
- (ulong) ut_dulint_get_high(read_view_get_nth_trx_id(view, i)),
- (ulong) ut_dulint_get_low(read_view_get_nth_trx_id(view, i)));
+ (ulong) ut_dulint_get_high
+ (read_view_get_nth_trx_id(view, i)),
+ (ulong) ut_dulint_get_low
+ (read_view_get_nth_trx_id(view, i)));
}
}
@@ -412,15 +414,14 @@ read_cursor_view_create_for_mysql(
curview->heap = heap;
/* Drop cursor tables from consideration when evaluating the need of
- auto-commit */
+ auto-commit */
curview->n_mysql_tables_in_use = cr_trx->n_mysql_tables_in_use;
cr_trx->n_mysql_tables_in_use = 0;
mutex_enter(&kernel_mutex);
- curview->read_view = read_view_create_low(
- UT_LIST_GET_LEN(trx_sys->trx_list),
- curview->heap);
+ curview->read_view = read_view_create_low
+ (UT_LIST_GET_LEN(trx_sys->trx_list), curview->heap);
view = curview->read_view;
view->creator_trx_id = cr_trx->id;
@@ -442,7 +443,7 @@ read_cursor_view_create_for_mysql(
while (trx) {
if (trx->conc_state == TRX_ACTIVE
- || trx->conc_state == TRX_PREPARED) {
+ || trx->conc_state == TRX_PREPARED) {
read_view_set_nth_trx_id(view, n, trx->id);
@@ -494,7 +495,7 @@ read_cursor_view_close_for_mysql(
ut_a(curview->heap);
/* Add cursor's tables to the global count of active tables that
- belong to this transaction */
+ belong to this transaction */
trx->n_mysql_tables_in_use += curview->n_mysql_tables_in_use;
mutex_enter(&kernel_mutex);
diff --git a/storage/innobase/rem/rem0cmp.c b/storage/innobase/rem/rem0cmp.c
index 6c29ef58ea1..57a028352fc 100644
--- a/storage/innobase/rem/rem0cmp.c
+++ b/storage/innobase/rem/rem0cmp.c
@@ -104,21 +104,21 @@ cmp_types_are_equal(
ibool check_charsets) /* in: whether to check charsets */
{
if (dtype_is_non_binary_string_type(type1->mtype, type1->prtype)
- && dtype_is_non_binary_string_type(type2->mtype, type2->prtype)) {
+ && dtype_is_non_binary_string_type(type2->mtype, type2->prtype)) {
/* Both are non-binary string types: they can be compared if
and only if the charset-collation is the same */
if (check_charsets) {
return(dtype_get_charset_coll(type1->prtype)
- == dtype_get_charset_coll(type2->prtype));
+ == dtype_get_charset_coll(type2->prtype));
} else {
return(TRUE);
}
}
if (dtype_is_binary_string_type(type1->mtype, type1->prtype)
- && dtype_is_binary_string_type(type2->mtype, type2->prtype)) {
+ && dtype_is_binary_string_type(type2->mtype, type2->prtype)) {
/* Both are binary string types: they can be compared */
@@ -131,8 +131,8 @@ cmp_types_are_equal(
}
if (type1->mtype == DATA_INT
- && (type1->prtype & DATA_UNSIGNED)
- != (type2->prtype & DATA_UNSIGNED)) {
+ && (type1->prtype & DATA_UNSIGNED)
+ != (type2->prtype & DATA_UNSIGNED)) {
/* The storage format of an unsigned integer is different
from a signed integer: in a signed integer we OR
@@ -257,18 +257,19 @@ cmp_whole_field(
case DATA_MYSQL:
case DATA_BLOB:
if (data_type == DATA_BLOB
- && 0 != (type->prtype & DATA_BINARY_TYPE)) {
+ && 0 != (type->prtype & DATA_BINARY_TYPE)) {
ut_print_timestamp(stderr);
fprintf(stderr,
-" InnoDB: Error: comparing a binary BLOB with a character set sensitive\n"
-"InnoDB: comparison!\n");
+ " InnoDB: Error: comparing a binary BLOB"
+ " with a character set sensitive\n"
+ "InnoDB: comparison!\n");
}
- return(innobase_mysql_cmp(
- (int)(type->prtype & DATA_MYSQL_TYPE_MASK),
- (uint)dtype_get_charset_coll(type->prtype),
- a, a_length, b, b_length));
+ return(innobase_mysql_cmp
+ ((int)(type->prtype & DATA_MYSQL_TYPE_MASK),
+ (uint)dtype_get_charset_coll(type->prtype),
+ a, a_length, b, b_length));
default:
fprintf(stderr,
"InnoDB: unknown type number %lu\n",
@@ -322,14 +323,14 @@ cmp_data_data_slow(
}
if (cur_type->mtype >= DATA_FLOAT
- || (cur_type->mtype == DATA_BLOB
- && 0 == (cur_type->prtype & DATA_BINARY_TYPE)
- && dtype_get_charset_coll(cur_type->prtype) !=
- DATA_MYSQL_LATIN1_SWEDISH_CHARSET_COLL)) {
+ || (cur_type->mtype == DATA_BLOB
+ && 0 == (cur_type->prtype & DATA_BINARY_TYPE)
+ && dtype_get_charset_coll(cur_type->prtype)
+ != DATA_MYSQL_LATIN1_SWEDISH_CHARSET_COLL)) {
return(cmp_whole_field(cur_type,
- data1, (unsigned) len1,
- data2, (unsigned) len2));
+ data1, (unsigned) len1,
+ data2, (unsigned) len2));
}
/* Compare then the fields */
@@ -372,8 +373,8 @@ cmp_data_data_slow(
}
if (cur_type->mtype <= DATA_CHAR
- || (cur_type->mtype == DATA_BLOB
- && 0 == (cur_type->prtype & DATA_BINARY_TYPE))) {
+ || (cur_type->mtype == DATA_BLOB
+ && 0 == (cur_type->prtype & DATA_BINARY_TYPE))) {
data1_byte = cmp_collate(data1_byte);
data2_byte = cmp_collate(data2_byte);
@@ -381,12 +382,12 @@ cmp_data_data_slow(
if (data1_byte > data2_byte) {
- return(1);
+ return(1);
} else if (data1_byte < data2_byte) {
- return(-1);
+ return(-1);
}
- next_byte:
+next_byte:
/* Next byte */
cur_bytes++;
data1++;
@@ -465,7 +466,7 @@ cmp_dtuple_rec_with_match(
if (cur_bytes == 0 && cur_field == 0) {
ulint rec_info = rec_get_info_bits(rec,
- rec_offs_comp(offsets));
+ rec_offs_comp(offsets));
ulint tup_info = dtuple_get_info_bits(dtuple);
if (rec_info & REC_INFO_MIN_REC_FLAG) {
@@ -488,7 +489,7 @@ cmp_dtuple_rec_with_match(
dtuple_f_len = dfield_get_len(dtuple_field);
rec_b_ptr = rec_get_nth_field(rec, offsets,
- cur_field, &rec_f_len);
+ cur_field, &rec_f_len);
/* If we have matched yet 0 bytes, it may be that one or
both the fields are SQL null, or the record or dtuple may be
@@ -524,16 +525,15 @@ cmp_dtuple_rec_with_match(
}
if (cur_type->mtype >= DATA_FLOAT
- || (cur_type->mtype == DATA_BLOB
- && 0 == (cur_type->prtype & DATA_BINARY_TYPE)
- && dtype_get_charset_coll(cur_type->prtype) !=
- DATA_MYSQL_LATIN1_SWEDISH_CHARSET_COLL)) {
+ || (cur_type->mtype == DATA_BLOB
+ && 0 == (cur_type->prtype & DATA_BINARY_TYPE)
+ && dtype_get_charset_coll(cur_type->prtype)
+ != DATA_MYSQL_LATIN1_SWEDISH_CHARSET_COLL)) {
- ret = cmp_whole_field(
- cur_type,
- dfield_get_data(dtuple_field),
- (unsigned) dtuple_f_len,
- rec_b_ptr, (unsigned) rec_f_len);
+ ret = cmp_whole_field(cur_type,
+ dfield_get_data(dtuple_field),
+ (unsigned) dtuple_f_len,
+ rec_b_ptr, (unsigned) rec_f_len);
if (ret != 0) {
cur_bytes = 0;
@@ -548,7 +548,7 @@ cmp_dtuple_rec_with_match(
rec_b_ptr = rec_b_ptr + cur_bytes;
dtuple_b_ptr = (byte*)dfield_get_data(dtuple_field)
- + cur_bytes;
+ + cur_bytes;
/* Compare then the fields */
for (;;) {
@@ -590,9 +590,8 @@ cmp_dtuple_rec_with_match(
}
if (cur_type->mtype <= DATA_CHAR
- || (cur_type->mtype == DATA_BLOB
- && 0 ==
- (cur_type->prtype & DATA_BINARY_TYPE))) {
+ || (cur_type->mtype == DATA_BLOB
+ && !(cur_type->prtype & DATA_BINARY_TYPE))) {
rec_byte = cmp_collate(rec_byte);
dtuple_byte = cmp_collate(dtuple_byte);
@@ -608,14 +607,14 @@ cmp_dtuple_rec_with_match(
goto order_resolved;
}
}
- next_byte:
+next_byte:
/* Next byte */
cur_bytes++;
rec_b_ptr++;
dtuple_b_ptr++;
}
- next_field:
+next_field:
cur_field++;
cur_bytes = 0;
}
@@ -627,10 +626,10 @@ cmp_dtuple_rec_with_match(
order_resolved:
ut_ad((ret >= - 1) && (ret <= 1));
ut_ad(ret == cmp_debug_dtuple_rec_with_match(dtuple, rec, offsets,
- matched_fields));
+ matched_fields));
ut_ad(*matched_fields == cur_field); /* In the debug version, the
- above cmp_debug_... sets
- *matched_fields to a value */
+ above cmp_debug_... sets
+ *matched_fields to a value */
*matched_fields = cur_field;
*matched_bytes = cur_bytes;
@@ -662,7 +661,7 @@ cmp_dtuple_rec(
ut_ad(rec_offs_validate(rec, NULL, offsets));
return(cmp_dtuple_rec_with_match(dtuple, rec, offsets,
- &matched_fields, &matched_bytes));
+ &matched_fields, &matched_bytes));
}
/******************************************************************
@@ -690,15 +689,15 @@ cmp_dtuple_is_prefix_of_rec(
}
cmp_dtuple_rec_with_match(dtuple, rec, offsets,
- &matched_fields, &matched_bytes);
+ &matched_fields, &matched_bytes);
if (matched_fields == n_fields) {
return(TRUE);
}
if (matched_fields == n_fields - 1
- && matched_bytes == dfield_get_len(
- dtuple_get_nth_field(dtuple, n_fields - 1))) {
+ && matched_bytes == dfield_get_len
+ (dtuple_get_nth_field(dtuple, n_fields - 1))) {
return(TRUE);
}
@@ -768,25 +767,25 @@ cmp_rec_rec_with_match(
if (index->type & DICT_UNIVERSAL) {
cur_type = dtype_binary;
} else {
- cur_type = dict_col_get_type(
- dict_field_get_col(
- dict_index_get_nth_field(index, cur_field)));
+ cur_type = dict_col_get_type
+ (dict_field_get_col(dict_index_get_nth_field
+ (index, cur_field)));
}
rec1_b_ptr = rec_get_nth_field(rec1, offsets1,
- cur_field, &rec1_f_len);
+ cur_field, &rec1_f_len);
rec2_b_ptr = rec_get_nth_field(rec2, offsets2,
- cur_field, &rec2_f_len);
+ cur_field, &rec2_f_len);
if (cur_bytes == 0) {
if (cur_field == 0) {
/* Test if rec is the predefined minimum
record */
if (rec_get_info_bits(rec1, comp)
- & REC_INFO_MIN_REC_FLAG) {
+ & REC_INFO_MIN_REC_FLAG) {
if (rec_get_info_bits(rec2, comp)
- & REC_INFO_MIN_REC_FLAG) {
+ & REC_INFO_MIN_REC_FLAG) {
ret = 0;
} else {
ret = -1;
@@ -804,7 +803,7 @@ cmp_rec_rec_with_match(
}
if (rec_offs_nth_extern(offsets1, cur_field)
- || rec_offs_nth_extern(offsets2, cur_field)) {
+ || rec_offs_nth_extern(offsets2, cur_field)) {
/* We do not compare to an externally
stored field */
@@ -814,7 +813,7 @@ cmp_rec_rec_with_match(
}
if (rec1_f_len == UNIV_SQL_NULL
- || rec2_f_len == UNIV_SQL_NULL) {
+ || rec2_f_len == UNIV_SQL_NULL) {
if (rec1_f_len == rec2_f_len) {
@@ -836,14 +835,16 @@ cmp_rec_rec_with_match(
}
if (cur_type->mtype >= DATA_FLOAT
- || (cur_type->mtype == DATA_BLOB
- && 0 == (cur_type->prtype & DATA_BINARY_TYPE)
- && dtype_get_charset_coll(cur_type->prtype) !=
- DATA_MYSQL_LATIN1_SWEDISH_CHARSET_COLL)) {
+ || (cur_type->mtype == DATA_BLOB
+ && 0 == (cur_type->prtype & DATA_BINARY_TYPE)
+ && dtype_get_charset_coll(cur_type->prtype)
+ != DATA_MYSQL_LATIN1_SWEDISH_CHARSET_COLL)) {
ret = cmp_whole_field(cur_type,
- rec1_b_ptr, (unsigned) rec1_f_len,
- rec2_b_ptr, (unsigned) rec2_f_len);
+ rec1_b_ptr,
+ (unsigned) rec1_f_len,
+ rec2_b_ptr,
+ (unsigned) rec2_f_len);
if (ret != 0) {
cur_bytes = 0;
@@ -898,9 +899,8 @@ cmp_rec_rec_with_match(
}
if (cur_type->mtype <= DATA_CHAR
- || (cur_type->mtype == DATA_BLOB
- && 0 ==
- (cur_type->prtype & DATA_BINARY_TYPE))) {
+ || (cur_type->mtype == DATA_BLOB
+ && !(cur_type->prtype & DATA_BINARY_TYPE))) {
rec1_byte = cmp_collate(rec1_byte);
rec2_byte = cmp_collate(rec2_byte);
@@ -913,7 +913,7 @@ cmp_rec_rec_with_match(
ret = 1;
goto order_resolved;
}
- next_byte:
+next_byte:
/* Next byte */
cur_bytes++;
@@ -921,7 +921,7 @@ cmp_rec_rec_with_match(
rec2_b_ptr++;
}
- next_field:
+next_field:
cur_field++;
cur_bytes = 0;
}
@@ -995,7 +995,7 @@ cmp_debug_dtuple_rec_with_match(
if (cur_field == 0) {
if (rec_get_info_bits(rec, rec_offs_comp(offsets))
- & REC_INFO_MIN_REC_FLAG) {
+ & REC_INFO_MIN_REC_FLAG) {
ret = !(dtuple_get_info_bits(dtuple)
& REC_INFO_MIN_REC_FLAG);
@@ -1022,7 +1022,7 @@ cmp_debug_dtuple_rec_with_match(
dtuple_f_len = dfield_get_len(dtuple_field);
rec_f_data = rec_get_nth_field(rec, offsets,
- cur_field, &rec_f_len);
+ cur_field, &rec_f_len);
if (rec_offs_nth_extern(offsets, cur_field)) {
/* We do not compare to an externally stored field */
@@ -1033,7 +1033,7 @@ cmp_debug_dtuple_rec_with_match(
}
ret = cmp_data_data(cur_type, dtuple_f_data, dtuple_f_len,
- rec_f_data, rec_f_len);
+ rec_f_data, rec_f_len);
if (ret != 0) {
goto order_resolved;
}
diff --git a/storage/innobase/rem/rem0rec.c b/storage/innobase/rem/rem0rec.c
index f7ee53aeda2..c57a19f0230 100644
--- a/storage/innobase/rem/rem0rec.c
+++ b/storage/innobase/rem/rem0rec.c
@@ -176,13 +176,13 @@ rec_init_offsets(
case REC_STATUS_INFIMUM:
case REC_STATUS_SUPREMUM:
/* the field is 8 bytes long */
- rec_offs_base(offsets)[0] =
- REC_N_NEW_EXTRA_BYTES | REC_OFFS_COMPACT;
+ rec_offs_base(offsets)[0]
+ = REC_N_NEW_EXTRA_BYTES | REC_OFFS_COMPACT;
rec_offs_base(offsets)[1] = 8;
return;
case REC_STATUS_NODE_PTR:
- n_node_ptr_field =
- dict_index_get_n_unique_in_tree(index);
+ n_node_ptr_field
+ = dict_index_get_n_unique_in_tree(index);
break;
case REC_STATUS_ORDINARY:
break;
@@ -202,9 +202,9 @@ rec_init_offsets(
}
field = dict_index_get_nth_field(index, i);
- if (!(dtype_get_prtype(dict_col_get_type(
- dict_field_get_col(field)))
- & DATA_NOT_NULL)) {
+ if (!(dtype_get_prtype(dict_col_get_type
+ (dict_field_get_col(field)))
+ & DATA_NOT_NULL)) {
/* nullable field => read the null flag */
if (UNIV_UNLIKELY(!(byte) null_mask)) {
@@ -226,12 +226,12 @@ rec_init_offsets(
if (UNIV_UNLIKELY(!field->fixed_len)) {
/* Variable-length field: read the length */
- dtype_t* type = dict_col_get_type(
- dict_field_get_col(field));
+ dtype_t* type = dict_col_get_type
+ (dict_field_get_col(field));
len = *lens--;
if (UNIV_UNLIKELY(dtype_get_len(type) > 255)
- || UNIV_UNLIKELY(dtype_get_mtype(type)
- == DATA_BLOB)) {
+ || UNIV_UNLIKELY(dtype_get_mtype(type)
+ == DATA_BLOB)) {
if (len & 0x80) {
/* 1exxxxxxx xxxxxxxx */
len <<= 8;
@@ -239,9 +239,9 @@ rec_init_offsets(
offs += len & 0x3fff;
if (UNIV_UNLIKELY(len
- & 0x4000)) {
+ & 0x4000)) {
len = offs
- | REC_OFFS_EXTERNAL;
+ | REC_OFFS_EXTERNAL;
} else {
len = offs;
}
@@ -254,12 +254,12 @@ rec_init_offsets(
} else {
len = offs += field->fixed_len;
}
- resolved:
+resolved:
rec_offs_base(offsets)[i + 1] = len;
} while (++i < rec_offs_n_fields(offsets));
- *rec_offs_base(offsets) =
- (rec - (lens + 1)) | REC_OFFS_COMPACT;
+ *rec_offs_base(offsets)
+ = (rec - (lens + 1)) | REC_OFFS_COMPACT;
} else {
/* Old-style record: determine extra size and end offsets */
offs = REC_N_OLD_EXTRA_BYTES;
@@ -323,7 +323,7 @@ rec_get_offsets_func(
if (dict_table_is_comp(index->table)) {
switch (UNIV_EXPECT(rec_get_status(rec),
- REC_STATUS_ORDINARY)) {
+ REC_STATUS_ORDINARY)) {
case REC_STATUS_ORDINARY:
n = dict_index_get_n_fields(index);
break;
@@ -349,11 +349,12 @@ rec_get_offsets_func(
size = n + (1 + REC_OFFS_HEADER_SIZE);
- if (UNIV_UNLIKELY(!offsets) ||
- UNIV_UNLIKELY(rec_offs_get_n_alloc(offsets) < size)) {
+ if (UNIV_UNLIKELY(!offsets)
+ || UNIV_UNLIKELY(rec_offs_get_n_alloc(offsets) < size)) {
if (!*heap) {
*heap = mem_heap_create_func(size * sizeof(ulint),
- NULL, MEM_HEAP_DYNAMIC, file, line);
+ NULL, MEM_HEAP_DYNAMIC,
+ file, line);
}
offsets = mem_heap_alloc(*heap, size * sizeof(ulint));
rec_offs_set_n_alloc(offsets, size);
@@ -385,7 +386,7 @@ rec_get_nth_field_old(
if (n > REC_MAX_N_FIELDS) {
fprintf(stderr, "Error: trying to access field %lu in rec\n",
- (ulong) n);
+ (ulong) n);
ut_error;
}
@@ -418,7 +419,7 @@ rec_get_nth_field_old(
}
next_os = next_os & ~(REC_2BYTE_SQL_NULL_MASK
- | REC_2BYTE_EXTERN_MASK);
+ | REC_2BYTE_EXTERN_MASK);
}
*len = next_os - os;
@@ -440,7 +441,7 @@ rec_get_converted_size_new(
dtuple_t* dtuple) /* in: data tuple */
{
ulint size = REC_N_NEW_EXTRA_BYTES
- + (index->n_nullable + 7) / 8;
+ + (index->n_nullable + 7) / 8;
dict_field_t* field;
dtype_t* type;
ulint i;
@@ -473,8 +474,8 @@ rec_get_converted_size_new(
ulint len = dtuple_get_nth_field(dtuple, i)->len;
field = dict_index_get_nth_field(index, i);
type = dict_col_get_type(dict_field_get_col(field));
- ut_ad(len != UNIV_SQL_NULL ||
- !(dtype_get_prtype(type) & DATA_NOT_NULL));
+ ut_ad(len != UNIV_SQL_NULL
+ || !(dtype_get_prtype(type) & DATA_NOT_NULL));
if (len == UNIV_SQL_NULL) {
/* No length is stored for NULL fields. */
@@ -482,12 +483,13 @@ rec_get_converted_size_new(
}
ut_ad(len <= dtype_get_len(type)
- || dtype_get_mtype(type) == DATA_BLOB);
+ || dtype_get_mtype(type) == DATA_BLOB);
ut_ad(!field->fixed_len || len == field->fixed_len);
if (field->fixed_len) {
- } else if (len < 128 || (dtype_get_len(type) < 256
- && dtype_get_mtype(type) != DATA_BLOB)) {
+ } else if (len < 128
+ || (dtype_get_len(type) < 256
+ && dtype_get_mtype(type) != DATA_BLOB)) {
size++;
} else {
size += 2;
@@ -564,7 +566,7 @@ rec_set_nth_field_extern_bit_old(
if (mtr) {
mlog_write_ulint(rec - REC_N_OLD_EXTRA_BYTES - 2 * (i + 1),
- info, MLOG_2BYTES, mtr);
+ info, MLOG_2BYTES, mtr);
} else {
rec_2_set_field_end_info(rec, i, info);
}
@@ -628,7 +630,7 @@ rec_set_nth_field_extern_bit_new(
}
lens--;
if (dtype_get_len(type) > 255
- || dtype_get_mtype(type) == DATA_BLOB) {
+ || dtype_get_mtype(type) == DATA_BLOB) {
ulint len = lens[1];
if (len & 0x80) { /* 1exxxxxx: 2-byte length */
if (i == ith) {
@@ -638,8 +640,9 @@ rec_set_nth_field_extern_bit_new(
/* toggle the extern bit */
len ^= 0x40;
if (mtr) {
- mlog_write_ulint(lens + 1, len,
- MLOG_1BYTE, mtr);
+ mlog_write_ulint
+ (lens + 1, len,
+ MLOG_1BYTE, mtr);
} else {
lens[1] = (byte) len;
}
@@ -677,12 +680,12 @@ rec_set_field_extern_bits(
if (dict_table_is_comp(index->table)) {
for (i = 0; i < n_fields; i++) {
rec_set_nth_field_extern_bit_new(rec, index, vec[i],
- TRUE, mtr);
+ TRUE, mtr);
}
} else {
for (i = 0; i < n_fields; i++) {
rec_set_nth_field_extern_bit_old(rec, vec[i],
- TRUE, mtr);
+ TRUE, mtr);
}
}
}
@@ -746,7 +749,7 @@ rec_convert_dtuple_to_rec_old(
/* Set the info bits of the record */
rec_set_info_bits(rec, FALSE,
- dtuple_get_info_bits(dtuple) & REC_INFO_BITS_MASK);
+ dtuple_get_info_bits(dtuple) & REC_INFO_BITS_MASK);
/* Store the data and the offsets */
@@ -764,8 +767,8 @@ rec_convert_dtuple_to_rec_old(
len = dfield_get_len(field);
if (len == UNIV_SQL_NULL) {
- len = dtype_get_sql_null_size(
- dfield_get_type(field));
+ len = dtype_get_sql_null_size
+ (dfield_get_type(field));
data_write_sql_null(rec + end_offset, len);
end_offset += len;
@@ -792,8 +795,8 @@ rec_convert_dtuple_to_rec_old(
len = dfield_get_len(field);
if (len == UNIV_SQL_NULL) {
- len = dtype_get_sql_null_size(
- dfield_get_type(field));
+ len = dtype_get_sql_null_size
+ (dfield_get_type(field));
data_write_sql_null(rec + end_offset, len);
end_offset += len;
@@ -840,7 +843,7 @@ rec_convert_dtuple_to_rec_new(
ulint null_mask = 1;
const ulint n_fields = dtuple_get_n_fields(dtuple);
const ulint status = dtuple_get_info_bits(dtuple)
- & REC_NEW_STATUS_MASK;
+ & REC_NEW_STATUS_MASK;
ut_ad(dict_table_is_comp(index->table));
ut_ad(n_fields > 0);
@@ -898,9 +901,10 @@ rec_convert_dtuple_to_rec_new(
ut_ad(len == fixed_len);
} else {
ut_ad(len <= dtype_get_len(type)
- || dtype_get_mtype(type) == DATA_BLOB);
+ || dtype_get_mtype(type) == DATA_BLOB);
rec++;
- if (len >= 128 && (dtype_get_len(type) >= 256
+ if (len >= 128
+ && (dtype_get_len(type) >= 256
|| dtype_get_mtype(type) == DATA_BLOB)) {
rec++;
}
@@ -918,7 +922,7 @@ init:
rec_set_status(rec, status);
rec_set_info_bits(rec, TRUE,
- dtuple_get_info_bits(dtuple) & REC_INFO_BITS_MASK);
+ dtuple_get_info_bits(dtuple) & REC_INFO_BITS_MASK);
/* Store the data and the offsets */
@@ -961,12 +965,13 @@ init:
ut_ad(len == fixed_len);
} else {
ut_ad(len <= dtype_get_len(type)
- || dtype_get_mtype(type) == DATA_BLOB);
- if (len < 128 || (dtype_get_len(type) < 256
+ || dtype_get_mtype(type) == DATA_BLOB);
+ if (len < 128
+ || (dtype_get_len(type) < 256
&& dtype_get_mtype(type) != DATA_BLOB)) {
+
*lens-- = (byte) len;
- }
- else {
+ } else {
/* the extern bits will be set later */
ut_ad(len < 16384);
*lens-- = (byte) (len >> 8) | 0x80;
@@ -1015,7 +1020,7 @@ rec_convert_dtuple_to_rec(
*offsets_ = (sizeof offsets_) / sizeof *offsets_;
offsets = rec_get_offsets(rec, index,
- offsets_, ULINT_UNDEFINED, &heap);
+ offsets_, ULINT_UNDEFINED, &heap);
ut_ad(rec_validate(rec, offsets));
if (UNIV_LIKELY_NULL(heap)) {
mem_heap_free(heap);
@@ -1052,8 +1057,8 @@ rec_copy_prefix_to_dtuple(
ut_ad(rec_validate(rec, offsets));
ut_ad(dtuple_check_typed(tuple));
- dtuple_set_info_bits(tuple,
- rec_get_info_bits(rec, dict_table_is_comp(index->table)));
+ dtuple_set_info_bits(tuple, rec_get_info_bits
+ (rec, dict_table_is_comp(index->table)));
for (i = 0; i < n_fields; i++) {
@@ -1143,7 +1148,8 @@ rec_copy_prefix_to_buf(
if (!dict_table_is_comp(index->table)) {
ut_ad(rec_validate_old(rec));
- return(rec_copy_prefix_to_buf_old(rec, n_fields,
+ return(rec_copy_prefix_to_buf_old
+ (rec, n_fields,
rec_get_field_start_offs(rec, n_fields),
buf, buf_size));
}
@@ -1196,7 +1202,7 @@ rec_copy_prefix_to_buf(
} else {
ulint len = *lens--;
if (dtype_get_len(type) > 255
- || dtype_get_mtype(type) == DATA_BLOB) {
+ || dtype_get_mtype(type) == DATA_BLOB) {
if (len & 0x80) {
/* 1exxxxxx */
len &= 0x3f;
@@ -1248,7 +1254,7 @@ rec_validate_old(
if ((n_fields == 0) || (n_fields > REC_MAX_N_FIELDS)) {
fprintf(stderr, "InnoDB: Error: record has %lu fields\n",
- (ulong) n_fields);
+ (ulong) n_fields);
return(FALSE);
}
@@ -1257,17 +1263,18 @@ rec_validate_old(
if (!((len < UNIV_PAGE_SIZE) || (len == UNIV_SQL_NULL))) {
fprintf(stderr,
- "InnoDB: Error: record field %lu len %lu\n", (ulong) i,
- (ulong) len);
+ "InnoDB: Error: record field %lu len %lu\n",
+ (ulong) i,
+ (ulong) len);
return(FALSE);
}
if (len != UNIV_SQL_NULL) {
len_sum += len;
sum += *(data + len -1); /* dereference the
- end of the field to
- cause a memory trap
- if possible */
+ end of the field to
+ cause a memory trap
+ if possible */
} else {
len_sum += rec_get_nth_field_size(rec, i);
}
@@ -1275,9 +1282,9 @@ rec_validate_old(
if (len_sum != rec_get_data_size_old(rec)) {
fprintf(stderr,
- "InnoDB: Error: record len should be %lu, len %lu\n",
- (ulong) len_sum,
- rec_get_data_size_old(rec));
+ "InnoDB: Error: record len should be %lu, len %lu\n",
+ (ulong) len_sum,
+ rec_get_data_size_old(rec));
return(FALSE);
}
@@ -1308,7 +1315,7 @@ rec_validate(
if ((n_fields == 0) || (n_fields > REC_MAX_N_FIELDS)) {
fprintf(stderr, "InnoDB: Error: record has %lu fields\n",
- (ulong) n_fields);
+ (ulong) n_fields);
return(FALSE);
}
@@ -1319,17 +1326,18 @@ rec_validate(
if (!((len < UNIV_PAGE_SIZE) || (len == UNIV_SQL_NULL))) {
fprintf(stderr,
- "InnoDB: Error: record field %lu len %lu\n", (ulong) i,
- (ulong) len);
+ "InnoDB: Error: record field %lu len %lu\n",
+ (ulong) i,
+ (ulong) len);
return(FALSE);
}
if (len != UNIV_SQL_NULL) {
len_sum += len;
sum += *(data + len -1); /* dereference the
- end of the field to
- cause a memory trap
- if possible */
+ end of the field to
+ cause a memory trap
+ if possible */
} else if (!rec_offs_comp(offsets)) {
len_sum += rec_get_nth_field_size(rec, i);
}
@@ -1337,9 +1345,9 @@ rec_validate(
if (len_sum != (ulint)(rec_get_end(rec, offsets) - rec)) {
fprintf(stderr,
- "InnoDB: Error: record len should be %lu, len %lu\n",
- (ulong) len_sum,
- (ulong) (rec_get_end(rec, offsets) - rec));
+ "InnoDB: Error: record len should be %lu, len %lu\n",
+ (ulong) len_sum,
+ (ulong) (rec_get_end(rec, offsets) - rec));
return(FALSE);
}
@@ -1477,8 +1485,9 @@ rec_print(
ulint offsets_[REC_OFFS_NORMAL_SIZE];
*offsets_ = (sizeof offsets_) / sizeof *offsets_;
- rec_print_new(file, rec, rec_get_offsets(rec, index, offsets_,
- ULINT_UNDEFINED, &heap));
+ rec_print_new(file, rec,
+ rec_get_offsets(rec, index, offsets_,
+ ULINT_UNDEFINED, &heap));
if (UNIV_LIKELY_NULL(heap)) {
mem_heap_free(heap);
}
diff --git a/storage/innobase/row/row0ins.c b/storage/innobase/row/row0ins.c
index 414f4091403..352519f5d56 100644
--- a/storage/innobase/row/row0ins.c
+++ b/storage/innobase/row/row0ins.c
@@ -120,7 +120,7 @@ ins_node_create_entry_list(
while (index != NULL) {
entry = row_build_index_entry(node->row, index,
- node->entry_sys_heap);
+ node->entry_sys_heap);
UT_LIST_ADD_LAST(tuple_list, node->entry_list, entry);
index = dict_table_get_next_index(index);
@@ -242,7 +242,7 @@ row_ins_sec_index_entry_by_modify(
ut_ad((cursor->index->type & DICT_CLUSTERED) == 0);
ut_ad(rec_get_deleted_flag(rec,
- dict_table_is_comp(cursor->index->table)));
+ dict_table_is_comp(cursor->index->table)));
/* We know that in the alphabetical ordering, entry and rec are
identified. But in their binary form there may be differences if
@@ -251,8 +251,8 @@ row_ins_sec_index_entry_by_modify(
heap = mem_heap_create(1024);
- update = row_upd_build_sec_rec_difference_binary(cursor->index,
- entry, rec, thr_get_trx(thr), heap);
+ update = row_upd_build_sec_rec_difference_binary
+ (cursor->index, entry, rec, thr_get_trx(thr), heap);
if (mode == BTR_MODIFY_LEAF) {
/* Try an optimistic updating of the record, keeping changes
within the page */
@@ -272,7 +272,8 @@ row_ins_sec_index_entry_by_modify(
}
err = btr_cur_pessimistic_update(BTR_KEEP_SYS_FLAG, cursor,
- &dummy_big_rec, update, 0, thr, mtr);
+ &dummy_big_rec, update,
+ 0, thr, mtr);
}
func_exit:
mem_heap_free(heap);
@@ -315,7 +316,7 @@ row_ins_clust_index_entry_by_modify(
rec = btr_cur_get_rec(cursor);
ut_ad(rec_get_deleted_flag(rec,
- dict_table_is_comp(cursor->index->table)));
+ dict_table_is_comp(cursor->index->table)));
heap = mem_heap_create(1024);
@@ -324,13 +325,14 @@ row_ins_clust_index_entry_by_modify(
roll_ptr */
update = row_upd_build_difference_binary(cursor->index, entry, ext_vec,
- n_ext_vec, rec, thr_get_trx(thr), heap);
+ n_ext_vec, rec,
+ thr_get_trx(thr), heap);
if (mode == BTR_MODIFY_LEAF) {
/* Try optimistic updating of the record, keeping changes
within the page */
err = btr_cur_optimistic_update(0, cursor, update, 0, thr,
- mtr);
+ mtr);
if (err == DB_OVERFLOW || err == DB_UNDERFLOW) {
err = DB_FAIL;
}
@@ -343,7 +345,7 @@ row_ins_clust_index_entry_by_modify(
goto func_exit;
}
err = btr_cur_pessimistic_update(0, cursor, big_rec, update,
- 0, thr, mtr);
+ 0, thr, mtr);
}
func_exit:
mem_heap_free(heap);
@@ -468,10 +470,9 @@ row_ins_cascade_calc_update_vec(
for (i = 0; i < foreign->n_fields; i++) {
- parent_field_no = dict_table_get_nth_col_pos(
- parent_table,
- dict_index_get_nth_col_no(
- parent_index, i));
+ parent_field_no = dict_table_get_nth_col_pos
+ (parent_table,
+ dict_index_get_nth_col_no(parent_index, i));
for (j = 0; j < parent_update->n_fields; j++) {
parent_ufield = parent_update->fields + j;
@@ -486,9 +487,10 @@ row_ins_cascade_calc_update_vec(
ufield = update->fields + n_fields_updated;
- ufield->field_no =
- dict_table_get_nth_col_pos(table,
- dict_index_get_nth_col_no(index, i));
+ ufield->field_no
+ = dict_table_get_nth_col_pos
+ (table,
+ dict_index_get_nth_col_no(index, i));
ufield->exp = NULL;
ufield->new_val = parent_ufield->new_val;
@@ -499,7 +501,7 @@ row_ins_cascade_calc_update_vec(
updated as NULL */
if (ufield->new_val.len == UNIV_SQL_NULL
- && (type->prtype & DATA_NOT_NULL)) {
+ && (type->prtype & DATA_NOT_NULL)) {
return(ULINT_UNDEFINED);
}
@@ -508,11 +510,10 @@ row_ins_cascade_calc_update_vec(
column, do not allow the update */
if (ufield->new_val.len != UNIV_SQL_NULL
- && dtype_get_at_most_n_mbchars(
- type, dtype_get_len(type),
- ufield->new_val.len,
- ufield->new_val.data)
- < ufield->new_val.len) {
+ && dtype_get_at_most_n_mbchars
+ (type, dtype_get_len(type),
+ ufield->new_val.len, ufield->new_val.data)
+ < ufield->new_val.len) {
return(ULINT_UNDEFINED);
}
@@ -525,34 +526,33 @@ row_ins_cascade_calc_update_vec(
min_size = dtype_get_min_size(type);
if (min_size
- && ufield->new_val.len != UNIV_SQL_NULL
- && ufield->new_val.len < min_size) {
+ && ufield->new_val.len != UNIV_SQL_NULL
+ && ufield->new_val.len < min_size) {
char* pad_start;
const char* pad_end;
- ufield->new_val.data =
- mem_heap_alloc(heap,
- min_size);
- pad_start =
- ((char*) ufield->new_val.data)
+ ufield->new_val.data = mem_heap_alloc
+ (heap, min_size);
+ pad_start = ((char*) ufield
+ ->new_val.data)
+ ufield->new_val.len;
- pad_end =
- ((char*) ufield->new_val.data)
+ pad_end = ((char*) ufield
+ ->new_val.data)
+ min_size;
ufield->new_val.len = min_size;
ut_memcpy(ufield->new_val.data,
- parent_ufield->new_val.data,
- parent_ufield->new_val.len);
+ parent_ufield->new_val.data,
+ parent_ufield->new_val.len);
- switch (UNIV_EXPECT(
- dtype_get_mbminlen(type), 1)) {
+ switch (UNIV_EXPECT(dtype_get_mbminlen
+ (type), 1)) {
default:
ut_error;
case 1:
- if (UNIV_UNLIKELY(
- dtype_get_charset_coll(
- dtype_get_prtype(type))
- == DATA_MYSQL_BINARY_CHARSET_COLL)) {
+ if (UNIV_UNLIKELY
+ (dtype_get_charset_coll
+ (dtype_get_prtype(type))
+ == DATA_MYSQL_BINARY_CHARSET_COLL)) {
/* Do not pad BINARY
columns. */
return(ULINT_UNDEFINED);
@@ -560,12 +560,12 @@ row_ins_cascade_calc_update_vec(
/* space=0x20 */
memset(pad_start, 0x20,
- pad_end - pad_start);
+ pad_end - pad_start);
break;
case 2:
/* space=0x0020 */
ut_a(!(ufield->new_val.len
- % 2));
+ % 2));
ut_a(!(min_size % 2));
do {
*pad_start++ = 0x00;
@@ -602,10 +602,9 @@ row_ins_set_detailed(
if (os_file_set_eof(srv_misc_tmpfile)) {
ut_print_name(srv_misc_tmpfile, trx, TRUE,
- foreign->foreign_table_name);
- dict_print_info_on_foreign_key_in_create_format(
- srv_misc_tmpfile,
- trx, foreign, FALSE);
+ foreign->foreign_table_name);
+ dict_print_info_on_foreign_key_in_create_format
+ (srv_misc_tmpfile, trx, foreign, FALSE);
trx_set_detailed_error_from_file(trx, srv_misc_tmpfile);
} else {
trx_set_detailed_error(trx, "temp file operation failed");
@@ -646,7 +645,7 @@ row_ins_foreign_report_err(
ut_print_name(ef, trx, TRUE, foreign->foreign_table_name);
fputs(":\n", ef);
dict_print_info_on_foreign_key_in_create_format(ef, trx, foreign,
- TRUE);
+ TRUE);
putc('\n', ef);
fputs(errstr, ef);
fputs(" in parent table, in index ", ef);
@@ -671,7 +670,7 @@ row_ins_foreign_report_err(
}
/*************************************************************************
-Reports a foreign key error to dict_foreign_err_buf when we are trying
+Reports a foreign key error to dict_foreign_err_file when we are trying
to add an index entry to a child table. Note that the adding may be the result
of an update, too. */
static
@@ -699,7 +698,7 @@ row_ins_foreign_report_add_err(
ut_print_name(ef, trx, TRUE, foreign->foreign_table_name);
fputs(":\n", ef);
dict_print_info_on_foreign_key_in_create_format(ef, trx, foreign,
- TRUE);
+ TRUE);
fputs("\nTrying to add in child table, in index ", ef);
ut_print_name(ef, trx, FALSE, foreign->foreign_index->name);
if (entry) {
@@ -805,26 +804,26 @@ row_ins_foreign_check_on_constraint(
node = thr->run_node;
- if (node->is_delete && 0 == (foreign->type &
- (DICT_FOREIGN_ON_DELETE_CASCADE
- | DICT_FOREIGN_ON_DELETE_SET_NULL))) {
+ if (node->is_delete && 0 == (foreign->type
+ & (DICT_FOREIGN_ON_DELETE_CASCADE
+ | DICT_FOREIGN_ON_DELETE_SET_NULL))) {
row_ins_foreign_report_err("Trying to delete",
- thr, foreign,
- btr_pcur_get_rec(pcur), entry);
+ thr, foreign,
+ btr_pcur_get_rec(pcur), entry);
return(DB_ROW_IS_REFERENCED);
}
- if (!node->is_delete && 0 == (foreign->type &
- (DICT_FOREIGN_ON_UPDATE_CASCADE
- | DICT_FOREIGN_ON_UPDATE_SET_NULL))) {
+ if (!node->is_delete && 0 == (foreign->type
+ & (DICT_FOREIGN_ON_UPDATE_CASCADE
+ | DICT_FOREIGN_ON_UPDATE_SET_NULL))) {
/* This is an UPDATE */
row_ins_foreign_report_err("Trying to update",
- thr, foreign,
- btr_pcur_get_rec(pcur), entry);
+ thr, foreign,
+ btr_pcur_get_rec(pcur), entry);
return(DB_ROW_IS_REFERENCED);
}
@@ -835,8 +834,8 @@ row_ins_foreign_check_on_constraint(
operation. */
node->cascade_heap = mem_heap_create(128);
- node->cascade_node = row_create_update_node_for_mysql(
- table, node->cascade_heap);
+ node->cascade_node = row_create_update_node_for_mysql
+ (table, node->cascade_heap);
que_node_set_parent(node->cascade_node, node);
}
@@ -852,7 +851,7 @@ row_ins_foreign_check_on_constraint(
cascade->foreign = foreign;
if (node->is_delete
- && (foreign->type & DICT_FOREIGN_ON_DELETE_CASCADE)) {
+ && (foreign->type & DICT_FOREIGN_ON_DELETE_CASCADE)) {
cascade->is_delete = TRUE;
} else {
cascade->is_delete = FALSE;
@@ -861,7 +860,7 @@ row_ins_foreign_check_on_constraint(
/* We have to make the update vector longer */
cascade->update = upd_create(foreign->n_fields,
- node->cascade_heap);
+ node->cascade_heap);
cascade->update_n_fields = foreign->n_fields;
}
}
@@ -875,16 +874,18 @@ row_ins_foreign_check_on_constraint(
of the parent table in an inconsistent state! */
if (!cascade->is_delete
- && row_ins_cascade_ancestor_updates_table(cascade, table)) {
+ && row_ins_cascade_ancestor_updates_table(cascade, table)) {
/* We do not know if this would break foreign key
constraints, but play safe and return an error */
err = DB_ROW_IS_REFERENCED;
- row_ins_foreign_report_err(
-"Trying an update, possibly causing a cyclic cascaded update\n"
-"in the child table,", thr, foreign, btr_pcur_get_rec(pcur), entry);
+ row_ins_foreign_report_err
+ ("Trying an update, possibly causing a cyclic"
+ " cascaded update\n"
+ "in the child table,", thr, foreign,
+ btr_pcur_get_rec(pcur), entry);
goto nonstandard_exit_func;
}
@@ -892,9 +893,9 @@ row_ins_foreign_check_on_constraint(
if (row_ins_cascade_n_ancestors(cascade) >= 15) {
err = DB_ROW_IS_REFERENCED;
- row_ins_foreign_report_err(
-"Trying a too deep cascaded delete or update\n",
- thr, foreign, btr_pcur_get_rec(pcur), entry);
+ row_ins_foreign_report_err
+ ("Trying a too deep cascaded delete or update\n",
+ thr, foreign, btr_pcur_get_rec(pcur), entry);
goto nonstandard_exit_func;
}
@@ -920,30 +921,30 @@ row_ins_foreign_check_on_constraint(
tmp_heap = mem_heap_create(256);
ref = row_build_row_ref(ROW_COPY_POINTERS, index, rec,
- tmp_heap);
+ tmp_heap);
btr_pcur_open_with_no_init(clust_index, ref,
- PAGE_CUR_LE, BTR_SEARCH_LEAF,
- cascade->pcur, 0, mtr);
+ PAGE_CUR_LE, BTR_SEARCH_LEAF,
+ cascade->pcur, 0, mtr);
clust_rec = btr_pcur_get_rec(cascade->pcur);
if (!page_rec_is_user_rec(clust_rec)
- || btr_pcur_get_low_match(cascade->pcur)
- < dict_index_get_n_unique(clust_index)) {
+ || btr_pcur_get_low_match(cascade->pcur)
+ < dict_index_get_n_unique(clust_index)) {
- fputs(
- "InnoDB: error in cascade of a foreign key op\n"
- "InnoDB: ", stderr);
+ fputs("InnoDB: error in cascade of a foreign key op\n"
+ "InnoDB: ", stderr);
dict_index_name_print(stderr, trx, index);
fputs("\n"
- "InnoDB: record ", stderr);
+ "InnoDB: record ", stderr);
rec_print(stderr, rec, index);
fputs("\n"
- "InnoDB: clustered record ", stderr);
+ "InnoDB: clustered record ", stderr);
rec_print(stderr, clust_rec, clust_index);
fputs("\n"
-"InnoDB: Submit a detailed bug report to http://bugs.mysql.com\n", stderr);
+ "InnoDB: Submit a detailed bug report to"
+ " http://bugs.mysql.com\n", stderr);
err = DB_SUCCESS;
@@ -960,8 +961,9 @@ row_ins_foreign_check_on_constraint(
we already have a normal shared lock on the appropriate
gap if the search criterion was not unique */
- err = lock_clust_rec_read_check_and_lock_alt(0, clust_rec,
- clust_index, LOCK_X, LOCK_REC_NOT_GAP, thr);
+ err = lock_clust_rec_read_check_and_lock_alt
+ (0, clust_rec, clust_index,
+ LOCK_X, LOCK_REC_NOT_GAP, thr);
}
if (err != DB_SUCCESS) {
@@ -979,9 +981,9 @@ row_ins_foreign_check_on_constraint(
}
if ((node->is_delete
- && (foreign->type & DICT_FOREIGN_ON_DELETE_SET_NULL))
- || (!node->is_delete
- && (foreign->type & DICT_FOREIGN_ON_UPDATE_SET_NULL))) {
+ && (foreign->type & DICT_FOREIGN_ON_DELETE_SET_NULL))
+ || (!node->is_delete
+ && (foreign->type & DICT_FOREIGN_ON_UPDATE_SET_NULL))) {
/* Build the appropriate update vector which sets
foreign->n_fields first fields in rec to SQL NULL */
@@ -993,8 +995,8 @@ row_ins_foreign_check_on_constraint(
for (i = 0; i < foreign->n_fields; i++) {
(update->fields + i)->field_no
- = dict_table_get_nth_col_pos(table,
- dict_index_get_nth_col_no(index, i));
+ = dict_table_get_nth_col_pos
+ (table, dict_index_get_nth_col_no(index, i));
(update->fields + i)->exp = NULL;
(update->fields + i)->new_val.len = UNIV_SQL_NULL;
(update->fields + i)->new_val.data = NULL;
@@ -1003,7 +1005,7 @@ row_ins_foreign_check_on_constraint(
}
if (!node->is_delete
- && (foreign->type & DICT_FOREIGN_ON_UPDATE_CASCADE)) {
+ && (foreign->type & DICT_FOREIGN_ON_UPDATE_CASCADE)) {
/* Build the appropriate update vector which sets changing
foreign->n_fields first fields in rec to new values */
@@ -1011,15 +1013,18 @@ row_ins_foreign_check_on_constraint(
upd_vec_heap = mem_heap_create(256);
n_to_update = row_ins_cascade_calc_update_vec(node, foreign,
- upd_vec_heap);
+ upd_vec_heap);
if (n_to_update == ULINT_UNDEFINED) {
err = DB_ROW_IS_REFERENCED;
- row_ins_foreign_report_err(
-"Trying a cascaded update where the updated value in the child\n"
-"table would not fit in the length of the column, or the value would\n"
-"be NULL and the column is declared as not NULL in the child table,",
- thr, foreign, btr_pcur_get_rec(pcur), entry);
+ row_ins_foreign_report_err
+ ("Trying a cascaded update where the"
+ " updated value in the child\n"
+ "table would not fit in the length"
+ " of the column, or the value would\n"
+ "be NULL and the column is"
+ " declared as not NULL in the child table,",
+ thr, foreign, btr_pcur_get_rec(pcur), entry);
goto nonstandard_exit_func;
}
@@ -1054,12 +1059,13 @@ row_ins_foreign_check_on_constraint(
cascade->state = UPD_NODE_UPDATE_CLUSTERED;
err = row_update_cascade_for_mysql(thr, cascade,
- foreign->foreign_table);
+ foreign->foreign_table);
if (foreign->foreign_table->n_foreign_key_checks_running == 0) {
fprintf(stderr,
-"InnoDB: error: table %s has the counter 0 though there is\n"
-"InnoDB: a FOREIGN KEY check running on it.\n",
+ "InnoDB: error: table %s has the counter 0"
+ " though there is\n"
+ "InnoDB: a FOREIGN KEY check running on it.\n",
foreign->foreign_table->name);
}
@@ -1127,11 +1133,11 @@ row_ins_set_shared_rec_lock(
ut_ad(rec_offs_validate(rec, index, offsets));
if (index->type & DICT_CLUSTERED) {
- err = lock_clust_rec_read_check_and_lock(0,
- rec, index, offsets, LOCK_S, type, thr);
+ err = lock_clust_rec_read_check_and_lock
+ (0, rec, index, offsets, LOCK_S, type, thr);
} else {
- err = lock_sec_rec_read_check_and_lock(0,
- rec, index, offsets, LOCK_S, type, thr);
+ err = lock_sec_rec_read_check_and_lock
+ (0, rec, index, offsets, LOCK_S, type, thr);
}
return(err);
@@ -1158,11 +1164,11 @@ row_ins_set_exclusive_rec_lock(
ut_ad(rec_offs_validate(rec, index, offsets));
if (index->type & DICT_CLUSTERED) {
- err = lock_clust_rec_read_check_and_lock(0,
- rec, index, offsets, LOCK_X, type, thr);
+ err = lock_clust_rec_read_check_and_lock
+ (0, rec, index, offsets, LOCK_X, type, thr);
} else {
- err = lock_sec_rec_read_check_and_lock(0,
- rec, index, offsets, LOCK_X, type, thr);
+ err = lock_sec_rec_read_check_and_lock
+ (0, rec, index, offsets, LOCK_X, type, thr);
}
return(err);
@@ -1226,8 +1232,8 @@ run_again:
for example */
for (i = 0; i < foreign->n_fields; i++) {
- if (UNIV_SQL_NULL == dfield_get_len(
- dtuple_get_nth_field(entry, i))) {
+ if (UNIV_SQL_NULL == dfield_get_len
+ (dtuple_get_nth_field(entry, i))) {
goto exit_func;
}
@@ -1278,19 +1284,20 @@ run_again:
trx_print(ef, trx, 600);
fputs("Foreign key constraint fails for table ", ef);
ut_print_name(ef, trx, TRUE,
- foreign->foreign_table_name);
+ foreign->foreign_table_name);
fputs(":\n", ef);
- dict_print_info_on_foreign_key_in_create_format(ef,
- trx, foreign, TRUE);
+ dict_print_info_on_foreign_key_in_create_format
+ (ef, trx, foreign, TRUE);
fputs("\nTrying to add to index ", ef);
ut_print_name(ef, trx, FALSE,
- foreign->foreign_index->name);
+ foreign->foreign_index->name);
fputs(" tuple:\n", ef);
dtuple_print(ef, entry);
fputs("\nBut the parent table ", ef);
ut_print_name(ef, trx, TRUE,
- foreign->referenced_table_name);
- fputs("\nor its .ibd file does not currently exist!\n", ef);
+ foreign->referenced_table_name);
+ fputs("\nor its .ibd file does"
+ " not currently exist!\n", ef);
mutex_exit(&dict_foreign_err_mutex);
err = DB_NO_REFERENCED_ROW;
@@ -1322,7 +1329,7 @@ run_again:
dtuple_set_n_fields_cmp(entry, foreign->n_fields);
btr_pcur_open(check_index, entry, PAGE_CUR_GE,
- BTR_SEARCH_LEAF, &pcur, &mtr);
+ BTR_SEARCH_LEAF, &pcur, &mtr);
/* Scan index records and check if there is a matching record */
@@ -1337,12 +1344,13 @@ run_again:
}
offsets = rec_get_offsets(rec, check_index,
- offsets, ULINT_UNDEFINED, &heap);
+ offsets, ULINT_UNDEFINED, &heap);
if (rec == page_get_supremum_rec(page)) {
- err = row_ins_set_shared_rec_lock(LOCK_ORDINARY, rec,
- check_index, offsets, thr);
+ err = row_ins_set_shared_rec_lock
+ (LOCK_ORDINARY, rec,
+ check_index, offsets, thr);
if (err != DB_SUCCESS) {
break;
@@ -1355,10 +1363,10 @@ run_again:
if (cmp == 0) {
if (rec_get_deleted_flag(rec,
- rec_offs_comp(offsets))) {
- err = row_ins_set_shared_rec_lock(
- LOCK_ORDINARY, rec,
- check_index, offsets, thr);
+ rec_offs_comp(offsets))) {
+ err = row_ins_set_shared_rec_lock
+ (LOCK_ORDINARY, rec,
+ check_index, offsets, thr);
if (err != DB_SUCCESS) {
break;
@@ -1368,9 +1376,9 @@ run_again:
a record because we can allow inserts
into gaps */
- err = row_ins_set_shared_rec_lock(
- LOCK_REC_NOT_GAP, rec,
- check_index, offsets, thr);
+ err = row_ins_set_shared_rec_lock
+ (LOCK_REC_NOT_GAP, rec,
+ check_index, offsets, thr);
if (err != DB_SUCCESS) {
@@ -1386,10 +1394,9 @@ run_again:
condition: check them in a separate
function */
- err =
- row_ins_foreign_check_on_constraint(
- thr, foreign, &pcur, entry,
- &mtr);
+ err = row_ins_foreign_check_on_constraint
+ (thr, foreign, &pcur,
+ entry, &mtr);
if (err != DB_SUCCESS) {
/* Since reporting a plain
"duplicate key" error
@@ -1410,9 +1417,9 @@ run_again:
break;
}
} else {
- row_ins_foreign_report_err(
- "Trying to delete or update",
- thr, foreign, rec, entry);
+ row_ins_foreign_report_err
+ ("Trying to delete or update",
+ thr, foreign, rec, entry);
err = DB_ROW_IS_REFERENCED;
break;
@@ -1421,8 +1428,8 @@ run_again:
}
if (cmp < 0) {
- err = row_ins_set_shared_rec_lock(LOCK_GAP,
- rec, check_index, offsets, thr);
+ err = row_ins_set_shared_rec_lock
+ (LOCK_GAP, rec, check_index, offsets, thr);
if (err != DB_SUCCESS) {
break;
@@ -1430,8 +1437,8 @@ run_again:
if (check_ref) {
err = DB_NO_REFERENCED_ROW;
- row_ins_foreign_report_add_err(
- trx, foreign, rec, entry);
+ row_ins_foreign_report_add_err
+ (trx, foreign, rec, entry);
} else {
err = DB_SUCCESS;
}
@@ -1446,8 +1453,8 @@ next_rec:
if (!moved) {
if (check_ref) {
rec = btr_pcur_get_rec(&pcur);
- row_ins_foreign_report_add_err(
- trx, foreign, rec, entry);
+ row_ins_foreign_report_add_err
+ (trx, foreign, rec, entry);
err = DB_NO_REFERENCED_ROW;
} else {
err = DB_SUCCESS;
@@ -1529,7 +1536,7 @@ row_ins_check_foreign_constraints(
mutex_enter(&(dict_sys->mutex));
(foreign->referenced_table
- ->n_foreign_key_checks_running)++;
+ ->n_foreign_key_checks_running)++;
mutex_exit(&(dict_sys->mutex));
}
@@ -1539,16 +1546,16 @@ row_ins_check_foreign_constraints(
But the counter on the table protects the referenced
table from being dropped while the check is running. */
- err = row_ins_check_foreign_constraint(TRUE, foreign,
- table, entry, thr);
+ err = row_ins_check_foreign_constraint
+ (TRUE, foreign, table, entry, thr);
if (foreign->referenced_table) {
mutex_enter(&(dict_sys->mutex));
ut_a(foreign->referenced_table
- ->n_foreign_key_checks_running > 0);
+ ->n_foreign_key_checks_running > 0);
(foreign->referenced_table
- ->n_foreign_key_checks_running)--;
+ ->n_foreign_key_checks_running)--;
mutex_exit(&(dict_sys->mutex));
}
@@ -1597,7 +1604,7 @@ row_ins_dupl_error_with_rec(
matched_bytes = 0;
cmp_dtuple_rec_with_match(entry, rec, offsets,
- &matched_fields, &matched_bytes);
+ &matched_fields, &matched_bytes);
if (matched_fields < n_unique) {
@@ -1610,8 +1617,8 @@ row_ins_dupl_error_with_rec(
if (!(index->type & DICT_CLUSTERED)) {
for (i = 0; i < n_unique; i++) {
- if (UNIV_SQL_NULL == dfield_get_len(
- dtuple_get_nth_field(entry, i))) {
+ if (UNIV_SQL_NULL == dfield_get_len
+ (dtuple_get_nth_field(entry, i))) {
return(FALSE);
}
@@ -1658,8 +1665,8 @@ row_ins_scan_sec_index_for_duplicate(
since we define NULL != NULL in this case */
for (i = 0; i < n_unique; i++) {
- if (UNIV_SQL_NULL == dfield_get_len(
- dtuple_get_nth_field(entry, i))) {
+ if (UNIV_SQL_NULL == dfield_get_len
+ (dtuple_get_nth_field(entry, i))) {
return(DB_SUCCESS);
}
@@ -1686,7 +1693,7 @@ row_ins_scan_sec_index_for_duplicate(
}
offsets = rec_get_offsets(rec, index, offsets,
- ULINT_UNDEFINED, &heap);
+ ULINT_UNDEFINED, &heap);
if (innobase_query_is_update()) {
@@ -1695,12 +1702,12 @@ row_ins_scan_sec_index_for_duplicate(
duplicates ( REPLACE, LOAD DATAFILE REPLACE,
INSERT ON DUPLICATE KEY UPDATE). */
- err = row_ins_set_exclusive_rec_lock(LOCK_ORDINARY,
- rec, index, offsets, thr);
+ err = row_ins_set_exclusive_rec_lock
+ (LOCK_ORDINARY, rec, index, offsets, thr);
} else {
- err = row_ins_set_shared_rec_lock(LOCK_ORDINARY,
- rec, index, offsets, thr);
+ err = row_ins_set_shared_rec_lock
+ (LOCK_ORDINARY, rec, index, offsets, thr);
}
if (err != DB_SUCCESS) {
@@ -1810,7 +1817,7 @@ row_ins_duplicate_error_in_clust(
if (!page_rec_is_infimum(rec)) {
offsets = rec_get_offsets(rec, cursor->index, offsets,
- ULINT_UNDEFINED, &heap);
+ ULINT_UNDEFINED, &heap);
/* We set a lock on the possible duplicate: this
is needed in logical logging of MySQL to make
@@ -1824,22 +1831,22 @@ row_ins_duplicate_error_in_clust(
duplicates ( REPLACE, LOAD DATAFILE REPLACE,
INSERT ON DUPLICATE KEY UPDATE). */
- err = row_ins_set_exclusive_rec_lock(
- LOCK_REC_NOT_GAP,rec,cursor->index,
- offsets, thr);
+ err = row_ins_set_exclusive_rec_lock
+ (LOCK_REC_NOT_GAP, rec,
+ cursor->index, offsets, thr);
} else {
- err = row_ins_set_shared_rec_lock(
- LOCK_REC_NOT_GAP,rec, cursor->index,
- offsets, thr);
+ err = row_ins_set_shared_rec_lock
+ (LOCK_REC_NOT_GAP, rec,
+ cursor->index, offsets, thr);
}
if (err != DB_SUCCESS) {
goto func_exit;
}
- if (row_ins_dupl_error_with_rec(rec, entry,
- cursor->index, offsets)) {
+ if (row_ins_dupl_error_with_rec
+ (rec, entry, cursor->index, offsets)) {
trx->error_info = cursor->index;
err = DB_DUPLICATE_KEY;
goto func_exit;
@@ -1853,7 +1860,7 @@ row_ins_duplicate_error_in_clust(
if (!page_rec_is_supremum(rec)) {
offsets = rec_get_offsets(rec, cursor->index, offsets,
- ULINT_UNDEFINED, &heap);
+ ULINT_UNDEFINED, &heap);
if (innobase_query_is_update()) {
@@ -1862,22 +1869,22 @@ row_ins_duplicate_error_in_clust(
duplicates ( REPLACE, LOAD DATAFILE REPLACE,
INSERT ON DUPLICATE KEY UPDATE). */
- err = row_ins_set_exclusive_rec_lock(
- LOCK_REC_NOT_GAP, rec,
- cursor->index, offsets, thr);
+ err = row_ins_set_exclusive_rec_lock
+ (LOCK_REC_NOT_GAP, rec,
+ cursor->index, offsets, thr);
} else {
- err = row_ins_set_shared_rec_lock(
- LOCK_REC_NOT_GAP, rec,
- cursor->index, offsets, thr);
+ err = row_ins_set_shared_rec_lock
+ (LOCK_REC_NOT_GAP, rec,
+ cursor->index, offsets, thr);
}
if (err != DB_SUCCESS) {
goto func_exit;
}
- if (row_ins_dupl_error_with_rec(rec, entry,
- cursor->index, offsets)) {
+ if (row_ins_dupl_error_with_rec
+ (rec, entry, cursor->index, offsets)) {
trx->error_info = cursor->index;
err = DB_DUPLICATE_KEY;
goto func_exit;
@@ -1885,7 +1892,7 @@ row_ins_duplicate_error_in_clust(
}
ut_a(!(cursor->index->type & DICT_CLUSTERED));
- /* This should never happen */
+ /* This should never happen */
}
err = DB_SUCCESS;
@@ -1999,8 +2006,8 @@ row_ins_index_entry_low(
}
btr_cur_search_to_nth_level(index, 0, entry, PAGE_CUR_LE,
- mode | BTR_INSERT | ignore_sec_unique,
- &cursor, 0, &mtr);
+ mode | BTR_INSERT | ignore_sec_unique,
+ &cursor, 0, &mtr);
if (cursor.flag == BTR_CUR_INSERT_TO_IBUF) {
/* The insertion was made to the insert buffer already during
@@ -2014,12 +2021,12 @@ row_ins_index_entry_low(
#ifdef UNIV_DEBUG
{
page_t* page = btr_cur_get_page(&cursor);
- rec_t* first_rec = page_rec_get_next(
- page_get_infimum_rec(page));
+ rec_t* first_rec = page_rec_get_next
+ (page_get_infimum_rec(page));
if (UNIV_LIKELY(first_rec != page_get_supremum_rec(page))) {
ut_a(rec_get_n_fields(first_rec, index)
- == dtuple_get_n_fields(entry));
+ == dtuple_get_n_fields(entry));
}
}
#endif
@@ -2027,22 +2034,22 @@ row_ins_index_entry_low(
n_unique = dict_index_get_n_unique(index);
if (index->type & DICT_UNIQUE && (cursor.up_match >= n_unique
- || cursor.low_match >= n_unique)) {
+ || cursor.low_match >= n_unique)) {
if (index->type & DICT_CLUSTERED) {
/* Note that the following may return also
DB_LOCK_WAIT */
- err = row_ins_duplicate_error_in_clust(&cursor,
- entry, thr, &mtr);
+ err = row_ins_duplicate_error_in_clust
+ (&cursor, entry, thr, &mtr);
if (err != DB_SUCCESS) {
goto function_exit;
}
} else {
mtr_commit(&mtr);
- err = row_ins_scan_sec_index_for_duplicate(index,
- entry, thr);
+ err = row_ins_scan_sec_index_for_duplicate
+ (index, entry, thr);
mtr_start(&mtr);
if (err != DB_SUCCESS) {
@@ -2057,8 +2064,9 @@ row_ins_index_entry_low(
continue the insertion. */
btr_cur_search_to_nth_level(index, 0, entry,
- PAGE_CUR_LE, mode | BTR_INSERT,
- &cursor, 0, &mtr);
+ PAGE_CUR_LE,
+ mode | BTR_INSERT,
+ &cursor, 0, &mtr);
}
}
@@ -2076,21 +2084,19 @@ row_ins_index_entry_low(
}
if (index->type & DICT_CLUSTERED) {
- err = row_ins_clust_index_entry_by_modify(mode,
- &cursor, &big_rec,
- entry,
- ext_vec, n_ext_vec,
- thr, &mtr);
+ err = row_ins_clust_index_entry_by_modify
+ (mode, &cursor, &big_rec, entry,
+ ext_vec, n_ext_vec, thr, &mtr);
} else {
- err = row_ins_sec_index_entry_by_modify(mode, &cursor,
- entry,
- thr, &mtr);
+ err = row_ins_sec_index_entry_by_modify
+ (mode, &cursor, entry, thr, &mtr);
}
} else {
if (mode == BTR_MODIFY_LEAF) {
- err = btr_cur_optimistic_insert(0, &cursor, entry,
- &insert_rec, &big_rec, thr, &mtr);
+ err = btr_cur_optimistic_insert
+ (0, &cursor, entry,
+ &insert_rec, &big_rec, thr, &mtr);
} else {
ut_a(mode == BTR_MODIFY_TREE);
if (buf_LRU_buf_pool_running_out()) {
@@ -2099,14 +2105,16 @@ row_ins_index_entry_low(
goto function_exit;
}
- err = btr_cur_pessimistic_insert(0, &cursor, entry,
- &insert_rec, &big_rec, thr, &mtr);
+ err = btr_cur_pessimistic_insert
+ (0, &cursor, entry,
+ &insert_rec, &big_rec, thr, &mtr);
}
if (err == DB_SUCCESS) {
if (ext_vec) {
rec_set_field_extern_bits(insert_rec, index,
- ext_vec, n_ext_vec, &mtr);
+ ext_vec, n_ext_vec,
+ &mtr);
}
}
}
@@ -2119,13 +2127,13 @@ function_exit:
mtr_start(&mtr);
btr_cur_search_to_nth_level(index, 0, entry, PAGE_CUR_LE,
- BTR_MODIFY_TREE, &cursor, 0, &mtr);
+ BTR_MODIFY_TREE, &cursor, 0, &mtr);
rec = btr_cur_get_rec(&cursor);
offsets = rec_get_offsets(rec, index, offsets,
- ULINT_UNDEFINED, &heap);
+ ULINT_UNDEFINED, &heap);
err = btr_store_big_rec_extern_fields(index, rec,
- offsets, big_rec, &mtr);
+ offsets, big_rec, &mtr);
if (modify) {
dtuple_big_rec_free(big_rec);
@@ -2164,7 +2172,7 @@ row_ins_index_entry(
if (UT_LIST_GET_FIRST(index->table->foreign_list)) {
err = row_ins_check_foreign_constraints(index->table, index,
- entry, thr);
+ entry, thr);
if (err != DB_SUCCESS) {
return(err);
@@ -2174,7 +2182,7 @@ row_ins_index_entry(
/* Try first optimistic descent to the B-tree */
err = row_ins_index_entry_low(BTR_MODIFY_LEAF, index, entry,
- ext_vec, n_ext_vec, thr);
+ ext_vec, n_ext_vec, thr);
if (err != DB_FAIL) {
return(err);
@@ -2183,7 +2191,7 @@ row_ins_index_entry(
/* Try then pessimistic descent to the B-tree */
err = row_ins_index_entry_low(BTR_MODIFY_TREE, index, entry,
- ext_vec, n_ext_vec, thr);
+ ext_vec, n_ext_vec, thr);
return(err);
}
@@ -2217,14 +2225,14 @@ row_ins_index_entry_set_vals(
/* Check column prefix indexes */
if (ind_field->prefix_len > 0
- && dfield_get_len(row_field) != UNIV_SQL_NULL) {
+ && dfield_get_len(row_field) != UNIV_SQL_NULL) {
- cur_type = dict_col_get_type(
- dict_field_get_col(ind_field));
+ cur_type = dict_col_get_type
+ (dict_field_get_col(ind_field));
- field->len = dtype_get_at_most_n_mbchars(cur_type,
- ind_field->prefix_len,
- dfield_get_len(row_field), row_field->data);
+ field->len = dtype_get_at_most_n_mbchars
+ (cur_type, ind_field->prefix_len,
+ dfield_get_len(row_field), row_field->data);
} else {
field->len = row_field->len;
}
@@ -2466,7 +2474,7 @@ row_ins_step(
}
node->trx_id = trx->id;
- same_trx:
+same_trx:
node->state = INS_NODE_ALLOC_ROW_ID;
if (node->ins_type == INS_SEARCHED) {
@@ -2482,7 +2490,7 @@ row_ins_step(
}
if ((node->ins_type == INS_SEARCHED)
- && (sel_node->state != SEL_NODE_FETCH)) {
+ && (sel_node->state != SEL_NODE_FETCH)) {
ut_ad(sel_node->state == SEL_NODE_NO_MORE_ROWS);
diff --git a/storage/innobase/row/row0mysql.c b/storage/innobase/row/row0mysql.c
index 0378a3f8c87..af3f80fa53b 100644
--- a/storage/innobase/row/row0mysql.c
+++ b/storage/innobase/row/row0mysql.c
@@ -70,8 +70,8 @@ row_mysql_is_system_table(
}
return(0 == strcmp(name + 6, "host")
- || 0 == strcmp(name + 6, "user")
- || 0 == strcmp(name + 6, "db"));
+ || 0 == strcmp(name + 6, "user")
+ || 0 == strcmp(name + 6, "db"));
}
/***********************************************************************
@@ -280,8 +280,8 @@ row_mysql_store_col_in_innobase_format(
buf += col_len;
} else if ((type == DATA_VARCHAR
- || type == DATA_VARMYSQL
- || type == DATA_BINARY)) {
+ || type == DATA_VARMYSQL
+ || type == DATA_BINARY)) {
if (dtype_get_mysql_type(dtype) == DATA_MYSQL_TRUE_VARCHAR) {
/* The length of the actual data is stored to 1 or 2
@@ -299,7 +299,7 @@ row_mysql_store_col_in_innobase_format(
}
ptr = row_mysql_read_true_varchar(&col_len, mysql_data,
- lenlen);
+ lenlen);
} else {
/* Remove trailing spaces from old style VARCHAR
columns. */
@@ -315,21 +315,21 @@ row_mysql_store_col_in_innobase_format(
col_len &= ~1;
while (col_len >= 2 && ptr[col_len - 2] == 0x00
- && ptr[col_len - 1] == 0x20) {
+ && ptr[col_len - 1] == 0x20) {
col_len -= 2;
}
} else {
ut_a(mbminlen == 1);
/* space=0x20 */
while (col_len > 0
- && ptr[col_len - 1] == 0x20) {
+ && ptr[col_len - 1] == 0x20) {
col_len--;
}
}
}
} else if (comp && type == DATA_MYSQL
- && dtype_get_mbminlen(dtype) == 1
- && dtype_get_mbmaxlen(dtype) > 1) {
+ && dtype_get_mbminlen(dtype) == 1
+ && dtype_get_mbmaxlen(dtype) > 1) {
/* In some cases we strip trailing spaces from UTF-8 and other
multibyte charsets, from FIXED-length CHAR columns, to save
space. UTF-8 would otherwise normally use 3 * the string length
@@ -406,8 +406,8 @@ row_mysql_convert_row_to_innobase(
if (templ->mysql_null_bit_mask != 0) {
/* Column may be SQL NULL */
- if (mysql_rec[templ->mysql_null_byte_offset] &
- (byte) (templ->mysql_null_bit_mask)) {
+ if (mysql_rec[templ->mysql_null_byte_offset]
+ & (byte) (templ->mysql_null_bit_mask)) {
/* It is SQL NULL */
@@ -417,13 +417,13 @@ row_mysql_convert_row_to_innobase(
}
}
- row_mysql_store_col_in_innobase_format(dfield,
- prebuilt->ins_upd_rec_buff
- + templ->mysql_col_offset,
- TRUE, /* MySQL row format data */
- mysql_rec + templ->mysql_col_offset,
- templ->mysql_col_len,
- dict_table_is_comp(prebuilt->table));
+ row_mysql_store_col_in_innobase_format
+ (dfield,
+ prebuilt->ins_upd_rec_buff + templ->mysql_col_offset,
+ TRUE, /* MySQL row format data */
+ mysql_rec + templ->mysql_col_offset,
+ templ->mysql_col_len,
+ dict_table_is_comp(prebuilt->table));
next_column:
;
}
@@ -456,7 +456,7 @@ handle_new_error:
trx->error_state = DB_SUCCESS;
if ((err == DB_DUPLICATE_KEY)
- || (err == DB_FOREIGN_DUPLICATE_KEY)) {
+ || (err == DB_FOREIGN_DUPLICATE_KEY)) {
if (savept) {
/* Roll back the latest, possibly incomplete
insertion or update */
@@ -514,23 +514,29 @@ handle_new_error:
} else if (err == DB_MUST_GET_MORE_FILE_SPACE) {
- fputs(
- "InnoDB: The database cannot continue operation because of\n"
- "InnoDB: lack of space. You must add a new data file to\n"
- "InnoDB: my.cnf and restart the database.\n", stderr);
+ fputs("InnoDB: The database cannot continue"
+ " operation because of\n"
+ "InnoDB: lack of space. You must add"
+ " a new data file to\n"
+ "InnoDB: my.cnf and restart the database.\n", stderr);
exit(1);
} else if (err == DB_CORRUPTION) {
- fputs(
- "InnoDB: We detected index corruption in an InnoDB type table.\n"
- "InnoDB: You have to dump + drop + reimport the table or, in\n"
- "InnoDB: a case of widespread corruption, dump all InnoDB\n"
- "InnoDB: tables and recreate the whole InnoDB tablespace.\n"
- "InnoDB: If the mysqld server crashes after the startup or when\n"
- "InnoDB: you dump the tables, look at\n"
- "InnoDB: http://dev.mysql.com/doc/refman/5.1/en/forcing-recovery.html"
- " for help.\n", stderr);
+ fputs("InnoDB: We detected index corruption"
+ " in an InnoDB type table.\n"
+ "InnoDB: You have to dump + drop + reimport"
+ " the table or, in\n"
+ "InnoDB: a case of widespread corruption,"
+ " dump all InnoDB\n"
+ "InnoDB: tables and recreate the"
+ " whole InnoDB tablespace.\n"
+ "InnoDB: If the mysqld server crashes"
+ " after the startup or when\n"
+ "InnoDB: you dump the tables, look at\n"
+ "InnoDB: http://dev.mysql.com/doc/refman/5.1/en/"
+ "forcing-recovery.html"
+ " for help.\n", stderr);
} else {
fprintf(stderr, "InnoDB: unknown error code %lu\n",
@@ -613,8 +619,8 @@ row_create_prebuilt(
prebuilt->sel_graph = NULL;
- prebuilt->search_tuple = dtuple_create(heap,
- 2 * dict_table_get_n_cols(table));
+ prebuilt->search_tuple = dtuple_create
+ (heap, 2 * dict_table_get_n_cols(table));
clust_index = dict_table_get_first_index(table);
@@ -653,12 +659,13 @@ row_prebuilt_free(
ulint i;
if (prebuilt->magic_n != ROW_PREBUILT_ALLOCATED
- || prebuilt->magic_n2 != ROW_PREBUILT_ALLOCATED) {
+ || prebuilt->magic_n2 != ROW_PREBUILT_ALLOCATED) {
fprintf(stderr,
-"InnoDB: Error: trying to free a corrupt\n"
-"InnoDB: table handle. Magic n %lu, magic n2 %lu, table name",
- (ulong) prebuilt->magic_n,
- (ulong) prebuilt->magic_n2);
+ "InnoDB: Error: trying to free a corrupt\n"
+ "InnoDB: table handle. Magic n %lu,"
+ " magic n2 %lu, table name",
+ (ulong) prebuilt->magic_n,
+ (ulong) prebuilt->magic_n2);
ut_print_name(stderr, NULL, TRUE, prebuilt->table->name);
putc('\n', stderr);
@@ -700,17 +707,16 @@ row_prebuilt_free(
for (i = 0; i < MYSQL_FETCH_CACHE_SIZE; i++) {
if (prebuilt->fetch_cache[i] != NULL) {
- if ((ROW_PREBUILT_FETCH_MAGIC_N !=
- mach_read_from_4((prebuilt->fetch_cache[i]) - 4))
- || (ROW_PREBUILT_FETCH_MAGIC_N !=
- mach_read_from_4((prebuilt->fetch_cache[i])
- + prebuilt->mysql_row_len))) {
- fputs(
- "InnoDB: Error: trying to free a corrupt\n"
- "InnoDB: fetch buffer.\n", stderr);
+ if ((ROW_PREBUILT_FETCH_MAGIC_N != mach_read_from_4
+ ((prebuilt->fetch_cache[i]) - 4))
+ || (ROW_PREBUILT_FETCH_MAGIC_N != mach_read_from_4
+ ((prebuilt->fetch_cache[i])
+ + prebuilt->mysql_row_len))) {
+ fputs("InnoDB: Error: trying to free"
+ " a corrupt fetch buffer.\n", stderr);
- mem_analyze_corruption(
- prebuilt->fetch_cache[i]);
+ mem_analyze_corruption
+ (prebuilt->fetch_cache[i]);
ut_error;
}
@@ -738,9 +744,9 @@ row_update_prebuilt_trx(
{
if (trx->magic_n != TRX_MAGIC_N) {
fprintf(stderr,
- "InnoDB: Error: trying to use a corrupt\n"
- "InnoDB: trx handle. Magic n %lu\n",
- (ulong) trx->magic_n);
+ "InnoDB: Error: trying to use a corrupt\n"
+ "InnoDB: trx handle. Magic n %lu\n",
+ (ulong) trx->magic_n);
mem_analyze_corruption(trx);
@@ -749,9 +755,9 @@ row_update_prebuilt_trx(
if (prebuilt->magic_n != ROW_PREBUILT_ALLOCATED) {
fprintf(stderr,
- "InnoDB: Error: trying to use a corrupt\n"
- "InnoDB: table handle. Magic n %lu, table name",
- (ulong) prebuilt->magic_n);
+ "InnoDB: Error: trying to use a corrupt\n"
+ "InnoDB: table handle. Magic n %lu, table name",
+ (ulong) prebuilt->magic_n);
ut_print_name(stderr, NULL, TRUE, prebuilt->table->name);
putc('\n', stderr);
@@ -805,13 +811,12 @@ row_get_prebuilt_insert_row(
prebuilt->ins_node = node;
if (prebuilt->ins_upd_rec_buff == NULL) {
- prebuilt->ins_upd_rec_buff = mem_heap_alloc(
- prebuilt->heap,
- prebuilt->mysql_row_len);
+ prebuilt->ins_upd_rec_buff = mem_heap_alloc
+ (prebuilt->heap, prebuilt->mysql_row_len);
}
row = dtuple_create(prebuilt->heap,
- dict_table_get_n_cols(table));
+ dict_table_get_n_cols(table));
dict_table_copy_types(row, table);
@@ -825,11 +830,10 @@ row_get_prebuilt_insert_row(
ins_node_set_new_row(node, row);
- prebuilt->ins_graph =
- que_node_get_parent(
- pars_complete_graph_for_exec(node,
- prebuilt->trx,
- prebuilt->heap));
+ prebuilt->ins_graph = que_node_get_parent
+ (pars_complete_graph_for_exec(node,
+ prebuilt->trx,
+ prebuilt->heap));
prebuilt->ins_graph->state = QUE_FORK_ACTIVE;
}
@@ -858,7 +862,7 @@ row_update_statistics_if_needed(
a counter table which is very small and updated very often. */
if (counter > 2000000000
- || ((ib_longlong)counter > 16 + table->stat_n_rows / 16)) {
+ || ((ib_longlong)counter > 16 + table->stat_n_rows / 16)) {
dict_update_statistics(table);
}
@@ -1007,7 +1011,7 @@ run_again:
err = lock_table(0, table, mode, thr);
} else {
err = lock_table(0, prebuilt->table,
- prebuilt->select_lock_type, thr);
+ prebuilt->select_lock_type, thr);
}
trx->error_state = err;
@@ -1057,24 +1061,28 @@ row_insert_for_mysql(
if (prebuilt->table->ibd_file_missing) {
ut_print_timestamp(stderr);
fprintf(stderr, " InnoDB: Error:\n"
-"InnoDB: MySQL is trying to use a table handle but the .ibd file for\n"
-"InnoDB: table %s does not exist.\n"
-"InnoDB: Have you deleted the .ibd file from the database directory under\n"
-"InnoDB: the MySQL datadir, or have you used DISCARD TABLESPACE?\n"
-"InnoDB: Look from\n"
-"InnoDB: http://dev.mysql.com/doc/refman/5.1/en/innodb-troubleshooting.html\n"
-"InnoDB: how you can resolve the problem.\n",
- prebuilt->table->name);
+ "InnoDB: MySQL is trying to use a table handle"
+ " but the .ibd file for\n"
+ "InnoDB: table %s does not exist.\n"
+ "InnoDB: Have you deleted the .ibd file"
+ " from the database directory under\n"
+ "InnoDB: the MySQL datadir, or have you"
+ " used DISCARD TABLESPACE?\n"
+ "InnoDB: Look from\n"
+ "InnoDB: http://dev.mysql.com/doc/refman/5.1/en/"
+ "innodb-troubleshooting.html\n"
+ "InnoDB: how you can resolve the problem.\n",
+ prebuilt->table->name);
return(DB_ERROR);
}
if (prebuilt->magic_n != ROW_PREBUILT_ALLOCATED) {
fprintf(stderr,
- "InnoDB: Error: trying to free a corrupt\n"
- "InnoDB: table handle. Magic n %lu, table name",
- (ulong) prebuilt->magic_n);
+ "InnoDB: Error: trying to free a corrupt\n"
+ "InnoDB: table handle. Magic n %lu, table name",
+ (ulong) prebuilt->magic_n);
ut_print_name(stderr, prebuilt->trx, TRUE,
- prebuilt->table->name);
+ prebuilt->table->name);
putc('\n', stderr);
mem_analyze_corruption(prebuilt);
@@ -1083,13 +1091,13 @@ row_insert_for_mysql(
}
if (srv_created_new_raw || srv_force_recovery) {
- fputs(
- "InnoDB: A new raw disk partition was initialized or\n"
- "InnoDB: innodb_force_recovery is on: we do not allow\n"
- "InnoDB: database modifications by the user. Shut down\n"
- "InnoDB: mysqld and edit my.cnf so that newraw is replaced\n"
- "InnoDB: with raw, and innodb_force_... is removed.\n",
- stderr);
+ fputs("InnoDB: A new raw disk partition was initialized or\n"
+ "InnoDB: innodb_force_recovery is on: we do not allow\n"
+ "InnoDB: database modifications by the user. Shut down\n"
+ "InnoDB: mysqld and edit my.cnf so that"
+ " newraw is replaced\n"
+ "InnoDB: with raw, and innodb_force_... is removed.\n",
+ stderr);
return(DB_ERROR);
}
@@ -1131,10 +1139,10 @@ run_again:
if (err != DB_SUCCESS) {
que_thr_stop_for_mysql(thr);
-/* TODO: what is this? */ thr->lock_state= QUE_THR_LOCK_ROW;
+ /* TODO: what is this? */ thr->lock_state= QUE_THR_LOCK_ROW;
was_lock_wait = row_mysql_handle_errors(&err, trx, thr,
- &savept);
+ &savept);
thr->lock_state= QUE_THR_LOCK_NOLOCK;
if (was_lock_wait) {
@@ -1180,11 +1188,10 @@ row_prebuild_sel_graph(
node = sel_node_create(prebuilt->heap);
- prebuilt->sel_graph =
- que_node_get_parent(
- pars_complete_graph_for_exec(node,
- prebuilt->trx,
- prebuilt->heap));
+ prebuilt->sel_graph = que_node_get_parent
+ (pars_complete_graph_for_exec(node,
+ prebuilt->trx,
+ prebuilt->heap));
prebuilt->sel_graph->state = QUE_FORK_ACTIVE;
}
@@ -1253,11 +1260,10 @@ row_get_prebuilt_update_vector(
prebuilt->upd_node = node;
- prebuilt->upd_graph =
- que_node_get_parent(
- pars_complete_graph_for_exec(node,
- prebuilt->trx,
- prebuilt->heap));
+ prebuilt->upd_graph = que_node_get_parent
+ (pars_complete_graph_for_exec(node,
+ prebuilt->trx,
+ prebuilt->heap));
prebuilt->upd_graph->state = QUE_FORK_ACTIVE;
}
@@ -1281,7 +1287,7 @@ row_update_for_mysql(
que_thr_t* thr;
ibool was_lock_wait;
dict_index_t* clust_index;
-/* ulint ref_len; */
+ /* ulint ref_len; */
upd_node_t* node;
dict_table_t* table = prebuilt->table;
trx_t* trx = prebuilt->trx;
@@ -1293,24 +1299,28 @@ row_update_for_mysql(
if (prebuilt->table->ibd_file_missing) {
ut_print_timestamp(stderr);
fprintf(stderr, " InnoDB: Error:\n"
-"InnoDB: MySQL is trying to use a table handle but the .ibd file for\n"
-"InnoDB: table %s does not exist.\n"
-"InnoDB: Have you deleted the .ibd file from the database directory under\n"
-"InnoDB: the MySQL datadir, or have you used DISCARD TABLESPACE?\n"
-"InnoDB: Look from\n"
-"InnoDB: http://dev.mysql.com/doc/refman/5.1/en/innodb-troubleshooting.html\n"
-"InnoDB: how you can resolve the problem.\n",
- prebuilt->table->name);
+ "InnoDB: MySQL is trying to use a table handle"
+ " but the .ibd file for\n"
+ "InnoDB: table %s does not exist.\n"
+ "InnoDB: Have you deleted the .ibd file"
+ " from the database directory under\n"
+ "InnoDB: the MySQL datadir, or have you"
+ " used DISCARD TABLESPACE?\n"
+ "InnoDB: Look from\n"
+ "InnoDB: http://dev.mysql.com/doc/refman/5.1/en/"
+ "innodb-troubleshooting.html\n"
+ "InnoDB: how you can resolve the problem.\n",
+ prebuilt->table->name);
return(DB_ERROR);
}
if (prebuilt->magic_n != ROW_PREBUILT_ALLOCATED) {
fprintf(stderr,
- "InnoDB: Error: trying to free a corrupt\n"
- "InnoDB: table handle. Magic n %lu, table name",
- (ulong) prebuilt->magic_n);
+ "InnoDB: Error: trying to free a corrupt\n"
+ "InnoDB: table handle. Magic n %lu, table name",
+ (ulong) prebuilt->magic_n);
ut_print_name(stderr, prebuilt->trx, TRUE,
- prebuilt->table->name);
+ prebuilt->table->name);
putc('\n', stderr);
mem_analyze_corruption(prebuilt);
@@ -1319,13 +1329,13 @@ row_update_for_mysql(
}
if (srv_created_new_raw || srv_force_recovery) {
- fputs(
- "InnoDB: A new raw disk partition was initialized or\n"
- "InnoDB: innodb_force_recovery is on: we do not allow\n"
- "InnoDB: database modifications by the user. Shut down\n"
- "InnoDB: mysqld and edit my.cnf so that newraw is replaced\n"
- "InnoDB: with raw, and innodb_force_... is removed.\n",
- stderr);
+ fputs("InnoDB: A new raw disk partition was initialized or\n"
+ "InnoDB: innodb_force_recovery is on: we do not allow\n"
+ "InnoDB: database modifications by the user. Shut down\n"
+ "InnoDB: mysqld and edit my.cnf so that newraw"
+ " is replaced\n"
+ "InnoDB: with raw, and innodb_force_... is removed.\n",
+ stderr);
return(DB_ERROR);
}
@@ -1344,7 +1354,7 @@ row_update_for_mysql(
btr_pcur_copy_stored_position(node->pcur, prebuilt->pcur);
} else {
btr_pcur_copy_stored_position(node->pcur,
- prebuilt->clust_pcur);
+ prebuilt->clust_pcur);
}
ut_a(node->pcur->rel_pos == BTR_PCUR_ON);
@@ -1386,7 +1396,7 @@ run_again:
thr->lock_state= QUE_THR_LOCK_ROW;
was_lock_wait = row_mysql_handle_errors(&err, trx, thr,
- &savept);
+ &savept);
thr->lock_state= QUE_THR_LOCK_NOLOCK;
if (was_lock_wait) {
@@ -1451,12 +1461,13 @@ row_unlock_for_mysql(
ut_ad(trx->mysql_thread_id == os_thread_get_curr_id());
if (!(srv_locks_unsafe_for_binlog
- || trx->isolation_level == TRX_ISO_READ_COMMITTED)) {
+ || trx->isolation_level == TRX_ISO_READ_COMMITTED)) {
fprintf(stderr,
-"InnoDB: Error: calling row_unlock_for_mysql though\n"
-"InnoDB: srv_locks_unsafe_for_binlog is FALSE and\n"
-"InnoDB: this session is not using READ COMMITTED isolation level.\n");
+ "InnoDB: Error: calling row_unlock_for_mysql though\n"
+ "InnoDB: srv_locks_unsafe_for_binlog is FALSE and\n"
+ "InnoDB: this session is not using"
+ " READ COMMITTED isolation level.\n");
return(DB_SUCCESS);
}
@@ -1502,7 +1513,7 @@ row_unlock_for_mysql(
if (!has_latches_on_recs) {
btr_pcur_restore_position(BTR_SEARCH_LEAF, clust_pcur,
- &mtr);
+ &mtr);
}
rec = btr_pcur_get_rec(clust_pcur);
@@ -1601,7 +1612,7 @@ row_table_got_default_clust_index(
clust_index = dict_table_get_first_index(table);
if (dtype_get_mtype(dict_index_get_nth_type(clust_index, 0))
- == DATA_SYS) {
+ == DATA_SYS) {
return(TRUE);
}
@@ -1679,7 +1690,7 @@ row_mysql_lock_data_dictionary(
trx_t* trx) /* in: transaction */
{
ut_a(trx->dict_operation_lock_mode == 0
- || trx->dict_operation_lock_mode == RW_X_LATCH);
+ || trx->dict_operation_lock_mode == RW_X_LATCH);
/* Serialize data dictionary operations with dictionary mutex:
no deadlocks or lock waits can occur then in these operations */
@@ -1738,13 +1749,13 @@ row_create_table_for_mysql(
ut_ad(trx->dict_operation_lock_mode == RW_X_LATCH);
if (srv_created_new_raw) {
- fputs(
- "InnoDB: A new raw disk partition was initialized or\n"
- "InnoDB: innodb_force_recovery is on: we do not allow\n"
- "InnoDB: database modifications by the user. Shut down\n"
- "InnoDB: mysqld and edit my.cnf so that newraw is replaced\n"
- "InnoDB: with raw, and innodb_force_... is removed.\n",
- stderr);
+ fputs("InnoDB: A new raw disk partition was initialized or\n"
+ "InnoDB: innodb_force_recovery is on: we do not allow\n"
+ "InnoDB: database modifications by the user. Shut down\n"
+ "InnoDB: mysqld and edit my.cnf so that newraw"
+ " is replaced\n"
+ "InnoDB: with raw, and innodb_force_... is removed.\n",
+ stderr);
dict_mem_table_free(table);
trx_commit_for_mysql(trx);
@@ -1757,9 +1768,11 @@ row_create_table_for_mysql(
if (row_mysql_is_system_table(table->name)) {
fprintf(stderr,
- "InnoDB: Error: trying to create a MySQL system table %s of type InnoDB.\n"
- "InnoDB: MySQL system tables must be of the MyISAM type!\n",
- table->name);
+ "InnoDB: Error: trying to create a MySQL system"
+ " table %s of type InnoDB.\n"
+ "InnoDB: MySQL system tables must be"
+ " of the MyISAM type!\n",
+ table->name);
dict_mem_table_free(table);
trx_commit_for_mysql(trx);
@@ -1792,8 +1805,8 @@ row_create_table_for_mysql(
table_name_len = strlen(table_name) + 1;
if (table_name_len == sizeof S_innodb_monitor
- && !memcmp(table_name, S_innodb_monitor,
- sizeof S_innodb_monitor)) {
+ && !memcmp(table_name, S_innodb_monitor,
+ sizeof S_innodb_monitor)) {
/* Table equals "innodb_monitor":
start monitor prints */
@@ -1805,41 +1818,43 @@ row_create_table_for_mysql(
os_event_set(srv_lock_timeout_thread_event);
} else if (table_name_len == sizeof S_innodb_lock_monitor
- && !memcmp(table_name, S_innodb_lock_monitor,
- sizeof S_innodb_lock_monitor)) {
+ && !memcmp(table_name, S_innodb_lock_monitor,
+ sizeof S_innodb_lock_monitor)) {
srv_print_innodb_monitor = TRUE;
srv_print_innodb_lock_monitor = TRUE;
os_event_set(srv_lock_timeout_thread_event);
} else if (table_name_len == sizeof S_innodb_tablespace_monitor
- && !memcmp(table_name, S_innodb_tablespace_monitor,
- sizeof S_innodb_tablespace_monitor)) {
+ && !memcmp(table_name, S_innodb_tablespace_monitor,
+ sizeof S_innodb_tablespace_monitor)) {
srv_print_innodb_tablespace_monitor = TRUE;
os_event_set(srv_lock_timeout_thread_event);
} else if (table_name_len == sizeof S_innodb_table_monitor
- && !memcmp(table_name, S_innodb_table_monitor,
- sizeof S_innodb_table_monitor)) {
+ && !memcmp(table_name, S_innodb_table_monitor,
+ sizeof S_innodb_table_monitor)) {
srv_print_innodb_table_monitor = TRUE;
os_event_set(srv_lock_timeout_thread_event);
} else if (table_name_len == sizeof S_innodb_mem_validate
- && !memcmp(table_name, S_innodb_mem_validate,
- sizeof S_innodb_mem_validate)) {
+ && !memcmp(table_name, S_innodb_mem_validate,
+ sizeof S_innodb_mem_validate)) {
/* We define here a debugging feature intended for
developers */
fputs("Validating InnoDB memory:\n"
- "to use this feature you must compile InnoDB with\n"
- "UNIV_MEM_DEBUG defined in univ.i and the server must be\n"
- "quiet because allocation from a mem heap is not protected\n"
- "by any semaphore.\n", stderr);
+ "to use this feature you must compile InnoDB with\n"
+ "UNIV_MEM_DEBUG defined in univ.i and"
+ " the server must be\n"
+ "quiet because allocation from a mem heap"
+ " is not protected\n"
+ "by any semaphore.\n", stderr);
#ifdef UNIV_MEM_DEBUG
ut_a(mem_validate());
fputs("Memory validated\n", stderr);
#else /* UNIV_MEM_DEBUG */
fputs("Memory NOT validated (recompile with UNIV_MEM_DEBUG)\n",
- stderr);
+ stderr);
#endif /* UNIV_MEM_DEBUG */
}
@@ -1867,14 +1882,14 @@ row_create_table_for_mysql(
ut_print_timestamp(stderr);
fputs(" InnoDB: Warning: cannot create table ",
- stderr);
+ stderr);
ut_print_name(stderr, trx, TRUE, table->name);
fputs(" because tablespace full\n", stderr);
if (dict_table_get_low(table->name)) {
row_drop_table_for_mysql(table->name, trx,
- FALSE);
+ FALSE);
}
} else if (err == DB_DUPLICATE_KEY) {
@@ -1883,18 +1898,27 @@ row_create_table_for_mysql(
fputs(" InnoDB: Error: table ", stderr);
ut_print_name(stderr, trx, TRUE, table->name);
fputs(" already exists in InnoDB internal\n"
- "InnoDB: data dictionary. Have you deleted the .frm file\n"
- "InnoDB: and not used DROP TABLE? Have you used DROP DATABASE\n"
- "InnoDB: for InnoDB tables in MySQL version <= 3.23.43?\n"
- "InnoDB: See the Restrictions section of the InnoDB manual.\n"
- "InnoDB: You can drop the orphaned table inside InnoDB by\n"
- "InnoDB: creating an InnoDB table with the same name in another\n"
- "InnoDB: database and copying the .frm file to the current database.\n"
- "InnoDB: Then MySQL thinks the table exists, and DROP TABLE will\n"
- "InnoDB: succeed.\n"
- "InnoDB: You can look for further help from\n"
-"InnoDB: http://dev.mysql.com/doc/refman/5.1/en/innodb-troubleshooting.html\n",
- stderr);
+ "InnoDB: data dictionary. Have you deleted"
+ " the .frm file\n"
+ "InnoDB: and not used DROP TABLE?"
+ " Have you used DROP DATABASE\n"
+ "InnoDB: for InnoDB tables in"
+ " MySQL version <= 3.23.43?\n"
+ "InnoDB: See the Restrictions section"
+ " of the InnoDB manual.\n"
+ "InnoDB: You can drop the orphaned table"
+ " inside InnoDB by\n"
+ "InnoDB: creating an InnoDB table with"
+ " the same name in another\n"
+ "InnoDB: database and copying the .frm file"
+ " to the current database.\n"
+ "InnoDB: Then MySQL thinks the table exists,"
+ " and DROP TABLE will\n"
+ "InnoDB: succeed.\n"
+ "InnoDB: You can look for further help from\n"
+ "InnoDB: http://dev.mysql.com/doc/refman/5.1/en/"
+ "innodb-troubleshooting.html\n",
+ stderr);
}
/* We may also get err == DB_ERROR if the .ibd file for the
@@ -1951,20 +1975,21 @@ row_create_index_for_mysql(
for (i = 0; i < dict_index_get_n_fields(index); i++) {
for (j = 0; j < i; j++) {
- if (0 == ut_strcmp(
- dict_index_get_nth_field(index, j)->name,
- dict_index_get_nth_field(index, i)->name)) {
+ if (0 == ut_strcmp
+ (dict_index_get_nth_field(index, j)->name,
+ dict_index_get_nth_field(index, i)->name)) {
ut_print_timestamp(stderr);
fputs(" InnoDB: Error: column ", stderr);
ut_print_name(stderr, trx, FALSE,
- dict_index_get_nth_field(index, i)->name);
+ dict_index_get_nth_field
+ (index, i)->name);
fputs(" appears twice in ", stderr);
dict_index_name_print(stderr, trx, index);
fputs("\n"
- "InnoDB: This is not allowed in InnoDB.\n",
- stderr);
+ "InnoDB: This is not allowed"
+ " in InnoDB.\n", stderr);
err = DB_COL_APPEARS_TWICE_IN_INDEX;
@@ -2065,7 +2090,7 @@ row_table_add_foreign_constraints(
trx->dict_operation = TRUE;
err = dict_create_foreign_constraints(trx, sql_string, name,
- reject_fks);
+ reject_fks);
if (err == DB_SUCCESS) {
/* Check that also referencing constraints are ok */
@@ -2112,7 +2137,7 @@ row_drop_table_for_mysql_in_background(
trx->check_foreigns = FALSE;
-/* fputs("InnoDB: Error: Dropping table ", stderr);
+ /* fputs("InnoDB: Error: Dropping table ", stderr);
ut_print_name(stderr, trx, TRUE, name);
fputs(" in background drop list\n", stderr); */
@@ -2180,8 +2205,8 @@ loop:
goto already_dropped;
}
- if (DB_SUCCESS != row_drop_table_for_mysql_in_background(
- drop->table_name)) {
+ if (DB_SUCCESS != row_drop_table_for_mysql_in_background
+ (drop->table_name)) {
/* If the DROP fails for some table, we return, and let the
main thread retry later */
@@ -2276,7 +2301,7 @@ row_add_table_to_background_drop_list(
UT_LIST_ADD_LAST(row_mysql_drop_list, row_mysql_drop_list, drop);
-/* fputs("InnoDB: Adding table ", stderr);
+ /* fputs("InnoDB: Adding table ", stderr);
ut_print_name(stderr, trx, TRUE, drop->table_name);
fputs(" to background drop list\n", stderr); */
@@ -2305,25 +2330,34 @@ row_discard_tablespace_for_mysql(
ulint err;
pars_info_t* info = NULL;
-/* How do we prevent crashes caused by ongoing operations on the table? Old
-operations could try to access non-existent pages.
-
-1) SQL queries, INSERT, SELECT, ...: we must get an exclusive MySQL table lock
-on the table before we can do DISCARD TABLESPACE. Then there are no running
-queries on the table.
-2) Purge and rollback: we assign a new table id for the table. Since purge and
-rollback look for the table based on the table id, they see the table as
-'dropped' and discard their operations.
-3) Insert buffer: we remove all entries for the tablespace in the insert
-buffer tree; as long as the tablespace mem object does not exist, ongoing
-insert buffer page merges are discarded in buf0rea.c. If we recreate the
-tablespace mem object with IMPORT TABLESPACE later, then the tablespace will
-have the same id, but the tablespace_version field in the mem object is
-different, and ongoing old insert buffer page merges get discarded.
-4) Linear readahead and random readahead: we use the same method as in 3) to
-discard ongoing operations.
-5) FOREIGN KEY operations: if table->n_foreign_key_checks_running > 0, we
-do not allow the discard. We also reserve the data dictionary latch. */
+ /* How do we prevent crashes caused by ongoing operations on
+ the table? Old operations could try to access non-existent
+ pages.
+
+ 1) SQL queries, INSERT, SELECT, ...: we must get an exclusive
+ MySQL table lock on the table before we can do DISCARD
+ TABLESPACE. Then there are no running queries on the table.
+
+ 2) Purge and rollback: we assign a new table id for the
+ table. Since purge and rollback look for the table based on
+ the table id, they see the table as 'dropped' and discard
+ their operations.
+
+ 3) Insert buffer: we remove all entries for the tablespace in
+ the insert buffer tree; as long as the tablespace mem object
+ does not exist, ongoing insert buffer page merges are
+ discarded in buf0rea.c. If we recreate the tablespace mem
+ object with IMPORT TABLESPACE later, then the tablespace will
+ have the same id, but the tablespace_version field in the mem
+ object is different, and ongoing old insert buffer page merges
+ get discarded.
+
+ 4) Linear readahead and random readahead: we use the same
+ method as in 3) to discard ongoing operations.
+
+ 5) FOREIGN KEY operations: if
+ table->n_foreign_key_checks_running > 0, we do not allow the
+ discard. We also reserve the data dictionary latch. */
ut_ad(trx->mysql_thread_id == os_thread_get_curr_id());
@@ -2348,7 +2382,8 @@ do not allow the discard. We also reserve the data dictionary latch. */
fputs(" InnoDB: Error: table ", stderr);
ut_print_name(stderr, trx, TRUE, name);
fputs("\n"
-"InnoDB: is in the system tablespace 0 which cannot be discarded\n", stderr);
+ "InnoDB: is in the system tablespace 0"
+ " which cannot be discarded\n", stderr);
err = DB_ERROR;
goto funct_exit;
@@ -2360,9 +2395,10 @@ do not allow the discard. We also reserve the data dictionary latch. */
fputs(" InnoDB: You are trying to DISCARD table ", stderr);
ut_print_name(stderr, trx, TRUE, table->name);
fputs("\n"
- "InnoDB: though there is a foreign key check running on it.\n"
- "InnoDB: Cannot discard the table.\n",
- stderr);
+ "InnoDB: though there is a foreign key check"
+ " running on it.\n"
+ "InnoDB: Cannot discard the table.\n",
+ stderr);
err = DB_ERROR;
@@ -2394,7 +2430,7 @@ do not allow the discard. We also reserve the data dictionary latch. */
fputs(" Cannot DISCARD table ", ef);
ut_print_name(ef, trx, TRUE, name);
fputs("\n"
- "because it is referenced by ", ef);
+ "because it is referenced by ", ef);
ut_print_name(ef, trx, TRUE, foreign->foreign_table_name);
putc('\n', ef);
mutex_exit(&dict_foreign_err_mutex);
@@ -2413,26 +2449,26 @@ do not allow the discard. We also reserve the data dictionary latch. */
pars_info_add_dulint_literal(info, "new_id", new_id);
err = que_eval_sql(info,
- "PROCEDURE DISCARD_TABLESPACE_PROC () IS\n"
- "old_id CHAR;\n"
- "BEGIN\n"
- "SELECT ID INTO old_id\n"
- "FROM SYS_TABLES\n"
- "WHERE NAME = :table_name\n"
- "LOCK IN SHARE MODE;\n"
- "IF (SQL % NOTFOUND) THEN\n"
- " COMMIT WORK;\n"
- " RETURN;\n"
- "END IF;\n"
- "UPDATE SYS_TABLES SET ID = :new_id\n"
- " WHERE ID = old_id;\n"
- "UPDATE SYS_COLUMNS SET TABLE_ID = :new_id\n"
- " WHERE TABLE_ID = old_id;\n"
- "UPDATE SYS_INDEXES SET TABLE_ID = :new_id\n"
- " WHERE TABLE_ID = old_id;\n"
- "COMMIT WORK;\n"
- "END;\n"
- , FALSE, trx);
+ "PROCEDURE DISCARD_TABLESPACE_PROC () IS\n"
+ "old_id CHAR;\n"
+ "BEGIN\n"
+ "SELECT ID INTO old_id\n"
+ "FROM SYS_TABLES\n"
+ "WHERE NAME = :table_name\n"
+ "LOCK IN SHARE MODE;\n"
+ "IF (SQL % NOTFOUND) THEN\n"
+ " COMMIT WORK;\n"
+ " RETURN;\n"
+ "END IF;\n"
+ "UPDATE SYS_TABLES SET ID = :new_id\n"
+ " WHERE ID = old_id;\n"
+ "UPDATE SYS_COLUMNS SET TABLE_ID = :new_id\n"
+ " WHERE TABLE_ID = old_id;\n"
+ "UPDATE SYS_INDEXES SET TABLE_ID = :new_id\n"
+ " WHERE TABLE_ID = old_id;\n"
+ "COMMIT WORK;\n"
+ "END;\n"
+ , FALSE, trx);
if (err != DB_SUCCESS) {
trx->error_state = DB_SUCCESS;
@@ -2510,7 +2546,8 @@ row_import_tablespace_for_mysql(
fputs(" InnoDB: Error: cannot reset lsn's in table ", stderr);
ut_print_name(stderr, trx, TRUE, name);
fputs("\n"
- "InnoDB: in ALTER TABLE ... IMPORT TABLESPACE\n", stderr);
+ "InnoDB: in ALTER TABLE ... IMPORT TABLESPACE\n",
+ stderr);
err = DB_ERROR;
@@ -2531,9 +2568,9 @@ row_import_tablespace_for_mysql(
fputs(" InnoDB: table ", stderr);
ut_print_name(stderr, trx, TRUE, name);
fputs("\n"
-"InnoDB: does not exist in the InnoDB data dictionary\n"
-"InnoDB: in ALTER TABLE ... IMPORT TABLESPACE\n",
- stderr);
+ "InnoDB: does not exist in the InnoDB data dictionary\n"
+ "InnoDB: in ALTER TABLE ... IMPORT TABLESPACE\n",
+ stderr);
err = DB_TABLE_NOT_FOUND;
@@ -2545,7 +2582,8 @@ row_import_tablespace_for_mysql(
fputs(" InnoDB: Error: table ", stderr);
ut_print_name(stderr, trx, TRUE, name);
fputs("\n"
-"InnoDB: is in the system tablespace 0 which cannot be imported\n", stderr);
+ "InnoDB: is in the system tablespace 0"
+ " which cannot be imported\n", stderr);
err = DB_ERROR;
goto funct_exit;
@@ -2553,12 +2591,13 @@ row_import_tablespace_for_mysql(
if (!table->tablespace_discarded) {
ut_print_timestamp(stderr);
- fputs(
-" InnoDB: Error: you are trying to IMPORT a tablespace\n"
-"InnoDB: ", stderr);
+ fputs(" InnoDB: Error: you are trying to"
+ " IMPORT a tablespace\n"
+ "InnoDB: ", stderr);
ut_print_name(stderr, trx, TRUE, name);
fputs(", though you have not called DISCARD on it yet\n"
-"InnoDB: during the lifetime of the mysqld process!\n", stderr);
+ "InnoDB: during the lifetime of the mysqld process!\n",
+ stderr);
err = DB_ERROR;
@@ -2571,20 +2610,20 @@ row_import_tablespace_for_mysql(
ibuf_delete_for_discarded_space(table->space);
success = fil_open_single_table_tablespace(TRUE, table->space,
- table->name);
+ table->name);
if (success) {
table->ibd_file_missing = FALSE;
table->tablespace_discarded = FALSE;
} else {
if (table->ibd_file_missing) {
ut_print_timestamp(stderr);
- fputs(
-" InnoDB: cannot find or open in the database directory the .ibd file of\n"
-"InnoDB: table ", stderr);
+ fputs(" InnoDB: cannot find or open in the"
+ " database directory the .ibd file of\n"
+ "InnoDB: table ", stderr);
ut_print_name(stderr, trx, TRUE, name);
fputs("\n"
-"InnoDB: in ALTER TABLE ... IMPORT TABLESPACE\n",
- stderr);
+ "InnoDB: in ALTER TABLE ... IMPORT TABLESPACE\n",
+ stderr);
}
err = DB_ERROR;
@@ -2622,43 +2661,51 @@ row_truncate_table_for_mysql(
dulint new_id;
pars_info_t* info = NULL;
-/* How do we prevent crashes caused by ongoing operations on the table? Old
-operations could try to access non-existent pages.
-
-1) SQL queries, INSERT, SELECT, ...: we must get an exclusive MySQL table lock
-on the table before we can do TRUNCATE TABLE. Then there are no running
-queries on the table. This is guaranteed, because in
-ha_innobase::store_lock(), we do not weaken the TL_WRITE lock requested
-by MySQL when executing SQLCOM_TRUNCATE.
-2) Purge and rollback: we assign a new table id for the table. Since purge and
-rollback look for the table based on the table id, they see the table as
-'dropped' and discard their operations.
-3) Insert buffer: TRUNCATE TABLE is analogous to DROP TABLE, so we do not
-have to remove insert buffer records, as the insert buffer works at a low
-level. If a freed page is later reallocated, the allocator will remove
-the ibuf entries for it.
-
-TODO: when we truncate *.ibd files (analogous to DISCARD TABLESPACE), we
-will have to remove we remove all entries for the table in the insert
-buffer tree!
-
-4) Linear readahead and random readahead: we use the same method as in 3) to
-discard ongoing operations. (This will only be relevant for TRUNCATE TABLE
-by DISCARD TABLESPACE.)
-5) FOREIGN KEY operations: if table->n_foreign_key_checks_running > 0, we
-do not allow the TRUNCATE. We also reserve the data dictionary latch. */
+ /* How do we prevent crashes caused by ongoing operations on
+ the table? Old operations could try to access non-existent
+ pages.
+
+ 1) SQL queries, INSERT, SELECT, ...: we must get an exclusive
+ MySQL table lock on the table before we can do TRUNCATE
+ TABLE. Then there are no running queries on the table. This is
+ guaranteed, because in ha_innobase::store_lock(), we do not
+ weaken the TL_WRITE lock requested by MySQL when executing
+ SQLCOM_TRUNCATE.
+
+ 2) Purge and rollback: we assign a new table id for the
+ table. Since purge and rollback look for the table based on
+ the table id, they see the table as 'dropped' and discard
+ their operations.
+
+ 3) Insert buffer: TRUNCATE TABLE is analogous to DROP TABLE,
+ so we do not have to remove insert buffer records, as the
+ insert buffer works at a low level. If a freed page is later
+ reallocated, the allocator will remove the ibuf entries for
+ it.
+
+ TODO: when we truncate *.ibd files (analogous to DISCARD
+ TABLESPACE), we will have to remove we remove all entries for
+ the table in the insert buffer tree!
+
+ 4) Linear readahead and random readahead: we use the same
+ method as in 3) to discard ongoing operations. (This will only
+ be relevant for TRUNCATE TABLE by DISCARD TABLESPACE.)
+
+ 5) FOREIGN KEY operations: if
+ table->n_foreign_key_checks_running > 0, we do not allow the
+ TRUNCATE. We also reserve the data dictionary latch. */
ut_ad(trx->mysql_thread_id == os_thread_get_curr_id());
ut_ad(table);
if (srv_created_new_raw) {
- fputs(
- "InnoDB: A new raw disk partition was initialized or\n"
- "InnoDB: innodb_force_recovery is on: we do not allow\n"
- "InnoDB: database modifications by the user. Shut down\n"
- "InnoDB: mysqld and edit my.cnf so that newraw is replaced\n"
- "InnoDB: with raw, and innodb_force_... is removed.\n",
- stderr);
+ fputs("InnoDB: A new raw disk partition was initialized or\n"
+ "InnoDB: innodb_force_recovery is on: we do not allow\n"
+ "InnoDB: database modifications by the user. Shut down\n"
+ "InnoDB: mysqld and edit my.cnf so that newraw"
+ " is replaced\n"
+ "InnoDB: with raw, and innodb_force_... is removed.\n",
+ stderr);
return(DB_ERROR);
}
@@ -2703,7 +2750,7 @@ do not allow the TRUNCATE. We also reserve the data dictionary latch. */
fputs(" Cannot truncate table ", ef);
ut_print_name(ef, trx, TRUE, table->name);
fputs(" by DROP+CREATE\n"
- "InnoDB: because it is referenced by ", ef);
+ "InnoDB: because it is referenced by ", ef);
ut_print_name(ef, trx, TRUE, foreign->foreign_table_name);
putc('\n', ef);
mutex_exit(&dict_foreign_err_mutex);
@@ -2723,8 +2770,9 @@ do not allow the TRUNCATE. We also reserve the data dictionary latch. */
fputs(" InnoDB: Cannot truncate table ", stderr);
ut_print_name(stderr, trx, TRUE, table->name);
fputs(" by DROP+CREATE\n"
-"InnoDB: because there is a foreign key check running on it.\n",
- stderr);
+ "InnoDB: because there is a foreign key check"
+ " running on it.\n",
+ stderr);
err = DB_ERROR;
goto funct_exit;
@@ -2751,7 +2799,7 @@ do not allow the TRUNCATE. We also reserve the data dictionary latch. */
mtr_start(&mtr);
btr_pcur_open_on_user_rec(sys_index, tuple, PAGE_CUR_GE,
- BTR_MODIFY_LEAF, &pcur, &mtr);
+ BTR_MODIFY_LEAF, &pcur, &mtr);
for (;;) {
rec_t* rec;
const byte* field;
@@ -2787,9 +2835,9 @@ do not allow the TRUNCATE. We also reserve the data dictionary latch. */
rec = btr_pcur_get_rec(&pcur);
if (root_page_no != FIL_NULL) {
- page_rec_write_index_page_no(rec,
- DICT_SYS_INDEXES_PAGE_NO_FIELD,
- root_page_no, &mtr);
+ page_rec_write_index_page_no
+ (rec, DICT_SYS_INDEXES_PAGE_NO_FIELD,
+ root_page_no, &mtr);
/* We will need to commit and restart the
mini-transaction in order to avoid deadlocks.
The dict_truncate_index_tree() call has allocated
@@ -2798,10 +2846,10 @@ do not allow the TRUNCATE. We also reserve the data dictionary latch. */
mtr_commit(&mtr);
mtr_start(&mtr);
btr_pcur_restore_position(BTR_MODIFY_LEAF,
- &pcur, &mtr);
+ &pcur, &mtr);
}
- next_rec:
+next_rec:
btr_pcur_move_to_next_user_rec(&pcur, &mtr);
}
@@ -2818,28 +2866,29 @@ do not allow the TRUNCATE. We also reserve the data dictionary latch. */
pars_info_add_dulint_literal(info, "new_id", new_id);
err = que_eval_sql(info,
- "PROCEDURE RENUMBER_TABLESPACE_PROC () IS\n"
- "BEGIN\n"
- "UPDATE SYS_TABLES SET ID = :new_id\n"
- " WHERE ID = :old_id;\n"
- "UPDATE SYS_COLUMNS SET TABLE_ID = :new_id\n"
- " WHERE TABLE_ID = :old_id;\n"
- "UPDATE SYS_INDEXES SET TABLE_ID = :new_id\n"
- " WHERE TABLE_ID = :old_id;\n"
- "COMMIT WORK;\n"
- "END;\n"
- , FALSE, trx);
+ "PROCEDURE RENUMBER_TABLESPACE_PROC () IS\n"
+ "BEGIN\n"
+ "UPDATE SYS_TABLES SET ID = :new_id\n"
+ " WHERE ID = :old_id;\n"
+ "UPDATE SYS_COLUMNS SET TABLE_ID = :new_id\n"
+ " WHERE TABLE_ID = :old_id;\n"
+ "UPDATE SYS_INDEXES SET TABLE_ID = :new_id\n"
+ " WHERE TABLE_ID = :old_id;\n"
+ "COMMIT WORK;\n"
+ "END;\n"
+ , FALSE, trx);
if (err != DB_SUCCESS) {
trx->error_state = DB_SUCCESS;
trx_general_rollback_for_mysql(trx, FALSE, NULL);
trx->error_state = DB_SUCCESS;
ut_print_timestamp(stderr);
-fputs(" InnoDB: Unable to assign a new identifier to table ", stderr);
+ fputs(" InnoDB: Unable to assign a new identifier to table ",
+ stderr);
ut_print_name(stderr, trx, TRUE, table->name);
fputs("\n"
-"InnoDB: after truncating it. Background processes may corrupt the table!\n",
- stderr);
+ "InnoDB: after truncating it. Background processes"
+ " may corrupt the table!\n", stderr);
err = DB_ERROR;
} else {
dict_table_change_id_in_cache(table, new_id);
@@ -2889,13 +2938,13 @@ row_drop_table_for_mysql(
ut_a(name != NULL);
if (srv_created_new_raw) {
- fputs(
- "InnoDB: A new raw disk partition was initialized or\n"
- "InnoDB: innodb_force_recovery is on: we do not allow\n"
- "InnoDB: database modifications by the user. Shut down\n"
- "InnoDB: mysqld and edit my.cnf so that newraw is replaced\n"
- "InnoDB: with raw, and innodb_force_... is removed.\n",
- stderr);
+ fputs("InnoDB: A new raw disk partition was initialized or\n"
+ "InnoDB: innodb_force_recovery is on: we do not allow\n"
+ "InnoDB: database modifications by the user. Shut down\n"
+ "InnoDB: mysqld and edit my.cnf so that newraw"
+ " is replaced\n"
+ "InnoDB: with raw, and innodb_force_... is removed.\n",
+ stderr);
return(DB_ERROR);
}
@@ -2914,8 +2963,8 @@ row_drop_table_for_mysql(
namelen = strlen(table_name) + 1;
if (namelen == sizeof S_innodb_monitor
- && !memcmp(table_name, S_innodb_monitor,
- sizeof S_innodb_monitor)) {
+ && !memcmp(table_name, S_innodb_monitor,
+ sizeof S_innodb_monitor)) {
/* Table name equals "innodb_monitor":
stop monitor prints */
@@ -2923,18 +2972,18 @@ row_drop_table_for_mysql(
srv_print_innodb_monitor = FALSE;
srv_print_innodb_lock_monitor = FALSE;
} else if (namelen == sizeof S_innodb_lock_monitor
- && !memcmp(table_name, S_innodb_lock_monitor,
- sizeof S_innodb_lock_monitor)) {
+ && !memcmp(table_name, S_innodb_lock_monitor,
+ sizeof S_innodb_lock_monitor)) {
srv_print_innodb_monitor = FALSE;
srv_print_innodb_lock_monitor = FALSE;
} else if (namelen == sizeof S_innodb_tablespace_monitor
- && !memcmp(table_name, S_innodb_tablespace_monitor,
- sizeof S_innodb_tablespace_monitor)) {
+ && !memcmp(table_name, S_innodb_tablespace_monitor,
+ sizeof S_innodb_tablespace_monitor)) {
srv_print_innodb_tablespace_monitor = FALSE;
} else if (namelen == sizeof S_innodb_table_monitor
- && !memcmp(table_name, S_innodb_table_monitor,
- sizeof S_innodb_table_monitor)) {
+ && !memcmp(table_name, S_innodb_table_monitor,
+ sizeof S_innodb_table_monitor)) {
srv_print_innodb_table_monitor = FALSE;
}
@@ -2965,12 +3014,16 @@ row_drop_table_for_mysql(
fputs(" InnoDB: Error: table ", stderr);
ut_print_name(stderr, trx, TRUE, name);
fputs(" does not exist in the InnoDB internal\n"
- "InnoDB: data dictionary though MySQL is trying to drop it.\n"
- "InnoDB: Have you copied the .frm file of the table to the\n"
- "InnoDB: MySQL database directory from another database?\n"
- "InnoDB: You can look for further help from\n"
-"InnoDB: http://dev.mysql.com/doc/refman/5.1/en/innodb-troubleshooting.html\n",
- stderr);
+ "InnoDB: data dictionary though MySQL is"
+ " trying to drop it.\n"
+ "InnoDB: Have you copied the .frm file"
+ " of the table to the\n"
+ "InnoDB: MySQL database directory"
+ " from another database?\n"
+ "InnoDB: You can look for further help from\n"
+ "InnoDB: http://dev.mysql.com/doc/refman/5.1/en/"
+ "innodb-troubleshooting.html\n",
+ stderr);
goto funct_exit;
}
@@ -2980,13 +3033,13 @@ row_drop_table_for_mysql(
foreign = UT_LIST_GET_FIRST(table->referenced_list);
while (foreign && foreign->foreign_table == table) {
- check_next_foreign:
+check_next_foreign:
foreign = UT_LIST_GET_NEXT(referenced_list, foreign);
}
- if (foreign && trx->check_foreigns &&
- !(drop_db && dict_tables_have_same_db(
- name, foreign->foreign_table_name))) {
+ if (foreign && trx->check_foreigns
+ && !(drop_db && dict_tables_have_same_db
+ (name, foreign->foreign_table_name))) {
FILE* ef = dict_foreign_err_file;
/* We only allow dropping a referenced table if
@@ -3001,7 +3054,7 @@ row_drop_table_for_mysql(
fputs(" Cannot drop table ", ef);
ut_print_name(ef, trx, TRUE, name);
fputs("\n"
- "because it is referenced by ", ef);
+ "because it is referenced by ", ef);
ut_print_name(ef, trx, TRUE, foreign->foreign_table_name);
putc('\n', ef);
mutex_exit(&dict_foreign_err_mutex);
@@ -3020,12 +3073,15 @@ row_drop_table_for_mysql(
if (added) {
ut_print_timestamp(stderr);
-fputs(" InnoDB: Warning: MySQL is trying to drop table ", stderr);
+ fputs(" InnoDB: Warning: MySQL is"
+ " trying to drop table ", stderr);
ut_print_name(stderr, trx, TRUE, table->name);
fputs("\n"
-"InnoDB: though there are still open handles to it.\n"
-"InnoDB: Adding the table to the background drop queue.\n",
- stderr);
+ "InnoDB: though there are still"
+ " open handles to it.\n"
+ "InnoDB: Adding the table to the"
+ " background drop queue.\n",
+ stderr);
/* We return DB_SUCCESS to MySQL though the drop will
happen lazily later */
@@ -3053,12 +3109,15 @@ fputs(" InnoDB: Warning: MySQL is trying to drop table ", stderr);
if (added) {
ut_print_timestamp(stderr);
-fputs(" InnoDB: You are trying to drop table ", stderr);
+ fputs(" InnoDB: You are trying to drop table ",
+ stderr);
ut_print_name(stderr, trx, TRUE, table->name);
fputs("\n"
-"InnoDB: though there is a foreign key check running on it.\n"
-"InnoDB: Adding the table to the background drop queue.\n",
- stderr);
+ "InnoDB: though there is a"
+ " foreign key check running on it.\n"
+ "InnoDB: Adding the table to"
+ " the background drop queue.\n",
+ stderr);
/* We return DB_SUCCESS to MySQL though the drop will
happen lazily later */
@@ -3089,67 +3148,74 @@ fputs(" InnoDB: You are trying to drop table ", stderr);
pars_info_add_str_literal(info, "table_name", name);
err = que_eval_sql(info,
- "PROCEDURE DROP_TABLE_PROC () IS\n"
- "sys_foreign_id CHAR;\n"
- "table_id CHAR;\n"
- "index_id CHAR;\n"
- "foreign_id CHAR;\n"
- "found INT;\n"
- "BEGIN\n"
- "SELECT ID INTO table_id\n"
- "FROM SYS_TABLES\n"
- "WHERE NAME = :table_name\n"
- "LOCK IN SHARE MODE;\n"
- "IF (SQL % NOTFOUND) THEN\n"
- " COMMIT WORK;\n"
- " RETURN;\n"
- "END IF;\n"
- "found := 1;\n"
- "SELECT ID INTO sys_foreign_id\n"
- "FROM SYS_TABLES\n"
- "WHERE NAME = 'SYS_FOREIGN'\n"
- "LOCK IN SHARE MODE;\n"
- "IF (SQL % NOTFOUND) THEN\n"
- " found := 0;\n"
- "END IF;\n"
- "IF (:table_name = 'SYS_FOREIGN') THEN\n"
- " found := 0;\n"
- "END IF;\n"
- "IF (:table_name = 'SYS_FOREIGN_COLS') THEN\n"
- " found := 0;\n"
- "END IF;\n"
- "WHILE found = 1 LOOP\n"
- " SELECT ID INTO foreign_id\n"
- " FROM SYS_FOREIGN\n"
- " WHERE FOR_NAME = :table_name\n"
- " AND TO_BINARY(FOR_NAME) = TO_BINARY(:table_name)\n"
- " LOCK IN SHARE MODE;\n"
- " IF (SQL % NOTFOUND) THEN\n"
- " found := 0;\n"
- " ELSE"
- " DELETE FROM SYS_FOREIGN_COLS WHERE ID = foreign_id;\n"
- " DELETE FROM SYS_FOREIGN WHERE ID = foreign_id;\n"
- " END IF;\n"
- "END LOOP;\n"
- "found := 1;\n"
- "WHILE found = 1 LOOP\n"
- " SELECT ID INTO index_id\n"
- " FROM SYS_INDEXES\n"
- " WHERE TABLE_ID = table_id\n"
- " LOCK IN SHARE MODE;\n"
- " IF (SQL % NOTFOUND) THEN\n"
- " found := 0;\n"
- " ELSE"
- " DELETE FROM SYS_FIELDS WHERE INDEX_ID = index_id;\n"
- " DELETE FROM SYS_INDEXES WHERE ID = index_id\n"
- " AND TABLE_ID = table_id;\n"
- " END IF;\n"
- "END LOOP;\n"
- "DELETE FROM SYS_COLUMNS WHERE TABLE_ID = table_id;\n"
- "DELETE FROM SYS_TABLES WHERE ID = table_id;\n"
- "COMMIT WORK;\n"
- "END;\n"
- , FALSE, trx);
+ "PROCEDURE DROP_TABLE_PROC () IS\n"
+ "sys_foreign_id CHAR;\n"
+ "table_id CHAR;\n"
+ "index_id CHAR;\n"
+ "foreign_id CHAR;\n"
+ "found INT;\n"
+ "BEGIN\n"
+ "SELECT ID INTO table_id\n"
+ "FROM SYS_TABLES\n"
+ "WHERE NAME = :table_name\n"
+ "LOCK IN SHARE MODE;\n"
+ "IF (SQL % NOTFOUND) THEN\n"
+ " COMMIT WORK;\n"
+ " RETURN;\n"
+ "END IF;\n"
+ "found := 1;\n"
+ "SELECT ID INTO sys_foreign_id\n"
+ "FROM SYS_TABLES\n"
+ "WHERE NAME = 'SYS_FOREIGN'\n"
+ "LOCK IN SHARE MODE;\n"
+ "IF (SQL % NOTFOUND) THEN\n"
+ " found := 0;\n"
+ "END IF;\n"
+ "IF (:table_name = 'SYS_FOREIGN') THEN\n"
+ " found := 0;\n"
+ "END IF;\n"
+ "IF (:table_name = 'SYS_FOREIGN_COLS') THEN\n"
+ " found := 0;\n"
+ "END IF;\n"
+ "WHILE found = 1 LOOP\n"
+ " SELECT ID INTO foreign_id\n"
+ " FROM SYS_FOREIGN\n"
+ " WHERE FOR_NAME = :table_name\n"
+ " AND TO_BINARY(FOR_NAME)\n"
+ " = TO_BINARY(:table_name)\n"
+ " LOCK IN SHARE MODE;\n"
+ " IF (SQL % NOTFOUND) THEN\n"
+ " found := 0;\n"
+ " ELSE\n"
+ " DELETE FROM SYS_FOREIGN_COLS\n"
+ " WHERE ID = foreign_id;\n"
+ " DELETE FROM SYS_FOREIGN\n"
+ " WHERE ID = foreign_id;\n"
+ " END IF;\n"
+ "END LOOP;\n"
+ "found := 1;\n"
+ "WHILE found = 1 LOOP\n"
+ " SELECT ID INTO index_id\n"
+ " FROM SYS_INDEXES\n"
+ " WHERE TABLE_ID = table_id\n"
+ " LOCK IN SHARE MODE;\n"
+ " IF (SQL % NOTFOUND) THEN\n"
+ " found := 0;\n"
+ " ELSE\n"
+ " DELETE FROM SYS_FIELDS\n"
+ " WHERE INDEX_ID = index_id;\n"
+ " DELETE FROM SYS_INDEXES\n"
+ " WHERE ID = index_id\n"
+ " AND TABLE_ID = table_id;\n"
+ " END IF;\n"
+ "END LOOP;\n"
+ "DELETE FROM SYS_COLUMNS\n"
+ "WHERE TABLE_ID = table_id;\n"
+ "DELETE FROM SYS_TABLES\n"
+ "WHERE ID = table_id;\n"
+ "COMMIT WORK;\n"
+ "END;\n"
+ , FALSE, trx);
if (err != DB_SUCCESS) {
ut_a(err == DB_OUT_OF_FILE_SPACE);
@@ -3166,8 +3232,8 @@ fputs(" InnoDB: You are trying to drop table ", stderr);
space_id = table->space;
if (table->dir_path_of_temp_table != NULL) {
- dir_path_of_temp_table =
- mem_strdup(table->dir_path_of_temp_table);
+ dir_path_of_temp_table = mem_strdup
+ (table->dir_path_of_temp_table);
is_path = TRUE;
name_or_path = dir_path_of_temp_table;
} else {
@@ -3180,7 +3246,7 @@ fputs(" InnoDB: You are trying to drop table ", stderr);
if (dict_load_table(name) != NULL) {
ut_print_timestamp(stderr);
fputs(" InnoDB: Error: not able to remove table ",
- stderr);
+ stderr);
ut_print_name(stderr, trx, TRUE, name);
fputs(" from the dictionary cache!\n", stderr);
err = DB_ERROR;
@@ -3191,14 +3257,15 @@ fputs(" InnoDB: You are trying to drop table ", stderr);
if (err == DB_SUCCESS && space_id > 0) {
if (!fil_space_for_table_exists_in_mem(space_id,
- name_or_path,
- is_path,
- FALSE, TRUE)) {
+ name_or_path,
+ is_path,
+ FALSE, TRUE)) {
err = DB_SUCCESS;
fprintf(stderr,
-"InnoDB: We removed now the InnoDB internal data dictionary entry\n"
-"InnoDB: of table ");
+ "InnoDB: We removed now the InnoDB"
+ " internal data dictionary entry\n"
+ "InnoDB: of table ");
ut_print_name(stderr, trx, TRUE, name);
fprintf(stderr, ".\n");
@@ -3209,14 +3276,16 @@ fputs(" InnoDB: You are trying to drop table ", stderr);
if (!success) {
fprintf(stderr,
-"InnoDB: We removed now the InnoDB internal data dictionary entry\n"
-"InnoDB: of table ");
+ "InnoDB: We removed now the InnoDB"
+ " internal data dictionary entry\n"
+ "InnoDB: of table ");
ut_print_name(stderr, trx, TRUE, name);
fprintf(stderr, ".\n");
ut_print_timestamp(stderr);
fprintf(stderr,
-" InnoDB: Error: not able to delete tablespace %lu of table ",
+ " InnoDB: Error: not able to"
+ " delete tablespace %lu of table ",
(ulong) space_id);
ut_print_name(stderr, trx, TRUE, name);
fputs("!\n", stderr);
@@ -3284,11 +3353,12 @@ loop:
row_mysql_unlock_data_dictionary(trx);
ut_print_timestamp(stderr);
- fputs(
- " InnoDB: Warning: MySQL is trying to drop database ", stderr);
+ fputs(" InnoDB: Warning: MySQL is trying to"
+ " drop database ", stderr);
ut_print_name(stderr, trx, TRUE, name);
fputs("\n"
- "InnoDB: though there are still open handles to table ", stderr);
+ "InnoDB: though there are still"
+ " open handles to table ", stderr);
ut_print_name(stderr, trx, TRUE, table_name);
fputs(".\n", stderr);
@@ -3353,12 +3423,12 @@ row_delete_constraint_low(
pars_info_add_str_literal(info, "id", id);
return(que_eval_sql(info,
- "PROCEDURE DELETE_CONSTRAINT () IS\n"
- "BEGIN\n"
- "DELETE FROM SYS_FOREIGN_COLS WHERE ID = :id;\n"
- "DELETE FROM SYS_FOREIGN WHERE ID = :id;\n"
- "END;\n"
- , FALSE, trx));
+ "PROCEDURE DELETE_CONSTRAINT () IS\n"
+ "BEGIN\n"
+ "DELETE FROM SYS_FOREIGN_COLS WHERE ID = :id;\n"
+ "DELETE FROM SYS_FOREIGN WHERE ID = :id;\n"
+ "END;\n"
+ , FALSE, trx));
}
/********************************************************************
@@ -3377,8 +3447,8 @@ row_delete_constraint(
ulint err;
/* New format constraints have ids <databasename>/<constraintname>. */
- err = row_delete_constraint_low(
- mem_heap_strcat(heap, database_name, id), trx);
+ err = row_delete_constraint_low
+ (mem_heap_strcat(heap, database_name, id), trx);
if ((err == DB_SUCCESS) && !strchr(id, '/')) {
/* Old format < 4.0.18 constraints have constraint ids
@@ -3418,13 +3488,13 @@ row_rename_table_for_mysql(
ut_a(new_name != NULL);
if (srv_created_new_raw || srv_force_recovery) {
- fputs(
- "InnoDB: A new raw disk partition was initialized or\n"
- "InnoDB: innodb_force_recovery is on: we do not allow\n"
- "InnoDB: database modifications by the user. Shut down\n"
- "InnoDB: mysqld and edit my.cnf so that newraw is replaced\n"
- "InnoDB: with raw, and innodb_force_... is removed.\n",
- stderr);
+ fputs("InnoDB: A new raw disk partition was initialized or\n"
+ "InnoDB: innodb_force_recovery is on: we do not allow\n"
+ "InnoDB: database modifications by the user. Shut down\n"
+ "InnoDB: mysqld and edit my.cnf so that newraw"
+ " is replaced\n"
+ "InnoDB: with raw, and innodb_force_... is removed.\n",
+ stderr);
trx_commit_for_mysql(trx);
return(DB_ERROR);
@@ -3433,9 +3503,11 @@ row_rename_table_for_mysql(
if (row_mysql_is_system_table(new_name)) {
fprintf(stderr,
- "InnoDB: Error: trying to create a MySQL system table %s of type InnoDB.\n"
- "InnoDB: MySQL system tables must be of the MyISAM type!\n",
- new_name);
+ "InnoDB: Error: trying to create a MySQL"
+ " system table %s of type InnoDB.\n"
+ "InnoDB: MySQL system tables must be"
+ " of the MyISAM type!\n",
+ new_name);
trx_commit_for_mysql(trx);
return(DB_ERROR);
@@ -3461,12 +3533,16 @@ row_rename_table_for_mysql(
fputs(" InnoDB: Error: table ", stderr);
ut_print_name(stderr, trx, TRUE, old_name);
fputs(" does not exist in the InnoDB internal\n"
- "InnoDB: data dictionary though MySQL is trying to rename the table.\n"
- "InnoDB: Have you copied the .frm file of the table to the\n"
- "InnoDB: MySQL database directory from another database?\n"
- "InnoDB: You can look for further help from\n"
-"InnoDB: http://dev.mysql.com/doc/refman/5.1/en/innodb-troubleshooting.html\n",
- stderr);
+ "InnoDB: data dictionary though MySQL is"
+ " trying to rename the table.\n"
+ "InnoDB: Have you copied the .frm file"
+ " of the table to the\n"
+ "InnoDB: MySQL database directory"
+ " from another database?\n"
+ "InnoDB: You can look for further help from\n"
+ "InnoDB: http://dev.mysql.com/doc/refman/5.1/en/"
+ "innodb-troubleshooting.html\n",
+ stderr);
goto funct_exit;
}
@@ -3476,11 +3552,12 @@ row_rename_table_for_mysql(
fputs(" InnoDB: Error: table ", stderr);
ut_print_name(stderr, trx, TRUE, old_name);
- fputs(
- " does not have an .ibd file in the database directory.\n"
- "InnoDB: You can look for further help from\n"
-"InnoDB: http://dev.mysql.com/doc/refman/5.1/en/innodb-troubleshooting.html\n",
- stderr);
+ fputs(" does not have an .ibd file"
+ " in the database directory.\n"
+ "InnoDB: You can look for further help from\n"
+ "InnoDB: http://dev.mysql.com/doc/refman/5.1/en/"
+ "innodb-troubleshooting.html\n",
+ stderr);
goto funct_exit;
}
@@ -3493,8 +3570,9 @@ row_rename_table_for_mysql(
heap = mem_heap_create(100);
- err = dict_foreign_parse_drop_constraints(heap, trx,
- table, &n_constraints_to_drop, &constraints_to_drop);
+ err = dict_foreign_parse_drop_constraints
+ (heap, trx, table,
+ &n_constraints_to_drop, &constraints_to_drop);
if (err != DB_SUCCESS) {
@@ -3513,12 +3591,12 @@ row_rename_table_for_mysql(
pars_info_add_str_literal(info, "old_table_name", old_name);
err = que_eval_sql(info,
- "PROCEDURE RENAME_TABLE () IS\n"
- "BEGIN\n"
- "UPDATE SYS_TABLES SET NAME = :new_table_name\n"
- " WHERE NAME = :old_table_name;\n"
- "END;\n"
- , FALSE, trx);
+ "PROCEDURE RENAME_TABLE () IS\n"
+ "BEGIN\n"
+ "UPDATE SYS_TABLES SET NAME = :new_table_name\n"
+ " WHERE NAME = :old_table_name;\n"
+ "END;\n"
+ , FALSE, trx);
if (err != DB_SUCCESS) {
@@ -3533,78 +3611,83 @@ row_rename_table_for_mysql(
pars_info_add_str_literal(info, "new_table_name", new_name);
pars_info_add_str_literal(info, "old_table_name", old_name);
- err = que_eval_sql(info,
- "PROCEDURE RENAME_CONSTRAINT_IDS () IS\n"
- "gen_constr_prefix CHAR;\n"
- "new_db_name CHAR;\n"
- "foreign_id CHAR;\n"
- "new_foreign_id CHAR;\n"
- "old_db_name_len INT;\n"
- "old_t_name_len INT;\n"
- "new_db_name_len INT;\n"
- "id_len INT;\n"
- "found INT;\n"
- "BEGIN\n"
- "found := 1;\n"
- "old_db_name_len := INSTR(:old_table_name, '/') - 1;\n"
- "new_db_name_len := INSTR(:new_table_name, '/') - 1;\n"
- "new_db_name := SUBSTR(:new_table_name, 0, new_db_name_len);\n"
- "old_t_name_len := LENGTH(:old_table_name);\n"
- "gen_constr_prefix := CONCAT(:old_table_name, '_ibfk_');\n"
- "WHILE found = 1 LOOP\n"
- " SELECT ID INTO foreign_id\n"
- " FROM SYS_FOREIGN\n"
- " WHERE FOR_NAME = :old_table_name\n"
- " AND TO_BINARY(FOR_NAME) = TO_BINARY(:old_table_name)\n"
- " LOCK IN SHARE MODE;\n"
- " IF (SQL % NOTFOUND) THEN\n"
- " found := 0;\n"
- " ELSE\n"
- " UPDATE SYS_FOREIGN\n"
- " SET FOR_NAME = :new_table_name\n"
- " WHERE ID = foreign_id;\n"
- " id_len := LENGTH(foreign_id);\n"
- " IF (INSTR(foreign_id, '/') > 0) THEN\n"
- " IF (INSTR(foreign_id,\n"
- " gen_constr_prefix) > 0)\n"
- " THEN\n"
- " new_foreign_id :=\n"
- " CONCAT(:new_table_name,\n"
- " SUBSTR(foreign_id, old_t_name_len,\n"
- " id_len - old_t_name_len));\n"
- " ELSE\n"
- " new_foreign_id :=\n"
- " CONCAT(new_db_name,\n"
- " SUBSTR(foreign_id,\n"
- " old_db_name_len,\n"
- " id_len - old_db_name_len));\n"
- " END IF;\n"
- " UPDATE SYS_FOREIGN\n"
- " SET ID = new_foreign_id\n"
- " WHERE ID = foreign_id;\n"
- " UPDATE SYS_FOREIGN_COLS\n"
- " SET ID = new_foreign_id\n"
- " WHERE ID = foreign_id;\n"
- " END IF;\n"
- " END IF;\n"
- "END LOOP;\n"
- "UPDATE SYS_FOREIGN SET REF_NAME = :new_table_name\n"
- "WHERE REF_NAME = :old_table_name\n"
- " AND TO_BINARY(REF_NAME) = TO_BINARY(:old_table_name);\n"
- "END;\n"
- , FALSE, trx);
+ err = que_eval_sql
+ (info,
+ "PROCEDURE RENAME_CONSTRAINT_IDS () IS\n"
+ "gen_constr_prefix CHAR;\n"
+ "new_db_name CHAR;\n"
+ "foreign_id CHAR;\n"
+ "new_foreign_id CHAR;\n"
+ "old_db_name_len INT;\n"
+ "old_t_name_len INT;\n"
+ "new_db_name_len INT;\n"
+ "id_len INT;\n"
+ "found INT;\n"
+ "BEGIN\n"
+ "found := 1;\n"
+ "old_db_name_len := INSTR(:old_table_name, '/')-1;\n"
+ "new_db_name_len := INSTR(:new_table_name, '/')-1;\n"
+ "new_db_name := SUBSTR(:new_table_name, 0,\n"
+ " new_db_name_len);\n"
+ "old_t_name_len := LENGTH(:old_table_name);\n"
+ "gen_constr_prefix := CONCAT(:old_table_name,\n"
+ " '_ibfk_');\n"
+ "WHILE found = 1 LOOP\n"
+ " SELECT ID INTO foreign_id\n"
+ " FROM SYS_FOREIGN\n"
+ " WHERE FOR_NAME = :old_table_name\n"
+ " AND TO_BINARY(FOR_NAME)\n"
+ " = TO_BINARY(:old_table_name)\n"
+ " LOCK IN SHARE MODE;\n"
+ " IF (SQL % NOTFOUND) THEN\n"
+ " found := 0;\n"
+ " ELSE\n"
+ " UPDATE SYS_FOREIGN\n"
+ " SET FOR_NAME = :new_table_name\n"
+ " WHERE ID = foreign_id;\n"
+ " id_len := LENGTH(foreign_id);\n"
+ " IF (INSTR(foreign_id, '/') > 0) THEN\n"
+ " IF (INSTR(foreign_id,\n"
+ " gen_constr_prefix) > 0)\n"
+ " THEN\n"
+ " new_foreign_id :=\n"
+ " CONCAT(:new_table_name,\n"
+ " SUBSTR(foreign_id, old_t_name_len,\n"
+ " id_len - old_t_name_len));\n"
+ " ELSE\n"
+ " new_foreign_id :=\n"
+ " CONCAT(new_db_name,\n"
+ " SUBSTR(foreign_id,\n"
+ " old_db_name_len,\n"
+ " id_len - old_db_name_len));\n"
+ " END IF;\n"
+ " UPDATE SYS_FOREIGN\n"
+ " SET ID = new_foreign_id\n"
+ " WHERE ID = foreign_id;\n"
+ " UPDATE SYS_FOREIGN_COLS\n"
+ " SET ID = new_foreign_id\n"
+ " WHERE ID = foreign_id;\n"
+ " END IF;\n"
+ " END IF;\n"
+ "END LOOP;\n"
+ "UPDATE SYS_FOREIGN SET REF_NAME = :new_table_name\n"
+ "WHERE REF_NAME = :old_table_name\n"
+ " AND TO_BINARY(REF_NAME)\n"
+ " = TO_BINARY(:old_table_name);\n"
+ "END;\n"
+ , FALSE, trx);
} else if (n_constraints_to_drop > 0) {
/* Drop some constraints of tmp tables. */
ulint db_name_len = dict_get_db_name_len(old_name) + 1;
char* db_name = mem_heap_strdupl(heap, old_name,
- db_name_len);
+ db_name_len);
ulint i;
for (i = 0; i < n_constraints_to_drop; i++) {
err = row_delete_constraint(constraints_to_drop[i],
- db_name, heap, trx);
+ db_name, heap, trx);
if (err != DB_SUCCESS) {
break;
@@ -3616,30 +3699,40 @@ end:
if (err != DB_SUCCESS) {
if (err == DB_DUPLICATE_KEY) {
ut_print_timestamp(stderr);
- fputs(
- " InnoDB: Error; possible reasons:\n"
- "InnoDB: 1) Table rename would cause two FOREIGN KEY constraints\n"
- "InnoDB: to have the same internal name in case-insensitive comparison.\n"
- "InnoDB: 2) table ", stderr);
- ut_print_name(stderr, trx, TRUE, new_name);
- fputs(" exists in the InnoDB internal data\n"
- "InnoDB: dictionary though MySQL is trying rename table ", stderr);
- ut_print_name(stderr, trx, TRUE, old_name);
- fputs(" to it.\n"
- "InnoDB: Have you deleted the .frm file and not used DROP TABLE?\n"
- "InnoDB: You can look for further help from\n"
-"InnoDB: http://dev.mysql.com/doc/refman/5.1/en/innodb-troubleshooting.html\n"
- "InnoDB: If table ", stderr);
+ fputs(" InnoDB: Error; possible reasons:\n"
+ "InnoDB: 1) Table rename would cause"
+ " two FOREIGN KEY constraints\n"
+ "InnoDB: to have the same internal name"
+ " in case-insensitive comparison.\n"
+ "InnoDB: 2) table ", stderr);
+ ut_print_name(stderr, trx, TRUE, new_name);
+ fputs(" exists in the InnoDB internal data\n"
+ "InnoDB: dictionary though MySQL is"
+ " trying to rename table ", stderr);
+ ut_print_name(stderr, trx, TRUE, old_name);
+ fputs(" to it.\n"
+ "InnoDB: Have you deleted the .frm file"
+ " and not used DROP TABLE?\n"
+ "InnoDB: You can look for further help from\n"
+ "InnoDB: http://dev.mysql.com/doc/refman/5.1/en/"
+ "innodb-troubleshooting.html\n"
+ "InnoDB: If table ", stderr);
ut_print_name(stderr, trx, TRUE, new_name);
- fputs(
- " is a temporary table #sql..., then it can be that\n"
- "InnoDB: there are still queries running on the table, and it will be\n"
- "InnoDB: dropped automatically when the queries end.\n"
- "InnoDB: You can drop the orphaned table inside InnoDB by\n"
- "InnoDB: creating an InnoDB table with the same name in another\n"
- "InnoDB: database and copying the .frm file to the current database.\n"
- "InnoDB: Then MySQL thinks the table exists, and DROP TABLE will\n"
- "InnoDB: succeed.\n", stderr);
+ fputs(" is a temporary table #sql..., then"
+ " it can be that\n"
+ "InnoDB: there are still queries running"
+ " on the table, and it will be\n"
+ "InnoDB: dropped automatically when"
+ " the queries end.\n"
+ "InnoDB: You can drop the orphaned table"
+ " inside InnoDB by\n"
+ "InnoDB: creating an InnoDB table with"
+ " the same name in another\n"
+ "InnoDB: database and copying the .frm file"
+ " to the current database.\n"
+ "InnoDB: Then MySQL thinks the table exists,"
+ " and DROP TABLE will\n"
+ "InnoDB: succeed.\n", stderr);
}
trx->error_state = DB_SUCCESS;
trx_general_rollback_for_mysql(trx, FALSE, NULL);
@@ -3649,15 +3742,15 @@ end:
the table is stored in a single-table tablespace */
ibool success = dict_table_rename_in_cache(table, new_name,
- !new_is_tmp);
+ !new_is_tmp);
if (!success) {
trx->error_state = DB_SUCCESS;
trx_general_rollback_for_mysql(trx, FALSE, NULL);
trx->error_state = DB_SUCCESS;
ut_print_timestamp(stderr);
- fputs(
-" InnoDB: Error in table rename, cannot rename ", stderr);
+ fputs(" InnoDB: Error in table rename,"
+ " cannot rename ", stderr);
ut_print_name(stderr, trx, TRUE, old_name);
fputs(" to ", stderr);
ut_print_name(stderr, trx, TRUE, new_name);
@@ -3670,33 +3763,37 @@ end:
/* We only want to switch off some of the type checking in
an ALTER, not in a RENAME. */
- err = dict_load_foreigns(new_name,
- old_is_tmp ? trx->check_foreigns : TRUE);
+ err = dict_load_foreigns
+ (new_name, old_is_tmp ? trx->check_foreigns : TRUE);
if (err != DB_SUCCESS) {
ut_print_timestamp(stderr);
if (old_is_tmp) {
fputs(" InnoDB: Error: in ALTER TABLE ",
- stderr);
+ stderr);
ut_print_name(stderr, trx, TRUE, new_name);
fputs("\n"
- "InnoDB: has or is referenced in foreign key constraints\n"
- "InnoDB: which are not compatible with the new table definition.\n",
- stderr);
+ "InnoDB: has or is referenced"
+ " in foreign key constraints\n"
+ "InnoDB: which are not compatible"
+ " with the new table definition.\n",
+ stderr);
} else {
- fputs(
- " InnoDB: Error: in RENAME TABLE table ",
- stderr);
+ fputs(" InnoDB: Error: in RENAME TABLE"
+ " table ",
+ stderr);
ut_print_name(stderr, trx, TRUE, new_name);
fputs("\n"
- "InnoDB: is referenced in foreign key constraints\n"
- "InnoDB: which are not compatible with the new table definition.\n",
- stderr);
+ "InnoDB: is referenced in"
+ " foreign key constraints\n"
+ "InnoDB: which are not compatible"
+ " with the new table definition.\n",
+ stderr);
}
ut_a(dict_table_rename_in_cache(table,
- old_name, FALSE));
+ old_name, FALSE));
trx->error_state = DB_SUCCESS;
trx_general_rollback_for_mysql(trx, FALSE, NULL);
trx->error_state = DB_SUCCESS;
@@ -3775,7 +3872,7 @@ loop:
cnt = 1000;
}
if (ret != DB_SUCCESS) {
- func_exit:
+func_exit:
mem_free(buf);
mem_heap_free(heap);
@@ -3795,7 +3892,7 @@ loop:
matched_bytes = 0;
offsets = rec_get_offsets(rec, index, offsets,
- ULINT_UNDEFINED, &heap);
+ ULINT_UNDEFINED, &heap);
cmp = cmp_dtuple_rec_with_match(prev_entry, rec, offsets,
&matched_fields,
&matched_bytes);
@@ -3807,8 +3904,8 @@ loop:
for (i = 0;
i < dict_index_get_n_ordering_defined_by_user(index);
i++) {
- if (UNIV_SQL_NULL == dfield_get_len(
- dtuple_get_nth_field(prev_entry, i))) {
+ if (UNIV_SQL_NULL == dfield_get_len
+ (dtuple_get_nth_field(prev_entry, i))) {
contains_null = TRUE;
}
@@ -3816,22 +3913,23 @@ loop:
if (cmp > 0) {
fputs("InnoDB: index records in a wrong order in ",
- stderr);
- not_ok:
+ stderr);
+not_ok:
dict_index_name_print(stderr,
- prebuilt->trx, index);
+ prebuilt->trx, index);
fputs("\n"
- "InnoDB: prev record ", stderr);
+ "InnoDB: prev record ", stderr);
dtuple_print(stderr, prev_entry);
fputs("\n"
- "InnoDB: record ", stderr);
+ "InnoDB: record ", stderr);
rec_print_new(stderr, rec, offsets);
putc('\n', stderr);
is_ok = FALSE;
} else if ((index->type & DICT_UNIQUE)
&& !contains_null
- && matched_fields >=
- dict_index_get_n_ordering_defined_by_user(index)) {
+ && matched_fields
+ >= dict_index_get_n_ordering_defined_by_user
+ (index)) {
fputs("InnoDB: duplicate key in ", stderr);
goto not_ok;
@@ -3868,14 +3966,18 @@ row_check_table_for_mysql(
if (prebuilt->table->ibd_file_missing) {
ut_print_timestamp(stderr);
fprintf(stderr, " InnoDB: Error:\n"
-"InnoDB: MySQL is trying to use a table handle but the .ibd file for\n"
-"InnoDB: table %s does not exist.\n"
-"InnoDB: Have you deleted the .ibd file from the database directory under\n"
-"InnoDB: the MySQL datadir, or have you used DISCARD TABLESPACE?\n"
-"InnoDB: Look from\n"
-"InnoDB: http://dev.mysql.com/doc/refman/5.1/en/innodb-troubleshooting.html\n"
-"InnoDB: how you can resolve the problem.\n",
- prebuilt->table->name);
+ "InnoDB: MySQL is trying to use a table handle"
+ " but the .ibd file for\n"
+ "InnoDB: table %s does not exist.\n"
+ "InnoDB: Have you deleted the .ibd file"
+ " from the database directory under\n"
+ "InnoDB: the MySQL datadir, or have you"
+ " used DISCARD TABLESPACE?\n"
+ "InnoDB: Look from\n"
+ "InnoDB: http://dev.mysql.com/doc/refman/5.1/en/"
+ "innodb-troubleshooting.html\n"
+ "InnoDB: how you can resolve the problem.\n",
+ prebuilt->table->name);
return(DB_ERROR);
}
@@ -3906,7 +4008,7 @@ row_check_table_for_mysql(
ret = DB_ERROR;
} else {
if (!row_scan_and_check_index(prebuilt,
- index, &n_rows)) {
+ index, &n_rows)) {
ret = DB_ERROR;
}
@@ -3915,7 +4017,7 @@ row_check_table_for_mysql(
}
/* fprintf(stderr, "%lu entries in index %s\n", n_rows,
- index->name); */
+ index->name); */
if (index == dict_table_get_first_index(table)) {
n_rows_in_table = n_rows;
@@ -3925,9 +4027,10 @@ row_check_table_for_mysql(
fputs("Error: ", stderr);
dict_index_name_print(stderr,
- prebuilt->trx, index);
+ prebuilt->trx, index);
fprintf(stderr,
- " contains %lu entries, should be %lu\n",
+ " contains %lu entries,"
+ " should be %lu\n",
(ulong) n_rows,
(ulong) n_rows_in_table);
}
diff --git a/storage/innobase/row/row0purge.c b/storage/innobase/row/row0purge.c
index 1ef24f8e957..1513b18666d 100644
--- a/storage/innobase/row/row0purge.c
+++ b/storage/innobase/row/row0purge.c
@@ -72,7 +72,7 @@ row_purge_reposition_pcur(
}
found = row_search_on_row_ref(&(node->pcur), mode, node->table,
- node->ref, mtr);
+ node->ref, mtr);
node->found_clust = found;
if (found) {
@@ -123,9 +123,10 @@ row_purge_remove_clust_if_poss_low(
rec = btr_pcur_get_rec(pcur);
- if (0 != ut_dulint_cmp(node->roll_ptr,
- row_get_rec_roll_ptr(rec, index, rec_get_offsets(
- rec, index, offsets_, ULINT_UNDEFINED, &heap)))) {
+ if (0 != ut_dulint_cmp(node->roll_ptr, row_get_rec_roll_ptr
+ (rec, index, rec_get_offsets
+ (rec, index, offsets_,
+ ULINT_UNDEFINED, &heap)))) {
if (UNIV_LIKELY_NULL(heap)) {
mem_heap_free(heap);
}
@@ -171,7 +172,7 @@ row_purge_remove_clust_if_poss(
ibool success;
ulint n_tries = 0;
-/* fputs("Purge: Removing clustered record\n", stderr); */
+ /* fputs("Purge: Removing clustered record\n", stderr); */
success = row_purge_remove_clust_if_poss_low(node, BTR_MODIFY_LEAF);
if (success) {
@@ -247,9 +248,9 @@ row_purge_remove_sec_if_poss_low(
success = row_purge_reposition_pcur(BTR_SEARCH_LEAF, node, mtr_vers);
if (success) {
- old_has = row_vers_old_has_index_entry(TRUE,
- btr_pcur_get_rec(&(node->pcur)),
- mtr_vers, index, entry);
+ old_has = row_vers_old_has_index_entry
+ (TRUE, btr_pcur_get_rec(&(node->pcur)),
+ mtr_vers, index, entry);
}
btr_pcur_commit_specify_mtr(&(node->pcur), mtr_vers);
@@ -264,7 +265,7 @@ row_purge_remove_sec_if_poss_low(
} else {
ut_ad(mode == BTR_MODIFY_TREE);
btr_cur_pessimistic_delete(&err, FALSE, btr_cur,
- FALSE, &mtr);
+ FALSE, &mtr);
if (err == DB_SUCCESS) {
success = TRUE;
} else if (err == DB_OUT_OF_FILE_SPACE) {
@@ -294,17 +295,17 @@ row_purge_remove_sec_if_poss(
ibool success;
ulint n_tries = 0;
-/* fputs("Purge: Removing secondary record\n", stderr); */
+ /* fputs("Purge: Removing secondary record\n", stderr); */
success = row_purge_remove_sec_if_poss_low(node, index, entry,
- BTR_MODIFY_LEAF);
+ BTR_MODIFY_LEAF);
if (success) {
return;
}
retry:
success = row_purge_remove_sec_if_poss_low(node, index, entry,
- BTR_MODIFY_TREE);
+ BTR_MODIFY_TREE);
/* The delete operation may fail if we have little
file space left: TODO: easiest to crash the database
and restart with more file space */
@@ -389,7 +390,7 @@ row_purge_upd_exist_or_extern(
index = node->index;
if (row_upd_changes_ord_field_binary(NULL, node->index,
- node->update)) {
+ node->update)) {
/* Build the older version of the index entry */
entry = row_build_index_entry(node->row, index, heap);
@@ -415,13 +416,13 @@ skip_secondaries:
address of the new_val data */
internal_offset = ((byte*)ufield->new_val.data)
- - node->undo_rec;
+ - node->undo_rec;
ut_a(internal_offset < UNIV_PAGE_SIZE);
trx_undo_decode_roll_ptr(node->roll_ptr,
- &is_insert, &rseg_id,
- &page_no, &offset);
+ &is_insert, &rseg_id,
+ &page_no, &offset);
mtr_start(&mtr);
/* We have to acquire an X-latch to the clustered
@@ -450,13 +451,14 @@ skip_secondaries:
#ifdef UNIV_SYNC_DEBUG
buf_page_dbg_add_level(buf_frame_align(data_field),
- SYNC_TRX_UNDO_PAGE);
+ SYNC_TRX_UNDO_PAGE);
#endif /* UNIV_SYNC_DEBUG */
data_field_len = ufield->new_val.len;
btr_free_externally_stored_field(index, data_field,
- data_field_len, FALSE, &mtr);
+ data_field_len,
+ FALSE, &mtr);
mtr_commit(&mtr);
}
}
@@ -493,7 +495,7 @@ row_purge_parse_undo_rec(
trx = thr_get_trx(thr);
ptr = trx_undo_rec_get_pars(node->undo_rec, &type, &cmpl_info,
- updated_extern, &undo_no, &table_id);
+ updated_extern, &undo_no, &table_id);
node->rec_type = type;
if (type == TRX_UNDO_UPD_DEL_REC && !(*updated_extern)) {
@@ -502,11 +504,11 @@ row_purge_parse_undo_rec(
}
ptr = trx_undo_update_rec_get_sys_cols(ptr, &trx_id, &roll_ptr,
- &info_bits);
+ &info_bits);
node->table = NULL;
if (type == TRX_UNDO_UPD_EXIST_REC
- && cmpl_info & UPD_NODE_NO_ORD_CHANGE && !(*updated_extern)) {
+ && cmpl_info & UPD_NODE_NO_ORD_CHANGE && !(*updated_extern)) {
/* Purge requires no changes to indexes: we may return */
@@ -553,17 +555,17 @@ row_purge_parse_undo_rec(
}
ptr = trx_undo_rec_get_row_ref(ptr, clust_index, &(node->ref),
- node->heap);
+ node->heap);
ptr = trx_undo_update_rec_get_update(ptr, clust_index, type, trx_id,
- roll_ptr, info_bits, trx,
- node->heap, &(node->update));
+ roll_ptr, info_bits, trx,
+ node->heap, &(node->update));
/* Read to the partial row the fields that occur in indexes */
if (!cmpl_info & UPD_NODE_NO_ORD_CHANGE) {
ptr = trx_undo_rec_get_partial_row(ptr, clust_index,
- &(node->row), node->heap);
+ &(node->row), node->heap);
}
return(TRUE);
@@ -592,8 +594,8 @@ row_purge(
trx = thr_get_trx(thr);
node->undo_rec = trx_purge_fetch_next_rec(&roll_ptr,
- &(node->reservation),
- node->heap);
+ &(node->reservation),
+ node->heap);
if (!node->undo_rec) {
/* Purge completed for this query thread */
@@ -608,7 +610,7 @@ row_purge(
purge_needed = FALSE;
} else {
purge_needed = row_purge_parse_undo_rec(node, &updated_extern,
- thr);
+ thr);
/* If purge_needed == TRUE, we must also remember to unfreeze
data dictionary! */
}
@@ -616,14 +618,14 @@ row_purge(
if (purge_needed) {
node->found_clust = FALSE;
- node->index = dict_table_get_next_index(
- dict_table_get_first_index(node->table));
+ node->index = dict_table_get_next_index
+ (dict_table_get_first_index(node->table));
if (node->rec_type == TRX_UNDO_DEL_MARK_REC) {
row_purge_del_mark(node);
} else if (updated_extern
- || node->rec_type == TRX_UNDO_UPD_EXIST_REC) {
+ || node->rec_type == TRX_UNDO_UPD_EXIST_REC) {
row_purge_upd_exist_or_extern(node);
}
diff --git a/storage/innobase/row/row0row.c b/storage/innobase/row/row0row.c
index 50ad462f4aa..b945954041e 100644
--- a/storage/innobase/row/row0row.c
+++ b/storage/innobase/row/row0row.c
@@ -128,8 +128,8 @@ row_build_index_entry(
if (index->type & DICT_UNIVERSAL) {
dtuple_set_n_fields_cmp(entry, entry_len);
} else {
- dtuple_set_n_fields_cmp(entry,
- dict_index_get_n_unique_in_tree(index));
+ dtuple_set_n_fields_cmp
+ (entry, dict_index_get_n_unique_in_tree(index));
}
for (i = 0; i < entry_len; i++) {
@@ -144,15 +144,14 @@ row_build_index_entry(
/* If a column prefix index, take only the prefix */
if (ind_field->prefix_len > 0
- && dfield_get_len(dfield2) != UNIV_SQL_NULL) {
+ && dfield_get_len(dfield2) != UNIV_SQL_NULL) {
- cur_type = dict_col_get_type(
- dict_field_get_col(ind_field));
+ cur_type = dict_col_get_type
+ (dict_field_get_col(ind_field));
- storage_len = dtype_get_at_most_n_mbchars(
- cur_type,
- ind_field->prefix_len,
- dfield_get_len(dfield2), dfield2->data);
+ storage_len = dtype_get_at_most_n_mbchars
+ (cur_type, ind_field->prefix_len,
+ dfield_get_len(dfield2), dfield2->data);
dfield_set_len(dfield, storage_len);
}
@@ -171,10 +170,9 @@ dtuple_t*
row_build(
/*======*/
/* out, own: row built; see the NOTE below! */
- ulint type, /* in: ROW_COPY_POINTERS, ROW_COPY_DATA, or
- ROW_COPY_ALSO_EXTERNALS,
- the two last copy also the data fields to
- heap as the first only places pointers to
+ ulint type, /* in: ROW_COPY_POINTERS or ROW_COPY_DATA;
+ the latter copies also the data fields to
+ heap while the first only places pointers to
data fields on the index page, and thus is
more efficient */
dict_index_t* index, /* in: clustered index */
@@ -211,7 +209,7 @@ row_build(
if (!offsets) {
offsets = rec_get_offsets(rec, index, offsets_,
- ULINT_UNDEFINED, &tmp_heap);
+ ULINT_UNDEFINED, &tmp_heap);
} else {
ut_ad(rec_offs_validate(rec, index, offsets));
}
@@ -229,8 +227,8 @@ row_build(
row = dtuple_create(heap, row_len);
- dtuple_set_info_bits(row, rec_get_info_bits(rec,
- dict_table_is_comp(table)));
+ dtuple_set_info_bits(row, rec_get_info_bits
+ (rec, dict_table_is_comp(table)));
n_fields = rec_offs_n_fields(offsets);
@@ -243,16 +241,9 @@ row_build(
col = dict_field_get_col(ind_field);
dfield = dtuple_get_nth_field(row,
- dict_col_get_no(col));
+ dict_col_get_no(col));
field = rec_get_nth_field(rec, offsets, i, &len);
- if (type == ROW_COPY_ALSO_EXTERNALS
- && rec_offs_nth_extern(offsets, i)) {
-
- field = btr_rec_copy_externally_stored_field(
- rec, offsets, i, &len, heap);
- }
-
dfield_set_data(dfield, field, len);
}
}
@@ -305,7 +296,7 @@ row_rec_to_index_entry(
ut_ad(rec && heap && index);
offsets = rec_get_offsets(rec, index, offsets,
- ULINT_UNDEFINED, &tmp_heap);
+ ULINT_UNDEFINED, &tmp_heap);
if (type == ROW_COPY_DATA) {
/* Take a copy of rec to heap */
@@ -326,7 +317,7 @@ row_rec_to_index_entry(
dict_index_copy_types(entry, index, rec_len);
dtuple_set_info_bits(entry,
- rec_get_info_bits(rec, rec_offs_comp(offsets)));
+ rec_get_info_bits(rec, rec_offs_comp(offsets)));
for (i = 0; i < rec_len; i++) {
@@ -387,7 +378,7 @@ row_build_row_ref(
ut_ad(index && rec && heap);
offsets = rec_get_offsets(rec, index, offsets,
- ULINT_UNDEFINED, &tmp_heap);
+ ULINT_UNDEFINED, &tmp_heap);
if (type == ROW_COPY_DATA) {
/* Take a copy of rec to heap */
@@ -425,16 +416,17 @@ row_build_row_ref(
column, or the full column, and we must adjust the length
accordingly. */
- clust_col_prefix_len =
- dict_index_get_nth_field(clust_index, i)->prefix_len;
+ clust_col_prefix_len = dict_index_get_nth_field
+ (clust_index, i)->prefix_len;
if (clust_col_prefix_len > 0) {
if (len != UNIV_SQL_NULL) {
dfield_set_len(dfield,
- dtype_get_at_most_n_mbchars(
- dfield_get_type(dfield),
- clust_col_prefix_len, len, (char*) field));
+ dtype_get_at_most_n_mbchars
+ (dfield_get_type(dfield),
+ clust_col_prefix_len, len,
+ (char*) field));
}
}
}
@@ -482,7 +474,7 @@ row_build_row_ref_in_tuple(
if (UNIV_UNLIKELY(!index->table)) {
fputs("InnoDB: table ", stderr);
- notfound:
+notfound:
ut_print_name(stderr, trx, TRUE, index->table_name);
fputs(" for index ", stderr);
ut_print_name(stderr, trx, FALSE, index->name);
@@ -521,16 +513,17 @@ row_build_row_ref_in_tuple(
column, or the full column, and we must adjust the length
accordingly. */
- clust_col_prefix_len =
- dict_index_get_nth_field(clust_index, i)->prefix_len;
+ clust_col_prefix_len = dict_index_get_nth_field
+ (clust_index, i)->prefix_len;
if (clust_col_prefix_len > 0) {
if (len != UNIV_SQL_NULL) {
dfield_set_len(dfield,
- dtype_get_at_most_n_mbchars(
- dfield_get_type(dfield),
- clust_col_prefix_len, len, (char*) field));
+ dtype_get_at_most_n_mbchars
+ (dfield_get_type(dfield),
+ clust_col_prefix_len, len,
+ (char*) field));
}
}
}
@@ -585,15 +578,14 @@ row_build_row_ref_from_row(
dfield_copy(dfield, dfield2);
if (field->prefix_len > 0
- && dfield->len != UNIV_SQL_NULL) {
+ && dfield->len != UNIV_SQL_NULL) {
- cur_type = dict_col_get_type(
- dict_field_get_col(field));
+ cur_type = dict_col_get_type
+ (dict_field_get_col(field));
- dfield->len = dtype_get_at_most_n_mbchars(
- cur_type,
- field->prefix_len,
- dfield->len, dfield->data);
+ dfield->len = dtype_get_at_most_n_mbchars
+ (cur_type, field->prefix_len,
+ dfield->len, dfield->data);
}
}
diff --git a/storage/innobase/row/row0sel.c b/storage/innobase/row/row0sel.c
index 251ee95886f..06aeca509d3 100644
--- a/storage/innobase/row/row0sel.c
+++ b/storage/innobase/row/row0sel.c
@@ -92,9 +92,9 @@ row_sel_sec_rec_is_for_clust_rec(
*sec_offsets_ = (sizeof sec_offsets_) / sizeof *sec_offsets_;
clust_offs = rec_get_offsets(clust_rec, clust_index, clust_offs,
- ULINT_UNDEFINED, &heap);
+ ULINT_UNDEFINED, &heap);
sec_offs = rec_get_offsets(sec_rec, sec_index, sec_offs,
- ULINT_UNDEFINED, &heap);
+ ULINT_UNDEFINED, &heap);
n = dict_index_get_n_ordering_defined_by_user(sec_index);
@@ -108,20 +108,19 @@ row_sel_sec_rec_is_for_clust_rec(
sec_field = rec_get_nth_field(sec_rec, sec_offs, i, &sec_len);
if (ifield->prefix_len > 0
- && clust_len != UNIV_SQL_NULL) {
+ && clust_len != UNIV_SQL_NULL) {
- cur_type = dict_col_get_type(
- dict_field_get_col(ifield));
+ cur_type = dict_col_get_type
+ (dict_field_get_col(ifield));
- clust_len = dtype_get_at_most_n_mbchars(
- cur_type,
- ifield->prefix_len,
- clust_len, (char*) clust_field);
+ clust_len = dtype_get_at_most_n_mbchars
+ (cur_type, ifield->prefix_len,
+ clust_len, (char*) clust_field);
}
if (0 != cmp_data_data(dict_col_get_type(col),
- clust_field, clust_len,
- sec_field, sec_len)) {
+ clust_field, clust_len,
+ sec_field, sec_len)) {
is_equal = FALSE;
goto func_exit;
}
@@ -313,29 +312,29 @@ row_sel_fetch_columns(
if (field_no != ULINT_UNDEFINED) {
if (UNIV_UNLIKELY(rec_offs_nth_extern(offsets,
- field_no))) {
+ field_no))) {
/* Copy an externally stored field to the
temporary heap */
heap = mem_heap_create(1);
- data = btr_rec_copy_externally_stored_field(
- rec, offsets, field_no, &len, heap);
+ data = btr_rec_copy_externally_stored_field
+ (rec, offsets, field_no, &len, heap);
ut_a(len != UNIV_SQL_NULL);
needs_copy = TRUE;
} else {
data = rec_get_nth_field(rec, offsets,
- field_no, &len);
+ field_no, &len);
needs_copy = column->copy_val;
}
if (needs_copy) {
eval_node_copy_and_alloc_val(column, data,
- len);
+ len);
} else {
val = que_node_get_val(column);
dfield_set_data(val, data, len);
@@ -364,7 +363,7 @@ sel_col_prefetch_buf_alloc(
ut_ad(que_node_get_type(column) == QUE_NODE_SYMBOL);
column->prefetch_buf = mem_alloc(SEL_MAX_N_PREFETCH
- * sizeof(sel_buf_t));
+ * sizeof(sel_buf_t));
for (i = 0; i < SEL_MAX_N_PREFETCH; i++) {
sel_buf = column->prefetch_buf + i;
@@ -558,9 +557,9 @@ row_sel_build_prev_vers(
plan->old_vers_heap = mem_heap_create(512);
}
- err = row_vers_build_for_consistent_read(rec, mtr, plan->index,
- offsets, read_view, offset_heap,
- plan->old_vers_heap, old_vers);
+ err = row_vers_build_for_consistent_read
+ (rec, mtr, plan->index, offsets, read_view, offset_heap,
+ plan->old_vers_heap, old_vers);
return(err);
}
@@ -593,9 +592,9 @@ row_sel_build_committed_vers_for_mysql(
prebuilt->old_vers_heap = mem_heap_create(200);
}
- err = row_vers_build_for_semi_consistent_read(rec, mtr, clust_index,
- offsets, offset_heap,
- prebuilt->old_vers_heap, old_vers);
+ err = row_vers_build_for_semi_consistent_read
+ (rec, mtr, clust_index, offsets, offset_heap,
+ prebuilt->old_vers_heap, old_vers);
return(err);
}
@@ -697,16 +696,16 @@ row_sel_get_clust_rec(
*out_rec = NULL;
offsets = rec_get_offsets(rec,
- btr_pcur_get_btr_cur(&plan->pcur)->index,
- offsets, ULINT_UNDEFINED, &heap);
+ btr_pcur_get_btr_cur(&plan->pcur)->index,
+ offsets, ULINT_UNDEFINED, &heap);
row_build_row_ref_fast(plan->clust_ref, plan->clust_map, rec, offsets);
index = dict_table_get_first_index(plan->table);
btr_pcur_open_with_no_init(index, plan->clust_ref, PAGE_CUR_LE,
- node->latch_mode, &(plan->clust_pcur),
- 0, mtr);
+ node->latch_mode, &(plan->clust_pcur),
+ 0, mtr);
clust_rec = btr_pcur_get_rec(&(plan->clust_pcur));
@@ -714,11 +713,11 @@ row_sel_get_clust_rec(
low_match value the real match to the search tuple */
if (!page_rec_is_user_rec(clust_rec)
- || btr_pcur_get_low_match(&(plan->clust_pcur))
- < dict_index_get_n_unique(index)) {
+ || btr_pcur_get_low_match(&(plan->clust_pcur))
+ < dict_index_get_n_unique(index)) {
ut_a(rec_get_deleted_flag(rec,
- dict_table_is_comp(plan->table)));
+ dict_table_is_comp(plan->table)));
ut_a(node->read_view);
/* In a rare case it is possible that no clust rec is found
@@ -734,7 +733,7 @@ row_sel_get_clust_rec(
}
offsets = rec_get_offsets(clust_rec, index, offsets,
- ULINT_UNDEFINED, &heap);
+ ULINT_UNDEFINED, &heap);
if (!node->read_view) {
/* Try to place a lock on the index record */
@@ -749,15 +748,15 @@ row_sel_get_clust_rec(
trx = thr_get_trx(thr);
if (srv_locks_unsafe_for_binlog
- || trx->isolation_level == TRX_ISO_READ_COMMITTED) {
+ || trx->isolation_level == TRX_ISO_READ_COMMITTED) {
lock_type = LOCK_REC_NOT_GAP;
} else {
lock_type = LOCK_ORDINARY;
}
- err = lock_clust_rec_read_check_and_lock(0,
- clust_rec, index, offsets,
- node->row_lock_mode, lock_type, thr);
+ err = lock_clust_rec_read_check_and_lock
+ (0, clust_rec, index, offsets,
+ node->row_lock_mode, lock_type, thr);
if (err != DB_SUCCESS) {
@@ -770,11 +769,11 @@ row_sel_get_clust_rec(
old_vers = NULL;
if (!lock_clust_rec_cons_read_sees(clust_rec, index, offsets,
- node->read_view)) {
+ node->read_view)) {
err = row_sel_build_prev_vers(node->read_view, plan,
- clust_rec, &offsets, &heap,
- &old_vers, mtr);
+ clust_rec, &offsets,
+ &heap, &old_vers, mtr);
if (err != DB_SUCCESS) {
goto err_exit;
@@ -800,10 +799,11 @@ row_sel_get_clust_rec(
visit through secondary index records that would not really
exist in our snapshot. */
- if ((old_vers || rec_get_deleted_flag(rec,
- dict_table_is_comp(plan->table)))
- && !row_sel_sec_rec_is_for_clust_rec(rec, plan->index,
- clust_rec, index)) {
+ if ((old_vers
+ || rec_get_deleted_flag(rec, dict_table_is_comp
+ (plan->table)))
+ && !row_sel_sec_rec_is_for_clust_rec(rec, plan->index,
+ clust_rec, index)) {
goto func_exit;
}
}
@@ -811,7 +811,7 @@ row_sel_get_clust_rec(
/* Fetch the columns needed in test conditions */
row_sel_fetch_columns(index, clust_rec, offsets,
- UT_LIST_GET_FIRST(plan->columns));
+ UT_LIST_GET_FIRST(plan->columns));
*out_rec = clust_rec;
func_exit:
err = DB_SUCCESS;
@@ -833,7 +833,8 @@ sel_set_rec_lock(
dict_index_t* index, /* in: index */
const ulint* offsets,/* in: rec_get_offsets(rec, index) */
ulint mode, /* in: lock mode */
- ulint type, /* in: LOCK_ORDINARY, LOCK_GAP, or LOC_REC_NOT_GAP */
+ ulint type, /* in: LOCK_ORDINARY, LOCK_GAP, or
+ LOC_REC_NOT_GAP */
que_thr_t* thr) /* in: query thread */
{
trx_t* trx;
@@ -849,11 +850,11 @@ sel_set_rec_lock(
}
if (index->type & DICT_CLUSTERED) {
- err = lock_clust_rec_read_check_and_lock(0,
- rec, index, offsets, mode, type, thr);
+ err = lock_clust_rec_read_check_and_lock
+ (0, rec, index, offsets, mode, type, thr);
} else {
- err = lock_sec_rec_read_check_and_lock(0,
- rec, index, offsets, mode, type, thr);
+ err = lock_sec_rec_read_check_and_lock
+ (0, rec, index, offsets, mode, type, thr);
}
return(err);
@@ -912,20 +913,20 @@ row_sel_open_pcur(
exp = plan->tuple_exps[i];
dfield_copy_data(dtuple_get_nth_field(plan->tuple, i),
- que_node_get_val(exp));
+ que_node_get_val(exp));
}
/* Open pcur to the index */
btr_pcur_open_with_no_init(index, plan->tuple, plan->mode,
- node->latch_mode, &(plan->pcur),
- has_search_latch, mtr);
+ node->latch_mode, &(plan->pcur),
+ has_search_latch, mtr);
} else {
/* Open the cursor to the start or the end of the index
(FALSE: no init) */
btr_pcur_open_at_index_side(plan->asc, index, node->latch_mode,
- &(plan->pcur), FALSE, mtr);
+ &(plan->pcur), FALSE, mtr);
}
ut_ad(plan->n_rows_prefetched == 0);
@@ -958,7 +959,7 @@ row_sel_restore_pcur_pos(
relative_position = btr_pcur_get_rel_pos(&(plan->pcur));
equal_position = btr_pcur_restore_position(node->latch_mode,
- &(plan->pcur), mtr);
+ &(plan->pcur), mtr);
/* If the cursor is traveling upwards, and relative_position is
@@ -988,7 +989,7 @@ row_sel_restore_pcur_pos(
}
ut_ad(relative_position == BTR_PCUR_AFTER
- || relative_position == BTR_PCUR_AFTER_LAST_IN_TREE);
+ || relative_position == BTR_PCUR_AFTER_LAST_IN_TREE);
return(FALSE);
}
@@ -1011,7 +1012,7 @@ row_sel_restore_pcur_pos(
record, else there is no need to move the cursor. */
if (relative_position == BTR_PCUR_BEFORE
- || relative_position == BTR_PCUR_BEFORE_FIRST_IN_TREE) {
+ || relative_position == BTR_PCUR_BEFORE_FIRST_IN_TREE) {
return(FALSE);
}
@@ -1027,7 +1028,7 @@ row_sel_restore_pcur_pos(
}
ut_ad(relative_position == BTR_PCUR_AFTER
- || relative_position == BTR_PCUR_AFTER_LAST_IN_TREE);
+ || relative_position == BTR_PCUR_AFTER_LAST_IN_TREE);
return(TRUE);
}
@@ -1103,7 +1104,7 @@ row_sel_try_search_shortcut(
if (index->type & DICT_CLUSTERED) {
if (!lock_clust_rec_cons_read_sees(rec, index, offsets,
- node->read_view)) {
+ node->read_view)) {
ret = SEL_RETRY;
goto func_exit;
}
@@ -1116,7 +1117,7 @@ row_sel_try_search_shortcut(
/* Test deleted flag. Fetch the columns needed in test conditions. */
row_sel_fetch_columns(index, rec, offsets,
- UT_LIST_GET_FIRST(plan->columns));
+ UT_LIST_GET_FIRST(plan->columns));
if (rec_get_deleted_flag(rec, dict_table_is_comp(plan->table))) {
@@ -1163,29 +1164,29 @@ row_sel(
ibool search_latch_locked;
ibool consistent_read;
- /* The following flag becomes TRUE when we are doing a
- consistent read from a non-clustered index and we must look
- at the clustered index to find out the previous delete mark
- state of the non-clustered record: */
+ /* The following flag becomes TRUE when we are doing a
+ consistent read from a non-clustered index and we must look
+ at the clustered index to find out the previous delete mark
+ state of the non-clustered record: */
ibool cons_read_requires_clust_rec = FALSE;
ulint cost_counter = 0;
ibool cursor_just_opened;
ibool must_go_to_next;
ibool leaf_contains_updates = FALSE;
- /* TRUE if select_will_do_update is
- TRUE and the current clustered index
- leaf page has been updated during
- the current mtr: mtr must be committed
- at the same time as the leaf x-latch
- is released */
+ /* TRUE if select_will_do_update is
+ TRUE and the current clustered index
+ leaf page has been updated during
+ the current mtr: mtr must be committed
+ at the same time as the leaf x-latch
+ is released */
ibool mtr_has_extra_clust_latch = FALSE;
- /* TRUE if the search was made using
- a non-clustered index, and we had to
- access the clustered record: now &mtr
- contains a clustered index latch, and
- &mtr must be committed before we move
- to the next non-clustered record */
+ /* TRUE if the search was made using
+ a non-clustered index, and we had to
+ access the clustered record: now &mtr
+ contains a clustered index latch, and
+ &mtr must be committed before we move
+ to the next non-clustered record */
ulint found_flag;
ulint err;
mem_heap_t* heap = NULL;
@@ -1212,7 +1213,7 @@ row_sel(
table_loop:
/* TABLE LOOP
- ----------
+ ----------
This is the outer major loop in calculating a join. We come here when
node->fetch_table changes, and after adding a row to aggregate totals
and, of course, when this function is called. */
@@ -1244,8 +1245,8 @@ table_loop:
mtr_start(&mtr);
if (consistent_read && plan->unique_search && !plan->pcur_is_open
- && !plan->must_get_clust
- && (plan->table->max_row_size < BIG_ROW_SIZE)) {
+ && !plan->must_get_clust
+ && (plan->table->max_row_size < BIG_ROW_SIZE)) {
if (!search_latch_locked) {
rw_lock_s_lock(&btr_search_latch);
@@ -1315,7 +1316,7 @@ table_loop:
rec_loop:
/* RECORD LOOP
- -----------
+ -----------
In this loop we use pcur and try to fetch a qualifying row, and
also fill the prefetch buffer for this table if n_rows_fetched has
exceeded a threshold. While we are inside this loop, the following
@@ -1333,7 +1334,7 @@ rec_loop:
/* PHASE 1: Set a lock if specified */
if (!node->asc && cursor_just_opened
- && !page_rec_is_supremum(rec)) {
+ && !page_rec_is_supremum(rec)) {
/* When we open a cursor for a descending search, we must set
a next-key lock on the successor record: otherwise it would
@@ -1355,10 +1356,11 @@ rec_loop:
trx = thr_get_trx(thr);
offsets = rec_get_offsets(next_rec, index, offsets,
- ULINT_UNDEFINED, &heap);
+ ULINT_UNDEFINED, &heap);
if (srv_locks_unsafe_for_binlog
- || trx->isolation_level == TRX_ISO_READ_COMMITTED) {
+ || trx->isolation_level
+ == TRX_ISO_READ_COMMITTED) {
if (page_rec_is_supremum(next_rec)) {
@@ -1371,7 +1373,8 @@ rec_loop:
}
err = sel_set_rec_lock(next_rec, index, offsets,
- node->row_lock_mode, lock_type, thr);
+ node->row_lock_mode,
+ lock_type, thr);
if (err != DB_SUCCESS) {
/* Note that in this case we will store in pcur
@@ -1408,12 +1411,12 @@ skip_lock:
trx_t* trx;
offsets = rec_get_offsets(rec, index, offsets,
- ULINT_UNDEFINED, &heap);
+ ULINT_UNDEFINED, &heap);
trx = thr_get_trx(thr);
if (srv_locks_unsafe_for_binlog
- || trx->isolation_level == TRX_ISO_READ_COMMITTED) {
+ || trx->isolation_level == TRX_ISO_READ_COMMITTED) {
if (page_rec_is_supremum(rec)) {
@@ -1426,7 +1429,7 @@ skip_lock:
}
err = sel_set_rec_lock(rec, index, offsets,
- node->row_lock_mode, lock_type, thr);
+ node->row_lock_mode, lock_type, thr);
if (err != DB_SUCCESS) {
@@ -1468,7 +1471,7 @@ skip_lock:
tuple */
if (btr_pcur_get_up_match(&(plan->pcur))
- < plan->n_exact_match) {
+ < plan->n_exact_match) {
goto table_exhausted;
}
@@ -1491,24 +1494,25 @@ skip_lock:
if (index->type & DICT_CLUSTERED) {
if (!lock_clust_rec_cons_read_sees(rec, index, offsets,
- node->read_view)) {
+ node->read_view)) {
err = row_sel_build_prev_vers(node->read_view,
- plan, rec,
- &offsets, &heap,
- &old_vers, &mtr);
+ plan, rec,
+ &offsets, &heap,
+ &old_vers, &mtr);
if (err != DB_SUCCESS) {
goto lock_wait_or_error;
}
if (old_vers == NULL) {
- offsets = rec_get_offsets(
- rec, index, offsets,
- ULINT_UNDEFINED, &heap);
- row_sel_fetch_columns(index, rec,
- offsets,
- UT_LIST_GET_FIRST(plan->columns));
+ offsets = rec_get_offsets
+ (rec, index, offsets,
+ ULINT_UNDEFINED, &heap);
+ row_sel_fetch_columns
+ (index, rec, offsets,
+ UT_LIST_GET_FIRST
+ (plan->columns));
if (!row_sel_test_end_conds(plan)) {
@@ -1531,7 +1535,7 @@ skip_lock:
/* Fetch the columns needed in test conditions */
row_sel_fetch_columns(index, rec, offsets,
- UT_LIST_GET_FIRST(plan->columns));
+ UT_LIST_GET_FIRST(plan->columns));
/* Test the selection end conditions: these can only contain columns
which already are found in the index, even though the index might be
@@ -1547,7 +1551,7 @@ skip_lock:
}
if (rec_get_deleted_flag(rec, dict_table_is_comp(plan->table))
- && !cons_read_requires_clust_rec) {
+ && !cons_read_requires_clust_rec) {
/* The record is delete marked: we can skip it if this is
not a consistent read which might see an earlier version
@@ -1570,7 +1574,7 @@ skip_lock:
clustered index record */
err = row_sel_get_clust_rec(node, plan, rec, thr, &clust_rec,
- &mtr);
+ &mtr);
mtr_has_extra_clust_latch = TRUE;
if (err != DB_SUCCESS) {
@@ -1591,7 +1595,7 @@ skip_lock:
}
if (rec_get_deleted_flag(clust_rec,
- dict_table_is_comp(plan->table))) {
+ dict_table_is_comp(plan->table))) {
/* The record is delete marked: we can skip it */
@@ -1646,8 +1650,8 @@ skip_lock:
}
if ((plan->n_rows_fetched <= SEL_PREFETCH_LIMIT)
- || plan->unique_search || plan->no_prefetch
- || (plan->table->max_row_size >= BIG_ROW_SIZE)) {
+ || plan->unique_search || plan->no_prefetch
+ || (plan->table->max_row_size >= BIG_ROW_SIZE)) {
/* No prefetch in operation: go to the next table */
@@ -1679,7 +1683,7 @@ next_rec:
}
if (leaf_contains_updates
- && btr_pcur_is_after_last_on_page(&(plan->pcur), &mtr)) {
+ && btr_pcur_is_after_last_on_page(&(plan->pcur), &mtr)) {
/* We must commit &mtr if we are moving to a different page,
because we have done updates to the x-latched leaf page, and
@@ -1705,7 +1709,7 @@ next_rec:
cursor_just_opened = FALSE;
/* END OF RECORD LOOP
- ------------------ */
+ ------------------ */
goto rec_loop;
next_table:
@@ -1860,7 +1864,7 @@ lock_wait_or_error:
/* See the note at stop_for_a_while: the same holds for this case */
ut_ad(!btr_pcur_is_before_first_on_page(&(plan->pcur), &mtr)
- || !node->asc);
+ || !node->asc);
ut_ad(!search_latch_locked);
plan->stored_cursor_rec_processed = FALSE;
@@ -1918,8 +1922,8 @@ row_sel_step(
if (node->consistent_read) {
/* Assign a read view for the query */
- node->read_view = trx_assign_read_view(
- thr_get_trx(thr));
+ node->read_view = trx_assign_read_view
+ (thr_get_trx(thr));
} else {
if (node->set_x_locks) {
i_lock_mode = LOCK_IX;
@@ -1931,7 +1935,7 @@ row_sel_step(
while (table_node) {
err = lock_table(0, table_node->table,
- i_lock_mode, thr);
+ i_lock_mode, thr);
if (err != DB_SUCCESS) {
thr_get_trx(thr)->error_state = err;
@@ -1947,8 +1951,8 @@ row_sel_step(
fetches (currently, we copy them also for non-explicit
cursors) */
- if (node->explicit_cursor &&
- UT_LIST_GET_FIRST(node->copy_variables)) {
+ if (node->explicit_cursor
+ && UT_LIST_GET_FIRST(node->copy_variables)) {
row_sel_copy_input_variable_vals(node);
}
@@ -2004,14 +2008,14 @@ fetch_step(
if (node->into_list) {
sel_assign_into_var_values(node->into_list,
- sel_node);
+ sel_node);
} else {
- void* ret = (*node->func->func)(sel_node,
- node->func->arg);
+ void* ret = (*node->func->func)
+ (sel_node, node->func->arg);
if (!ret) {
- sel_node->state =
- SEL_NODE_NO_MORE_ROWS;
+ sel_node->state
+ = SEL_NODE_NO_MORE_ROWS;
}
}
}
@@ -2073,7 +2077,7 @@ row_fetch_print(
if (dfield_get_len(dfield) != UNIV_SQL_NULL) {
ut_print_buf(stderr, dfield_get_data(dfield),
- dfield_get_len(dfield));
+ dfield_get_len(dfield));
} else {
fprintf(stderr, " <NULL>;");
}
@@ -2246,7 +2250,7 @@ row_sel_convert_mysql_key_to_innobase(
while (key_ptr < key_end) {
ut_a(dict_col_get_type(field->col)->mtype
- == dfield_get_type(dfield)->mtype);
+ == dfield_get_type(dfield)->mtype);
data_offset = 0;
is_null = FALSE;
@@ -2284,7 +2288,7 @@ row_sel_convert_mysql_key_to_innobase(
from the start. */
data_len = key_ptr[data_offset]
- + 256 * key_ptr[data_offset + 1];
+ + 256 * key_ptr[data_offset + 1];
data_field_len = data_offset + 2 + field->prefix_len;
data_offset += 2;
@@ -2312,8 +2316,8 @@ row_sel_convert_mysql_key_to_innobase(
}
if (dtype_get_mysql_type(dfield_get_type(dfield))
- == DATA_MYSQL_TRUE_VARCHAR
- && dfield_get_type(dfield)->mtype != DATA_INT) {
+ == DATA_MYSQL_TRUE_VARCHAR
+ && dfield_get_type(dfield)->mtype != DATA_INT) {
/* In a MySQL key value format, a true VARCHAR is
always preceded by 2 bytes of a length field.
dfield_get_type(dfield)->len returns the maximum
@@ -2330,13 +2334,11 @@ row_sel_convert_mysql_key_to_innobase(
/* Storing may use at most data_len bytes of buf */
if (!is_null) {
- row_mysql_store_col_in_innobase_format(
- dfield,
- buf,
- FALSE, /* MySQL key value format col */
- key_ptr + data_offset,
- data_len,
- dict_table_is_comp(index->table));
+ row_mysql_store_col_in_innobase_format
+ (dfield, buf,
+ FALSE, /* MySQL key value format col */
+ key_ptr + data_offset, data_len,
+ dict_table_is_comp(index->table));
buf += data_len;
}
@@ -2354,15 +2356,16 @@ row_sel_convert_mysql_key_to_innobase(
ut_print_timestamp(stderr);
- fputs(
- " InnoDB: Warning: using a partial-field key prefix in search.\n"
- "InnoDB: ", stderr);
+ fputs(" InnoDB: Warning: using a partial-field"
+ " key prefix in search.\n"
+ "InnoDB: ", stderr);
dict_index_name_print(stderr, trx, index);
fprintf(stderr, ". Last data field length %lu bytes,\n"
- "InnoDB: key ptr now exceeds key end by %lu bytes.\n"
- "InnoDB: Key value in the MySQL format:\n",
- (ulong) data_field_len,
- (ulong) (key_ptr - key_end));
+ "InnoDB: key ptr now exceeds"
+ " key end by %lu bytes.\n"
+ "InnoDB: Key value in the MySQL format:\n",
+ (ulong) data_field_len,
+ (ulong) (key_ptr - key_end));
fflush(stderr);
ut_print_buf(stderr, original_key_ptr, key_len);
fprintf(stderr, "\n");
@@ -2402,17 +2405,19 @@ row_sel_store_row_id_to_prebuilt(
ut_ad(rec_offs_validate(index_rec, index, offsets));
- data = rec_get_nth_field(index_rec, offsets,
- dict_index_get_sys_col_pos(index, DATA_ROW_ID), &len);
+ data = rec_get_nth_field
+ (index_rec, offsets,
+ dict_index_get_sys_col_pos(index, DATA_ROW_ID), &len);
if (len != DATA_ROW_ID_LEN) {
fprintf(stderr,
-"InnoDB: Error: Row id field is wrong length %lu in ", (ulong) len);
+ "InnoDB: Error: Row id field is"
+ " wrong length %lu in ", (ulong) len);
dict_index_name_print(stderr, prebuilt->trx, index);
fprintf(stderr, "\n"
-"InnoDB: Field number %lu, record:\n",
+ "InnoDB: Field number %lu, record:\n",
(ulong) dict_index_get_sys_col_pos(index,
- DATA_ROW_ID));
+ DATA_ROW_ID));
rec_print_new(stderr, index_rec, offsets);
putc('\n', stderr);
ut_error;
@@ -2475,8 +2480,8 @@ row_sel_field_store_in_mysql_format(
length of the data to the first byte or the first
two bytes of dest. */
- dest = row_mysql_store_true_var_len(dest, len,
- templ->mysql_length_bytes);
+ dest = row_mysql_store_true_var_len
+ (dest, len, templ->mysql_length_bytes);
}
/* Copy the actual data */
@@ -2523,7 +2528,7 @@ row_sel_field_store_in_mysql_format(
already copied to the buffer in row_sel_store_mysql_rec */
row_mysql_store_blob_ref(dest, templ->mysql_col_len, data,
- len);
+ len);
} else if (templ->type == DATA_MYSQL) {
memcpy(dest, data, len);
@@ -2531,11 +2536,11 @@ row_sel_field_store_in_mysql_format(
ut_ad(templ->mbmaxlen >= templ->mbminlen);
ut_ad(templ->mbmaxlen > templ->mbminlen
- || templ->mysql_col_len == len);
+ || templ->mysql_col_len == len);
/* The following assertion would fail for old tables
containing UTF-8 ENUM columns due to Bug #9526. */
ut_ad(!templ->mbmaxlen
- || !(templ->mysql_col_len % templ->mbmaxlen));
+ || !(templ->mysql_col_len % templ->mbmaxlen));
ut_ad(len * templ->mbmaxlen >= templ->mysql_col_len);
if (templ->mbminlen != templ->mbmaxlen) {
@@ -2547,12 +2552,12 @@ row_sel_field_store_in_mysql_format(
}
} else {
ut_ad(templ->type == DATA_CHAR
- || templ->type == DATA_FIXBINARY
- /*|| templ->type == DATA_SYS_CHILD
- || templ->type == DATA_SYS*/
- || templ->type == DATA_FLOAT
- || templ->type == DATA_DOUBLE
- || templ->type == DATA_DECIMAL);
+ || templ->type == DATA_FIXBINARY
+ /*|| templ->type == DATA_SYS_CHILD
+ || templ->type == DATA_SYS*/
+ || templ->type == DATA_FLOAT
+ || templ->type == DATA_DOUBLE
+ || templ->type == DATA_DECIMAL);
ut_ad(templ->mysql_col_len == len);
memcpy(dest, data, len);
@@ -2600,7 +2605,7 @@ row_sel_store_mysql_rec(
templ = prebuilt->mysql_template + i;
if (UNIV_UNLIKELY(rec_offs_nth_extern(offsets,
- templ->rec_field_no))) {
+ templ->rec_field_no))) {
/* Copy an externally stored field to the temporary
heap */
@@ -2609,14 +2614,14 @@ row_sel_store_mysql_rec(
if (UNIV_UNLIKELY(templ->type == DATA_BLOB)) {
if (prebuilt->blob_heap == NULL) {
- prebuilt->blob_heap =
- mem_heap_create(UNIV_PAGE_SIZE);
+ prebuilt->blob_heap = mem_heap_create
+ (UNIV_PAGE_SIZE);
}
heap = prebuilt->blob_heap;
} else {
- extern_field_heap =
- mem_heap_create(UNIV_PAGE_SIZE);
+ extern_field_heap
+ = mem_heap_create(UNIV_PAGE_SIZE);
heap = extern_field_heap;
}
@@ -2625,22 +2630,22 @@ row_sel_store_mysql_rec(
already run out of memory in the next call, which
causes an assert */
- data = btr_rec_copy_externally_stored_field(rec,
- offsets, templ->rec_field_no, &len,
- heap);
+ data = btr_rec_copy_externally_stored_field
+ (rec, offsets, templ->rec_field_no,
+ &len, heap);
ut_a(len != UNIV_SQL_NULL);
} else {
/* Field is stored in the row. */
data = rec_get_nth_field(rec, offsets,
- templ->rec_field_no, &len);
+ templ->rec_field_no, &len);
}
if (len != UNIV_SQL_NULL) {
- row_sel_field_store_in_mysql_format(
- mysql_rec + templ->mysql_col_offset,
- templ, data, len);
+ row_sel_field_store_in_mysql_format
+ (mysql_rec + templ->mysql_col_offset,
+ templ, data, len);
/* Cleanup */
if (extern_field_heap) {
@@ -2651,8 +2656,8 @@ row_sel_store_mysql_rec(
if (templ->mysql_null_bit_mask) {
/* It is a nullable column with a non-NULL
value */
- mysql_rec[templ->mysql_null_byte_offset] &=
- ~(byte) (templ->mysql_null_bit_mask);
+ mysql_rec[templ->mysql_null_byte_offset]
+ &= ~(byte) templ->mysql_null_bit_mask;
}
} else {
/* MySQL seems to assume the field for an SQL NULL
@@ -2662,14 +2667,14 @@ row_sel_store_mysql_rec(
and DISTINCT could treat NULL values inequal. */
int pad_char;
- mysql_rec[templ->mysql_null_byte_offset] |=
- (byte) (templ->mysql_null_bit_mask);
+ mysql_rec[templ->mysql_null_byte_offset]
+ |= (byte) templ->mysql_null_bit_mask;
switch (templ->type) {
case DATA_VARCHAR:
case DATA_BINARY:
case DATA_VARMYSQL:
if (templ->mysql_type
- == DATA_MYSQL_TRUE_VARCHAR) {
+ == DATA_MYSQL_TRUE_VARCHAR) {
/* This is a >= 5.0.3 type
true VARCHAR. Zero the field. */
pad_char = 0x00;
@@ -2706,7 +2711,7 @@ row_sel_store_mysql_rec(
ut_ad(!pad_char || templ->mbminlen == 1);
memset(mysql_rec + templ->mysql_col_offset,
- pad_char, templ->mysql_col_len);
+ pad_char, templ->mysql_col_len);
}
}
@@ -2742,9 +2747,9 @@ row_sel_build_prev_vers_for_mysql(
prebuilt->old_vers_heap = mem_heap_create(200);
}
- err = row_vers_build_for_consistent_read(rec, mtr, clust_index,
- offsets, read_view, offset_heap,
- prebuilt->old_vers_heap, old_vers);
+ err = row_vers_build_for_consistent_read
+ (rec, mtr, clust_index, offsets, read_view, offset_heap,
+ prebuilt->old_vers_heap, old_vers);
return(err);
}
@@ -2790,8 +2795,8 @@ row_sel_get_clust_rec_for_mysql(
clust_index = dict_table_get_first_index(sec_index->table);
btr_pcur_open_with_no_init(clust_index, prebuilt->clust_ref,
- PAGE_CUR_LE, BTR_SEARCH_LEAF,
- prebuilt->clust_pcur, 0, mtr);
+ PAGE_CUR_LE, BTR_SEARCH_LEAF,
+ prebuilt->clust_pcur, 0, mtr);
clust_rec = btr_pcur_get_rec(prebuilt->clust_pcur);
@@ -2801,8 +2806,8 @@ row_sel_get_clust_rec_for_mysql(
low_match value the real match to the search tuple */
if (!page_rec_is_user_rec(clust_rec)
- || btr_pcur_get_low_match(prebuilt->clust_pcur)
- < dict_index_get_n_unique(clust_index)) {
+ || btr_pcur_get_low_match(prebuilt->clust_pcur)
+ < dict_index_get_n_unique(clust_index)) {
/* In a rare case it is possible that no clust rec is found
for a delete-marked secondary index record: if in row0umod.c
@@ -2814,24 +2819,25 @@ row_sel_get_clust_rec_for_mysql(
trx. */
if (!rec_get_deleted_flag(rec,
- dict_table_is_comp(sec_index->table))
- || prebuilt->select_lock_type != LOCK_NONE) {
+ dict_table_is_comp(sec_index->table))
+ || prebuilt->select_lock_type != LOCK_NONE) {
ut_print_timestamp(stderr);
fputs(" InnoDB: error clustered record"
- " for sec rec not found\n"
- "InnoDB: ", stderr);
+ " for sec rec not found\n"
+ "InnoDB: ", stderr);
dict_index_name_print(stderr, trx, sec_index);
fputs("\n"
- "InnoDB: sec index record ", stderr);
+ "InnoDB: sec index record ", stderr);
rec_print(stderr, rec, sec_index);
fputs("\n"
- "InnoDB: clust index record ", stderr);
+ "InnoDB: clust index record ", stderr);
rec_print(stderr, clust_rec, clust_index);
putc('\n', stderr);
trx_print(stderr, trx, 600);
fputs("\n"
-"InnoDB: Submit a detailed bug report to http://bugs.mysql.com\n", stderr);
+ "InnoDB: Submit a detailed bug report"
+ " to http://bugs.mysql.com\n", stderr);
}
clust_rec = NULL;
@@ -2840,17 +2846,16 @@ row_sel_get_clust_rec_for_mysql(
}
*offsets = rec_get_offsets(clust_rec, clust_index, *offsets,
- ULINT_UNDEFINED, offset_heap);
+ ULINT_UNDEFINED, offset_heap);
if (prebuilt->select_lock_type != LOCK_NONE) {
/* Try to place a lock on the index record; we are searching
the clust rec with a unique condition, hence
we set a LOCK_REC_NOT_GAP type lock */
- err = lock_clust_rec_read_check_and_lock(0, clust_rec,
- clust_index, *offsets,
- prebuilt->select_lock_type,
- LOCK_REC_NOT_GAP, thr);
+ err = lock_clust_rec_read_check_and_lock
+ (0, clust_rec, clust_index, *offsets,
+ prebuilt->select_lock_type, LOCK_REC_NOT_GAP, thr);
if (err != DB_SUCCESS) {
goto err_exit;
@@ -2865,16 +2870,15 @@ row_sel_get_clust_rec_for_mysql(
then we never look for an earlier version */
if (trx->isolation_level > TRX_ISO_READ_UNCOMMITTED
- && !lock_clust_rec_cons_read_sees(clust_rec,
- clust_index, *offsets, trx->read_view)) {
+ && !lock_clust_rec_cons_read_sees
+ (clust_rec, clust_index, *offsets, trx->read_view)) {
/* The following call returns 'offsets' associated with
'old_vers' */
- err = row_sel_build_prev_vers_for_mysql(
- trx->read_view, clust_index,
- prebuilt, clust_rec,
- offsets, offset_heap,
- &old_vers, mtr);
+ err = row_sel_build_prev_vers_for_mysql
+ (trx->read_view, clust_index,
+ prebuilt, clust_rec, offsets, offset_heap,
+ &old_vers, mtr);
if (err != DB_SUCCESS) {
@@ -2897,17 +2901,16 @@ row_sel_get_clust_rec_for_mysql(
visit through secondary index records that would not really
exist in our snapshot. */
- if (clust_rec && (old_vers
- || rec_get_deleted_flag(rec,
- dict_table_is_comp(sec_index->table)))
- && !row_sel_sec_rec_is_for_clust_rec(rec, sec_index,
- clust_rec, clust_index)) {
+ if (clust_rec && (old_vers || rec_get_deleted_flag
+ (rec, dict_table_is_comp(sec_index->table)))
+ && !row_sel_sec_rec_is_for_clust_rec
+ (rec, sec_index, clust_rec, clust_index)) {
clust_rec = NULL;
} else {
#ifdef UNIV_SEARCH_DEBUG
- ut_a(clust_rec == NULL ||
- row_sel_sec_rec_is_for_clust_rec(rec,
- sec_index, clust_rec, clust_index));
+ ut_a(clust_rec == NULL
+ || row_sel_sec_rec_is_for_clust_rec
+ (rec, sec_index, clust_rec, clust_index));
#endif
}
}
@@ -2973,7 +2976,7 @@ sel_restore_position_for_mysql(
}
if (relative_position == BTR_PCUR_AFTER
- || relative_position == BTR_PCUR_AFTER_LAST_IN_TREE) {
+ || relative_position == BTR_PCUR_AFTER_LAST_IN_TREE) {
if (moves_up) {
return(TRUE);
@@ -2987,7 +2990,7 @@ sel_restore_position_for_mysql(
}
ut_ad(relative_position == BTR_PCUR_BEFORE
- || relative_position == BTR_PCUR_BEFORE_FIRST_IN_TREE);
+ || relative_position == BTR_PCUR_BEFORE_FIRST_IN_TREE);
if (moves_up && btr_pcur_is_on_user_rec(pcur, mtr)) {
btr_pcur_move_to_next(pcur, mtr);
@@ -3015,28 +3018,29 @@ row_sel_pop_cached_row_for_mysql(
if (UNIV_UNLIKELY(prebuilt->keep_other_fields_on_keyread)) {
/* Copy cache record field by field, don't touch fields that
are not covered by current key */
- cached_rec =
- prebuilt->fetch_cache[prebuilt->fetch_cache_first];
+ cached_rec = prebuilt->fetch_cache
+ [prebuilt->fetch_cache_first];
for (i = 0; i < prebuilt->n_template; i++) {
templ = prebuilt->mysql_template + i;
- ut_memcpy(
- buf + templ->mysql_col_offset,
- cached_rec + templ->mysql_col_offset,
- templ->mysql_col_len);
+ ut_memcpy(buf + templ->mysql_col_offset,
+ cached_rec + templ->mysql_col_offset,
+ templ->mysql_col_len);
/* Copy NULL bit of the current field from cached_rec
to buf */
if (templ->mysql_null_bit_mask) {
- buf[templ->mysql_null_byte_offset] ^=
- (buf[templ->mysql_null_byte_offset] ^
- cached_rec[templ->mysql_null_byte_offset]) &
- (byte)templ->mysql_null_bit_mask;
+ buf[templ->mysql_null_byte_offset]
+ ^= (buf[templ->mysql_null_byte_offset]
+ ^ cached_rec
+ [templ->mysql_null_byte_offset])
+ & (byte)templ->mysql_null_bit_mask;
}
}
}
else {
- ut_memcpy(buf, prebuilt->fetch_cache[prebuilt->fetch_cache_first],
- prebuilt->mysql_prefix_len);
+ ut_memcpy(buf,
+ prebuilt->fetch_cache[prebuilt->fetch_cache_first],
+ prebuilt->mysql_prefix_len);
}
prebuilt->n_fetch_cached--;
prebuilt->fetch_cache_first++;
@@ -3084,9 +3088,9 @@ row_sel_push_cache_row_for_mysql(
ut_ad(prebuilt->fetch_cache_first == 0);
- if (UNIV_UNLIKELY(!row_sel_store_mysql_rec(
- prebuilt->fetch_cache[prebuilt->n_fetch_cached],
- prebuilt, rec, offsets))) {
+ if (UNIV_UNLIKELY(!row_sel_store_mysql_rec
+ (prebuilt->fetch_cache[prebuilt->n_fetch_cached],
+ prebuilt, rec, offsets))) {
ut_error;
}
@@ -3119,13 +3123,13 @@ row_sel_try_search_shortcut_for_mysql(
ut_ad(!prebuilt->templ_contains_blob);
btr_pcur_open_with_no_init(index, search_tuple, PAGE_CUR_GE,
- BTR_SEARCH_LEAF, pcur,
+ BTR_SEARCH_LEAF, pcur,
#ifndef UNIV_SEARCH_DEBUG
- RW_S_LATCH,
+ RW_S_LATCH,
#else
- 0,
+ 0,
#endif
- mtr);
+ mtr);
rec = btr_pcur_get_rec(pcur);
if (!page_rec_is_user_rec(rec)) {
@@ -3146,10 +3150,10 @@ row_sel_try_search_shortcut_for_mysql(
a previous version of the record */
*offsets = rec_get_offsets(rec, index, *offsets,
- ULINT_UNDEFINED, heap);
+ ULINT_UNDEFINED, heap);
if (!lock_clust_rec_cons_read_sees(rec, index,
- *offsets, trx->read_view)) {
+ *offsets, trx->read_view)) {
return(SEL_RETRY);
}
@@ -3213,15 +3217,15 @@ row_search_for_mysql(
ibool mtr_has_extra_clust_latch = FALSE;
ibool moves_up = FALSE;
ibool set_also_gap_locks = TRUE;
- /* if the query is a plain
- locking SELECT, and the isolation
- level is <= TRX_ISO_READ_COMMITTED,
- then this is set to FALSE */
+ /* if the query is a plain
+ locking SELECT, and the isolation
+ level is <= TRX_ISO_READ_COMMITTED,
+ then this is set to FALSE */
ibool did_semi_consistent_read = FALSE;
- /* if the returned record was locked
- and we did a semi-consistent read
- (fetch the newest committed version),
- then this is set to TRUE */
+ /* if the returned record was locked
+ and we did a semi-consistent read
+ (fetch the newest committed version),
+ then this is set to TRUE */
#ifdef UNIV_SEARCH_DEBUG
ulint cnt = 0;
#endif /* UNIV_SEARCH_DEBUG */
@@ -3240,23 +3244,27 @@ row_search_for_mysql(
if (UNIV_UNLIKELY(prebuilt->table->ibd_file_missing)) {
ut_print_timestamp(stderr);
fprintf(stderr, " InnoDB: Error:\n"
-"InnoDB: MySQL is trying to use a table handle but the .ibd file for\n"
-"InnoDB: table %s does not exist.\n"
-"InnoDB: Have you deleted the .ibd file from the database directory under\n"
-"InnoDB: the MySQL datadir, or have you used DISCARD TABLESPACE?\n"
-"InnoDB: Look from\n"
-"InnoDB: http://dev.mysql.com/doc/refman/5.1/en/innodb-troubleshooting.html\n"
-"InnoDB: how you can resolve the problem.\n",
- prebuilt->table->name);
+ "InnoDB: MySQL is trying to use a table handle"
+ " but the .ibd file for\n"
+ "InnoDB: table %s does not exist.\n"
+ "InnoDB: Have you deleted the .ibd file"
+ " from the database directory under\n"
+ "InnoDB: the MySQL datadir, or have you used"
+ " DISCARD TABLESPACE?\n"
+ "InnoDB: Look from\n"
+ "InnoDB: http://dev.mysql.com/doc/refman/5.1/en/"
+ "innodb-troubleshooting.html\n"
+ "InnoDB: how you can resolve the problem.\n",
+ prebuilt->table->name);
return(DB_ERROR);
}
if (UNIV_UNLIKELY(prebuilt->magic_n != ROW_PREBUILT_ALLOCATED)) {
fprintf(stderr,
- "InnoDB: Error: trying to free a corrupt\n"
- "InnoDB: table handle. Magic n %lu, table name ",
- (ulong) prebuilt->magic_n);
+ "InnoDB: Error: trying to free a corrupt\n"
+ "InnoDB: table handle. Magic n %lu, table name ",
+ (ulong) prebuilt->magic_n);
ut_print_name(stderr, trx, TRUE, prebuilt->table->name);
putc('\n', stderr);
@@ -3265,37 +3273,40 @@ row_search_for_mysql(
ut_error;
}
+#if 0
+ /* August 19, 2005 by Heikki: temporarily disable this error
+ print until the cursor lock count is done correctly.
+ See bugs #12263 and #12456!*/
+
if (trx->n_mysql_tables_in_use == 0
- && UNIV_UNLIKELY(prebuilt->select_lock_type == LOCK_NONE)) {
+ && UNIV_UNLIKELY(prebuilt->select_lock_type == LOCK_NONE)) {
/* Note that if MySQL uses an InnoDB temp table that it
created inside LOCK TABLES, then n_mysql_tables_in_use can
be zero; in that case select_lock_type is set to LOCK_X in
::start_stmt. */
-/* August 19, 2005 by Heikki: temporarily disable this error print until the
-cursor lock count is done correctly. See bugs #12263 and #12456!
-
- fputs(
-"InnoDB: Error: MySQL is trying to perform a SELECT\n"
-"InnoDB: but it has not locked any tables in ::external_lock()!\n",
-stderr);
+ fputs("InnoDB: Error: MySQL is trying to perform a SELECT\n"
+ "InnoDB: but it has not locked"
+ " any tables in ::external_lock()!\n",
+ stderr);
trx_print(stderr, trx, 600);
fputc('\n', stderr);
-*/
-
}
+#endif
-/* fprintf(stderr, "Match mode %lu\n search tuple ", (ulong) match_mode);
+#if 0
+ fprintf(stderr, "Match mode %lu\n search tuple ",
+ (ulong) match_mode);
dtuple_print(search_tuple);
-
- fprintf(stderr, "N tables locked %lu\n", trx->mysql_n_tables_locked);
-*/
+ fprintf(stderr, "N tables locked %lu\n",
+ (ulong) trx->mysql_n_tables_locked);
+#endif
/*-------------------------------------------------------------*/
/* PHASE 0: Release a possible s-latch we are holding on the
adaptive hash index latch if there is someone waiting behind */
if (UNIV_UNLIKELY(btr_search_latch.writer != RW_LOCK_NOT_LOCKED)
- && trx->has_search_latch) {
+ && trx->has_search_latch) {
/* There is an x-latch request on the adaptive hash index:
release the s-latch to reduce starvation and wait for
@@ -3314,8 +3325,8 @@ stderr);
row. */
if ((srv_locks_unsafe_for_binlog
- || trx->isolation_level == TRX_ISO_READ_COMMITTED)
- && prebuilt->select_lock_type != LOCK_NONE) {
+ || trx->isolation_level == TRX_ISO_READ_COMMITTED)
+ && prebuilt->select_lock_type != LOCK_NONE) {
trx_reset_new_rec_lock_info(trx);
}
@@ -3365,7 +3376,7 @@ stderr);
}
if (prebuilt->fetch_cache_first > 0
- && prebuilt->fetch_cache_first < MYSQL_FETCH_CACHE_SIZE) {
+ && prebuilt->fetch_cache_first < MYSQL_FETCH_CACHE_SIZE) {
/* The previous returned row was popped from the fetch
cache, but the cache was not full at the time of the
@@ -3386,20 +3397,20 @@ stderr);
}
/* In a search where at most one record in the index may match, we
- can use a LOCK_REC_NOT_GAP type record lock when locking a non-delete-
- marked matching record.
+ can use a LOCK_REC_NOT_GAP type record lock when locking a
+ non-delete-marked matching record.
- Note that in a unique secondary index there may be different delete-
- marked versions of a record where only the primary key values differ:
- thus in a secondary index we must use next-key locks when locking
- delete-marked records. */
+ Note that in a unique secondary index there may be different
+ delete-marked versions of a record where only the primary key
+ values differ: thus in a secondary index we must use next-key
+ locks when locking delete-marked records. */
if (match_mode == ROW_SEL_EXACT
- && index->type & DICT_UNIQUE
- && dtuple_get_n_fields(search_tuple)
- == dict_index_get_n_unique(index)
- && (index->type & DICT_CLUSTERED
- || !dtuple_contains_null(search_tuple))) {
+ && index->type & DICT_UNIQUE
+ && dtuple_get_n_fields(search_tuple)
+ == dict_index_get_n_unique(index)
+ && (index->type & DICT_CLUSTERED
+ || !dtuple_contains_null(search_tuple))) {
/* Note above that a UNIQUE secondary index can contain many
rows with the same key value if one of the columns is the SQL
@@ -3414,8 +3425,8 @@ stderr);
1 column. Return immediately if this is not a HANDLER
command. */
- if (UNIV_UNLIKELY(direction != 0 &&
- !prebuilt->used_in_HANDLER)) {
+ if (UNIV_UNLIKELY(direction != 0
+ && !prebuilt->used_in_HANDLER)) {
err = DB_RECORD_NOT_FOUND;
goto func_exit;
@@ -3434,20 +3445,20 @@ stderr);
may be long and there may be externally stored fields */
if (UNIV_UNLIKELY(direction == 0)
- && unique_search
- && index->type & DICT_CLUSTERED
- && !prebuilt->templ_contains_blob
- && !prebuilt->used_in_HANDLER
- && (prebuilt->mysql_row_len < UNIV_PAGE_SIZE / 8)) {
+ && unique_search
+ && index->type & DICT_CLUSTERED
+ && !prebuilt->templ_contains_blob
+ && !prebuilt->used_in_HANDLER
+ && (prebuilt->mysql_row_len < UNIV_PAGE_SIZE / 8)) {
mode = PAGE_CUR_GE;
unique_search_from_clust_index = TRUE;
if (trx->mysql_n_tables_locked == 0
- && prebuilt->select_lock_type == LOCK_NONE
- && trx->isolation_level > TRX_ISO_READ_UNCOMMITTED
- && trx->read_view) {
+ && prebuilt->select_lock_type == LOCK_NONE
+ && trx->isolation_level > TRX_ISO_READ_UNCOMMITTED
+ && trx->read_view) {
/* This is a SELECT query done as a consistent read,
and the read view has already been allocated:
@@ -3467,15 +3478,15 @@ stderr);
trx->has_search_latch = TRUE;
}
#endif
- switch (row_sel_try_search_shortcut_for_mysql(&rec,
- prebuilt, &offsets, &heap, &mtr)) {
+ switch (row_sel_try_search_shortcut_for_mysql
+ (&rec, prebuilt, &offsets, &heap, &mtr)) {
case SEL_FOUND:
#ifdef UNIV_SEARCH_DEBUG
ut_a(0 == cmp_dtuple_rec(search_tuple,
- rec, offsets));
+ rec, offsets));
#endif
if (!row_sel_store_mysql_rec(buf, prebuilt,
- rec, offsets)) {
+ rec, offsets)) {
err = DB_TOO_BIG_RECORD;
/* We let the main loop to do the
@@ -3491,7 +3502,7 @@ stderr);
srv_n_rows_read++;
if (trx->search_latch_timeout > 0
- && trx->has_search_latch) {
+ && trx->has_search_latch) {
trx->search_latch_timeout--;
@@ -3511,7 +3522,7 @@ stderr);
fputs(" record not found 2\n", stderr); */
if (trx->search_latch_timeout > 0
- && trx->has_search_latch) {
+ && trx->has_search_latch) {
trx->search_latch_timeout--;
@@ -3542,14 +3553,14 @@ shortcut_fails_too_big_rec:
trx_start_if_not_started(trx);
if (trx->isolation_level <= TRX_ISO_READ_COMMITTED
- && prebuilt->select_lock_type != LOCK_NONE
- && trx->mysql_query_str && trx->mysql_thd) {
+ && prebuilt->select_lock_type != LOCK_NONE
+ && trx->mysql_query_str && trx->mysql_thd) {
/* Scan the MySQL query string; check if SELECT is the first
word there */
- if (dict_str_starts_with_keyword(trx->mysql_thd,
- *trx->mysql_query_str, "SELECT")) {
+ if (dict_str_starts_with_keyword
+ (trx->mysql_thd, *trx->mysql_query_str, "SELECT")) {
/* It is a plain locking SELECT and the isolation
level is low: do not lock gaps */
@@ -3576,13 +3587,13 @@ shortcut_fails_too_big_rec:
clust_index = dict_table_get_first_index(index->table);
if (UNIV_LIKELY(direction != 0)) {
- ibool need_to_process = sel_restore_position_for_mysql(
- &same_user_rec, BTR_SEARCH_LEAF,
- pcur, moves_up, &mtr);
+ ibool need_to_process = sel_restore_position_for_mysql
+ (&same_user_rec, BTR_SEARCH_LEAF,
+ pcur, moves_up, &mtr);
if (UNIV_UNLIKELY(need_to_process)) {
if (UNIV_UNLIKELY(prebuilt->row_read_type
- == ROW_READ_DID_SEMI_CONSISTENT)) {
+ == ROW_READ_DID_SEMI_CONSISTENT)) {
/* We did a semi-consistent read,
but the record was removed in
the meantime. */
@@ -3590,7 +3601,7 @@ shortcut_fails_too_big_rec:
= ROW_READ_TRY_SEMI_CONSISTENT;
}
} else if (UNIV_LIKELY(prebuilt->row_read_type
- != ROW_READ_DID_SEMI_CONSISTENT)) {
+ != ROW_READ_DID_SEMI_CONSISTENT)) {
/* The cursor was positioned on the record
that we returned previously. If we need
@@ -3604,17 +3615,19 @@ shortcut_fails_too_big_rec:
} else if (dtuple_get_n_fields(search_tuple) > 0) {
btr_pcur_open_with_no_init(index, search_tuple, mode,
- BTR_SEARCH_LEAF,
- pcur, 0, &mtr);
+ BTR_SEARCH_LEAF,
+ pcur, 0, &mtr);
pcur->trx_if_known = trx;
} else {
if (mode == PAGE_CUR_G) {
- btr_pcur_open_at_index_side(TRUE, index,
- BTR_SEARCH_LEAF, pcur, FALSE, &mtr);
+ btr_pcur_open_at_index_side
+ (TRUE, index,
+ BTR_SEARCH_LEAF, pcur, FALSE, &mtr);
} else if (mode == PAGE_CUR_L) {
- btr_pcur_open_at_index_side(FALSE, index,
- BTR_SEARCH_LEAF, pcur, FALSE, &mtr);
+ btr_pcur_open_at_index_side
+ (FALSE, index,
+ BTR_SEARCH_LEAF, pcur, FALSE, &mtr);
}
}
@@ -3622,11 +3635,12 @@ shortcut_fails_too_big_rec:
/* No need to set an intention lock or assign a read view */
if (trx->read_view == NULL
- && prebuilt->select_lock_type == LOCK_NONE) {
+ && prebuilt->select_lock_type == LOCK_NONE) {
- fputs(
-"InnoDB: Error: MySQL is trying to perform a consistent read\n"
-"InnoDB: but the read view is not assigned!\n", stderr);
+ fputs("InnoDB: Error: MySQL is trying to"
+ " perform a consistent read\n"
+ "InnoDB: but the read view is not assigned!\n",
+ stderr);
trx_print(stderr, trx, 600);
fputc('\n', stderr);
ut_a(0);
@@ -3660,13 +3674,13 @@ rec_loop:
rec = btr_pcur_get_rec(pcur);
ut_ad(!!page_rec_is_comp(rec) == comp);
#ifdef UNIV_SEARCH_DEBUG
-/*
+ /*
fputs("Using ", stderr);
dict_index_name_print(stderr, index);
fprintf(stderr, " cnt %lu ; Page no %lu\n", cnt,
- buf_frame_get_page_no(buf_frame_align(rec)));
+ buf_frame_get_page_no(buf_frame_align(rec)));
rec_print(rec);
-*/
+ */
#endif /* UNIV_SEARCH_DEBUG */
if (page_rec_is_infimum(rec)) {
@@ -3681,9 +3695,9 @@ rec_loop:
if (page_rec_is_supremum(rec)) {
if (set_also_gap_locks
- && !(srv_locks_unsafe_for_binlog
- || trx->isolation_level == TRX_ISO_READ_COMMITTED)
- && prebuilt->select_lock_type != LOCK_NONE) {
+ && !(srv_locks_unsafe_for_binlog
+ || trx->isolation_level == TRX_ISO_READ_COMMITTED)
+ && prebuilt->select_lock_type != LOCK_NONE) {
/* Try to place a lock on the index record */
@@ -3693,10 +3707,10 @@ rec_loop:
a gap and therefore we do not set locks there. */
offsets = rec_get_offsets(rec, index, offsets,
- ULINT_UNDEFINED, &heap);
+ ULINT_UNDEFINED, &heap);
err = sel_set_rec_lock(rec, index, offsets,
- prebuilt->select_lock_type,
- LOCK_ORDINARY, thr);
+ prebuilt->select_lock_type,
+ LOCK_ORDINARY, thr);
if (err != DB_SUCCESS) {
@@ -3734,21 +3748,25 @@ wrong_offs:
ut_print_timestamp(stderr);
buf_page_print(buf_frame_align(rec));
fprintf(stderr,
-"\nInnoDB: rec address %p, first buffer frame %p\n"
-"InnoDB: buffer pool high end %p, buf block fix count %lu\n",
- rec, buf_pool->frame_zero,
- buf_pool->high_end,
+ "\nInnoDB: rec address %p, first"
+ " buffer frame %p\n"
+ "InnoDB: buffer pool high end %p,"
+ " buf block fix count %lu\n",
+ (void*) rec, (void*) buf_pool->frame_zero,
+ (void*) buf_pool->high_end,
(ulong)buf_block_align(rec)->buf_fix_count);
fprintf(stderr,
-"InnoDB: Index corruption: rec offs %lu next offs %lu, page no %lu,\n"
-"InnoDB: ",
+ "InnoDB: Index corruption: rec offs %lu"
+ " next offs %lu, page no %lu,\n"
+ "InnoDB: ",
(ulong) ut_align_offset(rec, UNIV_PAGE_SIZE),
(ulong) next_offs,
(ulong) buf_frame_get_page_no(rec));
dict_index_name_print(stderr, trx, index);
fputs(". Run CHECK TABLE. You may need to\n"
-"InnoDB: restore from a backup, or dump + drop + reimport the table.\n",
- stderr);
+ "InnoDB: restore from a backup, or"
+ " dump + drop + reimport the table.\n",
+ stderr);
err = DB_CORRUPTION;
@@ -3758,14 +3776,15 @@ wrong_offs:
over the corruption to recover as much as possible. */
fprintf(stderr,
-"InnoDB: Index corruption: rec offs %lu next offs %lu, page no %lu,\n"
-"InnoDB: ",
- (ulong) ut_align_offset(rec, UNIV_PAGE_SIZE),
- (ulong) next_offs,
- (ulong) buf_frame_get_page_no(rec));
+ "InnoDB: Index corruption: rec offs %lu"
+ " next offs %lu, page no %lu,\n"
+ "InnoDB: ",
+ (ulong) ut_align_offset(rec, UNIV_PAGE_SIZE),
+ (ulong) next_offs,
+ (ulong) buf_frame_get_page_no(rec));
dict_index_name_print(stderr, trx, index);
fputs(". We try to skip the rest of the page.\n",
- stderr);
+ stderr);
btr_pcur_move_to_last_on_page(pcur, &mtr);
@@ -3780,16 +3799,17 @@ wrong_offs:
if (UNIV_UNLIKELY(srv_force_recovery > 0)) {
if (!rec_validate(rec, offsets)
- || !btr_index_rec_validate(rec, index, FALSE)) {
+ || !btr_index_rec_validate(rec, index, FALSE)) {
fprintf(stderr,
-"InnoDB: Index corruption: rec offs %lu next offs %lu, page no %lu,\n"
-"InnoDB: ",
- (ulong) ut_align_offset(rec, UNIV_PAGE_SIZE),
- (ulong) next_offs,
- (ulong) buf_frame_get_page_no(rec));
+ "InnoDB: Index corruption: rec offs %lu"
+ " next offs %lu, page no %lu,\n"
+ "InnoDB: ",
+ (ulong) ut_align_offset(rec, UNIV_PAGE_SIZE),
+ (ulong) next_offs,
+ (ulong) buf_frame_get_page_no(rec));
dict_index_name_print(stderr, trx, index);
fputs(". We try to skip the record.\n",
- stderr);
+ stderr);
goto next_rec;
}
@@ -3809,18 +3829,20 @@ wrong_offs:
if (0 != cmp_dtuple_rec(search_tuple, rec, offsets)) {
if (set_also_gap_locks
- && !(srv_locks_unsafe_for_binlog
- || trx->isolation_level == TRX_ISO_READ_COMMITTED)
- && prebuilt->select_lock_type != LOCK_NONE) {
+ && !(srv_locks_unsafe_for_binlog
+ || trx->isolation_level
+ == TRX_ISO_READ_COMMITTED)
+ && prebuilt->select_lock_type != LOCK_NONE) {
/* Try to place a gap lock on the index
record only if innodb_locks_unsafe_for_binlog
option is not set or this session is not
using a READ COMMITTED isolation level. */
- err = sel_set_rec_lock(rec, index, offsets,
- prebuilt->select_lock_type,
- LOCK_GAP, thr);
+ err = sel_set_rec_lock
+ (rec, index, offsets,
+ prebuilt->select_lock_type,
+ LOCK_GAP, thr);
if (err != DB_SUCCESS) {
@@ -3842,18 +3864,20 @@ wrong_offs:
if (!cmp_dtuple_is_prefix_of_rec(search_tuple, rec, offsets)) {
if (set_also_gap_locks
- && !(srv_locks_unsafe_for_binlog
- || trx->isolation_level == TRX_ISO_READ_COMMITTED)
- && prebuilt->select_lock_type != LOCK_NONE) {
+ && !(srv_locks_unsafe_for_binlog
+ || trx->isolation_level
+ == TRX_ISO_READ_COMMITTED)
+ && prebuilt->select_lock_type != LOCK_NONE) {
/* Try to place a gap lock on the index
record only if innodb_locks_unsafe_for_binlog
option is not set or this session is not
using a READ COMMITTED isolation level. */
- err = sel_set_rec_lock(rec, index, offsets,
- prebuilt->select_lock_type,
- LOCK_GAP, thr);
+ err = sel_set_rec_lock
+ (rec, index, offsets,
+ prebuilt->select_lock_type,
+ LOCK_GAP, thr);
if (err != DB_SUCCESS) {
@@ -3888,9 +3912,9 @@ wrong_offs:
ulint lock_type;
if (!set_also_gap_locks
- || srv_locks_unsafe_for_binlog
- || trx->isolation_level == TRX_ISO_READ_COMMITTED
- || (unique_search
+ || srv_locks_unsafe_for_binlog
+ || trx->isolation_level == TRX_ISO_READ_COMMITTED
+ || (unique_search
&& !UNIV_UNLIKELY(rec_get_deleted_flag(rec, comp)))) {
goto no_gap_lock;
@@ -3910,18 +3934,18 @@ wrong_offs:
need to lock the gap before that record. */
if (index == clust_index
- && mode == PAGE_CUR_GE
- && direction == 0
- && dtuple_get_n_fields_cmp(search_tuple)
- == dict_index_get_n_unique(index)
- && 0 == cmp_dtuple_rec(search_tuple, rec, offsets)) {
+ && mode == PAGE_CUR_GE
+ && direction == 0
+ && dtuple_get_n_fields_cmp(search_tuple)
+ == dict_index_get_n_unique(index)
+ && 0 == cmp_dtuple_rec(search_tuple, rec, offsets)) {
no_gap_lock:
lock_type = LOCK_REC_NOT_GAP;
}
err = sel_set_rec_lock(rec, index, offsets,
- prebuilt->select_lock_type,
- lock_type, thr);
+ prebuilt->select_lock_type,
+ lock_type, thr);
switch (err) {
rec_t* old_vers;
@@ -3930,17 +3954,16 @@ no_gap_lock:
case DB_LOCK_WAIT:
if (UNIV_LIKELY(prebuilt->row_read_type
!= ROW_READ_TRY_SEMI_CONSISTENT)
- || index != clust_index) {
+ || index != clust_index) {
goto lock_wait_or_error;
}
/* The following call returns 'offsets'
associated with 'old_vers' */
- err = row_sel_build_committed_vers_for_mysql(
- clust_index, prebuilt, rec,
- &offsets, &heap,
- &old_vers, &mtr);
+ err = row_sel_build_committed_vers_for_mysql
+ (clust_index, prebuilt, rec,
+ &offsets, &heap, &old_vers, &mtr);
if (err != DB_SUCCESS) {
@@ -3954,8 +3977,8 @@ no_gap_lock:
goto lock_wait_or_error;
}
if (UNIV_LIKELY(trx->wait_lock != NULL)) {
- lock_cancel_waiting_and_release(
- trx->wait_lock);
+ lock_cancel_waiting_and_release
+ (trx->wait_lock);
trx_reset_new_rec_lock_info(trx);
} else {
mutex_exit(&kernel_mutex);
@@ -3965,7 +3988,8 @@ no_gap_lock:
Do a normal locking read. */
offsets = rec_get_offsets(rec, index, offsets,
- ULINT_UNDEFINED, &heap);
+ ULINT_UNDEFINED,
+ &heap);
err = DB_SUCCESS;
break;
}
@@ -4001,17 +4025,16 @@ no_gap_lock:
by skipping this lookup */
if (UNIV_LIKELY(srv_force_recovery < 5)
- && !lock_clust_rec_cons_read_sees(rec, index,
- offsets, trx->read_view)) {
+ && !lock_clust_rec_cons_read_sees
+ (rec, index, offsets, trx->read_view)) {
rec_t* old_vers;
/* The following call returns 'offsets'
associated with 'old_vers' */
- err = row_sel_build_prev_vers_for_mysql(
- trx->read_view, clust_index,
- prebuilt, rec,
- &offsets, &heap,
- &old_vers, &mtr);
+ err = row_sel_build_prev_vers_for_mysql
+ (trx->read_view, clust_index,
+ prebuilt, rec, &offsets, &heap,
+ &old_vers, &mtr);
if (err != DB_SUCCESS) {
@@ -4051,9 +4074,9 @@ no_gap_lock:
/* The record is delete-marked: we can skip it */
if ((srv_locks_unsafe_for_binlog
- || trx->isolation_level == TRX_ISO_READ_COMMITTED)
- && prebuilt->select_lock_type != LOCK_NONE
- && !did_semi_consistent_read) {
+ || trx->isolation_level == TRX_ISO_READ_COMMITTED)
+ && prebuilt->select_lock_type != LOCK_NONE
+ && !did_semi_consistent_read) {
/* No need to keep a lock on a delete-marked record
if we do not want to use next-key locking. */
@@ -4086,8 +4109,8 @@ requires_clust_rec:
built for a consistent read. */
err = row_sel_get_clust_rec_for_mysql(prebuilt, index, rec,
- thr, &clust_rec,
- &offsets, &heap, &mtr);
+ thr, &clust_rec,
+ &offsets, &heap, &mtr);
if (err != DB_SUCCESS) {
goto lock_wait_or_error;
@@ -4105,8 +4128,8 @@ requires_clust_rec:
/* The record is delete marked: we can skip it */
if ((srv_locks_unsafe_for_binlog
- || trx->isolation_level == TRX_ISO_READ_COMMITTED)
- && prebuilt->select_lock_type != LOCK_NONE) {
+ || trx->isolation_level == TRX_ISO_READ_COMMITTED)
+ && prebuilt->select_lock_type != LOCK_NONE) {
/* No need to keep a lock on a delete-marked
record if we do not want to use next-key
@@ -4123,12 +4146,12 @@ requires_clust_rec:
result_rec = clust_rec;
ut_ad(rec_offs_validate(result_rec, clust_index,
- offsets));
+ offsets));
} else {
/* We used 'offsets' for the clust rec, recalculate
them for 'rec' */
offsets = rec_get_offsets(rec, index, offsets,
- ULINT_UNDEFINED, &heap);
+ ULINT_UNDEFINED, &heap);
result_rec = rec;
}
} else {
@@ -4143,13 +4166,13 @@ requires_clust_rec:
offsets));
if ((match_mode == ROW_SEL_EXACT
- || prebuilt->n_rows_fetched >= MYSQL_FETCH_CACHE_THRESHOLD)
- && prebuilt->select_lock_type == LOCK_NONE
- && !prebuilt->templ_contains_blob
- && !prebuilt->clust_index_was_generated
- && !prebuilt->used_in_HANDLER
- && prebuilt->template_type
- != ROW_MYSQL_DUMMY_TEMPLATE) {
+ || prebuilt->n_rows_fetched >= MYSQL_FETCH_CACHE_THRESHOLD)
+ && prebuilt->select_lock_type == LOCK_NONE
+ && !prebuilt->templ_contains_blob
+ && !prebuilt->clust_index_was_generated
+ && !prebuilt->used_in_HANDLER
+ && prebuilt->template_type
+ != ROW_MYSQL_DUMMY_TEMPLATE) {
/* Inside an update, for example, we do not cache rows,
since we may use the cursor position to do the actual
@@ -4161,7 +4184,7 @@ requires_clust_rec:
cursor. */
row_sel_push_cache_row_for_mysql(prebuilt, result_rec,
- offsets);
+ offsets);
if (prebuilt->n_fetch_cached == MYSQL_FETCH_CACHE_SIZE) {
goto got_row;
@@ -4171,13 +4194,13 @@ requires_clust_rec:
} else {
if (prebuilt->template_type == ROW_MYSQL_DUMMY_TEMPLATE) {
memcpy(buf + 4, result_rec
- - rec_offs_extra_size(offsets),
- rec_offs_size(offsets));
+ - rec_offs_extra_size(offsets),
+ rec_offs_size(offsets));
mach_write_to_4(buf,
rec_offs_extra_size(offsets) + 4);
} else {
if (!row_sel_store_mysql_rec(buf, prebuilt,
- result_rec, offsets)) {
+ result_rec, offsets)) {
err = DB_TOO_BIG_RECORD;
goto lock_wait_or_error;
@@ -4186,12 +4209,12 @@ requires_clust_rec:
if (prebuilt->clust_index_was_generated) {
if (result_rec != rec) {
- offsets = rec_get_offsets(
- rec, index, offsets,
- ULINT_UNDEFINED, &heap);
+ offsets = rec_get_offsets
+ (rec, index, offsets,
+ ULINT_UNDEFINED, &heap);
}
row_sel_store_row_id_to_prebuilt(prebuilt, rec,
- index, offsets);
+ index, offsets);
}
}
@@ -4206,8 +4229,8 @@ got_row:
even after a unique search. */
if (!unique_search_from_clust_index
- || prebuilt->select_lock_type != LOCK_NONE
- || prebuilt->used_in_HANDLER) {
+ || prebuilt->select_lock_type != LOCK_NONE
+ || prebuilt->used_in_HANDLER) {
/* Inside an update always store the cursor position */
@@ -4221,14 +4244,14 @@ got_row:
next_rec:
/* Reset the old and new "did semi-consistent read" flags. */
if (UNIV_UNLIKELY(prebuilt->row_read_type
- == ROW_READ_DID_SEMI_CONSISTENT)) {
+ == ROW_READ_DID_SEMI_CONSISTENT)) {
prebuilt->row_read_type = ROW_READ_TRY_SEMI_CONSISTENT;
}
did_semi_consistent_read = FALSE;
if (UNIV_UNLIKELY(srv_locks_unsafe_for_binlog
- || trx->isolation_level == TRX_ISO_READ_COMMITTED)
- && prebuilt->select_lock_type != LOCK_NONE) {
+ || trx->isolation_level == TRX_ISO_READ_COMMITTED)
+ && prebuilt->select_lock_type != LOCK_NONE) {
trx_reset_new_rec_lock_info(trx);
}
@@ -4249,8 +4272,8 @@ next_rec:
mtr_start(&mtr);
if (sel_restore_position_for_mysql(&same_user_rec,
- BTR_SEARCH_LEAF,
- pcur, moves_up, &mtr)) {
+ BTR_SEARCH_LEAF,
+ pcur, moves_up, &mtr)) {
#ifdef UNIV_SEARCH_DEBUG
cnt++;
#endif /* UNIV_SEARCH_DEBUG */
@@ -4287,7 +4310,7 @@ not_moved:
lock_wait_or_error:
/* Reset the old and new "did semi-consistent read" flags. */
if (UNIV_UNLIKELY(prebuilt->row_read_type
- == ROW_READ_DID_SEMI_CONSISTENT)) {
+ == ROW_READ_DID_SEMI_CONSISTENT)) {
prebuilt->row_read_type = ROW_READ_TRY_SEMI_CONSISTENT;
}
did_semi_consistent_read = FALSE;
@@ -4314,12 +4337,12 @@ lock_wait_or_error:
mtr_start(&mtr);
sel_restore_position_for_mysql(&same_user_rec,
- BTR_SEARCH_LEAF, pcur,
- moves_up, &mtr);
+ BTR_SEARCH_LEAF, pcur,
+ moves_up, &mtr);
if ((srv_locks_unsafe_for_binlog
- || trx->isolation_level == TRX_ISO_READ_COMMITTED)
- && !same_user_rec) {
+ || trx->isolation_level == TRX_ISO_READ_COMMITTED)
+ && !same_user_rec) {
/* Since we were not able to restore the cursor
on the same user record, we cannot use
@@ -4348,7 +4371,7 @@ lock_wait_or_error:
thr->lock_state = QUE_THR_LOCK_NOLOCK;
#ifdef UNIV_SEARCH_DEBUG
-/* fputs("Using ", stderr);
+ /* fputs("Using ", stderr);
dict_index_name_print(stderr, index);
fprintf(stderr, " cnt %lu ret value %lu err\n", cnt, err); */
#endif /* UNIV_SEARCH_DEBUG */
@@ -4367,7 +4390,7 @@ normal_return:
}
#ifdef UNIV_SEARCH_DEBUG
-/* fputs("Using ", stderr);
+ /* fputs("Using ", stderr);
dict_index_name_print(stderr, index);
fprintf(stderr, " cnt %lu ret value %lu err\n", cnt, err); */
#endif /* UNIV_SEARCH_DEBUG */
@@ -4385,7 +4408,7 @@ func_exit:
The flag did_semi_consistent_read is set if and only if
the record being returned was fetched with a semi-consistent read. */
ut_ad(prebuilt->row_read_type != ROW_READ_WITH_LOCKS
- || !did_semi_consistent_read);
+ || !did_semi_consistent_read);
if (UNIV_UNLIKELY(prebuilt->row_read_type != ROW_READ_WITH_LOCKS)) {
if (UNIV_UNLIKELY(did_semi_consistent_read)) {
@@ -4432,8 +4455,8 @@ row_search_check_if_query_cache_permitted(
IX type locks actually would require ret = FALSE. */
if (UT_LIST_GET_LEN(table->locks) == 0
- && ut_dulint_cmp(trx->id,
- table->query_cache_inv_trx_id) >= 0) {
+ && ut_dulint_cmp(trx->id,
+ table->query_cache_inv_trx_id) >= 0) {
ret = TRUE;
@@ -4441,10 +4464,10 @@ row_search_check_if_query_cache_permitted(
transaction if it does not yet have one */
if (trx->isolation_level >= TRX_ISO_REPEATABLE_READ
- && !trx->read_view) {
+ && !trx->read_view) {
- trx->read_view = read_view_open_now(trx->id,
- trx->global_read_view_heap);
+ trx->read_view = read_view_open_now
+ (trx->id, trx->global_read_view_heap);
trx->global_read_view = trx->read_view;
}
}
diff --git a/storage/innobase/row/row0uins.c b/storage/innobase/row/row0uins.c
index 2bf4b0e5c65..822b7cfb9f2 100644
--- a/storage/innobase/row/row0uins.c
+++ b/storage/innobase/row/row0uins.c
@@ -48,7 +48,7 @@ row_undo_ins_remove_clust_rec(
mtr_start(&mtr);
success = btr_pcur_restore_position(BTR_MODIFY_LEAF, &(node->pcur),
- &mtr);
+ &mtr);
ut_a(success);
if (ut_dulint_cmp(node->table->id, DICT_INDEXES_ID) == 0) {
@@ -63,7 +63,7 @@ row_undo_ins_remove_clust_rec(
mtr_start(&mtr);
success = btr_pcur_restore_position(BTR_MODIFY_LEAF,
- &(node->pcur), &mtr);
+ &(node->pcur), &mtr);
ut_a(success);
}
@@ -83,7 +83,7 @@ retry:
mtr_start(&mtr);
success = btr_pcur_restore_position(BTR_MODIFY_TREE,
- &(node->pcur), &mtr);
+ &(node->pcur), &mtr);
ut_a(success);
btr_cur_pessimistic_delete(&err, FALSE, btr_cur, TRUE, &mtr);
@@ -93,7 +93,7 @@ retry:
and restart with more file space */
if (err == DB_OUT_OF_FILE_SPACE
- && n_tries < BTR_CUR_RETRY_DELETE_N_TIMES) {
+ && n_tries < BTR_CUR_RETRY_DELETE_N_TIMES) {
btr_pcur_commit_specify_mtr(&(node->pcur), &mtr);
@@ -230,7 +230,7 @@ row_undo_ins_parse_undo_rec(
ut_ad(node);
ptr = trx_undo_rec_get_pars(node->undo_rec, &type, &dummy,
- &dummy_extern, &undo_no, &table_id);
+ &dummy_extern, &undo_no, &table_id);
ut_ad(type == TRX_UNDO_INSERT_REC);
node->rec_type = type;
@@ -251,7 +251,7 @@ row_undo_ins_parse_undo_rec(
clust_index = dict_table_get_first_index(node->table);
ptr = trx_undo_rec_get_row_ref(ptr, clust_index, &(node->ref),
- node->heap);
+ node->heap);
}
/***************************************************************
@@ -286,12 +286,12 @@ row_undo_ins(
return(DB_SUCCESS);
}
- node->index = dict_table_get_next_index(
- dict_table_get_first_index(node->table));
+ node->index = dict_table_get_next_index
+ (dict_table_get_first_index(node->table));
while (node->index != NULL) {
entry = row_build_index_entry(node->row, node->index,
- node->heap);
+ node->heap);
err = row_undo_ins_remove_sec(node->index, entry);
if (err != DB_SUCCESS) {
diff --git a/storage/innobase/row/row0umod.c b/storage/innobase/row/row0umod.c
index 9c871def661..778f240d18e 100644
--- a/storage/innobase/row/row0umod.c
+++ b/storage/innobase/row/row0umod.c
@@ -101,18 +101,19 @@ row_undo_mod_clust_low(
if (mode == BTR_MODIFY_LEAF) {
err = btr_cur_optimistic_update(BTR_NO_LOCKING_FLAG
- | BTR_NO_UNDO_LOG_FLAG
- | BTR_KEEP_SYS_FLAG,
- btr_cur, node->update,
- node->cmpl_info, thr, mtr);
+ | BTR_NO_UNDO_LOG_FLAG
+ | BTR_KEEP_SYS_FLAG,
+ btr_cur, node->update,
+ node->cmpl_info, thr, mtr);
} else {
ut_ad(mode == BTR_MODIFY_TREE);
- err = btr_cur_pessimistic_update(BTR_NO_LOCKING_FLAG
- | BTR_NO_UNDO_LOG_FLAG
- | BTR_KEEP_SYS_FLAG,
- btr_cur, &dummy_big_rec, node->update,
- node->cmpl_info, thr, mtr);
+ err = btr_cur_pessimistic_update
+ (BTR_NO_LOCKING_FLAG
+ | BTR_NO_UNDO_LOG_FLAG
+ | BTR_KEEP_SYS_FLAG,
+ btr_cur, &dummy_big_rec, node->update,
+ node->cmpl_info, thr, mtr);
}
return(err);
@@ -149,7 +150,7 @@ row_undo_mod_remove_clust_low(
/* Find out if we can remove the whole clustered index record */
if (node->rec_type == TRX_UNDO_UPD_DEL_REC
- && !row_vers_must_preserve_del_marked(node->new_trx_id, mtr)) {
+ && !row_vers_must_preserve_del_marked(node->new_trx_id, mtr)) {
/* Ok, we can remove */
} else {
@@ -234,7 +235,7 @@ row_undo_mod_clust(
mtr_start(&mtr);
err = row_undo_mod_remove_clust_low(node, thr, &mtr,
- BTR_MODIFY_LEAF);
+ BTR_MODIFY_LEAF);
if (err != DB_SUCCESS) {
btr_pcur_commit_specify_mtr(pcur, &mtr);
@@ -244,7 +245,7 @@ row_undo_mod_clust(
mtr_start(&mtr);
err = row_undo_mod_remove_clust_low(node, thr, &mtr,
- BTR_MODIFY_TREE);
+ BTR_MODIFY_TREE);
}
btr_pcur_commit_specify_mtr(pcur, &mtr);
@@ -318,15 +319,15 @@ row_undo_mod_del_mark_or_remove_sec_low(
mtr_start(&mtr_vers);
success = btr_pcur_restore_position(BTR_SEARCH_LEAF, &(node->pcur),
- &mtr_vers);
+ &mtr_vers);
ut_a(success);
old_has = row_vers_old_has_index_entry(FALSE,
- btr_pcur_get_rec(&(node->pcur)),
- &mtr_vers, index, entry);
+ btr_pcur_get_rec(&(node->pcur)),
+ &mtr_vers, index, entry);
if (old_has) {
err = btr_cur_del_mark_set_sec_rec(BTR_NO_LOCKING_FLAG,
- btr_cur, TRUE, thr, &mtr);
+ btr_cur, TRUE, thr, &mtr);
ut_ad(err == DB_SUCCESS);
} else {
/* Remove the index record */
@@ -342,7 +343,7 @@ row_undo_mod_del_mark_or_remove_sec_low(
ut_ad(mode == BTR_MODIFY_TREE);
btr_cur_pessimistic_delete(&err, FALSE, btr_cur,
- TRUE, &mtr);
+ TRUE, &mtr);
/* The delete operation may fail if we have little
file space left: TODO: easiest to crash the database
@@ -378,14 +379,14 @@ row_undo_mod_del_mark_or_remove_sec(
ulint err;
err = row_undo_mod_del_mark_or_remove_sec_low(node, thr, index,
- entry, BTR_MODIFY_LEAF);
+ entry, BTR_MODIFY_LEAF);
if (err == DB_SUCCESS) {
return(err);
}
err = row_undo_mod_del_mark_or_remove_sec_low(node, thr, index,
- entry, BTR_MODIFY_TREE);
+ entry, BTR_MODIFY_TREE);
return(err);
}
@@ -422,28 +423,29 @@ row_undo_mod_del_unmark_sec_and_undo_update(
if (!found) {
fputs("InnoDB: error in sec index entry del undo in\n"
- "InnoDB: ", stderr);
+ "InnoDB: ", stderr);
dict_index_name_print(stderr, trx, index);
fputs("\n"
- "InnoDB: tuple ", stderr);
+ "InnoDB: tuple ", stderr);
dtuple_print(stderr, entry);
fputs("\n"
- "InnoDB: record ", stderr);
+ "InnoDB: record ", stderr);
rec_print(stderr, btr_pcur_get_rec(&pcur), index);
putc('\n', stderr);
trx_print(stderr, trx, 0);
fputs("\n"
-"InnoDB: Submit a detailed bug report to http://bugs.mysql.com\n", stderr);
+ "InnoDB: Submit a detailed bug report"
+ " to http://bugs.mysql.com\n", stderr);
} else {
btr_cur_t* btr_cur = btr_pcur_get_btr_cur(&pcur);
err = btr_cur_del_mark_set_sec_rec(BTR_NO_LOCKING_FLAG,
- btr_cur, FALSE, thr, &mtr);
+ btr_cur, FALSE, thr, &mtr);
ut_a(err == DB_SUCCESS);
heap = mem_heap_create(100);
- update = row_upd_build_sec_rec_difference_binary(index, entry,
- btr_cur_get_rec(btr_cur), trx, heap);
+ update = row_upd_build_sec_rec_difference_binary
+ (index, entry, btr_cur_get_rec(btr_cur), trx, heap);
if (upd_get_n_fields(update) == 0) {
/* Do nothing */
@@ -452,18 +454,18 @@ row_undo_mod_del_unmark_sec_and_undo_update(
/* Try an optimistic updating of the record, keeping
changes within the page */
- err = btr_cur_optimistic_update(BTR_KEEP_SYS_FLAG
- | BTR_NO_LOCKING_FLAG,
- btr_cur, update, 0, thr, &mtr);
+ err = btr_cur_optimistic_update
+ (BTR_KEEP_SYS_FLAG | BTR_NO_LOCKING_FLAG,
+ btr_cur, update, 0, thr, &mtr);
if (err == DB_OVERFLOW || err == DB_UNDERFLOW) {
err = DB_FAIL;
}
} else {
ut_a(mode == BTR_MODIFY_TREE);
- err = btr_cur_pessimistic_update(BTR_KEEP_SYS_FLAG
- | BTR_NO_LOCKING_FLAG,
- btr_cur, &dummy_big_rec,
- update, 0, thr, &mtr);
+ err = btr_cur_pessimistic_update
+ (BTR_KEEP_SYS_FLAG | BTR_NO_LOCKING_FLAG,
+ btr_cur, &dummy_big_rec,
+ update, 0, thr, &mtr);
}
mem_heap_free(heap);
@@ -498,7 +500,7 @@ row_undo_mod_upd_del_sec(
entry = row_build_index_entry(node->row, index, heap);
err = row_undo_mod_del_mark_or_remove_sec(node, thr, index,
- entry);
+ entry);
if (err != DB_SUCCESS) {
mem_heap_free(heap);
@@ -536,13 +538,11 @@ row_undo_mod_del_mark_sec(
entry = row_build_index_entry(node->row, index, heap);
- err = row_undo_mod_del_unmark_sec_and_undo_update(
- BTR_MODIFY_LEAF,
- thr, index, entry);
+ err = row_undo_mod_del_unmark_sec_and_undo_update
+ (BTR_MODIFY_LEAF, thr, index, entry);
if (err == DB_FAIL) {
- err = row_undo_mod_del_unmark_sec_and_undo_update(
- BTR_MODIFY_TREE,
- thr, index, entry);
+ err = row_undo_mod_del_unmark_sec_and_undo_update
+ (BTR_MODIFY_TREE, thr, index, entry);
}
if (err != DB_SUCCESS) {
@@ -587,7 +587,7 @@ row_undo_mod_upd_exist_sec(
index = node->index;
if (row_upd_changes_ord_field_binary(node->row, node->index,
- node->update)) {
+ node->update)) {
/* Build the newest version of the index entry */
entry = row_build_index_entry(node->row, index, heap);
@@ -603,7 +603,8 @@ row_undo_mod_upd_exist_sec(
through which we do the search is delete-marked. */
err = row_undo_mod_del_mark_or_remove_sec(node, thr,
- index, entry);
+ index,
+ entry);
if (err != DB_SUCCESS) {
mem_heap_free(heap);
@@ -618,15 +619,12 @@ row_undo_mod_upd_exist_sec(
'abc' -> 'aBc'. */
row_upd_index_replace_new_col_vals(entry, index,
- node->update, NULL);
- err = row_undo_mod_del_unmark_sec_and_undo_update(
- BTR_MODIFY_LEAF,
- thr, index, entry);
+ node->update, NULL);
+ err = row_undo_mod_del_unmark_sec_and_undo_update
+ (BTR_MODIFY_LEAF, thr, index, entry);
if (err == DB_FAIL) {
- err =
- row_undo_mod_del_unmark_sec_and_undo_update(
- BTR_MODIFY_TREE,
- thr, index, entry);
+ err = row_undo_mod_del_unmark_sec_and_undo_update
+ (BTR_MODIFY_TREE, thr, index, entry);
}
if (err != DB_SUCCESS) {
@@ -668,7 +666,7 @@ row_undo_mod_parse_undo_rec(
ut_ad(node && thr);
trx = thr_get_trx(thr);
ptr = trx_undo_rec_get_pars(node->undo_rec, &type, &cmpl_info,
- &dummy_extern, &undo_no, &table_id);
+ &dummy_extern, &undo_no, &table_id);
node->rec_type = type;
node->table = dict_table_get_on_id(table_id, trx);
@@ -691,14 +689,14 @@ row_undo_mod_parse_undo_rec(
clust_index = dict_table_get_first_index(node->table);
ptr = trx_undo_update_rec_get_sys_cols(ptr, &trx_id, &roll_ptr,
- &info_bits);
+ &info_bits);
ptr = trx_undo_rec_get_row_ref(ptr, clust_index, &(node->ref),
- node->heap);
+ node->heap);
trx_undo_update_rec_get_update(ptr, clust_index, type, trx_id,
- roll_ptr, info_bits, trx,
- node->heap, &(node->update));
+ roll_ptr, info_bits, trx,
+ node->heap, &(node->update));
node->new_roll_ptr = roll_ptr;
node->new_trx_id = trx_id;
node->cmpl_info = cmpl_info;
@@ -738,8 +736,8 @@ row_undo_mod(
return(DB_SUCCESS);
}
- node->index = dict_table_get_next_index(
- dict_table_get_first_index(node->table));
+ node->index = dict_table_get_next_index
+ (dict_table_get_first_index(node->table));
if (node->rec_type == TRX_UNDO_UPD_EXIST_REC) {
diff --git a/storage/innobase/row/row0undo.c b/storage/innobase/row/row0undo.c
index 3454f6e3274..2f04e65e8ee 100644
--- a/storage/innobase/row/row0undo.c
+++ b/storage/innobase/row/row0undo.c
@@ -161,15 +161,16 @@ row_undo_search_clust_to_pcur(
clust_index = dict_table_get_first_index(node->table);
found = row_search_on_row_ref(&(node->pcur), BTR_MODIFY_LEAF,
- node->table, node->ref, &mtr);
+ node->table, node->ref, &mtr);
rec = btr_pcur_get_rec(&(node->pcur));
offsets = rec_get_offsets(rec, clust_index, offsets,
- ULINT_UNDEFINED, &heap);
+ ULINT_UNDEFINED, &heap);
if (!found || 0 != ut_dulint_cmp(node->roll_ptr,
- row_get_rec_roll_ptr(rec, clust_index, offsets))) {
+ row_get_rec_roll_ptr(rec, clust_index,
+ offsets))) {
/* We must remove the reservation on the undo log record
BEFORE releasing the latch on the clustered index page: this
@@ -177,12 +178,12 @@ row_undo_search_clust_to_pcur(
modification corresponding to node->roll_ptr. */
/* fputs("--------------------undoing a previous version\n",
- stderr); */
+ stderr); */
ret = FALSE;
} else {
node->row = row_build(ROW_COPY_DATA, clust_index, rec,
- offsets, node->heap);
+ offsets, node->heap);
btr_pcur_store_position(&(node->pcur), &mtr);
ret = TRUE;
@@ -221,9 +222,9 @@ row_undo(
if (node->state == UNDO_NODE_FETCH_NEXT) {
node->undo_rec = trx_roll_pop_top_rec_of_trx(trx,
- trx->roll_limit,
- &roll_ptr,
- node->heap);
+ trx->roll_limit,
+ &roll_ptr,
+ node->heap);
if (!node->undo_rec) {
/* Rollback completed for this query thread */
@@ -250,7 +251,7 @@ row_undo(
roll_ptr = node->new_roll_ptr;
node->undo_rec = trx_undo_get_undo_rec_low(roll_ptr,
- node->heap);
+ node->heap);
node->roll_ptr = roll_ptr;
node->undo_no = trx_undo_rec_get_undo_no(node->undo_rec);
@@ -335,8 +336,9 @@ row_undo_step(
if (err == DB_OUT_OF_FILE_SPACE) {
fprintf(stderr,
- "InnoDB: Error 13 means out of tablespace.\n"
- "InnoDB: Consider increasing your tablespace.\n");
+ "InnoDB: Error 13 means out of tablespace.\n"
+ "InnoDB: Consider increasing"
+ " your tablespace.\n");
exit(1);
}
diff --git a/storage/innobase/row/row0upd.c b/storage/innobase/row/row0upd.c
index 783a01bcaa0..84f5f2a1acf 100644
--- a/storage/innobase/row/row0upd.c
+++ b/storage/innobase/row/row0upd.c
@@ -196,10 +196,9 @@ row_upd_check_references_constraints(
NOT break the constraint. */
if (foreign->referenced_index == index
- && (node->is_delete
- || row_upd_changes_first_fields_binary(
- entry, index, node->update,
- foreign->n_fields))) {
+ && (node->is_delete
+ || row_upd_changes_first_fields_binary
+ (entry, index, node->update, foreign->n_fields))) {
if (foreign->foreign_table == NULL) {
dict_table_get(foreign->foreign_table_name);
@@ -209,7 +208,7 @@ row_upd_check_references_constraints(
mutex_enter(&(dict_sys->mutex));
(foreign->foreign_table
- ->n_foreign_key_checks_running)++;
+ ->n_foreign_key_checks_running)++;
mutex_exit(&(dict_sys->mutex));
}
@@ -219,25 +218,25 @@ row_upd_check_references_constraints(
But the counter on the table protects 'foreign' from
being dropped while the check is running. */
- err = row_ins_check_foreign_constraint(FALSE, foreign,
- table, entry, thr);
+ err = row_ins_check_foreign_constraint
+ (FALSE, foreign, table, entry, thr);
if (foreign->foreign_table) {
mutex_enter(&(dict_sys->mutex));
ut_a(foreign->foreign_table
- ->n_foreign_key_checks_running > 0);
+ ->n_foreign_key_checks_running > 0);
(foreign->foreign_table
- ->n_foreign_key_checks_running)--;
+ ->n_foreign_key_checks_running)--;
mutex_exit(&(dict_sys->mutex));
}
if (err != DB_SUCCESS) {
if (got_s_lock) {
- row_mysql_unfreeze_data_dictionary(
- trx);
+ row_mysql_unfreeze_data_dictionary
+ (trx);
}
mem_heap_free(heap);
@@ -389,16 +388,16 @@ row_upd_changes_field_size_or_external(
this fix also to 4.0. The merge to 5.0 will be made
manually immediately after we commit this to 4.1. */
- new_len = dtype_get_sql_null_size(
- dict_index_get_nth_type(index,
- upd_field->field_no));
+ new_len = dtype_get_sql_null_size
+ (dict_index_get_nth_type(index,
+ upd_field->field_no));
}
old_len = rec_offs_nth_size(offsets, upd_field->field_no);
if (rec_offs_comp(offsets)
- && rec_offs_nth_sql_null(offsets,
- upd_field->field_no)) {
+ && rec_offs_nth_sql_null(offsets,
+ upd_field->field_no)) {
/* Note that in the compact table format, for a
variable length field, an SQL NULL will use zero
bytes in the offset array at the start of the physical
@@ -456,8 +455,8 @@ row_upd_rec_in_place(
new_val = &(upd_field->new_val);
rec_set_nth_field(rec, offsets, upd_field->field_no,
- dfield_get_data(new_val),
- dfield_get_len(new_val));
+ dfield_get_data(new_val),
+ dfield_get_len(new_val));
}
}
@@ -480,7 +479,8 @@ row_upd_write_sys_vals_to_log(
ut_ad(mtr);
log_ptr += mach_write_compressed(log_ptr,
- dict_index_get_sys_col_pos(index, DATA_TRX_ID));
+ dict_index_get_sys_col_pos
+ (index, DATA_TRX_ID));
trx_write_roll_ptr(log_ptr, roll_ptr);
log_ptr += DATA_ROLL_PTR_LEN;
@@ -635,7 +635,7 @@ row_upd_index_parse(
new_val = &(upd_field->new_val);
ptr = mach_parse_compressed(ptr, end_ptr,
- &(upd_field->field_no));
+ &(upd_field->field_no));
if (ptr == NULL) {
return(NULL);
@@ -733,7 +733,7 @@ row_upd_build_sec_rec_difference_binary(
n_diff = 0;
offsets = rec_get_offsets(rec, index, offsets_,
- ULINT_UNDEFINED, &heap);
+ ULINT_UNDEFINED, &heap);
for (i = 0; i < dtuple_get_n_fields(entry); i++) {
@@ -815,7 +815,7 @@ row_upd_build_difference_binary(
trx_id_pos = dict_index_get_sys_col_pos(index, DATA_TRX_ID);
offsets = rec_get_offsets(rec, index, offsets_,
- ULINT_UNDEFINED, &heap);
+ ULINT_UNDEFINED, &heap);
for (i = 0; i < dtuple_get_n_fields(entry); i++) {
@@ -833,9 +833,9 @@ row_upd_build_difference_binary(
extern_bit = upd_ext_vec_contains(ext_vec, n_ext_vec, i);
- if (UNIV_UNLIKELY(extern_bit ==
- (ibool)!rec_offs_nth_extern(offsets, i))
- || !dfield_data_is_binary_equal(dfield, len, data)) {
+ if (UNIV_UNLIKELY(extern_bit
+ == (ibool)!rec_offs_nth_extern(offsets, i))
+ || !dfield_data_is_binary_equal(dfield, len, data)) {
upd_field = upd_get_nth_field(update, n_diff);
@@ -911,26 +911,24 @@ row_upd_index_replace_new_col_vals_index_pos(
new_val = &(upd_field->new_val);
dfield_set_data(dfield, new_val->data,
- new_val->len);
+ new_val->len);
if (heap && new_val->len != UNIV_SQL_NULL) {
- dfield->data = mem_heap_alloc(heap,
- new_val->len);
+ dfield->data = mem_heap_alloc
+ (heap, new_val->len);
ut_memcpy(dfield->data, new_val->data,
- new_val->len);
+ new_val->len);
}
if (field->prefix_len > 0
- && new_val->len != UNIV_SQL_NULL) {
+ && new_val->len != UNIV_SQL_NULL) {
- cur_type = dict_col_get_type(
- dict_field_get_col(field));
+ cur_type = dict_col_get_type
+ (dict_field_get_col(field));
- dfield->len =
- dtype_get_at_most_n_mbchars(
- cur_type,
- field->prefix_len,
- new_val->len,
- new_val->data);
+ dfield->len
+ = dtype_get_at_most_n_mbchars
+ (cur_type, field->prefix_len,
+ new_val->len, new_val->data);
}
}
}
@@ -981,26 +979,24 @@ row_upd_index_replace_new_col_vals(
new_val = &(upd_field->new_val);
dfield_set_data(dfield, new_val->data,
- new_val->len);
+ new_val->len);
if (heap && new_val->len != UNIV_SQL_NULL) {
- dfield->data = mem_heap_alloc(heap,
- new_val->len);
+ dfield->data = mem_heap_alloc
+ (heap, new_val->len);
ut_memcpy(dfield->data, new_val->data,
- new_val->len);
+ new_val->len);
}
if (field->prefix_len > 0
- && new_val->len != UNIV_SQL_NULL) {
+ && new_val->len != UNIV_SQL_NULL) {
- cur_type = dict_col_get_type(
- dict_field_get_col(field));
+ cur_type = dict_col_get_type
+ (dict_field_get_col(field));
- dfield->len =
- dtype_get_at_most_n_mbchars(
- cur_type,
- field->prefix_len,
- new_val->len,
- new_val->data);
+ dfield->len
+ = dtype_get_at_most_n_mbchars
+ (cur_type, field->prefix_len,
+ new_val->len, new_val->data);
}
}
}
@@ -1060,12 +1056,12 @@ row_upd_changes_ord_field_binary(
the datas */
if (col_pos == upd_field->field_no
- && (row == NULL
- || ind_field->prefix_len > 0
- || !dfield_datas_are_binary_equal(
- dtuple_get_nth_field(row,
- col_no),
- &(upd_field->new_val)))) {
+ && (row == NULL
+ || ind_field->prefix_len > 0
+ || !dfield_datas_are_binary_equal
+ (dtuple_get_nth_field(row, col_no),
+ &(upd_field->new_val)))) {
+
return(TRUE);
}
}
@@ -1096,9 +1092,9 @@ row_upd_changes_some_index_ord_field_binary(
upd_field = upd_get_nth_field(update, i);
- if (dict_field_get_col(dict_index_get_nth_field(index,
- upd_field->field_no))
- ->ord_part) {
+ if (dict_field_get_col(dict_index_get_nth_field
+ (index, upd_field->field_no))
+ ->ord_part) {
return(TRUE);
}
@@ -1146,9 +1142,9 @@ row_upd_changes_first_fields_binary(
upd_field = upd_get_nth_field(update, j);
if (col_pos == upd_field->field_no
- && !dfield_datas_are_binary_equal(
- dtuple_get_nth_field(entry, i),
- &(upd_field->new_val))) {
+ && !dfield_datas_are_binary_equal
+ (dtuple_get_nth_field(entry, i),
+ &(upd_field->new_val))) {
return(TRUE);
}
@@ -1174,8 +1170,8 @@ row_upd_copy_columns(
while (column) {
data = rec_get_nth_field(rec, offsets,
- column->field_nos[SYM_CLUST_FIELD_NO],
- &len);
+ column->field_nos[SYM_CLUST_FIELD_NO],
+ &len);
eval_node_copy_and_alloc_val(column, data, len);
column = UT_LIST_GET_NEXT(col_var_list, column);
@@ -1237,11 +1233,11 @@ row_upd_store_row(
rec = btr_pcur_get_rec(node->pcur);
offsets = rec_get_offsets(rec, clust_index, offsets_,
- ULINT_UNDEFINED, &heap);
+ ULINT_UNDEFINED, &heap);
node->row = row_build(ROW_COPY_DATA, clust_index, rec, offsets,
- node->heap);
+ node->heap);
node->ext_vec = mem_heap_alloc(node->heap, sizeof(ulint)
- * rec_offs_n_fields(offsets));
+ * rec_offs_n_fields(offsets));
if (node->is_delete) {
update = NULL;
} else {
@@ -1249,7 +1245,7 @@ row_upd_store_row(
}
node->n_ext_vec = btr_push_update_extern_fields(node->ext_vec,
- offsets, update);
+ offsets, update);
if (UNIV_LIKELY_NULL(heap)) {
mem_heap_free(heap);
}
@@ -1291,44 +1287,44 @@ row_upd_sec_index_entry(
mtr_start(&mtr);
found = row_search_index_entry(index, entry, BTR_MODIFY_LEAF, &pcur,
- &mtr);
+ &mtr);
btr_cur = btr_pcur_get_btr_cur(&pcur);
rec = btr_cur_get_rec(btr_cur);
if (UNIV_UNLIKELY(!found)) {
fputs("InnoDB: error in sec index entry update in\n"
- "InnoDB: ", stderr);
+ "InnoDB: ", stderr);
dict_index_name_print(stderr, trx, index);
fputs("\n"
- "InnoDB: tuple ", stderr);
+ "InnoDB: tuple ", stderr);
dtuple_print(stderr, entry);
fputs("\n"
- "InnoDB: record ", stderr);
+ "InnoDB: record ", stderr);
rec_print(stderr, rec, index);
putc('\n', stderr);
trx_print(stderr, trx, 0);
fputs("\n"
-"InnoDB: Submit a detailed bug report to http://bugs.mysql.com\n", stderr);
+ "InnoDB: Submit a detailed bug report"
+ " to http://bugs.mysql.com\n", stderr);
} else {
/* Delete mark the old index record; it can already be
delete marked if we return after a lock wait in
row_ins_index_entry below */
if (!rec_get_deleted_flag(rec,
- dict_table_is_comp(index->table))) {
+ dict_table_is_comp(index->table))) {
err = btr_cur_del_mark_set_sec_rec(0, btr_cur, TRUE,
- thr, &mtr);
+ thr, &mtr);
if (err == DB_SUCCESS && check_ref) {
/* NOTE that the following call loses
the position of pcur ! */
- err = row_upd_check_references_constraints(
- node,
- &pcur, index->table,
- index, thr, &mtr);
+ err = row_upd_check_references_constraints
+ (node, &pcur, index->table,
+ index, thr, &mtr);
if (err != DB_SUCCESS) {
goto close_cur;
@@ -1374,12 +1370,12 @@ row_upd_sec_step(
ulint err;
ut_ad((node->state == UPD_NODE_UPDATE_ALL_SEC)
- || (node->state == UPD_NODE_UPDATE_SOME_SEC));
+ || (node->state == UPD_NODE_UPDATE_SOME_SEC));
ut_ad(!(node->index->type & DICT_CLUSTERED));
if (node->state == UPD_NODE_UPDATE_ALL_SEC
- || row_upd_changes_ord_field_binary(node->row, node->index,
- node->update)) {
+ || row_upd_changes_ord_field_binary(node->row, node->index,
+ node->update)) {
err = row_upd_sec_index_entry(node, thr);
return(err);
@@ -1427,7 +1423,7 @@ row_upd_clust_rec_by_insert(
*offsets_ = (sizeof offsets_) / sizeof *offsets_;
err = btr_cur_del_mark_set_clust_rec(BTR_NO_LOCKING_FLAG,
- btr_cur, TRUE, thr, mtr);
+ btr_cur, TRUE, thr, mtr);
if (err != DB_SUCCESS) {
mtr_commit(mtr);
return(err);
@@ -1438,16 +1434,17 @@ row_upd_clust_rec_by_insert(
free those externally stored fields even if the delete marked
record is removed from the index tree, or updated. */
- btr_cur_mark_extern_inherited_fields(btr_cur_get_rec(btr_cur),
- rec_get_offsets(btr_cur_get_rec(btr_cur),
- dict_table_get_first_index(table), offsets_,
- ULINT_UNDEFINED, &heap), node->update, mtr);
+ btr_cur_mark_extern_inherited_fields
+ (btr_cur_get_rec(btr_cur),
+ rec_get_offsets(btr_cur_get_rec(btr_cur),
+ dict_table_get_first_index(table),
+ offsets_, ULINT_UNDEFINED, &heap),
+ node->update, mtr);
if (check_ref) {
/* NOTE that the following call loses
the position of pcur ! */
- err = row_upd_check_references_constraints(node,
- pcur, table,
- index, thr, mtr);
+ err = row_upd_check_references_constraints
+ (node, pcur, table, index, thr, mtr);
if (err != DB_SUCCESS) {
mtr_commit(mtr);
if (UNIV_LIKELY_NULL(heap)) {
@@ -1477,16 +1474,16 @@ row_upd_clust_rec_by_insert(
if-branch above). We must unmark them. */
btr_cur_unmark_dtuple_extern_fields(entry, node->ext_vec,
- node->n_ext_vec);
+ node->n_ext_vec);
/* We must mark non-updated extern fields in entry as inherited,
so that a possible rollback will not free them */
btr_cur_mark_dtuple_inherited_extern(entry, node->ext_vec,
- node->n_ext_vec,
- node->update);
+ node->n_ext_vec,
+ node->update);
err = row_ins_index_entry(index, entry, node->ext_vec,
- node->n_ext_vec, thr);
+ node->n_ext_vec, thr);
mem_heap_free(heap);
return(err);
@@ -1518,7 +1515,7 @@ row_upd_clust_rec(
btr_cur = btr_pcur_get_btr_cur(pcur);
ut_ad(!rec_get_deleted_flag(btr_pcur_get_rec(pcur),
- dict_table_is_comp(index->table)));
+ dict_table_is_comp(index->table)));
/* Try optimistic updating of the record, keeping changes within
the page; we do not check locks because we assume the x-lock on the
@@ -1526,8 +1523,8 @@ row_upd_clust_rec(
if (node->cmpl_info & UPD_NODE_NO_SIZE_CHANGE) {
err = btr_cur_update_in_place(BTR_NO_LOCKING_FLAG,
- btr_cur, node->update,
- node->cmpl_info, thr, mtr);
+ btr_cur, node->update,
+ node->cmpl_info, thr, mtr);
} else {
err = btr_cur_optimistic_update(BTR_NO_LOCKING_FLAG,
btr_cur, node->update,
@@ -1559,11 +1556,11 @@ row_upd_clust_rec(
ut_a(btr_pcur_restore_position(BTR_MODIFY_TREE, pcur, mtr));
ut_ad(!rec_get_deleted_flag(btr_pcur_get_rec(pcur),
- dict_table_is_comp(index->table)));
+ dict_table_is_comp(index->table)));
err = btr_cur_pessimistic_update(BTR_NO_LOCKING_FLAG, btr_cur,
- &big_rec, node->update,
- node->cmpl_info, thr, mtr);
+ &big_rec, node->update,
+ node->cmpl_info, thr, mtr);
mtr_commit(mtr);
if (err == DB_SUCCESS && big_rec) {
@@ -1576,10 +1573,11 @@ row_upd_clust_rec(
ut_a(btr_pcur_restore_position(BTR_MODIFY_TREE, pcur, mtr));
rec = btr_cur_get_rec(btr_cur);
- err = btr_store_big_rec_extern_fields(index, rec,
- rec_get_offsets(rec, index, offsets_,
- ULINT_UNDEFINED, &heap),
- big_rec, mtr);
+ err = btr_store_big_rec_extern_fields
+ (index, rec,
+ rec_get_offsets(rec, index, offsets_,
+ ULINT_UNDEFINED, &heap),
+ big_rec, mtr);
if (UNIV_LIKELY_NULL(heap)) {
mem_heap_free(heap);
}
@@ -1628,13 +1626,13 @@ row_upd_del_mark_clust_rec(
locks, because we assume that we have an x-lock on the record */
err = btr_cur_del_mark_set_clust_rec(BTR_NO_LOCKING_FLAG,
- btr_cur, TRUE, thr, mtr);
+ btr_cur, TRUE, thr, mtr);
if (err == DB_SUCCESS && check_ref) {
/* NOTE that the following call loses the position of pcur ! */
err = row_upd_check_references_constraints(node,
- pcur, index->table,
- index, thr, mtr);
+ pcur, index->table,
+ index, thr, mtr);
if (err != DB_SUCCESS) {
mtr_commit(mtr);
@@ -1708,7 +1706,7 @@ row_upd_clust_step(
with the index */
if (node->is_delete
- && ut_dulint_cmp(node->table->id, DICT_INDEXES_ID) == 0) {
+ && ut_dulint_cmp(node->table->id, DICT_INDEXES_ID) == 0) {
dict_drop_index_tree(btr_pcur_get_rec(pcur), mtr);
@@ -1717,7 +1715,7 @@ row_upd_clust_step(
mtr_start(mtr);
success = btr_pcur_restore_position(BTR_MODIFY_LEAF, pcur,
- mtr);
+ mtr);
if (!success) {
err = DB_ERROR;
@@ -1729,11 +1727,11 @@ row_upd_clust_step(
rec = btr_pcur_get_rec(pcur);
offsets = rec_get_offsets(rec, index, offsets_,
- ULINT_UNDEFINED, &heap);
+ ULINT_UNDEFINED, &heap);
if (!node->has_clust_rec_x_lock) {
- err = lock_clust_rec_modify_check_and_lock(0,
- rec, index, offsets, thr);
+ err = lock_clust_rec_modify_check_and_lock
+ (0, rec, index, offsets, thr);
if (err != DB_SUCCESS) {
mtr_commit(mtr);
goto exit_func;
@@ -1744,12 +1742,12 @@ row_upd_clust_step(
if (node->is_delete) {
err = row_upd_del_mark_clust_rec(node, index, thr, check_ref,
- mtr);
+ mtr);
if (err == DB_SUCCESS) {
node->state = UPD_NODE_UPDATE_ALL_SEC;
node->index = dict_table_get_next_index(index);
}
- exit_func:
+exit_func:
if (UNIV_LIKELY_NULL(heap)) {
mem_heap_free(heap);
}
@@ -1763,7 +1761,7 @@ row_upd_clust_step(
/* Copy the necessary columns from clust_rec and calculate the
new values to set */
row_upd_copy_columns(rec, offsets,
- UT_LIST_GET_FIRST(node->columns));
+ UT_LIST_GET_FIRST(node->columns));
row_upd_eval_new_vals(node->update);
}
@@ -1793,7 +1791,7 @@ row_upd_clust_step(
externally! */
err = row_upd_clust_rec_by_insert(node, index, thr, check_ref,
- mtr);
+ mtr);
if (err != DB_SUCCESS) {
return(err);
@@ -1838,9 +1836,9 @@ row_upd(
/* We do not get the cmpl_info value from the MySQL
interpreter: we must calculate it on the fly: */
- if (node->is_delete ||
- row_upd_changes_some_index_ord_field_binary(
- node->table, node->update)) {
+ if (node->is_delete
+ || row_upd_changes_some_index_ord_field_binary
+ (node->table, node->update)) {
node->cmpl_info = 0;
} else {
node->cmpl_info = UPD_NODE_NO_ORD_CHANGE;
@@ -1848,7 +1846,7 @@ row_upd(
}
if (node->state == UPD_NODE_UPDATE_CLUSTERED
- || node->state == UPD_NODE_INSERT_CLUSTERED) {
+ || node->state == UPD_NODE_INSERT_CLUSTERED) {
err = row_upd_clust_step(node, thr);
@@ -2038,24 +2036,26 @@ row_upd_in_place_in_select(
/* Copy the necessary columns from clust_rec and calculate the new
values to set */
- row_upd_copy_columns(btr_pcur_get_rec(pcur), rec_get_offsets(
- btr_pcur_get_rec(pcur), btr_cur->index, offsets_,
- ULINT_UNDEFINED, &heap),
- UT_LIST_GET_FIRST(node->columns));
+ row_upd_copy_columns(btr_pcur_get_rec(pcur),
+ rec_get_offsets(btr_pcur_get_rec(pcur),
+ btr_cur->index, offsets_,
+ ULINT_UNDEFINED, &heap),
+ UT_LIST_GET_FIRST(node->columns));
if (UNIV_LIKELY_NULL(heap)) {
mem_heap_free(heap);
}
row_upd_eval_new_vals(node->update);
- ut_ad(!rec_get_deleted_flag(btr_pcur_get_rec(pcur),
- dict_table_is_comp(btr_cur->index->table)));
+ ut_ad(!rec_get_deleted_flag
+ (btr_pcur_get_rec(pcur),
+ dict_table_is_comp(btr_cur->index->table)));
ut_ad(node->cmpl_info & UPD_NODE_NO_SIZE_CHANGE);
ut_ad(node->cmpl_info & UPD_NODE_NO_ORD_CHANGE);
ut_ad(node->select_will_do_update);
err = btr_cur_update_in_place(BTR_NO_LOCKING_FLAG, btr_cur,
- node->update, node->cmpl_info,
- thr, mtr);
+ node->update, node->cmpl_info,
+ thr, mtr);
ut_ad(err == DB_SUCCESS);
}
diff --git a/storage/innobase/row/row0vers.c b/storage/innobase/row/row0vers.c
index 07b75a34347..9b51314df7b 100644
--- a/storage/innobase/row/row0vers.c
+++ b/storage/innobase/row/row0vers.c
@@ -79,7 +79,7 @@ row_vers_impl_x_locked_off_kernel(
reserve purge_latch to lock the bottom of the version stack. */
clust_rec = row_get_clust_rec(BTR_SEARCH_LEAF, rec, index,
- &clust_index, &mtr);
+ &clust_index, &mtr);
if (!clust_rec) {
/* In a rare case it is possible that no clust rec is found
for a secondary index record: if in row0umod.c
@@ -116,7 +116,7 @@ row_vers_impl_x_locked_off_kernel(
}
if (!lock_check_trx_id_sanity(trx_id, clust_rec, clust_index,
- clust_offsets, TRUE)) {
+ clust_offsets, TRUE)) {
/* Corruption noticed: try to avoid a crash by returning */
goto exit_func;
}
@@ -153,14 +153,14 @@ row_vers_impl_x_locked_off_kernel(
heap2 = heap;
heap = mem_heap_create(1024);
err = trx_undo_prev_version_build(clust_rec, &mtr, version,
- clust_index, clust_offsets, heap,
- &prev_version);
+ clust_index, clust_offsets,
+ heap, &prev_version);
mem_heap_free(heap2); /* free version and clust_offsets */
if (prev_version) {
- clust_offsets = rec_get_offsets(prev_version,
- clust_index, NULL,
- ULINT_UNDEFINED, &heap);
+ clust_offsets = rec_get_offsets
+ (prev_version, clust_index, NULL,
+ ULINT_UNDEFINED, &heap);
row = row_build(ROW_COPY_POINTERS, clust_index,
prev_version, clust_offsets, heap);
entry = row_build_index_entry(row, index, heap);
@@ -232,7 +232,7 @@ row_vers_impl_x_locked_off_kernel(
}
prev_trx_id = row_get_rec_trx_id(prev_version, clust_index,
- clust_offsets);
+ clust_offsets);
if (0 != ut_dulint_cmp(trx_id, prev_trx_id)) {
/* The versions modified by the trx_id transaction end
@@ -313,8 +313,8 @@ row_vers_old_has_index_entry(
ulint comp;
ut_ad(mtr_memo_contains(mtr, buf_block_align(rec), MTR_MEMO_PAGE_X_FIX)
- || mtr_memo_contains(mtr, buf_block_align(rec),
- MTR_MEMO_PAGE_S_FIX));
+ || mtr_memo_contains(mtr, buf_block_align(rec),
+ MTR_MEMO_PAGE_S_FIX));
#ifdef UNIV_SYNC_DEBUG
ut_ad(!rw_lock_own(&(purge_sys->latch), RW_LOCK_SHARED));
#endif /* UNIV_SYNC_DEBUG */
@@ -330,7 +330,7 @@ row_vers_old_has_index_entry(
if (also_curr && !rec_get_deleted_flag(rec, comp)) {
row = row_build(ROW_COPY_POINTERS, clust_index,
- rec, clust_offsets, heap);
+ rec, clust_offsets, heap);
entry = row_build_index_entry(row, index, heap);
/* NOTE that we cannot do the comparison as binary
@@ -353,8 +353,8 @@ row_vers_old_has_index_entry(
heap2 = heap;
heap = mem_heap_create(1024);
err = trx_undo_prev_version_build(rec, mtr, version,
- clust_index, clust_offsets, heap,
- &prev_version);
+ clust_index, clust_offsets,
+ heap, &prev_version);
mem_heap_free(heap2); /* free version and clust_offsets */
if (err != DB_SUCCESS || !prev_version) {
@@ -428,8 +428,8 @@ row_vers_build_for_consistent_read(
ut_ad(index->type & DICT_CLUSTERED);
ut_ad(mtr_memo_contains(mtr, buf_block_align(rec), MTR_MEMO_PAGE_X_FIX)
- || mtr_memo_contains(mtr, buf_block_align(rec),
- MTR_MEMO_PAGE_S_FIX));
+ || mtr_memo_contains(mtr, buf_block_align(rec),
+ MTR_MEMO_PAGE_S_FIX));
#ifdef UNIV_SYNC_DEBUG
ut_ad(!rw_lock_own(&(purge_sys->latch), RW_LOCK_SHARED));
#endif /* UNIV_SYNC_DEBUG */
@@ -455,23 +455,24 @@ row_vers_build_for_consistent_read(
the record we see this record only in the case when
undo_no of the record is < undo_no in the view. */
- if (view->type == VIEW_HIGH_GRANULARITY
- && ut_dulint_cmp(view->creator_trx_id, trx_id) == 0) {
+ if (view->type == VIEW_HIGH_GRANULARITY
+ && ut_dulint_cmp(view->creator_trx_id, trx_id) == 0) {
- roll_ptr = row_get_rec_roll_ptr(version, index,
- *offsets);
+ roll_ptr = row_get_rec_roll_ptr(version, index,
+ *offsets);
undo_rec = trx_undo_get_undo_rec_low(roll_ptr, heap);
undo_no = trx_undo_rec_get_undo_no(undo_rec);
mem_heap_empty(heap);
if (ut_dulint_cmp(view->undo_no, undo_no) > 0) {
- /* The view already sees this version: we can
+ /* The view already sees this version: we can
copy it to in_heap and return */
- buf = mem_heap_alloc(in_heap,
- rec_offs_size(*offsets));
+ buf = mem_heap_alloc(in_heap,
+ rec_offs_size(*offsets));
*old_vers = rec_copy(buf, version, *offsets);
- rec_offs_make_valid(*old_vers, index, *offsets);
+ rec_offs_make_valid(*old_vers, index,
+ *offsets);
err = DB_SUCCESS;
break;
@@ -479,7 +480,8 @@ row_vers_build_for_consistent_read(
}
err = trx_undo_prev_version_build(rec, mtr, version, index,
- *offsets, heap, &prev_version);
+ *offsets, heap,
+ &prev_version);
if (heap2) {
mem_heap_free(heap2); /* free version */
}
@@ -497,7 +499,7 @@ row_vers_build_for_consistent_read(
}
*offsets = rec_get_offsets(prev_version, index, *offsets,
- ULINT_UNDEFINED, offset_heap);
+ ULINT_UNDEFINED, offset_heap);
trx_id = row_get_rec_trx_id(prev_version, index, *offsets);
@@ -557,8 +559,8 @@ row_vers_build_for_semi_consistent_read(
ut_ad(index->type & DICT_CLUSTERED);
ut_ad(mtr_memo_contains(mtr, buf_block_align(rec), MTR_MEMO_PAGE_X_FIX)
- || mtr_memo_contains(mtr, buf_block_align(rec),
- MTR_MEMO_PAGE_S_FIX));
+ || mtr_memo_contains(mtr, buf_block_align(rec),
+ MTR_MEMO_PAGE_S_FIX));
#ifdef UNIV_SYNC_DEBUG
ut_ad(!rw_lock_own(&(purge_sys->latch), RW_LOCK_SHARED));
#endif /* UNIV_SYNC_DEBUG */
@@ -579,8 +581,7 @@ row_vers_build_for_semi_consistent_read(
rec_t* prev_version;
dulint version_trx_id;
- version_trx_id = row_get_rec_trx_id(
- version, index, *offsets);
+ version_trx_id = row_get_rec_trx_id(version, index, *offsets);
if (rec == version) {
rec_trx_id = version_trx_id;
}
@@ -590,8 +591,8 @@ row_vers_build_for_semi_consistent_read(
mutex_exit(&kernel_mutex);
if (!version_trx
- || version_trx->conc_state == TRX_NOT_STARTED
- || version_trx->conc_state == TRX_COMMITTED_IN_MEMORY) {
+ || version_trx->conc_state == TRX_NOT_STARTED
+ || version_trx->conc_state == TRX_COMMITTED_IN_MEMORY) {
/* We found a version that belongs to a
committed transaction: return it. */
@@ -615,8 +616,9 @@ row_vers_build_for_semi_consistent_read(
version = rec;
*offsets = rec_get_offsets(version,
- index, *offsets,
- ULINT_UNDEFINED, offset_heap);
+ index, *offsets,
+ ULINT_UNDEFINED,
+ offset_heap);
}
buf = mem_heap_alloc(in_heap, rec_offs_size(*offsets));
@@ -631,7 +633,8 @@ row_vers_build_for_semi_consistent_read(
heap = mem_heap_create(1024);
err = trx_undo_prev_version_build(rec, mtr, version, index,
- *offsets, heap, &prev_version);
+ *offsets, heap,
+ &prev_version);
if (heap2) {
mem_heap_free(heap2); /* free version */
}
@@ -650,7 +653,7 @@ row_vers_build_for_semi_consistent_read(
version = prev_version;
*offsets = rec_get_offsets(version, index, *offsets,
- ULINT_UNDEFINED, offset_heap);
+ ULINT_UNDEFINED, offset_heap);
}/* for (;;) */
if (heap) {
diff --git a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c
index a475db031a3..b781a601039 100644
--- a/storage/innobase/srv/srv0srv.c
+++ b/storage/innobase/srv/srv0srv.c
@@ -85,10 +85,13 @@ ibool srv_file_per_table = FALSE; /* store to its own file each table
created by an user; data dictionary
tables are in the system tablespace
0 */
-ibool srv_locks_unsafe_for_binlog = FALSE; /* Place locks to records only
- i.e. do not use next-key locking
- except on duplicate key checking and
- foreign key checking */
+ibool srv_locks_unsafe_for_binlog = FALSE; /* Place locks to
+ records only i.e. do
+ not use next-key
+ locking except on
+ duplicate key checking
+ and foreign key
+ checking */
ulint srv_n_data_files = 0;
char** srv_data_file_names = NULL;
ulint* srv_data_file_sizes = NULL; /* size in database pages */
@@ -793,9 +796,11 @@ srv_release_threads(
if (srv_print_thread_releases) {
fprintf(stderr,
- "Releasing thread %lu type %lu from slot %lu meter %lu\n",
- (ulong) slot->id, (ulong) type, (ulong) i,
- (ulong) srv_meter[SRV_RECOVERY]);
+ "Releasing thread %lu type %lu"
+ " from slot %lu meter %lu\n",
+ (ulong) slot->id, (ulong) type,
+ (ulong) i,
+ (ulong) srv_meter[SRV_RECOVERY]);
}
count++;
@@ -892,24 +897,24 @@ srv_init(void)
/* create dummy table and index for old-style infimum and supremum */
table = dict_mem_table_create("SYS_DUMMY1",
- DICT_HDR_SPACE, 1, 0);
+ DICT_HDR_SPACE, 1, 0);
dict_mem_table_add_col(table, "DUMMY", DATA_CHAR,
- DATA_ENGLISH | DATA_NOT_NULL, 8, 0);
+ DATA_ENGLISH | DATA_NOT_NULL, 8, 0);
- srv_sys->dummy_ind1 = dict_mem_index_create("SYS_DUMMY1",
- "SYS_DUMMY1", DICT_HDR_SPACE, 0, 1);
+ srv_sys->dummy_ind1 = dict_mem_index_create
+ ("SYS_DUMMY1", "SYS_DUMMY1", DICT_HDR_SPACE, 0, 1);
dict_index_add_col(srv_sys->dummy_ind1,
- dict_table_get_nth_col(table, 0), 0);
+ dict_table_get_nth_col(table, 0), 0);
srv_sys->dummy_ind1->table = table;
/* create dummy table and index for new-style infimum and supremum */
table = dict_mem_table_create("SYS_DUMMY2",
- DICT_HDR_SPACE, 1, DICT_TF_COMPACT);
+ DICT_HDR_SPACE, 1, DICT_TF_COMPACT);
dict_mem_table_add_col(table, "DUMMY", DATA_CHAR,
- DATA_ENGLISH | DATA_NOT_NULL, 8, 0);
- srv_sys->dummy_ind2 = dict_mem_index_create("SYS_DUMMY2",
- "SYS_DUMMY2", DICT_HDR_SPACE, 0, 1);
+ DATA_ENGLISH | DATA_NOT_NULL, 8, 0);
+ srv_sys->dummy_ind2 = dict_mem_index_create
+ ("SYS_DUMMY2", "SYS_DUMMY2", DICT_HDR_SPACE, 0, 1);
dict_index_add_col(srv_sys->dummy_ind2,
- dict_table_get_nth_col(table, 0), 0);
+ dict_table_get_nth_col(table, 0), 0);
srv_sys->dummy_ind2->table = table;
/* avoid ut_ad(index->cached) in dict_index_get_n_unique_in_tree */
@@ -987,9 +992,9 @@ srv_conc_enter_innodb(
retry:
if (trx->declared_to_be_inside_innodb) {
ut_print_timestamp(stderr);
- fputs(
-" InnoDB: Error: trying to declare trx to enter InnoDB, but\n"
-"InnoDB: it already is declared.\n", stderr);
+ fputs(" InnoDB: Error: trying to declare trx"
+ " to enter InnoDB, but\n"
+ "InnoDB: it already is declared.\n", stderr);
trx_print(stderr, trx, 0);
putc('\n', stderr);
os_fast_mutex_unlock(&srv_conc_mutex);
@@ -1008,11 +1013,11 @@ retry:
return;
}
- /* If the transaction is not holding resources,
- let it sleep for SRV_THREAD_SLEEP_DELAY microseconds, and try again then */
+ /* If the transaction is not holding resources, let it sleep
+ for SRV_THREAD_SLEEP_DELAY microseconds, and try again then */
if (!has_slept && !trx->has_search_latch
- && NULL == UT_LIST_GET_FIRST(trx->trx_locks)) {
+ && NULL == UT_LIST_GET_FIRST(trx->trx_locks)) {
has_slept = TRUE; /* We let is sleep only once to avoid
starvation */
@@ -1227,11 +1232,11 @@ srv_normalize_init_values(void)
for (i = 0; i < n; i++) {
srv_data_file_sizes[i] = srv_data_file_sizes[i]
- * ((1024 * 1024) / UNIV_PAGE_SIZE);
+ * ((1024 * 1024) / UNIV_PAGE_SIZE);
}
srv_last_file_size_max = srv_last_file_size_max
- * ((1024 * 1024) / UNIV_PAGE_SIZE);
+ * ((1024 * 1024) / UNIV_PAGE_SIZE);
srv_log_file_size = srv_log_file_size / UNIV_PAGE_SIZE;
@@ -1313,21 +1318,29 @@ srv_table_reserve_slot_for_mysql(void)
ut_print_timestamp(stderr);
fprintf(stderr,
-" InnoDB: There appear to be %lu MySQL threads currently waiting\n"
-"InnoDB: inside InnoDB, which is the upper limit. Cannot continue operation.\n"
-"InnoDB: We intentionally generate a seg fault to print a stack trace\n"
-"InnoDB: on Linux. But first we print a list of waiting threads.\n", (ulong) i);
+ " InnoDB: There appear to be %lu MySQL"
+ " threads currently waiting\n"
+ "InnoDB: inside InnoDB, which is the"
+ " upper limit. Cannot continue operation.\n"
+ "InnoDB: We intentionally generate"
+ " a seg fault to print a stack trace\n"
+ "InnoDB: on Linux. But first we print"
+ " a list of waiting threads.\n", (ulong) i);
for (i = 0; i < OS_THREAD_MAX_N; i++) {
slot = srv_mysql_table + i;
fprintf(stderr,
-"Slot %lu: thread id %lu, type %lu, in use %lu, susp %lu, time %lu\n",
- (ulong) i, (ulong) os_thread_pf(slot->id),
- (ulong) slot->type, (ulong) slot->in_use,
- (ulong) slot->suspended,
- (ulong) difftime(ut_time(), slot->suspend_time));
+ "Slot %lu: thread id %lu, type %lu,"
+ " in use %lu, susp %lu, time %lu\n",
+ (ulong) i,
+ (ulong) os_thread_pf(slot->id),
+ (ulong) slot->type,
+ (ulong) slot->in_use,
+ (ulong) slot->suspended,
+ (ulong) difftime(ut_time(),
+ slot->suspend_time));
}
ut_error;
@@ -1493,8 +1506,8 @@ srv_suspend_mysql_thread(
mutex_exit(&kernel_mutex);
- if (srv_lock_wait_timeout < 100000000 &&
- wait_time > (double)srv_lock_wait_timeout) {
+ if (srv_lock_wait_timeout < 100000000
+ && wait_time > (double)srv_lock_wait_timeout) {
trx->error_state = DB_LOCK_WAIT_TIMEOUT;
}
@@ -1600,7 +1613,7 @@ srv_printf_innodb_monitor(
time */
time_elapsed = difftime(current_time, srv_last_monitor_time)
- + 0.001;
+ + 0.001;
srv_last_monitor_time = time(NULL);
@@ -1614,8 +1627,8 @@ srv_printf_innodb_monitor(
(ulong)time_elapsed);
fputs("----------\n"
- "SEMAPHORES\n"
- "----------\n", file);
+ "SEMAPHORES\n"
+ "----------\n", file);
sync_print(file);
/* Conceptually, srv_innodb_monitor_mutex has a very high latching
@@ -1627,8 +1640,8 @@ srv_printf_innodb_monitor(
if (ftell(dict_foreign_err_file) != 0L) {
fputs("------------------------\n"
- "LATEST FOREIGN KEY ERROR\n"
- "------------------------\n", file);
+ "LATEST FOREIGN KEY ERROR\n"
+ "------------------------\n", file);
ut_copy_file(file, dict_foreign_err_file);
}
@@ -1653,64 +1666,66 @@ srv_printf_innodb_monitor(
}
}
fputs("--------\n"
- "FILE I/O\n"
- "--------\n", file);
+ "FILE I/O\n"
+ "--------\n", file);
os_aio_print(file);
fputs("-------------------------------------\n"
- "INSERT BUFFER AND ADAPTIVE HASH INDEX\n"
- "-------------------------------------\n", file);
+ "INSERT BUFFER AND ADAPTIVE HASH INDEX\n"
+ "-------------------------------------\n", file);
ibuf_print(file);
ha_print_info(file, btr_search_sys->hash_index);
fprintf(file,
"%.2f hash searches/s, %.2f non-hash searches/s\n",
- (btr_cur_n_sea - btr_cur_n_sea_old)
- / time_elapsed,
- (btr_cur_n_non_sea - btr_cur_n_non_sea_old)
- / time_elapsed);
+ (btr_cur_n_sea - btr_cur_n_sea_old)
+ / time_elapsed,
+ (btr_cur_n_non_sea - btr_cur_n_non_sea_old)
+ / time_elapsed);
btr_cur_n_sea_old = btr_cur_n_sea;
btr_cur_n_non_sea_old = btr_cur_n_non_sea;
fputs("---\n"
- "LOG\n"
- "---\n", file);
+ "LOG\n"
+ "---\n", file);
log_print(file);
fputs("----------------------\n"
- "BUFFER POOL AND MEMORY\n"
- "----------------------\n", file);
+ "BUFFER POOL AND MEMORY\n"
+ "----------------------\n", file);
fprintf(file,
- "Total memory allocated " ULINTPF
- "; in additional pool allocated " ULINTPF "\n",
- ut_total_allocated_memory,
- mem_pool_get_reserved(mem_comm_pool));
+ "Total memory allocated " ULINTPF
+ "; in additional pool allocated " ULINTPF "\n",
+ ut_total_allocated_memory,
+ mem_pool_get_reserved(mem_comm_pool));
fprintf(file, "Dictionary memory allocated " ULINTPF "\n",
dict_sys->size);
if (srv_use_awe) {
fprintf(file,
- "In addition to that %lu MB of AWE memory allocated\n",
- (ulong) (srv_pool_size / ((1024 * 1024) / UNIV_PAGE_SIZE)));
+ "In addition to that %lu MB of AWE memory allocated\n",
+ (ulong) (srv_pool_size
+ / ((1024 * 1024) / UNIV_PAGE_SIZE)));
}
buf_print_io(file);
fputs("--------------\n"
- "ROW OPERATIONS\n"
- "--------------\n", file);
+ "ROW OPERATIONS\n"
+ "--------------\n", file);
fprintf(file, "%ld queries inside InnoDB, %lu queries in queue\n",
(long) srv_conc_n_threads,
(ulong) srv_conc_n_waiting_threads);
fprintf(file, "%lu read views open inside InnoDB\n",
- UT_LIST_GET_LEN(trx_sys->view_list));
+ UT_LIST_GET_LEN(trx_sys->view_list));
n_reserved = fil_space_get_n_reserved_extents(0);
if (n_reserved > 0) {
fprintf(file,
- "%lu tablespace extents now reserved for B-tree split operations\n",
+ "%lu tablespace extents now reserved for"
+ " B-tree split operations\n",
(ulong) n_reserved);
}
@@ -1721,35 +1736,37 @@ srv_printf_innodb_monitor(
srv_main_thread_op_info);
#else
fprintf(file, "Main thread id %lu, state: %s\n",
- (ulong) srv_main_thread_id,
- srv_main_thread_op_info);
+ (ulong) srv_main_thread_id,
+ srv_main_thread_op_info);
#endif
fprintf(file,
- "Number of rows inserted " ULINTPF
- ", updated " ULINTPF ", deleted " ULINTPF ", read " ULINTPF "\n",
- srv_n_rows_inserted,
- srv_n_rows_updated,
- srv_n_rows_deleted,
- srv_n_rows_read);
+ "Number of rows inserted " ULINTPF
+ ", updated " ULINTPF ", deleted " ULINTPF
+ ", read " ULINTPF "\n",
+ srv_n_rows_inserted,
+ srv_n_rows_updated,
+ srv_n_rows_deleted,
+ srv_n_rows_read);
fprintf(file,
- "%.2f inserts/s, %.2f updates/s, %.2f deletes/s, %.2f reads/s\n",
- (srv_n_rows_inserted - srv_n_rows_inserted_old)
- / time_elapsed,
- (srv_n_rows_updated - srv_n_rows_updated_old)
- / time_elapsed,
- (srv_n_rows_deleted - srv_n_rows_deleted_old)
- / time_elapsed,
- (srv_n_rows_read - srv_n_rows_read_old)
- / time_elapsed);
-
- srv_n_rows_inserted_old = srv_n_rows_inserted;
+ "%.2f inserts/s, %.2f updates/s,"
+ " %.2f deletes/s, %.2f reads/s\n",
+ (srv_n_rows_inserted - srv_n_rows_inserted_old)
+ / time_elapsed,
+ (srv_n_rows_updated - srv_n_rows_updated_old)
+ / time_elapsed,
+ (srv_n_rows_deleted - srv_n_rows_deleted_old)
+ / time_elapsed,
+ (srv_n_rows_read - srv_n_rows_read_old)
+ / time_elapsed);
+
+ srv_n_rows_inserted_old = srv_n_rows_inserted;
srv_n_rows_updated_old = srv_n_rows_updated;
srv_n_rows_deleted_old = srv_n_rows_deleted;
srv_n_rows_read_old = srv_n_rows_read;
- fputs("----------------------------\n"
- "END OF INNODB MONITOR OUTPUT\n"
- "============================\n", file);
+ fputs("----------------------------\n"
+ "END OF INNODB MONITOR OUTPUT\n"
+ "============================\n", file);
mutex_exit(&srv_innodb_monitor_mutex);
fflush(file);
}
@@ -1760,60 +1777,72 @@ Function to pass InnoDB status variables to MySQL */
void
srv_export_innodb_status(void)
{
-
mutex_enter(&srv_innodb_monitor_mutex);
- export_vars.innodb_data_pending_reads= os_n_pending_reads;
- export_vars.innodb_data_pending_writes= os_n_pending_writes;
- export_vars.innodb_data_pending_fsyncs=
- fil_n_pending_log_flushes + fil_n_pending_tablespace_flushes;
- export_vars.innodb_data_fsyncs= os_n_fsyncs;
- export_vars.innodb_data_read= srv_data_read;
- export_vars.innodb_data_reads= os_n_file_reads;
- export_vars.innodb_data_writes= os_n_file_writes;
- export_vars.innodb_data_written= srv_data_written;
- export_vars.innodb_buffer_pool_read_requests= buf_pool->n_page_gets;
- export_vars.innodb_buffer_pool_write_requests= srv_buf_pool_write_requests;
- export_vars.innodb_buffer_pool_wait_free= srv_buf_pool_wait_free;
- export_vars.innodb_buffer_pool_pages_flushed= srv_buf_pool_flushed;
- export_vars.innodb_buffer_pool_reads= srv_buf_pool_reads;
- export_vars.innodb_buffer_pool_read_ahead_rnd= srv_read_ahead_rnd;
- export_vars.innodb_buffer_pool_read_ahead_seq= srv_read_ahead_seq;
- export_vars.innodb_buffer_pool_pages_data= UT_LIST_GET_LEN(buf_pool->LRU);
- export_vars.innodb_buffer_pool_pages_dirty= UT_LIST_GET_LEN(buf_pool->flush_list);
- export_vars.innodb_buffer_pool_pages_free= UT_LIST_GET_LEN(buf_pool->free);
- export_vars.innodb_buffer_pool_pages_latched= buf_get_latched_pages_number();
- export_vars.innodb_buffer_pool_pages_total= buf_pool->curr_size;
- export_vars.innodb_buffer_pool_pages_misc= buf_pool->max_size -
- UT_LIST_GET_LEN(buf_pool->LRU) - UT_LIST_GET_LEN(buf_pool->free);
- export_vars.innodb_page_size= UNIV_PAGE_SIZE;
- export_vars.innodb_log_waits= srv_log_waits;
- export_vars.innodb_os_log_written= srv_os_log_written;
- export_vars.innodb_os_log_fsyncs= fil_n_log_flushes;
- export_vars.innodb_os_log_pending_fsyncs= fil_n_pending_log_flushes;
- export_vars.innodb_os_log_pending_writes= srv_os_log_pending_writes;
- export_vars.innodb_log_write_requests= srv_log_write_requests;
- export_vars.innodb_log_writes= srv_log_writes;
- export_vars.innodb_dblwr_pages_written= srv_dblwr_pages_written;
- export_vars.innodb_dblwr_writes= srv_dblwr_writes;
- export_vars.innodb_pages_created= buf_pool->n_pages_created;
- export_vars.innodb_pages_read= buf_pool->n_pages_read;
- export_vars.innodb_pages_written= buf_pool->n_pages_written;
- export_vars.innodb_row_lock_waits= srv_n_lock_wait_count;
- export_vars.innodb_row_lock_current_waits= srv_n_lock_wait_current_count;
- export_vars.innodb_row_lock_time= srv_n_lock_wait_time / 10000;
+
+ export_vars.innodb_data_pending_reads
+ = os_n_pending_reads;
+ export_vars.innodb_data_pending_writes
+ = os_n_pending_writes;
+ export_vars.innodb_data_pending_fsyncs
+ = fil_n_pending_log_flushes
+ + fil_n_pending_tablespace_flushes;
+ export_vars.innodb_data_fsyncs = os_n_fsyncs;
+ export_vars.innodb_data_read = srv_data_read;
+ export_vars.innodb_data_reads = os_n_file_reads;
+ export_vars.innodb_data_writes = os_n_file_writes;
+ export_vars.innodb_data_written = srv_data_written;
+ export_vars.innodb_buffer_pool_read_requests = buf_pool->n_page_gets;
+ export_vars.innodb_buffer_pool_write_requests
+ = srv_buf_pool_write_requests;
+ export_vars.innodb_buffer_pool_wait_free = srv_buf_pool_wait_free;
+ export_vars.innodb_buffer_pool_pages_flushed = srv_buf_pool_flushed;
+ export_vars.innodb_buffer_pool_reads = srv_buf_pool_reads;
+ export_vars.innodb_buffer_pool_read_ahead_rnd = srv_read_ahead_rnd;
+ export_vars.innodb_buffer_pool_read_ahead_seq = srv_read_ahead_seq;
+ export_vars.innodb_buffer_pool_pages_data
+ = UT_LIST_GET_LEN(buf_pool->LRU);
+ export_vars.innodb_buffer_pool_pages_dirty
+ = UT_LIST_GET_LEN(buf_pool->flush_list);
+ export_vars.innodb_buffer_pool_pages_free
+ = UT_LIST_GET_LEN(buf_pool->free);
+ export_vars.innodb_buffer_pool_pages_latched
+ = buf_get_latched_pages_number();
+ export_vars.innodb_buffer_pool_pages_total = buf_pool->curr_size;
+
+ export_vars.innodb_buffer_pool_pages_misc = buf_pool->max_size
+ - UT_LIST_GET_LEN(buf_pool->LRU)
+ - UT_LIST_GET_LEN(buf_pool->free);
+ export_vars.innodb_page_size = UNIV_PAGE_SIZE;
+ export_vars.innodb_log_waits = srv_log_waits;
+ export_vars.innodb_os_log_written = srv_os_log_written;
+ export_vars.innodb_os_log_fsyncs = fil_n_log_flushes;
+ export_vars.innodb_os_log_pending_fsyncs = fil_n_pending_log_flushes;
+ export_vars.innodb_os_log_pending_writes = srv_os_log_pending_writes;
+ export_vars.innodb_log_write_requests = srv_log_write_requests;
+ export_vars.innodb_log_writes = srv_log_writes;
+ export_vars.innodb_dblwr_pages_written = srv_dblwr_pages_written;
+ export_vars.innodb_dblwr_writes = srv_dblwr_writes;
+ export_vars.innodb_pages_created = buf_pool->n_pages_created;
+ export_vars.innodb_pages_read = buf_pool->n_pages_read;
+ export_vars.innodb_pages_written = buf_pool->n_pages_written;
+ export_vars.innodb_row_lock_waits = srv_n_lock_wait_count;
+ export_vars.innodb_row_lock_current_waits
+ = srv_n_lock_wait_current_count;
+ export_vars.innodb_row_lock_time = srv_n_lock_wait_time / 10000;
if (srv_n_lock_wait_count > 0) {
export_vars.innodb_row_lock_time_avg = (ulint)
(srv_n_lock_wait_time / 10000 / srv_n_lock_wait_count);
} else {
export_vars.innodb_row_lock_time_avg = 0;
}
- export_vars.innodb_row_lock_time_max= srv_n_lock_max_wait_time / 10000;
- export_vars.innodb_rows_read= srv_n_rows_read;
- export_vars.innodb_rows_inserted= srv_n_rows_inserted;
- export_vars.innodb_rows_updated= srv_n_rows_updated;
- export_vars.innodb_rows_deleted= srv_n_rows_deleted;
- mutex_exit(&srv_innodb_monitor_mutex);
+ export_vars.innodb_row_lock_time_max
+ = srv_n_lock_max_wait_time / 10000;
+ export_vars.innodb_rows_read = srv_n_rows_read;
+ export_vars.innodb_rows_inserted = srv_n_rows_inserted;
+ export_vars.innodb_rows_updated = srv_n_rows_updated;
+ export_vars.innodb_rows_deleted = srv_n_rows_deleted;
+ mutex_exit(&srv_innodb_monitor_mutex);
}
/*************************************************************************
@@ -1873,53 +1902,57 @@ loop:
if (srv_innodb_status) {
mutex_enter(&srv_monitor_file_mutex);
rewind(srv_monitor_file);
- srv_printf_innodb_monitor(srv_monitor_file, NULL, NULL);
+ srv_printf_innodb_monitor
+ (srv_monitor_file, NULL, NULL);
os_file_set_eof(srv_monitor_file);
mutex_exit(&srv_monitor_file_mutex);
}
if (srv_print_innodb_tablespace_monitor
- && difftime(current_time, last_table_monitor_time) > 60) {
+ && difftime(current_time, last_table_monitor_time) > 60) {
last_table_monitor_time = time(NULL);
- fputs("================================================\n",
- stderr);
+ fputs("========================"
+ "========================\n",
+ stderr);
ut_print_timestamp(stderr);
fputs(" INNODB TABLESPACE MONITOR OUTPUT\n"
- "================================================\n",
- stderr);
+ "========================"
+ "========================\n",
+ stderr);
fsp_print(0);
fputs("Validating tablespace\n", stderr);
fsp_validate(0);
fputs("Validation ok\n"
- "---------------------------------------\n"
- "END OF INNODB TABLESPACE MONITOR OUTPUT\n"
- "=======================================\n",
- stderr);
+ "---------------------------------------\n"
+ "END OF INNODB TABLESPACE MONITOR OUTPUT\n"
+ "=======================================\n",
+ stderr);
}
if (srv_print_innodb_table_monitor
- && difftime(current_time, last_table_monitor_time) > 60) {
+ && difftime(current_time, last_table_monitor_time) > 60) {
last_table_monitor_time = time(NULL);
- fputs("===========================================\n", stderr);
+ fputs("===========================================\n",
+ stderr);
ut_print_timestamp(stderr);
fputs(" INNODB TABLE MONITOR OUTPUT\n"
- "===========================================\n",
- stderr);
+ "===========================================\n",
+ stderr);
dict_print();
fputs("-----------------------------------\n"
- "END OF INNODB TABLE MONITOR OUTPUT\n"
- "==================================\n",
- stderr);
+ "END OF INNODB TABLE MONITOR OUTPUT\n"
+ "==================================\n",
+ stderr);
}
}
@@ -1939,9 +1972,9 @@ loop:
wait_time = ut_difftime(ut_time(), slot->suspend_time);
- if (srv_lock_wait_timeout < 100000000 &&
- (wait_time > (double) srv_lock_wait_timeout
- || wait_time < 0)) {
+ if (srv_lock_wait_timeout < 100000000
+ && (wait_time > (double) srv_lock_wait_timeout
+ || wait_time < 0)) {
/* Timeout exceeded or a wrap-around in system
time counter: cancel the lock request queued
@@ -1951,8 +1984,9 @@ loop:
granted: in that case do nothing */
if (thr_get_trx(slot->thr)->wait_lock) {
- lock_cancel_waiting_and_release(
- thr_get_trx(slot->thr)->wait_lock);
+ lock_cancel_waiting_and_release
+ (thr_get_trx(slot->thr)
+ ->wait_lock);
}
}
}
@@ -1967,9 +2001,9 @@ loop:
}
if (some_waits || srv_print_innodb_monitor
- || srv_print_innodb_lock_monitor
- || srv_print_innodb_tablespace_monitor
- || srv_print_innodb_table_monitor) {
+ || srv_print_innodb_lock_monitor
+ || srv_print_innodb_tablespace_monitor
+ || srv_print_innodb_table_monitor) {
goto loop;
}
@@ -2030,13 +2064,15 @@ loop:
if (ut_dulint_cmp(new_lsn, old_lsn) < 0) {
ut_print_timestamp(stderr);
fprintf(stderr,
-" InnoDB: Error: old log sequence number %lu %lu was greater\n"
-"InnoDB: than the new log sequence number %lu %lu!\n"
-"InnoDB: Please send a bug report to mysql@lists.mysql.com\n",
- (ulong) ut_dulint_get_high(old_lsn),
- (ulong) ut_dulint_get_low(old_lsn),
- (ulong) ut_dulint_get_high(new_lsn),
- (ulong) ut_dulint_get_low(new_lsn));
+ " InnoDB: Error: old log sequence number %lu %lu"
+ " was greater\n"
+ "InnoDB: than the new log sequence number %lu %lu!\n"
+ "InnoDB: Please submit a bug report"
+ " to http://bugs.mysql.com\n",
+ (ulong) ut_dulint_get_high(old_lsn),
+ (ulong) ut_dulint_get_low(old_lsn),
+ (ulong) ut_dulint_get_high(new_lsn),
+ (ulong) ut_dulint_get_low(new_lsn));
}
old_lsn = new_lsn;
@@ -2053,9 +2089,11 @@ loop:
if (fatal_cnt > 5) {
fprintf(stderr,
-"InnoDB: Error: semaphore wait has lasted > %lu seconds\n"
-"InnoDB: We intentionally crash the server, because it appears to be hung.\n",
- srv_fatal_semaphore_wait_threshold);
+ "InnoDB: Error: semaphore wait has lasted"
+ " > %lu seconds\n"
+ "InnoDB: We intentionally crash the server,"
+ " because it appears to be hung.\n",
+ (ulong) srv_fatal_semaphore_wait_threshold);
ut_error;
}
@@ -2174,7 +2212,7 @@ loop:
srv_main_thread_op_info = "reserving kernel mutex";
n_ios_very_old = log_sys->n_log_ios + buf_pool->n_pages_read
- + buf_pool->n_pages_written;
+ + buf_pool->n_pages_written;
mutex_enter(&kernel_mutex);
/* Store the user activity counter at the start of this loop */
@@ -2194,7 +2232,7 @@ loop:
for (i = 0; i < 10; i++) {
n_ios_old = log_sys->n_log_ios + buf_pool->n_pages_read
- + buf_pool->n_pages_written;
+ + buf_pool->n_pages_written;
srv_main_thread_op_info = "sleeping";
if (!skip_sleep) {
@@ -2235,9 +2273,9 @@ loop:
do an insert buffer merge. */
n_pend_ios = buf_get_n_pending_ios()
- + log_sys->n_pending_writes;
+ + log_sys->n_pending_writes;
n_ios = log_sys->n_log_ios + buf_pool->n_pages_read
- + buf_pool->n_pages_written;
+ + buf_pool->n_pages_written;
if (n_pend_ios < 3 && (n_ios - n_ios_old < 5)) {
srv_main_thread_op_info = "doing insert buffer merge";
ibuf_contract_for_n_pages(TRUE, 5);
@@ -2247,8 +2285,8 @@ loop:
log_buffer_flush_to_disk();
}
- if (buf_get_modified_ratio_pct() >
- srv_max_buf_pool_modified_pct) {
+ if (UNIV_UNLIKELY(buf_get_modified_ratio_pct()
+ > srv_max_buf_pool_modified_pct)) {
/* Try to keep the number of modified pages in the
buffer pool under the limit wished by the user */
@@ -2287,7 +2325,7 @@ loop:
n_pend_ios = buf_get_n_pending_ios() + log_sys->n_pending_writes;
n_ios = log_sys->n_log_ios + buf_pool->n_pages_read
- + buf_pool->n_pages_written;
+ + buf_pool->n_pages_written;
if (n_pend_ios < 3 && (n_ios - n_ios_very_old < 200)) {
srv_main_thread_op_info = "flushing buffer pool pages";
@@ -2344,14 +2382,14 @@ loop:
the time it requires to flush 100 pages */
n_pages_flushed = buf_flush_batch(BUF_FLUSH_LIST, 100,
- ut_dulint_max);
+ ut_dulint_max);
} else {
/* Otherwise, we only flush a small number of pages so that
we do not unnecessarily use much disk i/o capacity from
other work */
n_pages_flushed = buf_flush_batch(BUF_FLUSH_LIST, 10,
- ut_dulint_max);
+ ut_dulint_max);
}
srv_main_thread_op_info = "making checkpoint";
@@ -2455,8 +2493,8 @@ flush_loop:
srv_main_thread_op_info = "flushing buffer pool pages";
if (srv_fast_shutdown < 2) {
- n_pages_flushed =
- buf_flush_batch(BUF_FLUSH_LIST, 100, ut_dulint_max);
+ n_pages_flushed = buf_flush_batch
+ (BUF_FLUSH_LIST, 100, ut_dulint_max);
} else {
/* In the fastest shutdown we do not flush the buffer pool
to data files: we set n_pages_flushed to 0 artificially. */
@@ -2500,18 +2538,18 @@ flush_loop:
goto loop;
}
mutex_exit(&kernel_mutex);
-/*
+ /*
srv_main_thread_op_info = "archiving log (if log archive is on)";
log_archive_do(FALSE, &n_bytes_archived);
-*/
+ */
n_bytes_archived = 0;
/* Keep looping in the background loop if still work to do */
if (srv_fast_shutdown && srv_shutdown_state > 0) {
if (n_tables_to_drop + n_pages_flushed
- + n_bytes_archived != 0) {
+ + n_bytes_archived != 0) {
/* If we are doing a fast shutdown (= the default)
we do not do purge or insert buffer merge. But we
@@ -2522,9 +2560,9 @@ flush_loop:
goto background_loop;
}
- } else if (n_tables_to_drop +
- n_pages_purged + n_bytes_merged + n_pages_flushed
- + n_bytes_archived != 0) {
+ } else if (n_tables_to_drop
+ + n_pages_purged + n_bytes_merged + n_pages_flushed
+ + n_bytes_archived != 0) {
/* In a 'slow' shutdown we run purge and the insert buffer
merge to completion */
@@ -2549,6 +2587,10 @@ suspend_thread:
mutex_exit(&kernel_mutex);
+ /* DO NOT CHANGE THIS STRING. innobase_start_or_create_for_mysql()
+ waits for database activity to die down when converting < 4.1.x
+ databases, and relies on this string being exactly as it is. InnoDB
+ manual also mentions this string in several places. */
srv_main_thread_op_info = "waiting for server activity";
os_event_wait(event);
@@ -2564,5 +2606,7 @@ suspend_thread:
main thread goes back to loop. */
goto loop;
+
+ OS_THREAD_DUMMY_RETURN; /* Not reached, avoid compiler warning */
}
#endif /* !UNIV_HOTBACKUP */
diff --git a/storage/innobase/srv/srv0start.c b/storage/innobase/srv/srv0start.c
index 8346203f3f7..2b9bd402bb7 100644
--- a/storage/innobase/srv/srv0start.c
+++ b/storage/innobase/srv/srv0start.c
@@ -188,9 +188,9 @@ srv_parse_data_file_paths_and_sizes(
path = str;
while ((*str != ':' && *str != '\0')
- || (*str == ':'
- && (*(str + 1) == '\\' || *(str + 1) == '/'
- || *(str + 1) == ':'))) {
+ || (*str == ':'
+ && (*(str + 1) == '\\' || *(str + 1) == '/'
+ || *(str + 1) == ':'))) {
str++;
}
@@ -202,11 +202,13 @@ srv_parse_data_file_paths_and_sizes(
str = srv_parse_megabytes(str, &size);
- if (0 == memcmp(str, ":autoextend", (sizeof ":autoextend") - 1)) {
+ if (0 == memcmp(str, ":autoextend",
+ (sizeof ":autoextend") - 1)) {
str += (sizeof ":autoextend") - 1;
- if (0 == memcmp(str, ":max:", (sizeof ":max:") - 1)) {
+ if (0 == memcmp(str, ":max:",
+ (sizeof ":max:") - 1)) {
str += (sizeof ":max:") - 1;
@@ -220,9 +222,9 @@ srv_parse_data_file_paths_and_sizes(
}
if (strlen(str) >= 6
- && *str == 'n'
- && *(str + 1) == 'e'
- && *(str + 2) == 'w') {
+ && *str == 'n'
+ && *(str + 1) == 'e'
+ && *(str + 2) == 'w') {
str += 3;
}
@@ -271,9 +273,9 @@ srv_parse_data_file_paths_and_sizes(
\\.\C::1Gnewraw or \\.\PHYSICALDRIVE2:1Gnewraw */
while ((*str != ':' && *str != '\0')
- || (*str == ':'
- && (*(str + 1) == '\\' || *(str + 1) == '/'
- || *(str + 1) == ':'))) {
+ || (*str == ':'
+ && (*(str + 1) == '\\' || *(str + 1) == '/'
+ || *(str + 1) == ':'))) {
str++;
}
@@ -288,7 +290,8 @@ srv_parse_data_file_paths_and_sizes(
(*data_file_names)[i] = path;
(*data_file_sizes)[i] = size;
- if (0 == memcmp(str, ":autoextend", (sizeof ":autoextend") - 1)) {
+ if (0 == memcmp(str, ":autoextend",
+ (sizeof ":autoextend") - 1)) {
*is_auto_extending = TRUE;
@@ -298,8 +301,8 @@ srv_parse_data_file_paths_and_sizes(
str += (sizeof ":max:") - 1;
- str = srv_parse_megabytes(str,
- max_auto_extend_size);
+ str = srv_parse_megabytes
+ (str, max_auto_extend_size);
}
if (*str != '\0') {
@@ -311,9 +314,9 @@ srv_parse_data_file_paths_and_sizes(
(*data_file_is_raw_partition)[i] = 0;
if (strlen(str) >= 6
- && *str == 'n'
- && *(str + 1) == 'e'
- && *(str + 2) == 'w') {
+ && *str == 'n'
+ && *(str + 1) == 'e'
+ && *(str + 2) == 'w') {
str += 3;
(*data_file_is_raw_partition)[i] = SRV_NEW_RAW;
}
@@ -425,7 +428,7 @@ io_handler_thread(
#ifdef UNIV_DEBUG_THREAD_CREATION
fprintf(stderr, "Io handler thread %lu starts, id %lu\n", segment,
- os_thread_pf(os_thread_get_curr_id()));
+ os_thread_pf(os_thread_get_curr_id()));
#endif
for (i = 0;; i++) {
fil_aio_wait(segment);
@@ -459,7 +462,7 @@ void
srv_normalize_path_for_win(
/*=======================*/
char* str __attribute__((unused))) /* in/out: null-terminated
- character string */
+ character string */
{
#ifdef __WIN__
for (; *str; str++) {
@@ -554,35 +557,37 @@ open_or_create_log_file(
*log_file_created = FALSE;
srv_normalize_path_for_win(srv_log_group_home_dirs[k]);
- srv_log_group_home_dirs[k] = srv_add_path_separator_if_needed(
- srv_log_group_home_dirs[k]);
+ srv_log_group_home_dirs[k] = srv_add_path_separator_if_needed
+ (srv_log_group_home_dirs[k]);
- ut_a(strlen(srv_log_group_home_dirs[k]) <
- (sizeof name) - 10 - sizeof "ib_logfile");
- sprintf(name, "%s%s%lu", srv_log_group_home_dirs[k], "ib_logfile", (ulong) i);
+ ut_a(strlen(srv_log_group_home_dirs[k])
+ < (sizeof name) - 10 - sizeof "ib_logfile");
+ sprintf(name, "%s%s%lu", srv_log_group_home_dirs[k],
+ "ib_logfile", (ulong) i);
files[i] = os_file_create(name, OS_FILE_CREATE, OS_FILE_NORMAL,
- OS_LOG_FILE, &ret);
+ OS_LOG_FILE, &ret);
if (ret == FALSE) {
if (os_file_get_last_error(FALSE) != OS_FILE_ALREADY_EXISTS
#ifdef UNIV_AIX
- /* AIX 5.1 after security patch ML7 may have errno set
- to 0 here, which causes our function to return 100;
- work around that AIX problem */
- && os_file_get_last_error(FALSE) != 100
+ /* AIX 5.1 after security patch ML7 may have errno set
+ to 0 here, which causes our function to return 100;
+ work around that AIX problem */
+ && os_file_get_last_error(FALSE) != 100
#endif
- ) {
+ ) {
fprintf(stderr,
- "InnoDB: Error in creating or opening %s\n", name);
+ "InnoDB: Error in creating"
+ " or opening %s\n", name);
return(DB_ERROR);
}
files[i] = os_file_create(name, OS_FILE_OPEN, OS_FILE_AIO,
- OS_LOG_FILE, &ret);
+ OS_LOG_FILE, &ret);
if (!ret) {
fprintf(stderr,
- "InnoDB: Error in opening %s\n", name);
+ "InnoDB: Error in opening %s\n", name);
return(DB_ERROR);
}
@@ -591,11 +596,13 @@ open_or_create_log_file(
ut_a(ret);
if (size != srv_calc_low32(srv_log_file_size)
- || size_high != srv_calc_high32(srv_log_file_size)) {
+ || size_high != srv_calc_high32(srv_log_file_size)) {
fprintf(stderr,
-"InnoDB: Error: log file %s is of different size %lu %lu bytes\n"
-"InnoDB: than specified in the .cnf file %lu %lu bytes!\n",
+ "InnoDB: Error: log file %s is"
+ " of different size %lu %lu bytes\n"
+ "InnoDB: than specified in the .cnf"
+ " file %lu %lu bytes!\n",
name, (ulong) size_high, (ulong) size,
(ulong) srv_calc_high32(srv_log_file_size),
(ulong) srv_calc_low32(srv_log_file_size));
@@ -608,8 +615,9 @@ open_or_create_log_file(
ut_print_timestamp(stderr);
fprintf(stderr,
- " InnoDB: Log file %s did not exist: new to be created\n",
- name);
+ " InnoDB: Log file %s did not exist:"
+ " new to be created\n",
+ name);
if (log_file_has_been_opened) {
return(DB_ERROR);
@@ -620,15 +628,17 @@ open_or_create_log_file(
>> (20 - UNIV_PAGE_SIZE_SHIFT));
fprintf(stderr,
- "InnoDB: Database physically writes the file full: wait...\n");
+ "InnoDB: Database physically writes the file"
+ " full: wait...\n");
ret = os_file_set_size(name, files[i],
- srv_calc_low32(srv_log_file_size),
- srv_calc_high32(srv_log_file_size));
+ srv_calc_low32(srv_log_file_size),
+ srv_calc_high32(srv_log_file_size));
if (!ret) {
fprintf(stderr,
- "InnoDB: Error in creating %s: probably out of disk space\n",
- name);
+ "InnoDB: Error in creating %s:"
+ " probably out of disk space\n",
+ name);
return(DB_ERROR);
}
@@ -642,13 +652,13 @@ open_or_create_log_file(
which is for this log group */
fil_space_create(name,
- 2 * k + SRV_LOG_SPACE_FIRST_ID, FIL_LOG);
+ 2 * k + SRV_LOG_SPACE_FIRST_ID, FIL_LOG);
}
ut_a(fil_validate());
fil_node_create(name, srv_log_file_size,
- 2 * k + SRV_LOG_SPACE_FIRST_ID, FALSE);
+ 2 * k + SRV_LOG_SPACE_FIRST_ID, FALSE);
#ifdef UNIV_LOG_ARCHIVE
/* If this is the first log group, create the file space object
for archived logs.
@@ -664,10 +674,10 @@ open_or_create_log_file(
#endif /* UNIV_LOG_ARCHIVE */
if (i == 0) {
log_group_init(k, srv_n_log_files,
- srv_log_file_size * UNIV_PAGE_SIZE,
- 2 * k + SRV_LOG_SPACE_FIRST_ID,
- SRV_LOG_SPACE_FIRST_ID + 1); /* dummy arch
- space id */
+ srv_log_file_size * UNIV_PAGE_SIZE,
+ 2 * k + SRV_LOG_SPACE_FIRST_ID,
+ SRV_LOG_SPACE_FIRST_ID + 1); /* dummy arch
+ space id */
}
return(DB_SUCCESS);
@@ -703,8 +713,8 @@ open_or_create_data_files(
if (srv_n_data_files >= 1000) {
fprintf(stderr, "InnoDB: can only have < 1000 data files\n"
- "InnoDB: you have defined %lu\n",
- (ulong) srv_n_data_files);
+ "InnoDB: you have defined %lu\n",
+ (ulong) srv_n_data_files);
return(DB_ERROR);
}
@@ -719,7 +729,7 @@ open_or_create_data_files(
srv_normalize_path_for_win(srv_data_file_names[i]);
ut_a(strlen(srv_data_home) + strlen(srv_data_file_names[i])
- < (sizeof name) - 1);
+ < (sizeof name) - 1);
sprintf(name, "%s%s", srv_data_home, srv_data_file_names[i]);
if (srv_data_file_is_raw_partition[i] == 0) {
@@ -728,20 +738,22 @@ open_or_create_data_files(
exists, ret will get value FALSE */
files[i] = os_file_create(name, OS_FILE_CREATE,
- OS_FILE_NORMAL, OS_DATA_FILE, &ret);
+ OS_FILE_NORMAL,
+ OS_DATA_FILE, &ret);
- if (ret == FALSE && os_file_get_last_error(FALSE) !=
- OS_FILE_ALREADY_EXISTS
+ if (ret == FALSE && os_file_get_last_error(FALSE)
+ != OS_FILE_ALREADY_EXISTS
#ifdef UNIV_AIX
- /* AIX 5.1 after security patch ML7 may have
- errno set to 0 here, which causes our function
- to return 100; work around that AIX problem */
- && os_file_get_last_error(FALSE) != 100
+ /* AIX 5.1 after security patch ML7 may have
+ errno set to 0 here, which causes our function
+ to return 100; work around that AIX problem */
+ && os_file_get_last_error(FALSE) != 100
#endif
- ) {
+ ) {
fprintf(stderr,
- "InnoDB: Error in creating or opening %s\n",
- name);
+ "InnoDB: Error in creating"
+ " or opening %s\n",
+ name);
return(DB_ERROR);
}
@@ -752,12 +764,12 @@ open_or_create_data_files(
srv_start_raw_disk_in_use = TRUE;
srv_created_new_raw = TRUE;
- files[i] = os_file_create(
- name, OS_FILE_OPEN_RAW, OS_FILE_NORMAL,
- OS_DATA_FILE, &ret);
+ files[i] = os_file_create(name, OS_FILE_OPEN_RAW,
+ OS_FILE_NORMAL,
+ OS_DATA_FILE, &ret);
if (!ret) {
fprintf(stderr,
- "InnoDB: Error in opening %s\n", name);
+ "InnoDB: Error in opening %s\n", name);
return(DB_ERROR);
}
@@ -774,31 +786,32 @@ open_or_create_data_files(
if (one_created) {
fprintf(stderr,
- "InnoDB: Error: data files can only be added at the end\n");
+ "InnoDB: Error: data files can only"
+ " be added at the end\n");
fprintf(stderr,
- "InnoDB: of a tablespace, but data file %s existed beforehand.\n",
- name);
+ "InnoDB: of a tablespace, but"
+ " data file %s existed beforehand.\n",
+ name);
return(DB_ERROR);
}
if (srv_data_file_is_raw_partition[i] == SRV_OLD_RAW) {
- files[i] = os_file_create(
- name, OS_FILE_OPEN_RAW, OS_FILE_NORMAL,
- OS_DATA_FILE, &ret);
+ files[i] = os_file_create
+ (name, OS_FILE_OPEN_RAW,
+ OS_FILE_NORMAL, OS_DATA_FILE, &ret);
} else if (i == 0) {
- files[i] = os_file_create(
- name, OS_FILE_OPEN_RETRY,
- OS_FILE_NORMAL,
- OS_DATA_FILE, &ret);
+ files[i] = os_file_create
+ (name, OS_FILE_OPEN_RETRY,
+ OS_FILE_NORMAL, OS_DATA_FILE, &ret);
} else {
- files[i] = os_file_create(
- name, OS_FILE_OPEN, OS_FILE_NORMAL,
- OS_DATA_FILE, &ret);
+ files[i] = os_file_create
+ (name, OS_FILE_OPEN,
+ OS_FILE_NORMAL, OS_DATA_FILE, &ret);
}
if (!ret) {
fprintf(stderr,
- "InnoDB: Error in opening %s\n", name);
+ "InnoDB: Error in opening %s\n", name);
os_file_get_last_error(TRUE);
return(DB_ERROR);
@@ -813,26 +826,33 @@ open_or_create_data_files(
ut_a(ret);
/* Round size downward to megabytes */
- rounded_size_pages = (size / (1024 * 1024)
- + 4096 * size_high)
- << (20 - UNIV_PAGE_SIZE_SHIFT);
+ rounded_size_pages
+ = (size / (1024 * 1024) + 4096 * size_high)
+ << (20 - UNIV_PAGE_SIZE_SHIFT);
if (i == srv_n_data_files - 1
- && srv_auto_extend_last_data_file) {
+ && srv_auto_extend_last_data_file) {
- if (srv_data_file_sizes[i] >
- rounded_size_pages
- || (srv_last_file_size_max > 0
- && srv_last_file_size_max <
- rounded_size_pages)) {
+ if (srv_data_file_sizes[i] > rounded_size_pages
+ || (srv_last_file_size_max > 0
+ && srv_last_file_size_max
+ < rounded_size_pages)) {
fprintf(stderr,
-"InnoDB: Error: auto-extending data file %s is of a different size\n"
-"InnoDB: %lu pages (rounded down to MB) than specified in the .cnf file:\n"
-"InnoDB: initial %lu pages, max %lu (relevant if non-zero) pages!\n",
- name, (ulong) rounded_size_pages,
- (ulong) srv_data_file_sizes[i],
- (ulong) srv_last_file_size_max);
+ "InnoDB: Error: auto-extending"
+ " data file %s is"
+ " of a different size\n"
+ "InnoDB: %lu pages (rounded"
+ " down to MB) than specified"
+ " in the .cnf file:\n"
+ "InnoDB: initial %lu pages,"
+ " max %lu (relevant if"
+ " non-zero) pages!\n",
+ name,
+ (ulong) rounded_size_pages,
+ (ulong) srv_data_file_sizes[i],
+ (ulong)
+ srv_last_file_size_max);
return(DB_ERROR);
}
@@ -843,21 +863,25 @@ open_or_create_data_files(
if (rounded_size_pages != srv_data_file_sizes[i]) {
fprintf(stderr,
-"InnoDB: Error: data file %s is of a different size\n"
-"InnoDB: %lu pages (rounded down to MB)\n"
-"InnoDB: than specified in the .cnf file %lu pages!\n", name,
+ "InnoDB: Error: data file %s"
+ " is of a different size\n"
+ "InnoDB: %lu pages"
+ " (rounded down to MB)\n"
+ "InnoDB: than specified"
+ " in the .cnf file %lu pages!\n",
+ name,
(ulong) rounded_size_pages,
(ulong) srv_data_file_sizes[i]);
return(DB_ERROR);
}
skip_size_check:
- fil_read_flushed_lsn_and_arch_log_no(files[i],
- one_opened,
+ fil_read_flushed_lsn_and_arch_log_no
+ (files[i], one_opened,
#ifdef UNIV_LOG_ARCHIVE
- min_arch_log_no, max_arch_log_no,
+ min_arch_log_no, max_arch_log_no,
#endif /* UNIV_LOG_ARCHIVE */
- min_flushed_lsn, max_flushed_lsn);
+ min_flushed_lsn, max_flushed_lsn);
one_opened = TRUE;
} else {
/* We created the data file and now write it full of
@@ -868,37 +892,44 @@ skip_size_check:
if (i > 0) {
ut_print_timestamp(stderr);
fprintf(stderr,
- " InnoDB: Data file %s did not exist: new to be created\n",
- name);
+ " InnoDB: Data file %s did not"
+ " exist: new to be created\n",
+ name);
} else {
fprintf(stderr,
- "InnoDB: The first specified data file %s did not exist:\n"
- "InnoDB: a new database to be created!\n", name);
+ "InnoDB: The first specified"
+ " data file %s did not exist:\n"
+ "InnoDB: a new database"
+ " to be created!\n", name);
*create_new_db = TRUE;
}
ut_print_timestamp(stderr);
fprintf(stderr,
" InnoDB: Setting file %s size to %lu MB\n",
- name, (ulong) (srv_data_file_sizes[i]
- >> (20 - UNIV_PAGE_SIZE_SHIFT)));
+ name,
+ (ulong) (srv_data_file_sizes[i]
+ >> (20 - UNIV_PAGE_SIZE_SHIFT)));
fprintf(stderr,
- "InnoDB: Database physically writes the file full: wait...\n");
+ "InnoDB: Database physically writes the"
+ " file full: wait...\n");
- ret = os_file_set_size(name, files[i],
- srv_calc_low32(srv_data_file_sizes[i]),
- srv_calc_high32(srv_data_file_sizes[i]));
+ ret = os_file_set_size
+ (name, files[i],
+ srv_calc_low32(srv_data_file_sizes[i]),
+ srv_calc_high32(srv_data_file_sizes[i]));
if (!ret) {
fprintf(stderr,
- "InnoDB: Error in creating %s: probably out of disk space\n", name);
+ "InnoDB: Error in creating %s:"
+ " probably out of disk space\n", name);
return(DB_ERROR);
}
*sum_of_new_sizes = *sum_of_new_sizes
- + srv_data_file_sizes[i];
+ + srv_data_file_sizes[i];
}
ret = os_file_close(files[i]);
@@ -915,7 +946,7 @@ skip_size_check:
fil_node_create(name, srv_data_file_sizes[i], 0, TRUE);
} else {
fil_node_create(name, srv_data_file_sizes[i], 0,
- FALSE);
+ FALSE);
}
}
@@ -970,67 +1001,74 @@ innobase_start_or_create_for_mysql(void)
srv_have_fullfsync = strcmp(utsname.release, "7.") >= 0;
}
if (!srv_have_fullfsync) {
- fputs(
-"InnoDB: On Mac OS X, fsync() may be broken on internal drives,\n"
-"InnoDB: making transactions unsafe!\n", stderr);
+ fputs("InnoDB: On Mac OS X, fsync() may be"
+ " broken on internal drives,\n"
+ "InnoDB: making transactions unsafe!\n", stderr);
}
# endif /* F_FULLFSYNC */
#endif /* HAVE_DARWIN_THREADS */
if (sizeof(ulint) != sizeof(void*)) {
fprintf(stderr,
-"InnoDB: Error: size of InnoDB's ulint is %lu, but size of void* is %lu.\n"
-"InnoDB: The sizes should be the same so that on a 64-bit platform you can\n"
-"InnoDB: allocate more than 4 GB of memory.",
+ "InnoDB: Error: size of InnoDB's ulint is %lu,"
+ " but size of void* is %lu.\n"
+ "InnoDB: The sizes should be the same"
+ " so that on a 64-bit platform you can\n"
+ "InnoDB: allocate more than 4 GB of memory.",
(ulong)sizeof(ulint), (ulong)sizeof(void*));
}
srv_file_per_table = FALSE; /* system tables are created in tablespace
- 0 */
+ 0 */
#ifdef UNIV_DEBUG
fprintf(stderr,
-"InnoDB: !!!!!!!!!!!!!! UNIV_DEBUG switched on !!!!!!!!!!!!!!!\n");
+ "InnoDB: !!!!!!!! UNIV_DEBUG switched on !!!!!!!!!\n");
#endif
#ifdef UNIV_SYNC_DEBUG
fprintf(stderr,
-"InnoDB: !!!!!!!!!!!!!! UNIV_SYNC_DEBUG switched on !!!!!!!!!!!!!!!\n");
+ "InnoDB: !!!!!!!! UNIV_SYNC_DEBUG switched on !!!!!!!!!\n");
#endif
#ifdef UNIV_SEARCH_DEBUG
fprintf(stderr,
-"InnoDB: !!!!!!!!!!!!!! UNIV_SEARCH_DEBUG switched on !!!!!!!!!!!!!!!\n");
+ "InnoDB: !!!!!!!! UNIV_SEARCH_DEBUG switched on !!!!!!!!!\n");
#endif
#ifdef UNIV_MEM_DEBUG
fprintf(stderr,
-"InnoDB: !!!!!!!!!!!!!! UNIV_MEM_DEBUG switched on !!!!!!!!!!!!!!!\n");
+ "InnoDB: !!!!!!!! UNIV_MEM_DEBUG switched on !!!!!!!!!\n");
#endif
#ifdef UNIV_SIMULATE_AWE
fprintf(stderr,
-"InnoDB: !!!!!!!!!!!!!! UNIV_SIMULATE_AWE switched on !!!!!!!!!!!!!!!!!\n");
+ "InnoDB: !!!!!!!! UNIV_SIMULATE_AWE switched on !!!!!!!!!\n");
#endif
if (srv_sizeof_trx_t_in_ha_innodb_cc != (ulint)sizeof(trx_t)) {
fprintf(stderr,
- "InnoDB: Error: trx_t size is %lu in ha_innodb.cc but %lu in srv0start.c\n"
- "InnoDB: Check that pthread_mutex_t is defined in the same way in these\n"
- "InnoDB: compilation modules. Cannot continue.\n",
- (ulong) srv_sizeof_trx_t_in_ha_innodb_cc,
- (ulong) sizeof(trx_t));
+ "InnoDB: Error: trx_t size is %lu in ha_innodb.cc"
+ " but %lu in srv0start.c\n"
+ "InnoDB: Check that pthread_mutex_t is defined"
+ " in the same way in these\n"
+ "InnoDB: compilation modules. Cannot continue.\n",
+ (ulong) srv_sizeof_trx_t_in_ha_innodb_cc,
+ (ulong) sizeof(trx_t));
return(DB_ERROR);
}
/* Since InnoDB does not currently clean up all its internal data
- structures in MySQL Embedded Server Library server_end(), we
- print an error message if someone tries to start up InnoDB a
- second time during the process lifetime. */
+ structures in MySQL Embedded Server Library server_end(), we
+ print an error message if someone tries to start up InnoDB a
+ second time during the process lifetime. */
if (srv_start_has_been_called) {
fprintf(stderr,
-"InnoDB: Error:startup called second time during the process lifetime.\n"
-"InnoDB: In the MySQL Embedded Server Library you cannot call server_init()\n"
-"InnoDB: more than once during the process lifetime.\n");
+ "InnoDB: Error:startup called second time"
+ " during the process lifetime.\n"
+ "InnoDB: In the MySQL Embedded Server Library"
+ " you cannot call server_init()\n"
+ "InnoDB: more than once during"
+ " the process lifetime.\n");
}
srv_start_has_been_called = TRUE;
@@ -1038,7 +1076,7 @@ innobase_start_or_create_for_mysql(void)
#ifdef UNIV_DEBUG
log_do_write = TRUE;
#endif /* UNIV_DEBUG */
-/* yydebug = TRUE; */
+ /* yydebug = TRUE; */
srv_is_being_started = TRUE;
srv_startup_is_before_trx_rollback_phase = TRUE;
@@ -1048,9 +1086,12 @@ innobase_start_or_create_for_mysql(void)
if (srv_use_awe) {
fprintf(stderr,
-"InnoDB: Error: You have specified innodb_buffer_pool_awe_mem_mb\n"
-"InnoDB: in my.cnf, but AWE can only be used in Windows 2000 and later.\n"
-"InnoDB: To use AWE, InnoDB must be compiled with __WIN2000__ defined.\n");
+ "InnoDB: Error: You have specified"
+ " innodb_buffer_pool_awe_mem_mb\n"
+ "InnoDB: in my.cnf, but AWE can only"
+ " be used in Windows 2000 and later.\n"
+ "InnoDB: To use AWE, InnoDB must"
+ " be compiled with __WIN2000__ defined.\n");
return(DB_ERROR);
}
@@ -1058,8 +1099,8 @@ innobase_start_or_create_for_mysql(void)
#ifdef __WIN__
if (os_get_os_version() == OS_WIN95
- || os_get_os_version() == OS_WIN31
- || os_get_os_version() == OS_WINNT) {
+ || os_get_os_version() == OS_WIN31
+ || os_get_os_version() == OS_WINNT) {
/* On Win 95, 98, ME, Win32 subsystem for Windows 3.1,
and NT use simulated aio. In NT Windows provides async i/o,
@@ -1103,13 +1144,14 @@ innobase_start_or_create_for_mysql(void)
os_aio_use_native_aio = FALSE;
} else if (0 == ut_strcmp(srv_file_flush_method_str,
- "async_unbuffered")) {
+ "async_unbuffered")) {
srv_win_file_flush_method = SRV_WIN_IO_UNBUFFERED;
#endif
} else {
fprintf(stderr,
- "InnoDB: Unrecognized value %s for innodb_flush_method\n",
- srv_file_flush_method_str);
+ "InnoDB: Unrecognized value %s for"
+ " innodb_flush_method\n",
+ srv_file_flush_method_str);
return(DB_ERROR);
}
@@ -1123,18 +1165,18 @@ innobase_start_or_create_for_mysql(void)
#if defined(__WIN__) || defined(__NETWARE__)
-/* Create less event semaphores because Win 98/ME had difficulty creating
-40000 event semaphores.
-Comment from Novell, Inc.: also, these just take a lot of memory on
-NetWare. */
+ /* Create less event semaphores because Win 98/ME had
+ difficulty creating 40000 event semaphores. Comment from
+ Novell, Inc.: also, these just take a lot of memory on
+ NetWare. */
srv_max_n_threads = 1000;
#else
if (srv_pool_size >= 1000 * 1024) {
- /* Here we still have srv_pool_size counted
- in kilobytes (in 4.0 this was in bytes)
- srv_boot() converts the value to
- pages; if buffer pool is less than 1000 MB,
- assume fewer threads. */
+ /* Here we still have srv_pool_size counted
+ in kilobytes (in 4.0 this was in bytes)
+ srv_boot() converts the value to
+ pages; if buffer pool is less than 1000 MB,
+ assume fewer threads. */
srv_max_n_threads = 50000;
} else if (srv_pool_size >= 8 * 1024) {
@@ -1156,9 +1198,9 @@ NetWare. */
mutex_create(&srv_monitor_file_mutex, SYNC_NO_ORDER_CHECK);
if (srv_innodb_status) {
- srv_monitor_file_name = mem_alloc(
- strlen(fil_path_to_mysql_datadir) +
- 20 + sizeof "/innodb_status.");
+ srv_monitor_file_name = mem_alloc
+ (strlen(fil_path_to_mysql_datadir)
+ + 20 + sizeof "/innodb_status.");
sprintf(srv_monitor_file_name, "%s/innodb_status.%lu",
fil_path_to_mysql_datadir, os_proc_get_number());
srv_monitor_file = fopen(srv_monitor_file_name, "w+");
@@ -1200,38 +1242,42 @@ NetWare. */
srv_n_file_io_threads = 4;
os_aio_init(8 * SRV_N_PENDING_IOS_PER_THREAD
- * srv_n_file_io_threads,
- srv_n_file_io_threads,
- SRV_MAX_N_PENDING_SYNC_IOS);
+ * srv_n_file_io_threads,
+ srv_n_file_io_threads,
+ SRV_MAX_N_PENDING_SYNC_IOS);
} else {
os_aio_init(SRV_N_PENDING_IOS_PER_THREAD
- * srv_n_file_io_threads,
- srv_n_file_io_threads,
- SRV_MAX_N_PENDING_SYNC_IOS);
+ * srv_n_file_io_threads,
+ srv_n_file_io_threads,
+ SRV_MAX_N_PENDING_SYNC_IOS);
}
fil_init(srv_max_n_open_files);
if (srv_use_awe) {
fprintf(stderr,
-"InnoDB: Using AWE: Memory window is %lu MB and AWE memory is %lu MB\n",
- (ulong) (srv_awe_window_size / ((1024 * 1024) / UNIV_PAGE_SIZE)),
- (ulong) (srv_pool_size / ((1024 * 1024) / UNIV_PAGE_SIZE)));
+ "InnoDB: Using AWE: Memory window is %lu MB"
+ " and AWE memory is %lu MB\n",
+ (ulong) (srv_awe_window_size / ((1024 * 1024)
+ / UNIV_PAGE_SIZE)),
+ (ulong) (srv_pool_size / ((1024 * 1024)
+ / UNIV_PAGE_SIZE)));
/* We must disable adaptive hash indexes because they do not
tolerate remapping of pages in AWE */
srv_use_adaptive_hash_indexes = FALSE;
ret = buf_pool_init(srv_pool_size, srv_pool_size,
- srv_awe_window_size);
+ srv_awe_window_size);
} else {
ret = buf_pool_init(srv_pool_size, srv_pool_size,
- srv_pool_size);
+ srv_pool_size);
}
if (ret == NULL) {
fprintf(stderr,
-"InnoDB: Fatal error: cannot allocate the memory for the buffer pool\n");
+ "InnoDB: Fatal error: cannot allocate the memory"
+ " for the buffer pool\n");
return(DB_ERROR);
}
@@ -1252,8 +1298,9 @@ NetWare. */
#ifdef UNIV_LOG_ARCHIVE
if (0 != ut_strcmp(srv_log_group_home_dirs[0], srv_arch_dir)) {
fprintf(stderr,
- "InnoDB: Error: you must set the log group home dir in my.cnf the\n"
- "InnoDB: same as log arch dir.\n");
+ "InnoDB: Error: you must set the log group"
+ " home dir in my.cnf the\n"
+ "InnoDB: same as log arch dir.\n");
return(DB_ERROR);
}
@@ -1261,7 +1308,8 @@ NetWare. */
if (srv_n_log_files * srv_log_file_size >= 262144) {
fprintf(stderr,
- "InnoDB: Error: combined size of log files must be < 4 GB\n");
+ "InnoDB: Error: combined size of log files"
+ " must be < 4 GB\n");
return(DB_ERROR);
}
@@ -1272,8 +1320,10 @@ NetWare. */
#ifndef __WIN__
if (sizeof(off_t) < 5 && srv_data_file_sizes[i] >= 262144) {
fprintf(stderr,
- "InnoDB: Error: file size must be < 4 GB with this MySQL binary\n"
- "InnoDB: and operating system combination, in some OS's < 2 GB\n");
+ "InnoDB: Error: file size must be < 4 GB"
+ " with this MySQL binary\n"
+ "InnoDB: and operating system combination,"
+ " in some OS's < 2 GB\n");
return(DB_ERROR);
}
@@ -1282,10 +1332,11 @@ NetWare. */
}
if (sum_of_new_sizes < 640) {
- fprintf(stderr,
- "InnoDB: Error: tablespace size must be at least 10 MB\n");
+ fprintf(stderr,
+ "InnoDB: Error: tablespace size must be"
+ " at least 10 MB\n");
- return(DB_ERROR);
+ return(DB_ERROR);
}
err = open_or_create_data_files(&create_new_db,
@@ -1296,13 +1347,19 @@ NetWare. */
&sum_of_new_sizes);
if (err != DB_SUCCESS) {
fprintf(stderr,
-"InnoDB: Could not open or create data files.\n"
-"InnoDB: If you tried to add new data files, and it failed here,\n"
-"InnoDB: you should now edit innodb_data_file_path in my.cnf back\n"
-"InnoDB: to what it was, and remove the new ibdata files InnoDB created\n"
-"InnoDB: in this failed attempt. InnoDB only wrote those files full of\n"
-"InnoDB: zeros, but did not yet use them in any way. But be careful: do not\n"
-"InnoDB: remove old data files which contain your precious data!\n");
+ "InnoDB: Could not open or create data files.\n"
+ "InnoDB: If you tried to add new data files,"
+ " and it failed here,\n"
+ "InnoDB: you should now edit innodb_data_file_path"
+ " in my.cnf back\n"
+ "InnoDB: to what it was, and remove the"
+ " new ibdata files InnoDB created\n"
+ "InnoDB: in this failed attempt. InnoDB only wrote"
+ " those files full of\n"
+ "InnoDB: zeros, but did not yet use them in any way."
+ " But be careful: do not\n"
+ "InnoDB: remove old data files"
+ " which contain your precious data!\n");
return((int) err);
}
@@ -1314,7 +1371,7 @@ NetWare. */
for (i = 0; i < srv_n_log_files; i++) {
err = open_or_create_log_file(create_new_db, &log_file_created,
- log_opened, 0, i);
+ log_opened, 0, i);
if (err != DB_SUCCESS) {
return((int) err);
@@ -1326,14 +1383,19 @@ NetWare. */
log_opened = TRUE;
}
if ((log_opened && create_new_db)
- || (log_opened && log_created)) {
+ || (log_opened && log_created)) {
fprintf(stderr,
- "InnoDB: Error: all log files must be created at the same time.\n"
- "InnoDB: All log files must be created also in database creation.\n"
- "InnoDB: If you want bigger or smaller log files, shut down the\n"
- "InnoDB: database and make sure there were no errors in shutdown.\n"
- "InnoDB: Then delete the existing log files. Edit the .cnf file\n"
- "InnoDB: and start the database again.\n");
+ "InnoDB: Error: all log files must be"
+ " created at the same time.\n"
+ "InnoDB: All log files must be"
+ " created also in database creation.\n"
+ "InnoDB: If you want bigger or smaller"
+ " log files, shut down the\n"
+ "InnoDB: database and make sure there"
+ " were no errors in shutdown.\n"
+ "InnoDB: Then delete the existing log files."
+ " Edit the .cnf file\n"
+ "InnoDB: and start the database again.\n");
return(DB_ERROR);
}
@@ -1346,30 +1408,36 @@ NetWare. */
if (log_created && !create_new_db
#ifdef UNIV_LOG_ARCHIVE
- && !srv_archive_recovery
+ && !srv_archive_recovery
#endif /* UNIV_LOG_ARCHIVE */
- ) {
+ ) {
if (ut_dulint_cmp(max_flushed_lsn, min_flushed_lsn) != 0
#ifdef UNIV_LOG_ARCHIVE
- || max_arch_log_no != min_arch_log_no
+ || max_arch_log_no != min_arch_log_no
#endif /* UNIV_LOG_ARCHIVE */
- ) {
+ ) {
fprintf(stderr,
- "InnoDB: Cannot initialize created log files because\n"
- "InnoDB: data files were not in sync with each other\n"
- "InnoDB: or the data files are corrupt.\n");
+ "InnoDB: Cannot initialize created"
+ " log files because\n"
+ "InnoDB: data files were not in sync"
+ " with each other\n"
+ "InnoDB: or the data files are corrupt.\n");
return(DB_ERROR);
}
if (ut_dulint_cmp(max_flushed_lsn, ut_dulint_create(0, 1000))
- < 0) {
+ < 0) {
fprintf(stderr,
- "InnoDB: Cannot initialize created log files because\n"
- "InnoDB: data files are corrupt, or new data files were\n"
- "InnoDB: created when the database was started previous\n"
- "InnoDB: time but the database was not shut down\n"
- "InnoDB: normally after that.\n");
+ "InnoDB: Cannot initialize created"
+ " log files because\n"
+ "InnoDB: data files are corrupt,"
+ " or new data files were\n"
+ "InnoDB: created when the database"
+ " was started previous\n"
+ "InnoDB: time but the database"
+ " was not shut down\n"
+ "InnoDB: normally after that.\n");
return(DB_ERROR);
}
@@ -1401,11 +1469,12 @@ NetWare. */
#ifdef UNIV_LOG_ARCHIVE
} else if (srv_archive_recovery) {
fprintf(stderr,
- "InnoDB: Starting archive recovery from a backup...\n");
- err = recv_recovery_from_archive_start(
- min_flushed_lsn,
- srv_archive_recovery_limit_lsn,
- min_arch_log_no);
+ "InnoDB: Starting archive"
+ " recovery from a backup...\n");
+ err = recv_recovery_from_archive_start
+ (min_flushed_lsn,
+ srv_archive_recovery_limit_lsn,
+ min_arch_log_no);
if (err != DB_SUCCESS) {
return(DB_ERROR);
@@ -1428,9 +1497,9 @@ NetWare. */
been shut down normally: this is the normal startup path */
err = recv_recovery_from_checkpoint_start(LOG_CHECKPOINT,
- ut_dulint_max,
- min_flushed_lsn,
- max_flushed_lsn);
+ ut_dulint_max,
+ min_flushed_lsn,
+ max_flushed_lsn);
if (err != DB_SUCCESS) {
return(DB_ERROR);
@@ -1466,8 +1535,8 @@ NetWare. */
data dictionary tables. Does that harm the scanning of
the data dictionary below? */
- dict_check_tablespaces_and_store_max_id(
- recv_needed_recovery);
+ dict_check_tablespaces_and_store_max_id
+ (recv_needed_recovery);
}
srv_startup_is_before_trx_rollback_phase = FALSE;
@@ -1519,17 +1588,17 @@ NetWare. */
#endif /* UNIV_LOG_ARCHIVE */
/* fprintf(stderr, "Max allowed record size %lu\n",
- page_get_free_space_of_empty() / 2); */
+ page_get_free_space_of_empty() / 2); */
/* Create the thread which watches the timeouts for lock waits
and prints InnoDB monitor info */
os_thread_create(&srv_lock_timeout_and_monitor_thread, NULL,
- thread_ids + 2 + SRV_MAX_N_IO_THREADS);
+ thread_ids + 2 + SRV_MAX_N_IO_THREADS);
/* Create the thread which warns of long semaphore waits */
os_thread_create(&srv_error_monitor_thread, NULL,
- thread_ids + 3 + SRV_MAX_N_IO_THREADS);
+ thread_ids + 3 + SRV_MAX_N_IO_THREADS);
srv_was_started = TRUE;
srv_is_being_started = FALSE;
@@ -1559,8 +1628,8 @@ NetWare. */
/* Create the master thread which does purge and other utility
operations */
- os_thread_create(&srv_master_thread, NULL, thread_ids + 1 +
- SRV_MAX_N_IO_THREADS);
+ os_thread_create(&srv_master_thread, NULL, thread_ids
+ + (1 + SRV_MAX_N_IO_THREADS));
#ifdef UNIV_DEBUG
/* buf_debug_prints = TRUE; */
#endif /* UNIV_DEBUG */
@@ -1573,47 +1642,60 @@ NetWare. */
tablespace_size_in_header = fsp_header_get_tablespace_size(0);
if (!srv_auto_extend_last_data_file
- && sum_of_data_file_sizes != tablespace_size_in_header) {
+ && sum_of_data_file_sizes != tablespace_size_in_header) {
fprintf(stderr,
-"InnoDB: Error: tablespace size stored in header is %lu pages, but\n"
-"InnoDB: the sum of data file sizes is %lu pages\n",
+ "InnoDB: Error: tablespace size"
+ " stored in header is %lu pages, but\n"
+ "InnoDB: the sum of data file sizes is %lu pages\n",
(ulong) tablespace_size_in_header,
(ulong) sum_of_data_file_sizes);
if (srv_force_recovery == 0
- && sum_of_data_file_sizes < tablespace_size_in_header) {
+ && sum_of_data_file_sizes < tablespace_size_in_header) {
/* This is a fatal error, the tail of a tablespace is
missing */
fprintf(stderr,
-"InnoDB: Cannot start InnoDB. The tail of the system tablespace is\n"
-"InnoDB: missing. Have you edited innodb_data_file_path in my.cnf in an\n"
-"InnoDB: inappropriate way, removing ibdata files from there?\n"
-"InnoDB: You can set innodb_force_recovery=1 in my.cnf to force\n"
-"InnoDB: a startup if you are trying to recover a badly corrupt database.\n");
+ "InnoDB: Cannot start InnoDB."
+ " The tail of the system tablespace is\n"
+ "InnoDB: missing. Have you edited"
+ " innodb_data_file_path in my.cnf in an\n"
+ "InnoDB: inappropriate way, removing"
+ " ibdata files from there?\n"
+ "InnoDB: You can set innodb_force_recovery=1"
+ " in my.cnf to force\n"
+ "InnoDB: a startup if you are trying"
+ " to recover a badly corrupt database.\n");
return(DB_ERROR);
}
}
if (srv_auto_extend_last_data_file
- && sum_of_data_file_sizes < tablespace_size_in_header) {
+ && sum_of_data_file_sizes < tablespace_size_in_header) {
fprintf(stderr,
-"InnoDB: Error: tablespace size stored in header is %lu pages, but\n"
-"InnoDB: the sum of data file sizes is only %lu pages\n",
+ "InnoDB: Error: tablespace size stored in header"
+ " is %lu pages, but\n"
+ "InnoDB: the sum of data file sizes"
+ " is only %lu pages\n",
(ulong) tablespace_size_in_header,
(ulong) sum_of_data_file_sizes);
if (srv_force_recovery == 0) {
fprintf(stderr,
-"InnoDB: Cannot start InnoDB. The tail of the system tablespace is\n"
-"InnoDB: missing. Have you edited innodb_data_file_path in my.cnf in an\n"
-"InnoDB: inappropriate way, removing ibdata files from there?\n"
-"InnoDB: You can set innodb_force_recovery=1 in my.cnf to force\n"
-"InnoDB: a startup if you are trying to recover a badly corrupt database.\n");
+ "InnoDB: Cannot start InnoDB. The tail of"
+ " the system tablespace is\n"
+ "InnoDB: missing. Have you edited"
+ " innodb_data_file_path in my.cnf in an\n"
+ "InnoDB: inappropriate way, removing"
+ " ibdata files from there?\n"
+ "InnoDB: You can set innodb_force_recovery=1"
+ " in my.cnf to force\n"
+ "InnoDB: a startup if you are trying to"
+ " recover a badly corrupt database.\n");
return(DB_ERROR);
}
@@ -1624,8 +1706,9 @@ NetWare. */
if (0 != os_fast_mutex_trylock(&srv_os_test_mutex)) {
fprintf(stderr,
-"InnoDB: Error: pthread_mutex_trylock returns an unexpected value on\n"
-"InnoDB: success! Cannot continue.\n");
+ "InnoDB: Error: pthread_mutex_trylock returns"
+ " an unexpected value on\n"
+ "InnoDB: success! Cannot continue.\n");
exit(1);
}
@@ -1640,14 +1723,15 @@ NetWare. */
if (srv_print_verbose_log) {
ut_print_timestamp(stderr);
fprintf(stderr,
-" InnoDB: Started; log sequence number %lu %lu\n",
+ " InnoDB: Started; log sequence number %lu %lu\n",
(ulong) ut_dulint_get_high(srv_start_lsn),
(ulong) ut_dulint_get_low(srv_start_lsn));
}
if (srv_force_recovery > 0) {
fprintf(stderr,
- "InnoDB: !!! innodb_force_recovery is set to %lu !!!\n",
+ "InnoDB: !!! innodb_force_recovery"
+ " is set to %lu !!!\n",
(ulong) srv_force_recovery);
}
@@ -1668,9 +1752,11 @@ NetWare. */
here! */
fprintf(stderr,
-"InnoDB: You are upgrading to an InnoDB version which allows multiple\n"
-"InnoDB: tablespaces. Wait that purge and insert buffer merge run to\n"
-"InnoDB: completion...\n");
+ "InnoDB: You are upgrading to an"
+ " InnoDB version which allows multiple\n"
+ "InnoDB: tablespaces. Wait that purge"
+ " and insert buffer merge run to\n"
+ "InnoDB: completion...\n");
for (;;) {
os_thread_sleep(1000000);
@@ -1683,16 +1769,21 @@ NetWare. */
}
}
fprintf(stderr,
-"InnoDB: Full purge and insert buffer merge completed.\n");
+ "InnoDB: Full purge and insert buffer merge"
+ " completed.\n");
trx_sys_mark_upgraded_to_multiple_tablespaces();
fprintf(stderr,
-"InnoDB: You have now successfully upgraded to the multiple tablespaces\n"
-"InnoDB: format. You should NOT DOWNGRADE to an earlier version of\n"
-"InnoDB: InnoDB! But if you absolutely need to downgrade, see\n"
-"InnoDB: http://dev.mysql.com/doc/refman/5.1/en/multiple-tablespaces.html\n"
-"InnoDB: for instructions.\n");
+ "InnoDB: You have now successfully upgraded"
+ " to the multiple tablespaces\n"
+ "InnoDB: format. You should NOT DOWNGRADE"
+ " to an earlier version of\n"
+ "InnoDB: InnoDB! But if you absolutely need to"
+ " downgrade, see\n"
+ "InnoDB: http://dev.mysql.com/doc/refman/5.1/en/"
+ "multiple-tablespaces.html\n"
+ "InnoDB: for instructions.\n");
}
if (srv_force_recovery == 0) {
@@ -1725,8 +1816,9 @@ innobase_shutdown_for_mysql(void)
if (srv_is_being_started) {
ut_print_timestamp(stderr);
fprintf(stderr,
-" InnoDB: Warning: shutting down a not properly started\n"
-" InnoDB: or created database!\n");
+ " InnoDB: Warning: shutting down"
+ " a not properly started\n"
+ "InnoDB: or created database!\n");
}
return(DB_SUCCESS);
@@ -1741,21 +1833,24 @@ innobase_shutdown_for_mysql(void)
if (srv_fast_shutdown == 2) {
ut_print_timestamp(stderr);
fprintf(stderr,
-" InnoDB: MySQL has requested a very fast shutdown without flushing "
-"the InnoDB buffer pool to data files. At the next mysqld startup "
-"InnoDB will do a crash recovery!\n");
+ " InnoDB: MySQL has requested a very fast shutdown"
+ " without flushing "
+ "the InnoDB buffer pool to data files."
+ " At the next mysqld startup "
+ "InnoDB will do a crash recovery!\n");
}
#ifdef __NETWARE__
if(!panic_shutdown)
#endif
- logs_empty_and_mark_files_at_shutdown();
+ logs_empty_and_mark_files_at_shutdown();
if (srv_conc_n_threads != 0) {
fprintf(stderr,
- "InnoDB: Warning: query counter shows %ld queries still\n"
- "InnoDB: inside InnoDB at shutdown\n",
- srv_conc_n_threads);
+ "InnoDB: Warning: query counter shows %ld queries"
+ " still\n"
+ "InnoDB: inside InnoDB at shutdown\n",
+ srv_conc_n_threads);
}
/* 2. Make all threads created by InnoDB to exit */
@@ -1814,7 +1909,8 @@ innobase_shutdown_for_mysql(void)
if (i == 1000) {
fprintf(stderr,
-"InnoDB: Warning: %lu threads created by InnoDB had not exited at shutdown!\n",
+ "InnoDB: Warning: %lu threads created by InnoDB"
+ " had not exited at shutdown!\n",
(ulong) os_thread_count);
}
@@ -1854,9 +1950,10 @@ innobase_shutdown_for_mysql(void)
if (UT_LIST_GET_LEN(trx_sys->view_list) > 1) {
fprintf(stderr,
-"InnoDB: Error: all read views were not closed before shutdown:\n"
-"InnoDB: %lu read views open \n",
- UT_LIST_GET_LEN(trx_sys->view_list) - 1);
+ "InnoDB: Error: all read views were not closed"
+ " before shutdown:\n"
+ "InnoDB: %lu read views open \n",
+ UT_LIST_GET_LEN(trx_sys->view_list) - 1);
}
/* 5. Free all allocated memory and the os_fast_mutex created in
@@ -1865,12 +1962,14 @@ innobase_shutdown_for_mysql(void)
ut_free_all_mem();
if (os_thread_count != 0
- || os_event_count != 0
- || os_mutex_count != 0
- || os_fast_mutex_count != 0) {
+ || os_event_count != 0
+ || os_mutex_count != 0
+ || os_fast_mutex_count != 0) {
fprintf(stderr,
-"InnoDB: Warning: some resources were not cleaned up in shutdown:\n"
-"InnoDB: threads %lu, events %lu, os_mutexes %lu, os_fast_mutexes %lu\n",
+ "InnoDB: Warning: some resources were not"
+ " cleaned up in shutdown:\n"
+ "InnoDB: threads %lu, events %lu,"
+ " os_mutexes %lu, os_fast_mutexes %lu\n",
(ulong) os_thread_count, (ulong) os_event_count,
(ulong) os_mutex_count, (ulong) os_fast_mutex_count);
}
@@ -1885,7 +1984,8 @@ innobase_shutdown_for_mysql(void)
if (srv_print_verbose_log) {
ut_print_timestamp(stderr);
fprintf(stderr,
-" InnoDB: Shutdown completed; log sequence number %lu %lu\n",
+ " InnoDB: Shutdown completed;"
+ " log sequence number %lu %lu\n",
(ulong) ut_dulint_get_high(srv_shutdown_lsn),
(ulong) ut_dulint_get_low(srv_shutdown_lsn));
}
diff --git a/storage/innobase/sync/sync0arr.c b/storage/innobase/sync/sync0arr.c
index 81986cdfd33..278dd65bb1e 100644
--- a/storage/innobase/sync/sync0arr.c
+++ b/storage/innobase/sync/sync0arr.c
@@ -498,7 +498,8 @@ sync_array_cell_print(
type = cell->request_type;
fprintf(file,
-"--Thread %lu has waited at %s line %lu for %.2f seconds the semaphore:\n",
+ "--Thread %lu has waited at %s line %lu"
+ " for %.2f seconds the semaphore:\n",
(ulong) os_thread_pf(cell->thread), cell->file,
(ulong) cell->line,
difftime(time(NULL), cell->reservation_time));
@@ -542,7 +543,8 @@ sync_array_cell_print(
(ulong) rwlock->cline);
if (rwlock->writer != RW_LOCK_NOT_LOCKED) {
fprintf(file,
- "a writer (thread id %lu) has reserved it in mode %s",
+ "a writer (thread id %lu) has"
+ " reserved it in mode %s",
(ulong) os_thread_pf(rwlock->writer_thread),
rwlock->writer == RW_LOCK_EX
? " exclusive\n"
@@ -588,7 +590,7 @@ sync_array_find_thread(
cell = sync_array_get_nth_cell(arr, i);
if ((cell->state == SC_RESERVED)
- && os_thread_eq(cell->thread, thread)) {
+ && os_thread_eq(cell->thread, thread)) {
return(cell); /* Found */
}
@@ -634,7 +636,7 @@ sync_array_deadlock_step(
/* Deadlock */
fputs("########################################\n"
- "DEADLOCK of threads detected!\n", stderr);
+ "DEADLOCK of threads detected!\n", stderr);
return(TRUE);
@@ -697,10 +699,11 @@ sync_array_detect_deadlock(
a thread with ID_UNDEFINED value. */
ret = sync_array_deadlock_step(arr, start, thread, 0,
- depth);
+ depth);
if (ret) {
fprintf(stderr,
- "Mutex %p owned by thread %lu file %s line %lu\n",
+ "Mutex %p owned by thread %lu"
+ " file %s line %lu\n",
(void*) mutex,
(ulong) os_thread_pf(mutex->thread_id),
mutex->file_name, (ulong) mutex->line);
@@ -723,10 +726,10 @@ sync_array_detect_deadlock(
thread = debug->thread_id;
if (((debug->lock_type == RW_LOCK_EX)
- && !os_thread_eq(thread, cell->thread))
- || ((debug->lock_type == RW_LOCK_WAIT_EX)
- && !os_thread_eq(thread, cell->thread))
- || (debug->lock_type == RW_LOCK_SHARED)) {
+ && !os_thread_eq(thread, cell->thread))
+ || ((debug->lock_type == RW_LOCK_WAIT_EX)
+ && !os_thread_eq(thread, cell->thread))
+ || (debug->lock_type == RW_LOCK_SHARED)) {
/* The (wait) x-lock request can block
infinitely only if someone (can be also cell
@@ -734,10 +737,11 @@ sync_array_detect_deadlock(
(cannot be cell thread) (wait) x-lock, and
he is blocked by start thread */
- ret = sync_array_deadlock_step(arr, start,
- thread, debug->pass, depth);
+ ret = sync_array_deadlock_step
+ (arr, start, thread,
+ debug->pass, depth);
if (ret) {
- print:
+print:
fprintf(stderr, "rw-lock %p ",
(void*) lock);
sync_array_cell_print(stderr, cell);
@@ -761,15 +765,16 @@ sync_array_detect_deadlock(
thread = debug->thread_id;
if ((debug->lock_type == RW_LOCK_EX)
- || (debug->lock_type == RW_LOCK_WAIT_EX)) {
+ || (debug->lock_type == RW_LOCK_WAIT_EX)) {
/* The s-lock request can block infinitely
only if someone (can also be cell thread) is
holding (wait) x-lock, and he is blocked by
start thread */
- ret = sync_array_deadlock_step(arr, start,
- thread, debug->pass, depth);
+ ret = sync_array_deadlock_step
+ (arr, start, thread,
+ debug->pass, depth);
if (ret) {
goto print;
}
@@ -814,14 +819,14 @@ sync_arr_cell_can_wake_up(
lock = cell->wait_object;
if (rw_lock_get_reader_count(lock) == 0
- && rw_lock_get_writer(lock) == RW_LOCK_NOT_LOCKED) {
+ && rw_lock_get_writer(lock) == RW_LOCK_NOT_LOCKED) {
return(TRUE);
}
if (rw_lock_get_reader_count(lock) == 0
- && rw_lock_get_writer(lock) == RW_LOCK_WAIT_EX
- && os_thread_eq(lock->writer_thread, cell->thread)) {
+ && rw_lock_get_writer(lock) == RW_LOCK_WAIT_EX
+ && os_thread_eq(lock->writer_thread, cell->thread)) {
return(TRUE);
}
@@ -897,16 +902,16 @@ sync_array_signal_object(
sync_cell_t** old_cell_ptr = cell_ptr;
size_t old_size, new_size;
- old_size = cell_max_count *
- sizeof(sync_cell_t*);
+ old_size = cell_max_count
+ * sizeof(sync_cell_t*);
cell_max_count *= 2;
- new_size = cell_max_count *
- sizeof(sync_cell_t*);
+ new_size = cell_max_count
+ * sizeof(sync_cell_t*);
cell_ptr = malloc(new_size);
ut_a(cell_ptr);
memcpy(cell_ptr, old_cell_ptr,
- old_size);
+ old_size);
if (old_cell_ptr != &cells[0]) {
free(old_cell_ptr);
@@ -1009,23 +1014,24 @@ sync_array_print_long_waits(void)
cell = sync_array_get_nth_cell(sync_primary_wait_array, i);
if ((cell->state != SC_FREE)
- && difftime(time(NULL), cell->reservation_time) > 240) {
+ && difftime(time(NULL), cell->reservation_time) > 240) {
fputs("InnoDB: Warning: a long semaphore wait:\n",
- stderr);
+ stderr);
sync_array_cell_print(stderr, cell);
noticed = TRUE;
}
if ((cell->state != SC_FREE)
- && difftime(time(NULL), cell->reservation_time)
- > fatal_timeout) {
+ && difftime(time(NULL), cell->reservation_time)
+ > fatal_timeout) {
fatal = TRUE;
}
}
if (noticed) {
fprintf(stderr,
-"InnoDB: ###### Starts InnoDB Monitor for 30 secs to print diagnostic info:\n");
+ "InnoDB: ###### Starts InnoDB Monitor"
+ " for 30 secs to print diagnostic info:\n");
old_val = srv_print_innodb_monitor;
/* If some crucial semaphore is reserved, then also the InnoDB
@@ -1035,8 +1041,9 @@ sync_array_print_long_waits(void)
now the values of pending calls of these. */
fprintf(stderr,
-"InnoDB: Pending preads %lu, pwrites %lu\n", (ulong)os_file_n_pending_preads,
- (ulong)os_file_n_pending_pwrites);
+ "InnoDB: Pending preads %lu, pwrites %lu\n",
+ (ulong)os_file_n_pending_preads,
+ (ulong)os_file_n_pending_pwrites);
srv_print_innodb_monitor = TRUE;
os_event_set(srv_lock_timeout_thread_event);
@@ -1045,7 +1052,8 @@ sync_array_print_long_waits(void)
srv_print_innodb_monitor = old_val;
fprintf(stderr,
-"InnoDB: ###### Diagnostic info printed to the standard error stream\n");
+ "InnoDB: ###### Diagnostic info printed"
+ " to the standard error stream\n");
}
return(fatal);
@@ -1065,9 +1073,10 @@ sync_array_output_info(
ulint i;
fprintf(file,
- "OS WAIT ARRAY INFO: reservation count %ld, signal count %ld\n",
- (long) arr->res_count,
- (long) arr->sg_count);
+ "OS WAIT ARRAY INFO: reservation count %ld,"
+ " signal count %ld\n",
+ (long) arr->res_count,
+ (long) arr->sg_count);
for (i = 0; i < arr->n_cells; i++) {
cell = sync_array_get_nth_cell(arr, i);
diff --git a/storage/innobase/sync/sync0rw.c b/storage/innobase/sync/sync0rw.c
index ffc2633b467..f22b0dc8d61 100644
--- a/storage/innobase/sync/sync0rw.c
+++ b/storage/innobase/sync/sync0rw.c
@@ -103,8 +103,8 @@ rw_lock_create_func(
lock->mutex.cline = cline;
#ifndef UNIV_HOTBACKUP
- lock->mutex.cmutex_name = cmutex_name;
- lock->mutex.mutex_type = 1;
+ lock->mutex.cmutex_name = cmutex_name;
+ lock->mutex.mutex_type = 1;
#endif /* !UNIV_HOTBACKUP */
rw_lock_set_waiters(lock, 0);
@@ -134,7 +134,7 @@ rw_lock_create_func(
if (UT_LIST_GET_LEN(rw_lock_list) > 0) {
ut_a(UT_LIST_GET_FIRST(rw_lock_list)->magic_n
- == RW_LOCK_MAGIC_N);
+ == RW_LOCK_MAGIC_N);
}
UT_LIST_ADD_FIRST(list, rw_lock_list, lock);
@@ -192,12 +192,12 @@ rw_lock_validate(
ut_a(lock->magic_n == RW_LOCK_MAGIC_N);
ut_a((rw_lock_get_reader_count(lock) == 0)
- || (rw_lock_get_writer(lock) != RW_LOCK_EX));
+ || (rw_lock_get_writer(lock) != RW_LOCK_EX));
ut_a((rw_lock_get_writer(lock) == RW_LOCK_EX)
- || (rw_lock_get_writer(lock) == RW_LOCK_WAIT_EX)
- || (rw_lock_get_writer(lock) == RW_LOCK_NOT_LOCKED));
+ || (rw_lock_get_writer(lock) == RW_LOCK_WAIT_EX)
+ || (rw_lock_get_writer(lock) == RW_LOCK_NOT_LOCKED));
ut_a((rw_lock_get_waiters(lock) == 0)
- || (rw_lock_get_waiters(lock) == 1));
+ || (rw_lock_get_waiters(lock) == 1));
ut_a((lock->writer != RW_LOCK_EX) || (lock->writer_count > 0));
mutex_exit(rw_lock_get_mutex(lock));
@@ -232,7 +232,7 @@ lock_loop:
i = 0;
while (rw_lock_get_writer(lock) != RW_LOCK_NOT_LOCKED
- && i < SYNC_SPIN_ROUNDS) {
+ && i < SYNC_SPIN_ROUNDS) {
if (srv_spin_wait_delay) {
ut_delay(ut_rnd_interval(0, srv_spin_wait_delay));
}
@@ -246,9 +246,11 @@ lock_loop:
if (srv_print_latch_waits) {
fprintf(stderr,
- "Thread %lu spin wait rw-s-lock at %p cfile %s cline %lu rnds %lu\n",
- (ulong) os_thread_pf(os_thread_get_curr_id()), (void*) lock,
- lock->cfile_name, (ulong) lock->cline, (ulong) i);
+ "Thread %lu spin wait rw-s-lock at %p"
+ " cfile %s cline %lu rnds %lu\n",
+ (ulong) os_thread_pf(os_thread_get_curr_id()),
+ (void*) lock,
+ lock->cfile_name, (ulong) lock->cline, (ulong) i);
}
mutex_enter(rw_lock_get_mutex(lock));
@@ -266,9 +268,9 @@ lock_loop:
rw_s_system_call_count++;
sync_array_reserve_cell(sync_primary_wait_array,
- lock, RW_LOCK_SHARED,
- file_name, line,
- &index);
+ lock, RW_LOCK_SHARED,
+ file_name, line,
+ &index);
rw_lock_set_waiters(lock, 1);
@@ -276,7 +278,8 @@ lock_loop:
if (srv_print_latch_waits) {
fprintf(stderr,
- "Thread %lu OS wait rw-s-lock at %p cfile %s cline %lu\n",
+ "Thread %lu OS wait rw-s-lock at %p"
+ " cfile %s cline %lu\n",
os_thread_pf(os_thread_get_curr_id()),
(void*) lock, lock->cfile_name,
(ulong) lock->cline);
@@ -346,7 +349,7 @@ rw_lock_x_lock_low(
#ifdef UNIV_SYNC_DEBUG
rw_lock_add_debug_info(lock, pass, RW_LOCK_EX,
- file_name, line);
+ file_name, line);
#endif
lock->last_x_file_name = file_name;
lock->last_x_line = line;
@@ -362,7 +365,7 @@ rw_lock_x_lock_low(
#ifdef UNIV_SYNC_DEBUG
rw_lock_add_debug_info(lock, pass, RW_LOCK_WAIT_EX,
- file_name, line);
+ file_name, line);
#endif
return(RW_LOCK_WAIT_EX);
@@ -370,7 +373,7 @@ rw_lock_x_lock_low(
} else if ((rw_lock_get_writer(lock) == RW_LOCK_WAIT_EX)
&& os_thread_eq(lock->writer_thread,
- os_thread_get_curr_id())) {
+ os_thread_get_curr_id())) {
if (rw_lock_get_reader_count(lock) == 0) {
@@ -382,7 +385,7 @@ rw_lock_x_lock_low(
#ifdef UNIV_SYNC_DEBUG
rw_lock_remove_debug_info(lock, pass, RW_LOCK_WAIT_EX);
rw_lock_add_debug_info(lock, pass, RW_LOCK_EX,
- file_name, line);
+ file_name, line);
#endif
lock->last_x_file_name = file_name;
@@ -396,7 +399,7 @@ rw_lock_x_lock_low(
} else if ((rw_lock_get_writer(lock) == RW_LOCK_EX)
&& os_thread_eq(lock->writer_thread,
- os_thread_get_curr_id())
+ os_thread_get_curr_id())
&& (lock->pass == 0)
&& (pass == 0)) {
@@ -404,7 +407,7 @@ rw_lock_x_lock_low(
#ifdef UNIV_SYNC_DEBUG
rw_lock_add_debug_info(lock, pass, RW_LOCK_EX, file_name,
- line);
+ line);
#endif
lock->last_x_file_name = file_name;
@@ -461,10 +464,10 @@ lock_loop:
i = 0;
while (rw_lock_get_writer(lock) != RW_LOCK_NOT_LOCKED
- && i < SYNC_SPIN_ROUNDS) {
+ && i < SYNC_SPIN_ROUNDS) {
if (srv_spin_wait_delay) {
ut_delay(ut_rnd_interval(0,
- srv_spin_wait_delay));
+ srv_spin_wait_delay));
}
i++;
@@ -478,10 +481,10 @@ lock_loop:
i = 0;
while (rw_lock_get_reader_count(lock) != 0
- && i < SYNC_SPIN_ROUNDS) {
+ && i < SYNC_SPIN_ROUNDS) {
if (srv_spin_wait_delay) {
ut_delay(ut_rnd_interval(0,
- srv_spin_wait_delay));
+ srv_spin_wait_delay));
}
i++;
@@ -496,7 +499,8 @@ lock_loop:
if (srv_print_latch_waits) {
fprintf(stderr,
- "Thread %lu spin wait rw-x-lock at %p cfile %s cline %lu rnds %lu\n",
+ "Thread %lu spin wait rw-x-lock at %p"
+ " cfile %s cline %lu rnds %lu\n",
os_thread_pf(os_thread_get_curr_id()), (void*) lock,
lock->cfile_name, (ulong) lock->cline, (ulong) i);
}
@@ -529,7 +533,8 @@ lock_loop:
if (srv_print_latch_waits) {
fprintf(stderr,
- "Thread %lu OS wait for rw-x-lock at %p cfile %s cline %lu\n",
+ "Thread %lu OS wait for rw-x-lock at %p"
+ " cfile %s cline %lu\n",
os_thread_pf(os_thread_get_curr_id()), (void*) lock,
lock->cfile_name, (ulong) lock->cline);
}
@@ -556,7 +561,7 @@ rw_lock_debug_mutex_enter(void)
{
loop:
if (0 == mutex_enter_nowait(&rw_lock_debug_mutex,
- __FILE__, __LINE__)) {
+ __FILE__, __LINE__)) {
return;
}
@@ -565,7 +570,7 @@ loop:
rw_lock_debug_waiters = TRUE;
if (0 == mutex_enter_nowait(&rw_lock_debug_mutex,
- __FILE__, __LINE__)) {
+ __FILE__, __LINE__)) {
return;
}
@@ -649,10 +654,10 @@ rw_lock_remove_debug_info(
while (info != NULL) {
if ((pass == info->pass)
- && ((pass != 0)
- || os_thread_eq(info->thread_id,
+ && ((pass != 0)
+ || os_thread_eq(info->thread_id,
os_thread_get_curr_id()))
- && (info->lock_type == lock_type)) {
+ && (info->lock_type == lock_type)) {
/* Found! */
UT_LIST_REMOVE(list, lock->debug_list, info);
@@ -695,8 +700,8 @@ rw_lock_own(
while (info != NULL) {
if (os_thread_eq(info->thread_id, os_thread_get_curr_id())
- && (info->pass == 0)
- && (info->lock_type == lock_type)) {
+ && (info->pass == 0)
+ && (info->lock_type == lock_type)) {
mutex_exit(&(lock->mutex));
/* Found! */
@@ -762,8 +767,8 @@ rw_lock_list_print_info(void)
mutex_enter(&rw_lock_list_mutex);
fputs("-------------\n"
- "RW-LATCH INFO\n"
- "-------------\n", stderr);
+ "RW-LATCH INFO\n"
+ "-------------\n", stderr);
lock = UT_LIST_GET_FIRST(rw_lock_list);
@@ -774,8 +779,8 @@ rw_lock_list_print_info(void)
mutex_enter(&(lock->mutex));
if ((rw_lock_get_writer(lock) != RW_LOCK_NOT_LOCKED)
- || (rw_lock_get_reader_count(lock) != 0)
- || (rw_lock_get_waiters(lock) != 0)) {
+ || (rw_lock_get_reader_count(lock) != 0)
+ || (rw_lock_get_waiters(lock) != 0)) {
fprintf(stderr, "RW-LOCK: %p ", (void*) lock);
@@ -816,8 +821,8 @@ rw_lock_print(
"RW-LATCH: %p ", (void*) lock);
if ((rw_lock_get_writer(lock) != RW_LOCK_NOT_LOCKED)
- || (rw_lock_get_reader_count(lock) != 0)
- || (rw_lock_get_waiters(lock) != 0)) {
+ || (rw_lock_get_reader_count(lock) != 0)
+ || (rw_lock_get_waiters(lock) != 0)) {
if (rw_lock_get_waiters(lock)) {
fputs(" Waiters for the lock exist\n", stderr);
@@ -882,7 +887,7 @@ rw_lock_n_locked(void)
mutex_enter(rw_lock_get_mutex(lock));
if ((rw_lock_get_writer(lock) != RW_LOCK_NOT_LOCKED)
- || (rw_lock_get_reader_count(lock) != 0)) {
+ || (rw_lock_get_reader_count(lock) != 0)) {
count++;
}
diff --git a/storage/innobase/sync/sync0sync.c b/storage/innobase/sync/sync0sync.c
index 04f03e89ec5..d74b2b09ccf 100644
--- a/storage/innobase/sync/sync0sync.c
+++ b/storage/innobase/sync/sync0sync.c
@@ -277,11 +277,11 @@ mutex_free(
if (UT_LIST_GET_PREV(list, mutex)) {
ut_a(UT_LIST_GET_PREV(list, mutex)->magic_n
- == MUTEX_MAGIC_N);
+ == MUTEX_MAGIC_N);
}
if (UT_LIST_GET_NEXT(list, mutex)) {
ut_a(UT_LIST_GET_NEXT(list, mutex)->magic_n
- == MUTEX_MAGIC_N);
+ == MUTEX_MAGIC_N);
}
UT_LIST_REMOVE(list, mutex_list, mutex);
@@ -351,8 +351,8 @@ mutex_set_waiters(
mutex_t* mutex, /* in: mutex */
ulint n) /* in: value to set */
{
-volatile ulint* ptr; /* declared volatile to ensure that
- the value is stored to memory */
+ volatile ulint* ptr; /* declared volatile to ensure that
+ the value is stored to memory */
ut_ad(mutex);
ptr = &(mutex->waiters);
@@ -423,7 +423,8 @@ spin_loop:
#ifdef UNIV_SRV_PRINT_LATCH_WAITS
fprintf(stderr,
- "Thread %lu spin wait mutex at %p cfile %s cline %lu rnds %lu\n",
+ "Thread %lu spin wait mutex at %p"
+ " cfile %s cline %lu rnds %lu\n",
(ulong) os_thread_pf(os_thread_get_curr_id()), (void*) mutex,
mutex->cfile_name, (ulong) mutex->cline, (ulong) i);
#endif
@@ -458,7 +459,7 @@ spin_loop:
}
sync_array_reserve_cell(sync_primary_wait_array, mutex,
- SYNC_MUTEX, file_name, line, &index);
+ SYNC_MUTEX, file_name, line, &index);
mutex_system_call_count++;
@@ -476,7 +477,7 @@ spin_loop:
/* Succeeded! Free the reserved wait cell */
sync_array_free_cell_protected(sync_primary_wait_array,
- index);
+ index);
#ifdef UNIV_SYNC_DEBUG
mutex_set_debug_info(mutex, file_name, line);
@@ -639,8 +640,8 @@ mutex_list_print_info(void)
ulint count = 0;
fputs("----------\n"
- "MUTEX INFO\n"
- "----------\n", stderr);
+ "MUTEX INFO\n"
+ "----------\n", stderr);
mutex_enter(&mutex_list_mutex);
@@ -651,9 +652,10 @@ mutex_list_print_info(void)
if (mutex_get_lock_word(mutex) != 0) {
mutex_get_debug_info(mutex, &file_name, &line,
- &thread_id);
+ &thread_id);
fprintf(stderr,
- "Locked mutex: addr %p thread %ld file %s line %ld\n",
+ "Locked mutex: addr %p thread %ld"
+ " file %s line %ld\n",
(void*) mutex, os_thread_pf(thread_id),
file_name, line);
}
@@ -820,8 +822,9 @@ sync_thread_levels_g(
mutex = slot->latch;
fprintf(stderr,
- "InnoDB error: sync levels should be > %lu but a level is %lu\n",
- (ulong) limit, (ulong) slot->level);
+ "InnoDB error: sync levels should be"
+ " > %lu but a level is %lu\n",
+ (ulong) limit, (ulong) slot->level);
if (mutex->magic_n == MUTEX_MAGIC_N) {
fprintf(stderr,
@@ -835,15 +838,24 @@ sync_thread_levels_g(
ulint line;
os_thread_id_t thread_id;
- mutex_get_debug_info(mutex,
- &file_name, &line, &thread_id);
+ mutex_get_debug_info
+ (mutex, &file_name,
+ &line, &thread_id);
fprintf(stderr,
- "InnoDB: Locked mutex: addr %p thread %ld file %s line %ld\n",
- (void*) mutex, os_thread_pf(thread_id), file_name, (ulong) line);
+ "InnoDB: Locked mutex:"
+ " addr %p thread %ld"
+ " file %s line %ld\n",
+ (void*) mutex,
+ os_thread_pf
+ (thread_id),
+ file_name,
+ (ulong) line);
#else /* UNIV_SYNC_DEBUG */
fprintf(stderr,
- "InnoDB: Locked mutex: addr %p\n", (void*) mutex);
+ "InnoDB: Locked mutex:"
+ " addr %p\n",
+ (void*) mutex);
#endif /* UNIV_SYNC_DEBUG */
} else {
fputs("Not locked\n", stderr);
@@ -931,9 +943,10 @@ sync_thread_levels_empty_gen(
slot = sync_thread_levels_get_nth(arr, i);
- if (slot->latch != NULL && (!dict_mutex_allowed ||
- (slot->level != SYNC_DICT
- && slot->level != SYNC_DICT_OPERATION))) {
+ if (slot->latch != NULL
+ && (!dict_mutex_allowed
+ || (slot->level != SYNC_DICT
+ && slot->level != SYNC_DICT_OPERATION))) {
mutex_exit(&sync_thread_mutex);
ut_error;
@@ -981,11 +994,11 @@ sync_thread_add_level(
}
if ((latch == (void*)&sync_thread_mutex)
- || (latch == (void*)&mutex_list_mutex)
+ || (latch == (void*)&mutex_list_mutex)
#ifdef UNIV_SYNC_DEBUG
- || (latch == (void*)&rw_lock_debug_mutex)
+ || (latch == (void*)&rw_lock_debug_mutex)
#endif /* UNIV_SYNC_DEBUG */
- || (latch == (void*)&rw_lock_list_mutex)) {
+ || (latch == (void*)&rw_lock_list_mutex)) {
return;
}
@@ -1058,8 +1071,8 @@ sync_thread_add_level(
break;
case SYNC_BUF_BLOCK:
ut_a((sync_thread_levels_contain(array, SYNC_BUF_POOL)
- && sync_thread_levels_g(array, SYNC_BUF_BLOCK - 1))
- || sync_thread_levels_g(array, SYNC_BUF_BLOCK));
+ && sync_thread_levels_g(array, SYNC_BUF_BLOCK - 1))
+ || sync_thread_levels_g(array, SYNC_BUF_BLOCK));
break;
case SYNC_BUF_POOL:
ut_a(sync_thread_levels_g(array, SYNC_BUF_POOL));
@@ -1072,16 +1085,16 @@ sync_thread_add_level(
break;
case SYNC_REC_LOCK:
ut_a((sync_thread_levels_contain(array, SYNC_KERNEL)
- && sync_thread_levels_g(array, SYNC_REC_LOCK - 1))
- || sync_thread_levels_g(array, SYNC_REC_LOCK));
+ && sync_thread_levels_g(array, SYNC_REC_LOCK - 1))
+ || sync_thread_levels_g(array, SYNC_REC_LOCK));
break;
case SYNC_KERNEL:
ut_a(sync_thread_levels_g(array, SYNC_KERNEL));
break;
case SYNC_IBUF_BITMAP:
ut_a((sync_thread_levels_contain(array, SYNC_IBUF_BITMAP_MUTEX)
- && sync_thread_levels_g(array, SYNC_IBUF_BITMAP - 1))
- || sync_thread_levels_g(array, SYNC_IBUF_BITMAP));
+ && sync_thread_levels_g(array, SYNC_IBUF_BITMAP - 1))
+ || sync_thread_levels_g(array, SYNC_IBUF_BITMAP));
break;
case SYNC_IBUF_BITMAP_MUTEX:
ut_a(sync_thread_levels_g(array, SYNC_IBUF_BITMAP_MUTEX));
@@ -1091,20 +1104,20 @@ sync_thread_add_level(
break;
case SYNC_FSP:
ut_a(sync_thread_levels_contain(array, SYNC_FSP)
- || sync_thread_levels_g(array, SYNC_FSP));
+ || sync_thread_levels_g(array, SYNC_FSP));
break;
case SYNC_TRX_UNDO_PAGE:
ut_a(sync_thread_levels_contain(array, SYNC_TRX_UNDO)
- || sync_thread_levels_contain(array, SYNC_RSEG)
- || sync_thread_levels_contain(array, SYNC_PURGE_SYS)
- || sync_thread_levels_g(array, SYNC_TRX_UNDO_PAGE));
+ || sync_thread_levels_contain(array, SYNC_RSEG)
+ || sync_thread_levels_contain(array, SYNC_PURGE_SYS)
+ || sync_thread_levels_g(array, SYNC_TRX_UNDO_PAGE));
break;
case SYNC_RSEG_HEADER:
ut_a(sync_thread_levels_contain(array, SYNC_RSEG));
break;
case SYNC_RSEG_HEADER_NEW:
ut_a(sync_thread_levels_contain(array, SYNC_KERNEL)
- && sync_thread_levels_contain(array, SYNC_FSP_PAGE));
+ && sync_thread_levels_contain(array, SYNC_FSP_PAGE));
break;
case SYNC_RSEG:
ut_a(sync_thread_levels_g(array, SYNC_RSEG));
@@ -1120,30 +1133,30 @@ sync_thread_add_level(
break;
case SYNC_TREE_NODE:
ut_a(sync_thread_levels_contain(array, SYNC_INDEX_TREE)
- || sync_thread_levels_g(array, SYNC_TREE_NODE - 1));
+ || sync_thread_levels_g(array, SYNC_TREE_NODE - 1));
break;
case SYNC_TREE_NODE_NEW:
ut_a(sync_thread_levels_contain(array, SYNC_FSP_PAGE)
- || sync_thread_levels_contain(array, SYNC_IBUF_MUTEX));
+ || sync_thread_levels_contain(array, SYNC_IBUF_MUTEX));
break;
case SYNC_INDEX_TREE:
ut_a((sync_thread_levels_contain(array, SYNC_IBUF_MUTEX)
- && sync_thread_levels_contain(array, SYNC_FSP)
- && sync_thread_levels_g(array, SYNC_FSP_PAGE - 1))
- || sync_thread_levels_g(array, SYNC_TREE_NODE - 1));
+ && sync_thread_levels_contain(array, SYNC_FSP)
+ && sync_thread_levels_g(array, SYNC_FSP_PAGE - 1))
+ || sync_thread_levels_g(array, SYNC_TREE_NODE - 1));
break;
case SYNC_IBUF_MUTEX:
ut_a(sync_thread_levels_g(array, SYNC_FSP_PAGE - 1));
break;
case SYNC_IBUF_PESS_INSERT_MUTEX:
ut_a(sync_thread_levels_g(array, SYNC_FSP - 1)
- && !sync_thread_levels_contain(array, SYNC_IBUF_MUTEX));
+ && !sync_thread_levels_contain(array, SYNC_IBUF_MUTEX));
break;
case SYNC_IBUF_HEADER:
ut_a(sync_thread_levels_g(array, SYNC_FSP - 1)
- && !sync_thread_levels_contain(array, SYNC_IBUF_MUTEX)
- && !sync_thread_levels_contain(array,
- SYNC_IBUF_PESS_INSERT_MUTEX));
+ && !sync_thread_levels_contain(array, SYNC_IBUF_MUTEX)
+ && !sync_thread_levels_contain
+ (array, SYNC_IBUF_PESS_INSERT_MUTEX));
break;
case SYNC_DICT_AUTOINC_MUTEX:
ut_a(sync_thread_levels_g(array, SYNC_DICT_AUTOINC_MUTEX));
@@ -1157,7 +1170,7 @@ sync_thread_add_level(
case SYNC_DICT:
#ifdef UNIV_DEBUG
ut_a(buf_debug_prints
- || sync_thread_levels_g(array, SYNC_DICT));
+ || sync_thread_levels_g(array, SYNC_DICT));
#else /* UNIV_DEBUG */
ut_a(sync_thread_levels_g(array, SYNC_DICT));
#endif /* UNIV_DEBUG */
@@ -1204,11 +1217,11 @@ sync_thread_reset_level(
}
if ((latch == (void*)&sync_thread_mutex)
- || (latch == (void*)&mutex_list_mutex)
+ || (latch == (void*)&mutex_list_mutex)
#ifdef UNIV_SYNC_DEBUG
- || (latch == (void*)&rw_lock_debug_mutex)
+ || (latch == (void*)&rw_lock_debug_mutex)
#endif /* UNIV_SYNC_DEBUG */
- || (latch == (void*)&rw_lock_list_mutex)) {
+ || (latch == (void*)&rw_lock_list_mutex)) {
return(FALSE);
}
@@ -1265,13 +1278,13 @@ sync_init(void)
mutex */
sync_primary_wait_array = sync_array_create(OS_THREAD_MAX_N,
- SYNC_ARRAY_OS_MUTEX);
+ SYNC_ARRAY_OS_MUTEX);
/* Create the thread latch level array where the latch levels
are stored for each OS thread */
sync_thread_level_arrays = ut_malloc(OS_THREAD_MAX_N
- * sizeof(sync_thread_t));
+ * sizeof(sync_thread_t));
for (i = 0; i < OS_THREAD_MAX_N; i++) {
thread_slot = sync_thread_level_arrays_get_nth(i);
@@ -1335,15 +1348,16 @@ sync_print_wait_info(
#endif
fprintf(file,
-"Mutex spin waits %lu, rounds %lu, OS waits %lu\n"
-"RW-shared spins %lu, OS waits %lu; RW-excl spins %lu, OS waits %lu\n",
- (ulong) mutex_spin_wait_count,
- (ulong) mutex_spin_round_count,
- (ulong) mutex_os_wait_count,
- (ulong) rw_s_spin_wait_count,
- (ulong) rw_s_os_wait_count,
- (ulong) rw_x_spin_wait_count,
- (ulong) rw_x_os_wait_count);
+ "Mutex spin waits %lu, rounds %lu, OS waits %lu\n"
+ "RW-shared spins %lu, OS waits %lu;"
+ " RW-excl spins %lu, OS waits %lu\n",
+ (ulong) mutex_spin_wait_count,
+ (ulong) mutex_spin_round_count,
+ (ulong) mutex_os_wait_count,
+ (ulong) rw_s_spin_wait_count,
+ (ulong) rw_s_os_wait_count,
+ (ulong) rw_x_spin_wait_count,
+ (ulong) rw_x_os_wait_count);
}
/***********************************************************************
diff --git a/storage/innobase/thr/thr0loc.c b/storage/innobase/thr/thr0loc.c
index c63520e8a07..f22e909f392 100644
--- a/storage/innobase/thr/thr0loc.c
+++ b/storage/innobase/thr/thr0loc.c
@@ -73,7 +73,7 @@ try_again:
local = NULL;
HASH_SEARCH(hash, thr_local_hash, os_thread_pf(id),
- local, os_thread_eq(local->id, id));
+ local, os_thread_eq(local->id, id));
if (local == NULL) {
mutex_exit(&thr_local_mutex);
@@ -176,8 +176,8 @@ thr_local_create(void)
mutex_enter(&thr_local_mutex);
HASH_INSERT(thr_local_t, hash, thr_local_hash,
- os_thread_pf(os_thread_get_curr_id()),
- local);
+ os_thread_pf(os_thread_get_curr_id()),
+ local);
mutex_exit(&thr_local_mutex);
}
@@ -197,7 +197,7 @@ thr_local_free(
/* Look for the local struct in the hash table */
HASH_SEARCH(hash, thr_local_hash, os_thread_pf(id),
- local, os_thread_eq(local->id, id));
+ local, os_thread_eq(local->id, id));
if (local == NULL) {
mutex_exit(&thr_local_mutex);
@@ -205,7 +205,7 @@ thr_local_free(
}
HASH_DELETE(thr_local_t, hash, thr_local_hash,
- os_thread_pf(id), local);
+ os_thread_pf(id), local);
mutex_exit(&thr_local_mutex);
diff --git a/storage/innobase/trx/trx0purge.c b/storage/innobase/trx/trx0purge.c
index 79f38b1ee52..9689a9fb179 100644
--- a/storage/innobase/trx/trx0purge.c
+++ b/storage/innobase/trx/trx0purge.c
@@ -142,9 +142,9 @@ trx_purge_arr_get_biggest(
trx_cmp = ut_dulint_cmp(cell->trx_no, pair_trx_no);
if ((trx_cmp > 0)
- || ((trx_cmp == 0)
- && (ut_dulint_cmp(cell->undo_no,
- pair_undo_no) >= 0))) {
+ || ((trx_cmp == 0)
+ && (ut_dulint_cmp(cell->undo_no,
+ pair_undo_no) >= 0))) {
pair_trx_no = cell->trx_no;
pair_undo_no = cell->undo_no;
@@ -172,7 +172,7 @@ trx_purge_graph_build(void)
mem_heap_t* heap;
que_fork_t* fork;
que_thr_t* thr;
-/* que_thr_t* thr2; */
+ /* que_thr_t* thr2; */
heap = mem_heap_create(512);
fork = que_fork_create(NULL, NULL, QUE_FORK_PURGE, heap);
@@ -182,7 +182,7 @@ trx_purge_graph_build(void)
thr->child = row_purge_node_create(thr, heap);
-/* thr2 = que_thr_create(fork, fork, heap);
+ /* thr2 = que_thr_create(fork, fork, heap);
thr2->child = row_purge_node_create(fork, thr2, heap); */
@@ -229,8 +229,8 @@ trx_purge_sys_create(void)
purge_sys->query = trx_purge_graph_build();
- purge_sys->view = read_view_oldest_copy_or_open_new(
- ut_dulint_create(0,0), purge_sys->heap);
+ purge_sys->view = read_view_oldest_copy_or_open_new(ut_dulint_zero,
+ purge_sys->heap);
}
/*================ UNDO LOG HISTORY LIST =============================*/
@@ -275,24 +275,25 @@ trx_purge_add_update_undo_to_history(
if (undo->id >= TRX_RSEG_N_SLOTS) {
fprintf(stderr,
- "InnoDB: Error: undo->id is %lu\n", (ulong) undo->id);
+ "InnoDB: Error: undo->id is %lu\n",
+ (ulong) undo->id);
ut_error;
}
trx_rsegf_set_nth_undo(rseg_header, undo->id, FIL_NULL, mtr);
hist_size = mtr_read_ulint(rseg_header + TRX_RSEG_HISTORY_SIZE,
- MLOG_4BYTES, mtr);
- ut_ad(undo->size ==
- flst_get_len(seg_header + TRX_UNDO_PAGE_LIST, mtr));
+ MLOG_4BYTES, mtr);
+ ut_ad(undo->size == flst_get_len
+ (seg_header + TRX_UNDO_PAGE_LIST, mtr));
mlog_write_ulint(rseg_header + TRX_RSEG_HISTORY_SIZE,
- hist_size + undo->size, MLOG_4BYTES, mtr);
+ hist_size + undo->size, MLOG_4BYTES, mtr);
}
/* Add the log as the first in the history list */
flst_add_first(rseg_header + TRX_RSEG_HISTORY,
- undo_header + TRX_UNDO_HISTORY_NODE, mtr);
+ undo_header + TRX_UNDO_HISTORY_NODE, mtr);
mutex_enter(&kernel_mutex);
trx_sys->rseg_history_len++;
mutex_exit(&kernel_mutex);
@@ -303,7 +304,7 @@ trx_purge_add_update_undo_to_history(
if (!undo->del_marks) {
mlog_write_ulint(undo_header + TRX_UNDO_DEL_MARKS, FALSE,
- MLOG_2BYTES, mtr);
+ MLOG_2BYTES, mtr);
}
if (rseg->last_page_no == FIL_NULL) {
@@ -338,7 +339,7 @@ trx_purge_free_segment(
ibool marked = FALSE;
mtr_t mtr;
-/* fputs("Freeing an update undo log segment\n", stderr); */
+ /* fputs("Freeing an update undo log segment\n", stderr); */
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(purge_sys->mutex)));
@@ -361,12 +362,12 @@ loop:
if (!marked) {
mlog_write_ulint(log_hdr + TRX_UNDO_DEL_MARKS, FALSE,
- MLOG_2BYTES, &mtr);
+ MLOG_2BYTES, &mtr);
marked = TRUE;
}
freed = fseg_free_step_not_header(seg_hdr + TRX_UNDO_FSEG_HEADER,
- &mtr);
+ &mtr);
if (!freed) {
mutex_exit(&(rseg->mutex));
mtr_commit(&mtr);
@@ -386,7 +387,7 @@ loop:
could become inaccessible garbage in the file space. */
flst_cut_end(rseg_hdr + TRX_RSEG_HISTORY,
- log_hdr + TRX_UNDO_HISTORY_NODE, n_removed_logs, &mtr);
+ log_hdr + TRX_UNDO_HISTORY_NODE, n_removed_logs, &mtr);
mutex_enter(&kernel_mutex);
ut_ad(trx_sys->rseg_history_len >= n_removed_logs);
@@ -402,15 +403,15 @@ loop:
fsp0fsp.c. */
freed = fseg_free_step(seg_hdr + TRX_UNDO_FSEG_HEADER,
- &mtr);
+ &mtr);
}
hist_size = mtr_read_ulint(rseg_hdr + TRX_RSEG_HISTORY_SIZE,
- MLOG_4BYTES, &mtr);
+ MLOG_4BYTES, &mtr);
ut_ad(hist_size >= seg_size);
mlog_write_ulint(rseg_hdr + TRX_RSEG_HISTORY_SIZE,
- hist_size - seg_size, MLOG_4BYTES, &mtr);
+ hist_size - seg_size, MLOG_4BYTES, &mtr);
ut_ad(rseg->curr_size >= seg_size);
@@ -453,8 +454,8 @@ trx_purge_truncate_rseg_history(
rseg_hdr = trx_rsegf_get(rseg->space, rseg->page_no, &mtr);
- hdr_addr = trx_purge_get_log_from_hist(
- flst_get_last(rseg_hdr + TRX_RSEG_HISTORY, &mtr));
+ hdr_addr = trx_purge_get_log_from_hist
+ (flst_get_last(rseg_hdr + TRX_RSEG_HISTORY, &mtr));
loop:
if (hdr_addr.page == FIL_NULL) {
@@ -470,7 +471,7 @@ loop:
log_hdr = undo_page + hdr_addr.boffset;
cmp = ut_dulint_cmp(mach_read_from_8(log_hdr + TRX_UNDO_TRX_NO),
- limit_trx_no);
+ limit_trx_no);
if (cmp == 0) {
trx_undo_truncate_start(rseg, rseg->space, hdr_addr.page,
hdr_addr.boffset, limit_undo_no);
@@ -483,8 +484,8 @@ loop:
mutex_exit(&kernel_mutex);
flst_truncate_end(rseg_hdr + TRX_RSEG_HISTORY,
- log_hdr + TRX_UNDO_HISTORY_NODE,
- n_removed_logs, &mtr);
+ log_hdr + TRX_UNDO_HISTORY_NODE,
+ n_removed_logs, &mtr);
mutex_exit(&(rseg->mutex));
mtr_commit(&mtr);
@@ -492,15 +493,14 @@ loop:
return;
}
- prev_hdr_addr = trx_purge_get_log_from_hist(
- flst_get_prev_addr(log_hdr + TRX_UNDO_HISTORY_NODE,
- &mtr));
+ prev_hdr_addr = trx_purge_get_log_from_hist
+ (flst_get_prev_addr(log_hdr + TRX_UNDO_HISTORY_NODE, &mtr));
n_removed_logs++;
seg_hdr = undo_page + TRX_UNDO_SEG_HDR;
if ((mach_read_from_2(seg_hdr + TRX_UNDO_STATE) == TRX_UNDO_TO_PURGE)
- && (mach_read_from_2(log_hdr + TRX_UNDO_NEXT_LOG) == 0)) {
+ && (mach_read_from_2(log_hdr + TRX_UNDO_NEXT_LOG) == 0)) {
/* We can free the whole log segment */
@@ -542,7 +542,7 @@ trx_purge_truncate_history(void)
#endif /* UNIV_SYNC_DEBUG */
trx_purge_arr_get_biggest(purge_sys->arr, &limit_trx_no,
- &limit_undo_no);
+ &limit_undo_no);
if (ut_dulint_cmp(limit_trx_no, ut_dulint_zero) == 0) {
@@ -559,13 +559,13 @@ trx_purge_truncate_history(void)
}
ut_ad((ut_dulint_cmp(limit_trx_no,
- purge_sys->view->low_limit_no) <= 0));
+ purge_sys->view->low_limit_no) <= 0));
rseg = UT_LIST_GET_FIRST(trx_sys->rseg_list);
while (rseg) {
trx_purge_truncate_rseg_history(rseg, limit_trx_no,
- limit_undo_no);
+ limit_undo_no);
rseg = UT_LIST_GET_NEXT(rseg_list, rseg);
}
}
@@ -633,9 +633,8 @@ trx_purge_rseg_get_next_history_log(
purge_sys->n_pages_handled++;
- prev_log_addr = trx_purge_get_log_from_hist(
- flst_get_prev_addr(log_hdr + TRX_UNDO_HISTORY_NODE,
- &mtr));
+ prev_log_addr = trx_purge_get_log_from_hist
+ (flst_get_prev_addr(log_hdr + TRX_UNDO_HISTORY_NODE, &mtr));
if (prev_log_addr.page == FIL_NULL) {
/* No logs left in the history list */
@@ -657,10 +656,13 @@ trx_purge_rseg_get_next_history_log(
if (trx_sys->rseg_history_len > 20000) {
ut_print_timestamp(stderr);
fprintf(stderr,
-" InnoDB: Warning: purge reached the head of the history list,\n"
-"InnoDB: but its length is still reported as %lu! Make a detailed bug\n"
-"InnoDB: report, and post it to bugs.mysql.com\n",
- (ulong)trx_sys->rseg_history_len);
+ " InnoDB: Warning: purge reached the"
+ " head of the history list,\n"
+ "InnoDB: but its length is still"
+ " reported as %lu! Make a detailed bug\n"
+ "InnoDB: report, and submit it"
+ " to http://bugs.mysql.com\n",
+ (ulong) trx_sys->rseg_history_len);
}
mutex_exit(&kernel_mutex);
@@ -675,8 +677,8 @@ trx_purge_rseg_get_next_history_log(
mtr_start(&mtr);
log_hdr = trx_undo_page_get_s_latched(rseg->space,
- prev_log_addr.page, &mtr)
- + prev_log_addr.boffset;
+ prev_log_addr.page, &mtr)
+ + prev_log_addr.boffset;
trx_no = mach_read_from_8(log_hdr + TRX_UNDO_TRX_NO);
@@ -730,15 +732,15 @@ trx_purge_choose_next_log(void)
if (rseg->last_page_no != FIL_NULL) {
if ((min_rseg == NULL)
- || (ut_dulint_cmp(min_trx_no,
- rseg->last_trx_no) > 0)) {
+ || (ut_dulint_cmp(min_trx_no,
+ rseg->last_trx_no) > 0)) {
min_rseg = rseg;
min_trx_no = rseg->last_trx_no;
space = rseg->space;
ut_a(space == 0); /* We assume in purge of
- externally stored fields
- that space id == 0 */
+ externally stored fields
+ that space id == 0 */
page_no = rseg->last_page_no;
offset = rseg->last_offset;
}
@@ -762,7 +764,7 @@ trx_purge_choose_next_log(void)
rec = &trx_purge_dummy_rec;
} else {
rec = trx_undo_get_first_rec(space, page_no, offset,
- RW_S_LATCH, &mtr);
+ RW_S_LATCH, &mtr);
if (rec == NULL) {
/* Undo log empty */
@@ -850,12 +852,12 @@ trx_purge_get_next_rec(
operation from the same page of the same undo log */
next_rec = trx_undo_page_get_next_rec(rec2,
- purge_sys->hdr_page_no,
- purge_sys->hdr_offset);
+ purge_sys->hdr_page_no,
+ purge_sys->hdr_offset);
if (next_rec == NULL) {
- rec2 = trx_undo_get_next_rec(rec2,
- purge_sys->hdr_page_no,
- purge_sys->hdr_offset, &mtr);
+ rec2 = trx_undo_get_next_rec
+ (rec2, purge_sys->hdr_page_no,
+ purge_sys->hdr_offset, &mtr);
break;
}
@@ -875,7 +877,7 @@ trx_purge_get_next_rec(
}
if ((type == TRX_UNDO_UPD_EXIST_REC)
- && !(cmpl_info & UPD_NODE_NO_ORD_CHANGE)) {
+ && !(cmpl_info & UPD_NODE_NO_ORD_CHANGE)) {
break;
}
}
@@ -952,7 +954,8 @@ trx_purge_fetch_next_rec(
if (srv_print_thread_releases) {
fprintf(stderr,
- "Purge: No logs left in the history list; pages handled %lu\n",
+ "Purge: No logs left in the"
+ " history list; pages handled %lu\n",
(ulong) purge_sys->n_pages_handled);
}
@@ -974,7 +977,7 @@ trx_purge_fetch_next_rec(
}
if (ut_dulint_cmp(purge_sys->purge_trx_no,
- purge_sys->view->low_limit_no) >= 0) {
+ purge_sys->view->low_limit_no) >= 0) {
purge_sys->state = TRX_STOP_PURGE;
trx_purge_truncate_if_arr_empty();
@@ -984,20 +987,20 @@ trx_purge_fetch_next_rec(
return(NULL);
}
-/* fprintf(stderr, "Thread %lu purging trx %lu undo record %lu\n",
- os_thread_get_curr_id(),
- ut_dulint_get_low(purge_sys->purge_trx_no),
- ut_dulint_get_low(purge_sys->purge_undo_no)); */
+ /* fprintf(stderr, "Thread %lu purging trx %lu undo record %lu\n",
+ os_thread_get_curr_id(),
+ ut_dulint_get_low(purge_sys->purge_trx_no),
+ ut_dulint_get_low(purge_sys->purge_undo_no)); */
*roll_ptr = trx_undo_build_roll_ptr(FALSE, (purge_sys->rseg)->id,
- purge_sys->page_no,
- purge_sys->offset);
+ purge_sys->page_no,
+ purge_sys->offset);
*cell = trx_purge_arr_store_info(purge_sys->purge_trx_no,
purge_sys->purge_undo_no);
ut_ad(ut_dulint_cmp(purge_sys->purge_trx_no,
- (purge_sys->view)->low_limit_no) < 0);
+ (purge_sys->view)->low_limit_no) < 0);
/* The following call will advance the stored values of purge_trx_no
and purge_undo_no, therefore we had to store them first */
@@ -1038,7 +1041,7 @@ trx_purge(void)
the batch */
{
que_thr_t* thr;
-/* que_thr_t* thr2; */
+ /* que_thr_t* thr2; */
ulint old_pages_handled;
mutex_enter(&(purge_sys->mutex));
@@ -1073,9 +1076,9 @@ trx_purge(void)
'consistent read view', then the DML statements cannot be delayed.
Also, srv_max_purge_lag <= 0 means 'infinity'. */
if (srv_max_purge_lag > 0
- && !UT_LIST_GET_LAST(trx_sys->view_list)) {
+ && !UT_LIST_GET_LAST(trx_sys->view_list)) {
float ratio = (float) trx_sys->rseg_history_len
- / srv_max_purge_lag;
+ / srv_max_purge_lag;
if (ratio > ULINT_MAX / 10000) {
/* Avoid overflow: maximum delay is 4295 seconds */
srv_dml_needed_delay = ULINT_MAX;
@@ -1088,9 +1091,8 @@ trx_purge(void)
}
}
- purge_sys->view = read_view_oldest_copy_or_open_new(
- ut_dulint_create(0, 0),
- purge_sys->heap);
+ purge_sys->view = read_view_oldest_copy_or_open_new(ut_dulint_zero,
+ purge_sys->heap);
mutex_exit(&kernel_mutex);
rw_lock_x_unlock(&(purge_sys->latch));
@@ -1111,14 +1113,14 @@ trx_purge(void)
ut_ad(thr);
-/* thr2 = que_fork_start_command(purge_sys->query);
+ /* thr2 = que_fork_start_command(purge_sys->query);
ut_ad(thr2); */
mutex_exit(&kernel_mutex);
-/* srv_que_task_enqueue(thr2); */
+ /* srv_que_task_enqueue(thr2); */
if (srv_print_thread_releases) {
@@ -1130,8 +1132,8 @@ trx_purge(void)
if (srv_print_thread_releases) {
fprintf(stderr,
- "Purge ends; pages handled %lu\n",
- (ulong) purge_sys->n_pages_handled);
+ "Purge ends; pages handled %lu\n",
+ (ulong) purge_sys->n_pages_handled);
}
return(purge_sys->n_pages_handled - old_pages_handled);
@@ -1148,13 +1150,13 @@ trx_purge_sys_print(void)
read_view_print(purge_sys->view);
fprintf(stderr, "InnoDB: Purge trx n:o %lu %lu, undo n_o %lu %lu\n",
- (ulong) ut_dulint_get_high(purge_sys->purge_trx_no),
- (ulong) ut_dulint_get_low(purge_sys->purge_trx_no),
- (ulong) ut_dulint_get_high(purge_sys->purge_undo_no),
- (ulong) ut_dulint_get_low(purge_sys->purge_undo_no));
+ (ulong) ut_dulint_get_high(purge_sys->purge_trx_no),
+ (ulong) ut_dulint_get_low(purge_sys->purge_trx_no),
+ (ulong) ut_dulint_get_high(purge_sys->purge_undo_no),
+ (ulong) ut_dulint_get_low(purge_sys->purge_undo_no));
fprintf(stderr,
- "InnoDB: Purge next stored %lu, page_no %lu, offset %lu,\n"
- "InnoDB: Purge hdr_page_no %lu, hdr_offset %lu\n",
+ "InnoDB: Purge next stored %lu, page_no %lu, offset %lu,\n"
+ "InnoDB: Purge hdr_page_no %lu, hdr_offset %lu\n",
(ulong) purge_sys->next_stored,
(ulong) purge_sys->page_no,
(ulong) purge_sys->offset,
diff --git a/storage/innobase/trx/trx0rec.c b/storage/innobase/trx/trx0rec.c
index 55723df48c5..3a214d6ce38 100644
--- a/storage/innobase/trx/trx0rec.c
+++ b/storage/innobase/trx/trx0rec.c
@@ -50,8 +50,8 @@ trx_undof_page_add_undo_rec_log(
}
log_end = &log_ptr[11 + 13 + MLOG_BUF_MARGIN];
- log_ptr = mlog_write_initial_log_record_fast(undo_page,
- MLOG_UNDO_INSERT, log_ptr, mtr);
+ log_ptr = mlog_write_initial_log_record_fast
+ (undo_page, MLOG_UNDO_INSERT, log_ptr, mtr);
len = new_free - old_free - 4;
mach_write_to_2(log_ptr, len);
@@ -100,14 +100,14 @@ trx_undo_parse_add_undo_rec(
}
first_free = mach_read_from_2(page + TRX_UNDO_PAGE_HDR
- + TRX_UNDO_PAGE_FREE);
+ + TRX_UNDO_PAGE_FREE);
rec = page + first_free;
mach_write_to_2(rec, first_free + 4 + len);
mach_write_to_2(rec + 2 + len, first_free);
mach_write_to_2(page + TRX_UNDO_PAGE_HDR + TRX_UNDO_PAGE_FREE,
- first_free + 4 + len);
+ first_free + 4 + len);
ut_memcpy(rec + 2, ptr, len);
return(ptr + len);
@@ -152,10 +152,10 @@ trx_undo_page_report_insert(
ulint i;
ut_ad(mach_read_from_2(undo_page + TRX_UNDO_PAGE_HDR
- + TRX_UNDO_PAGE_TYPE) == TRX_UNDO_INSERT);
+ + TRX_UNDO_PAGE_TYPE) == TRX_UNDO_INSERT);
first_free = mach_read_from_2(undo_page + TRX_UNDO_PAGE_HDR
- + TRX_UNDO_PAGE_FREE);
+ + TRX_UNDO_PAGE_FREE);
ptr = undo_page + first_free;
ut_ad(first_free <= UNIV_PAGE_SIZE);
@@ -228,12 +228,12 @@ trx_undo_page_report_insert(
mach_write_to_2(undo_page + first_free, ptr - undo_page);
mach_write_to_2(undo_page + TRX_UNDO_PAGE_HDR + TRX_UNDO_PAGE_FREE,
- ptr - undo_page);
+ ptr - undo_page);
/* Write the log entry to the REDO log of this change in the UNDO
- log */
+ log */
trx_undof_page_add_undo_rec_log(undo_page, first_free,
- ptr - undo_page, mtr);
+ ptr - undo_page, mtr);
return(first_free);
}
@@ -432,11 +432,11 @@ trx_undo_page_report_modify(
ut_a(index->type & DICT_CLUSTERED);
ut_ad(rec_offs_validate(rec, index, offsets));
ut_ad(mach_read_from_2(undo_page + TRX_UNDO_PAGE_HDR
- + TRX_UNDO_PAGE_TYPE) == TRX_UNDO_UPDATE);
+ + TRX_UNDO_PAGE_TYPE) == TRX_UNDO_UPDATE);
table = index->table;
first_free = mach_read_from_2(undo_page + TRX_UNDO_PAGE_HDR
- + TRX_UNDO_PAGE_FREE);
+ + TRX_UNDO_PAGE_FREE);
ptr = undo_page + first_free;
ut_ad(first_free <= UNIV_PAGE_SIZE);
@@ -486,11 +486,13 @@ trx_undo_page_report_modify(
/* Store the values of the system columns */
field = rec_get_nth_field(rec, offsets,
- dict_index_get_sys_col_pos(index, DATA_TRX_ID), &len);
+ dict_index_get_sys_col_pos
+ (index, DATA_TRX_ID), &len);
ut_ad(len == DATA_TRX_ID_LEN);
trx_id = trx_read_trx_id(field);
field = rec_get_nth_field(rec, offsets,
- dict_index_get_sys_col_pos(index, DATA_ROLL_PTR), &len);
+ dict_index_get_sys_col_pos
+ (index, DATA_ROLL_PTR), &len);
ut_ad(len == DATA_ROLL_PTR_LEN);
roll_ptr = trx_read_roll_ptr(field);
@@ -565,8 +567,9 @@ trx_undo_page_report_modify(
/* If a field has external storage, we add
to flen the flag */
- len = mach_write_compressed(ptr,
- UNIV_EXTERN_STORAGE_FIELD + flen);
+ len = mach_write_compressed
+ (ptr,
+ UNIV_EXTERN_STORAGE_FIELD + flen);
/* Notify purge that it eventually has to
free the old externally stored field */
@@ -629,7 +632,7 @@ trx_undo_page_report_modify(
if (col->ord_part > 0) {
pos = dict_index_get_nth_col_pos(index,
- col_no);
+ col_no);
/* Write field number to undo log */
if (trx_undo_left(undo_page, ptr) < 5) {
@@ -642,7 +645,7 @@ trx_undo_page_report_modify(
/* Save the old value of field */
field = rec_get_nth_field(rec, offsets, pos,
- &flen);
+ &flen);
if (trx_undo_left(undo_page, ptr) < 5) {
@@ -654,7 +657,7 @@ trx_undo_page_report_modify(
if (flen != UNIV_SQL_NULL) {
if (trx_undo_left(undo_page, ptr)
- < flen) {
+ < flen) {
return(0);
}
@@ -680,12 +683,12 @@ trx_undo_page_report_modify(
mach_write_to_2(undo_page + first_free, ptr - undo_page);
mach_write_to_2(undo_page + TRX_UNDO_PAGE_HDR + TRX_UNDO_PAGE_FREE,
- ptr - undo_page);
+ ptr - undo_page);
/* Write to the REDO log about this change in the UNDO log */
trx_undof_page_add_undo_rec_log(undo_page, first_free,
- ptr - undo_page, mtr);
+ ptr - undo_page, mtr);
return(first_free);
}
@@ -815,17 +818,17 @@ trx_undo_update_rec_get_update(
trx_write_trx_id(buf, trx_id);
upd_field_set_field_no(upd_field,
- dict_index_get_sys_col_pos(index, DATA_TRX_ID),
- index, trx);
+ dict_index_get_sys_col_pos(index, DATA_TRX_ID),
+ index, trx);
dfield_set_data(&(upd_field->new_val), buf, DATA_TRX_ID_LEN);
upd_field = upd_get_nth_field(update, n_fields + 1);
buf = mem_heap_alloc(heap, DATA_ROLL_PTR_LEN);
trx_write_roll_ptr(buf, roll_ptr);
- upd_field_set_field_no(upd_field,
- dict_index_get_sys_col_pos(index, DATA_ROLL_PTR),
- index, trx);
+ upd_field_set_field_no
+ (upd_field, dict_index_get_sys_col_pos(index, DATA_ROLL_PTR),
+ index, trx);
dfield_set_data(&(upd_field->new_val), buf, DATA_ROLL_PTR_LEN);
/* Store then the updated ordinary columns to the update vector */
@@ -836,16 +839,19 @@ trx_undo_update_rec_get_update(
if (field_no >= dict_index_get_n_fields(index)) {
fprintf(stderr,
-"InnoDB: Error: trying to access update undo rec field %lu in ", (ulong) field_no);
+ "InnoDB: Error: trying to access"
+ " update undo rec field %lu in ",
+ (ulong) field_no);
dict_index_name_print(stderr, trx, index);
fprintf(stderr, "\n"
-"InnoDB: but index has only %lu fields\n"
-"InnoDB: Submit a detailed bug report to http://bugs.mysql.com\n"
-"InnoDB: Run also CHECK TABLE ",
+ "InnoDB: but index has only %lu fields\n"
+ "InnoDB: Submit a detailed bug report"
+ " to http://bugs.mysql.com\n"
+ "InnoDB: Run also CHECK TABLE ",
(ulong) dict_index_get_n_fields(index));
ut_print_name(stderr, trx, TRUE, index->table_name);
fprintf(stderr, "\n"
-"InnoDB: n_fields = %lu, i = %lu, ptr %p\n",
+ "InnoDB: n_fields = %lu, i = %lu, ptr %p\n",
(ulong) n_fields, (ulong) i, ptr);
return(NULL);
}
@@ -948,9 +954,9 @@ trx_undo_erase_page_end(
ulint first_free;
first_free = mach_read_from_2(undo_page + TRX_UNDO_PAGE_HDR
- + TRX_UNDO_PAGE_FREE);
+ + TRX_UNDO_PAGE_FREE);
memset(undo_page + first_free, 0xff,
- (UNIV_PAGE_SIZE - FIL_PAGE_DATA_END) - first_free);
+ (UNIV_PAGE_SIZE - FIL_PAGE_DATA_END) - first_free);
mlog_write_initial_log_record(undo_page, MLOG_UNDO_ERASE_END, mtr);
}
@@ -1034,7 +1040,7 @@ trx_undo_report_row_operation(
ut_ad(thr);
ut_ad((op_type != TRX_UNDO_INSERT_OP)
- || (clust_entry && !update && !rec));
+ || (clust_entry && !update && !rec));
trx = thr_get_trx(thr);
rseg = trx->rseg;
@@ -1078,32 +1084,30 @@ trx_undo_report_row_operation(
for (;;) {
undo_page = buf_page_get_gen(undo->space, page_no,
- RW_X_LATCH, undo->guess_page,
- BUF_GET,
- __FILE__, __LINE__,
- &mtr);
+ RW_X_LATCH, undo->guess_page,
+ BUF_GET,
+ __FILE__, __LINE__,
+ &mtr);
#ifdef UNIV_SYNC_DEBUG
buf_page_dbg_add_level(undo_page, SYNC_TRX_UNDO_PAGE);
#endif /* UNIV_SYNC_DEBUG */
if (op_type == TRX_UNDO_INSERT_OP) {
- offset = trx_undo_page_report_insert(undo_page, trx,
- index, clust_entry,
- &mtr);
+ offset = trx_undo_page_report_insert
+ (undo_page, trx, index, clust_entry, &mtr);
} else {
offsets = rec_get_offsets(rec, index, offsets,
- ULINT_UNDEFINED, &heap);
- offset = trx_undo_page_report_modify(undo_page, trx,
- index, rec, offsets, update, cmpl_info, &mtr);
+ ULINT_UNDEFINED, &heap);
+ offset = trx_undo_page_report_modify
+ (undo_page, trx, index, rec, offsets,
+ update, cmpl_info, &mtr);
}
if (offset == 0) {
/* The record did not fit on the page. We erase the
end segment of the undo log page and write a log
- record of it: this is to ensure that in the debug
- version the replicate page constructed using the log
- records stays identical to the original page */
+ record of it to to ensure deterministic contents. */
trx_undo_erase_page_end(undo_page, &mtr);
}
@@ -1155,7 +1159,7 @@ trx_undo_report_row_operation(
mutex_exit(&(trx->undo_mutex));
*roll_ptr = trx_undo_build_roll_ptr(is_insert, rseg->id, page_no,
- offset);
+ offset);
if (UNIV_LIKELY_NULL(heap)) {
mem_heap_free(heap);
}
@@ -1185,7 +1189,7 @@ trx_undo_get_undo_rec_low(
mtr_t mtr;
trx_undo_decode_roll_ptr(roll_ptr, &is_insert, &rseg_id, &page_no,
- &offset);
+ &offset);
rseg = trx_rseg_get_on_id(rseg_id);
mtr_start(&mtr);
@@ -1282,9 +1286,9 @@ trx_undo_prev_version_build(
ut_ad(rw_lock_own(&(purge_sys->latch), RW_LOCK_SHARED));
#endif /* UNIV_SYNC_DEBUG */
ut_ad(mtr_memo_contains(index_mtr, buf_block_align(index_rec),
- MTR_MEMO_PAGE_S_FIX) ||
- mtr_memo_contains(index_mtr, buf_block_align(index_rec),
- MTR_MEMO_PAGE_X_FIX));
+ MTR_MEMO_PAGE_S_FIX)
+ || mtr_memo_contains(index_mtr, buf_block_align(index_rec),
+ MTR_MEMO_PAGE_X_FIX));
ut_ad(rec_offs_validate(rec, index, offsets));
if (!(index->type & DICT_CLUSTERED)) {
@@ -1295,7 +1299,7 @@ trx_undo_prev_version_build(
"InnoDB: index record ", index->name);
rec_print(stderr, index_rec, index);
fputs("\n"
- "InnoDB: record version ", stderr);
+ "InnoDB: record version ", stderr);
rec_print_new(stderr, rec, offsets);
putc('\n', stderr);
return(DB_ERROR);
@@ -1323,23 +1327,27 @@ trx_undo_prev_version_build(
}
ptr = trx_undo_rec_get_pars(undo_rec, &type, &cmpl_info,
- &dummy_extern, &undo_no, &table_id);
+ &dummy_extern, &undo_no, &table_id);
ptr = trx_undo_update_rec_get_sys_cols(ptr, &trx_id, &roll_ptr,
- &info_bits);
+ &info_bits);
ptr = trx_undo_rec_skip_row_ref(ptr, index);
ptr = trx_undo_update_rec_get_update(ptr, index, type, trx_id,
- roll_ptr, info_bits, NULL, heap, &update);
+ roll_ptr, info_bits,
+ NULL, heap, &update);
if (ut_dulint_cmp(table_id, index->table->id) != 0) {
ptr = NULL;
fprintf(stderr,
-"InnoDB: Error: trying to access update undo rec for table %s\n"
-"InnoDB: but the table id in the undo record is wrong\n"
-"InnoDB: Submit a detailed bug report to http://bugs.mysql.com\n"
-"InnoDB: Run also CHECK TABLE %s\n",
+ "InnoDB: Error: trying to access update undo rec"
+ " for table %s\n"
+ "InnoDB: but the table id in the"
+ " undo record is wrong\n"
+ "InnoDB: Submit a detailed bug report"
+ " to http://bugs.mysql.com\n"
+ "InnoDB: Run also CHECK TABLE %s\n",
index->table_name, index->table_name);
}
@@ -1348,10 +1356,11 @@ trx_undo_prev_version_build(
should catch an elusive bug in row_vers_old_has_index_entry */
fprintf(stderr,
- "InnoDB: table %s, index %s, n_uniq %lu\n"
- "InnoDB: undo rec address %p, type %lu cmpl_info %lu\n"
- "InnoDB: undo rec table id %lu %lu, index table id %lu %lu\n"
- "InnoDB: dump of 150 bytes in undo rec: ",
+ "InnoDB: table %s, index %s, n_uniq %lu\n"
+ "InnoDB: undo rec address %p, type %lu cmpl_info %lu\n"
+ "InnoDB: undo rec table id %lu %lu,"
+ " index table id %lu %lu\n"
+ "InnoDB: dump of 150 bytes in undo rec: ",
index->table_name, index->name,
(ulong) dict_index_get_n_unique(index),
undo_rec, (ulong) type, (ulong) cmpl_info,
@@ -1361,14 +1370,16 @@ trx_undo_prev_version_build(
(ulong) ut_dulint_get_low(index->table->id));
ut_print_buf(stderr, undo_rec, 150);
fputs("\n"
- "InnoDB: index record ", stderr);
+ "InnoDB: index record ", stderr);
rec_print(stderr, index_rec, index);
fputs("\n"
- "InnoDB: record version ", stderr);
+ "InnoDB: record version ", stderr);
rec_print_new(stderr, rec, offsets);
fprintf(stderr, "\n"
- "InnoDB: Record trx id %lu %lu, update rec trx id %lu %lu\n"
- "InnoDB: Roll ptr in rec %lu %lu, in update rec %lu %lu\n",
+ "InnoDB: Record trx id %lu %lu, update rec"
+ " trx id %lu %lu\n"
+ "InnoDB: Roll ptr in rec %lu %lu, in update rec"
+ " %lu %lu\n",
(ulong) ut_dulint_get_high(rec_trx_id),
(ulong) ut_dulint_get_low(rec_trx_id),
(ulong) ut_dulint_get_high(trx_id),
@@ -1393,21 +1404,21 @@ trx_undo_prev_version_build(
fields. Store the info to ext_vect: */
ext_vect = mem_alloc(sizeof(ulint)
- * rec_offs_n_fields(offsets));
+ * rec_offs_n_fields(offsets));
n_ext_vect = btr_push_update_extern_fields(ext_vect, offsets,
- update);
+ update);
entry = row_rec_to_index_entry(ROW_COPY_DATA, index, rec,
- heap);
+ heap);
row_upd_index_replace_new_col_vals(entry, index, update, heap);
buf = mem_heap_alloc(heap,
- rec_get_converted_size(index, entry));
+ rec_get_converted_size(index, entry));
*old_vers = rec_convert_dtuple_to_rec(buf, index, entry);
/* Now set the extern bits in the old version of the record */
rec_set_field_extern_bits(*old_vers, index,
- ext_vect, n_ext_vect, NULL);
+ ext_vect, n_ext_vect, NULL);
mem_free(ext_vect);
} else {
buf = mem_heap_alloc(heap, rec_offs_size(offsets));
diff --git a/storage/innobase/trx/trx0roll.c b/storage/innobase/trx/trx0roll.c
index c777510cd06..1b00ae63ecd 100644
--- a/storage/innobase/trx/trx0roll.c
+++ b/storage/innobase/trx/trx0roll.c
@@ -157,7 +157,7 @@ trx_rollback_last_sql_stat_for_mysql(
trx->op_info = "rollback of SQL statement";
err = trx_general_rollback_for_mysql(trx, TRUE,
- &(trx->last_sql_stat_start));
+ &(trx->last_sql_stat_start));
/* The following call should not be needed, but we play safe: */
trx_mark_sql_stat_end(trx);
@@ -422,7 +422,8 @@ trx_rollback_or_clean_all_without_sess(
if (UT_LIST_GET_FIRST(trx_sys->trx_list)) {
fprintf(stderr,
-"InnoDB: Starting in background the rollback of uncommitted transactions\n");
+ "InnoDB: Starting in background the rollback"
+ " of uncommitted transactions\n");
} else {
goto leave_function;
}
@@ -450,7 +451,8 @@ loop:
if (trx == NULL) {
ut_print_timestamp(stderr);
fprintf(stderr,
- " InnoDB: Rollback of non-prepared transactions completed\n");
+ " InnoDB: Rollback of non-prepared transactions"
+ " completed\n");
mem_heap_free(heap);
@@ -461,8 +463,8 @@ loop:
if (trx->conc_state == TRX_COMMITTED_IN_MEMORY) {
fprintf(stderr, "InnoDB: Cleaning up trx with id %lu %lu\n",
- (ulong) ut_dulint_get_high(trx->id),
- (ulong) ut_dulint_get_low(trx->id));
+ (ulong) ut_dulint_get_high(trx->id),
+ (ulong) ut_dulint_get_low(trx->id));
trx_cleanup_at_db_startup(trx);
@@ -499,10 +501,11 @@ loop:
ut_print_timestamp(stderr);
fprintf(stderr,
-" InnoDB: Rolling back trx with id %lu %lu, %lu%s rows to undo\n",
- (ulong) ut_dulint_get_high(trx->id),
- (ulong) ut_dulint_get_low(trx->id),
- (ulong) rows_to_undo, unit);
+ " InnoDB: Rolling back trx with id %lu %lu, %lu%s"
+ " rows to undo\n",
+ (ulong) ut_dulint_get_high(trx->id),
+ (ulong) ut_dulint_get_low(trx->id),
+ (ulong) rows_to_undo, unit);
mutex_exit(&kernel_mutex);
trx->mysql_thread_id = os_thread_get_curr_id();
@@ -522,8 +525,8 @@ loop:
mutex_exit(&kernel_mutex);
fprintf(stderr,
- "InnoDB: Waiting for rollback of trx id %lu to end\n",
- (ulong) ut_dulint_get_low(trx->id));
+ "InnoDB: Waiting for rollback of trx id %lu to end\n",
+ (ulong) ut_dulint_get_low(trx->id));
os_thread_sleep(100000);
mutex_enter(&kernel_mutex);
@@ -536,7 +539,8 @@ loop:
drop the relevant table, if it still exists */
fprintf(stderr,
-"InnoDB: Dropping table with id %lu %lu in recovery if it exists\n",
+ "InnoDB: Dropping table with id %lu %lu"
+ " in recovery if it exists\n",
(ulong) ut_dulint_get_high(trx->table_id),
(ulong) ut_dulint_get_low(trx->table_id));
@@ -558,8 +562,8 @@ loop:
}
fprintf(stderr, "\nInnoDB: Rolling back of trx id %lu %lu completed\n",
- (ulong) ut_dulint_get_high(trx->id),
- (ulong) ut_dulint_get_low(trx->id));
+ (ulong) ut_dulint_get_high(trx->id),
+ (ulong) ut_dulint_get_low(trx->id));
mem_heap_free(heap);
trx_roll_crash_recv_trx = NULL;
@@ -591,7 +595,7 @@ trx_undo_arr_create(void)
arr = mem_heap_alloc(heap, sizeof(trx_undo_arr_t));
arr->infos = mem_heap_alloc(heap, sizeof(trx_undo_inf_t)
- * UNIV_MAX_PARALLELISM);
+ * UNIV_MAX_PARALLELISM);
arr->n_cells = UNIV_MAX_PARALLELISM;
arr->n_used = 0;
@@ -701,7 +705,7 @@ trx_undo_arr_remove_info(
cell = trx_undo_arr_get_nth_info(arr, i);
if (cell->in_use
- && 0 == ut_dulint_cmp(cell->undo_no, undo_no)) {
+ && 0 == ut_dulint_cmp(cell->undo_no, undo_no)) {
cell->in_use = FALSE;
@@ -817,13 +821,13 @@ trx_roll_pop_top_rec(
undo->top_page_no, mtr);
offset = undo->top_offset;
-/* fprintf(stderr, "Thread %lu undoing trx %lu undo record %lu\n",
- os_thread_get_curr_id(), ut_dulint_get_low(trx->id),
- ut_dulint_get_low(undo->top_undo_no)); */
+ /* fprintf(stderr, "Thread %lu undoing trx %lu undo record %lu\n",
+ os_thread_get_curr_id(), ut_dulint_get_low(trx->id),
+ ut_dulint_get_low(undo->top_undo_no)); */
prev_rec = trx_undo_get_prev_rec(undo_page + offset,
- undo->hdr_page_no, undo->hdr_offset,
- mtr);
+ undo->hdr_page_no, undo->hdr_offset,
+ mtr);
if (prev_rec == NULL) {
undo->empty = TRUE;
@@ -899,7 +903,7 @@ try_again:
}
if (!undo || undo->empty
- || (ut_dulint_cmp(limit, undo->top_undo_no) > 0)) {
+ || (ut_dulint_cmp(limit, undo->top_undo_no) > 0)) {
if ((trx->undo_no_arr)->n_used == 0) {
/* Rollback is ending */
@@ -923,7 +927,8 @@ try_again:
}
*roll_ptr = trx_undo_build_roll_ptr(is_insert, (undo->rseg)->id,
- undo->top_page_no, undo->top_offset);
+ undo->top_page_no,
+ undo->top_offset);
mtr_start(&mtr);
undo_rec = trx_roll_pop_top_rec(trx, undo, &mtr);
@@ -938,15 +943,16 @@ try_again:
if (trx == trx_roll_crash_recv_trx && trx_roll_max_undo_no > 1000) {
progress_pct = 100 - (ulint)
- ((ut_conv_dulint_to_longlong(undo_no) * 100)
- / trx_roll_max_undo_no);
+ ((ut_conv_dulint_to_longlong(undo_no) * 100)
+ / trx_roll_max_undo_no);
if (progress_pct != trx_roll_progress_printed_pct) {
if (trx_roll_progress_printed_pct == 0) {
fprintf(stderr,
-"\nInnoDB: Progress in percents: %lu", (ulong) progress_pct);
+ "\nInnoDB: Progress in percents:"
+ " %lu", (ulong) progress_pct);
} else {
fprintf(stderr,
- " %lu", (ulong) progress_pct);
+ " %lu", (ulong) progress_pct);
}
fflush(stderr);
trx_roll_progress_printed_pct = progress_pct;
@@ -1034,7 +1040,7 @@ trx_rollback(
{
que_t* roll_graph;
que_thr_t* thr;
-/* que_thr_t* thr2; */
+ /* que_thr_t* thr2; */
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&kernel_mutex));
@@ -1077,16 +1083,16 @@ trx_rollback(
ut_ad(thr);
-/* thr2 = que_fork_start_command(roll_graph);
+ /* thr2 = que_fork_start_command(roll_graph);
ut_ad(thr2); */
if (next_thr && (*next_thr == NULL)) {
*next_thr = thr;
-/* srv_que_task_enqueue_low(thr2); */
+ /* srv_que_task_enqueue_low(thr2); */
} else {
srv_que_task_enqueue_low(thr);
-/* srv_que_task_enqueue_low(thr2); */
+ /* srv_que_task_enqueue_low(thr2); */
}
}
@@ -1105,7 +1111,7 @@ trx_roll_graph_build(
mem_heap_t* heap;
que_fork_t* fork;
que_thr_t* thr;
-/* que_thr_t* thr2; */
+ /* que_thr_t* thr2; */
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&kernel_mutex));
@@ -1116,10 +1122,10 @@ trx_roll_graph_build(
fork->trx = trx;
thr = que_thr_create(fork, heap);
-/* thr2 = que_thr_create(fork, heap); */
+ /* thr2 = que_thr_create(fork, heap); */
thr->child = row_undo_node_create(trx, thr, heap);
-/* thr2->child = row_undo_node_create(trx, thr2, heap); */
+ /* thr2->child = row_undo_node_create(trx, thr2, heap); */
return(fork);
}
@@ -1231,7 +1237,7 @@ trx_finish_rollback_off_kernel(
#ifdef UNIV_DEBUG
if (lock_print_waits) {
fprintf(stderr, "Trx %lu rollback finished\n",
- (ulong) ut_dulint_get_low(trx->id));
+ (ulong) ut_dulint_get_low(trx->id));
}
#endif /* UNIV_DEBUG */
@@ -1313,7 +1319,7 @@ trx_rollback_step(
/* Send a rollback signal to the transaction */
trx_sig_send(thr_get_trx(thr), sig_no, TRX_SIG_SELF, thr,
- savept, NULL);
+ savept, NULL);
thr->state = QUE_THR_SIG_REPLY_WAIT;
diff --git a/storage/innobase/trx/trx0rseg.c b/storage/innobase/trx/trx0rseg.c
index 5136174d110..745a29021ad 100644
--- a/storage/innobase/trx/trx0rseg.c
+++ b/storage/innobase/trx/trx0rseg.c
@@ -64,7 +64,7 @@ trx_rseg_header_create(
ut_ad(mutex_own(&kernel_mutex));
#endif /* UNIV_SYNC_DEBUG */
ut_ad(mtr_memo_contains(mtr, fil_space_get_latch(space),
- MTR_MEMO_X_LOCK));
+ MTR_MEMO_X_LOCK));
sys_header = trx_sysf_get(mtr);
*slot_no = trx_sysf_rseg_find_free(mtr);
@@ -93,7 +93,8 @@ trx_rseg_header_create(
rsegf = trx_rsegf_get_new(space, page_no, mtr);
/* Initialize max size field */
- mlog_write_ulint(rsegf + TRX_RSEG_MAX_SIZE, max_size, MLOG_4BYTES, mtr);
+ mlog_write_ulint(rsegf + TRX_RSEG_MAX_SIZE, max_size,
+ MLOG_4BYTES, mtr);
/* Initialize the history list */
@@ -156,34 +157,32 @@ trx_rseg_mem_create(
rseg_header = trx_rsegf_get_new(space, page_no, mtr);
rseg->max_size = mtr_read_ulint(rseg_header + TRX_RSEG_MAX_SIZE,
- MLOG_4BYTES, mtr);
+ MLOG_4BYTES, mtr);
/* Initialize the undo log lists according to the rseg header */
sum_of_undo_sizes = trx_undo_lists_init(rseg);
rseg->curr_size = mtr_read_ulint(rseg_header + TRX_RSEG_HISTORY_SIZE,
- MLOG_4BYTES, mtr)
- + 1 + sum_of_undo_sizes;
+ MLOG_4BYTES, mtr)
+ + 1 + sum_of_undo_sizes;
len = flst_get_len(rseg_header + TRX_RSEG_HISTORY, mtr);
if (len > 0) {
trx_sys->rseg_history_len += len;
- node_addr = trx_purge_get_log_from_hist(
- flst_get_last(rseg_header + TRX_RSEG_HISTORY,
- mtr));
+ node_addr = trx_purge_get_log_from_hist
+ (flst_get_last(rseg_header + TRX_RSEG_HISTORY, mtr));
rseg->last_page_no = node_addr.page;
rseg->last_offset = node_addr.boffset;
undo_log_hdr = trx_undo_page_get(rseg->space, node_addr.page,
- mtr) + node_addr.boffset;
+ mtr) + node_addr.boffset;
- rseg->last_trx_no = mtr_read_dulint(
- undo_log_hdr + TRX_UNDO_TRX_NO, mtr);
- rseg->last_del_marks = mtr_read_ulint(
- undo_log_hdr + TRX_UNDO_DEL_MARKS,
- MLOG_2BYTES, mtr);
+ rseg->last_trx_no = mtr_read_dulint
+ (undo_log_hdr + TRX_UNDO_TRX_NO, mtr);
+ rseg->last_del_marks = mtr_read_ulint
+ (undo_log_hdr + TRX_UNDO_DEL_MARKS, MLOG_2BYTES, mtr);
} else {
rseg->last_page_no = FIL_NULL;
}
diff --git a/storage/innobase/trx/trx0sys.c b/storage/innobase/trx/trx0sys.c
index 8f24a54208a..ce68f994d44 100644
--- a/storage/innobase/trx/trx0sys.c
+++ b/storage/innobase/trx/trx0sys.c
@@ -70,14 +70,14 @@ trx_doublewrite_page_inside(
}
if (page_no >= trx_doublewrite->block1
- && page_no < trx_doublewrite->block1
- + TRX_SYS_DOUBLEWRITE_BLOCK_SIZE) {
+ && page_no < trx_doublewrite->block1
+ + TRX_SYS_DOUBLEWRITE_BLOCK_SIZE) {
return(TRUE);
}
if (page_no >= trx_doublewrite->block2
- && page_no < trx_doublewrite->block2
- + TRX_SYS_DOUBLEWRITE_BLOCK_SIZE) {
+ && page_no < trx_doublewrite->block2
+ + TRX_SYS_DOUBLEWRITE_BLOCK_SIZE) {
return(TRUE);
}
@@ -105,23 +105,17 @@ trx_doublewrite_init(
trx_doublewrite->first_free = 0;
- trx_doublewrite->block1 = mach_read_from_4(
- doublewrite
- + TRX_SYS_DOUBLEWRITE_BLOCK1);
- trx_doublewrite->block2 = mach_read_from_4(
- doublewrite
- + TRX_SYS_DOUBLEWRITE_BLOCK2);
- trx_doublewrite->write_buf_unaligned =
- ut_malloc(
- (1 + 2 * TRX_SYS_DOUBLEWRITE_BLOCK_SIZE)
- * UNIV_PAGE_SIZE);
-
- trx_doublewrite->write_buf = ut_align(
- trx_doublewrite->write_buf_unaligned,
- UNIV_PAGE_SIZE);
- trx_doublewrite->buf_block_arr = mem_alloc(
- 2 * TRX_SYS_DOUBLEWRITE_BLOCK_SIZE
- * sizeof(void*));
+ trx_doublewrite->block1 = mach_read_from_4
+ (doublewrite + TRX_SYS_DOUBLEWRITE_BLOCK1);
+ trx_doublewrite->block2 = mach_read_from_4
+ (doublewrite + TRX_SYS_DOUBLEWRITE_BLOCK2);
+ trx_doublewrite->write_buf_unaligned = ut_malloc
+ ((1 + 2 * TRX_SYS_DOUBLEWRITE_BLOCK_SIZE) * UNIV_PAGE_SIZE);
+
+ trx_doublewrite->write_buf = ut_align
+ (trx_doublewrite->write_buf_unaligned, UNIV_PAGE_SIZE);
+ trx_doublewrite->buf_block_arr = mem_alloc
+ (2 * TRX_SYS_DOUBLEWRITE_BLOCK_SIZE * sizeof(void*));
}
/********************************************************************
@@ -150,8 +144,8 @@ trx_sys_mark_upgraded_to_multiple_tablespaces(void)
doublewrite = page + TRX_SYS_DOUBLEWRITE;
mlog_write_ulint(doublewrite + TRX_SYS_DOUBLEWRITE_SPACE_ID_STORED,
- TRX_SYS_DOUBLEWRITE_SPACE_ID_STORED_N,
- MLOG_4BYTES, &mtr);
+ TRX_SYS_DOUBLEWRITE_SPACE_ID_STORED_N,
+ MLOG_4BYTES, &mtr);
mtr_commit(&mtr);
/* Flush the modified pages to disk and make a checkpoint */
@@ -195,7 +189,7 @@ start_again:
doublewrite = page + TRX_SYS_DOUBLEWRITE;
if (mach_read_from_4(doublewrite + TRX_SYS_DOUBLEWRITE_MAGIC)
- == TRX_SYS_DOUBLEWRITE_MAGIC_N) {
+ == TRX_SYS_DOUBLEWRITE_MAGIC_N) {
/* The doublewrite buffer has already been created:
just read in some numbers */
@@ -204,22 +198,25 @@ start_again:
mtr_commit(&mtr);
} else {
fprintf(stderr,
- "InnoDB: Doublewrite buffer not found: creating new\n");
+ "InnoDB: Doublewrite buffer not found:"
+ " creating new\n");
- if (buf_pool_get_curr_size() <
- (2 * TRX_SYS_DOUBLEWRITE_BLOCK_SIZE
- + FSP_EXTENT_SIZE / 2 + 100)
- * UNIV_PAGE_SIZE) {
+ if (buf_pool_get_curr_size()
+ < ((2 * TRX_SYS_DOUBLEWRITE_BLOCK_SIZE
+ + FSP_EXTENT_SIZE / 2 + 100)
+ * UNIV_PAGE_SIZE)) {
fprintf(stderr,
- "InnoDB: Cannot create doublewrite buffer: you must\n"
- "InnoDB: increase your buffer pool size.\n"
- "InnoDB: Cannot continue operation.\n");
+ "InnoDB: Cannot create doublewrite buffer:"
+ " you must\n"
+ "InnoDB: increase your buffer pool size.\n"
+ "InnoDB: Cannot continue operation.\n");
exit(1);
}
page2 = fseg_create(TRX_SYS_SPACE, TRX_SYS_PAGE_NO,
- TRX_SYS_DOUBLEWRITE + TRX_SYS_DOUBLEWRITE_FSEG, &mtr);
+ TRX_SYS_DOUBLEWRITE
+ + TRX_SYS_DOUBLEWRITE_FSEG, &mtr);
/* fseg_create acquires a second latch on the page,
therefore we must declare it: */
@@ -230,9 +227,10 @@ start_again:
if (page2 == NULL) {
fprintf(stderr,
- "InnoDB: Cannot create doublewrite buffer: you must\n"
- "InnoDB: increase your tablespace size.\n"
- "InnoDB: Cannot continue operation.\n");
+ "InnoDB: Cannot create doublewrite buffer:"
+ " you must\n"
+ "InnoDB: increase your tablespace size.\n"
+ "InnoDB: Cannot continue operation.\n");
/* We exit without committing the mtr to prevent
its modifications to the database getting to disk */
@@ -241,19 +239,22 @@ start_again:
}
fseg_header = page + TRX_SYS_DOUBLEWRITE
- + TRX_SYS_DOUBLEWRITE_FSEG;
+ + TRX_SYS_DOUBLEWRITE_FSEG;
prev_page_no = 0;
for (i = 0; i < 2 * TRX_SYS_DOUBLEWRITE_BLOCK_SIZE
- + FSP_EXTENT_SIZE / 2; i++) {
+ + FSP_EXTENT_SIZE / 2; i++) {
page_no = fseg_alloc_free_page(fseg_header,
- prev_page_no + 1,
- FSP_UP, &mtr);
+ prev_page_no + 1,
+ FSP_UP, &mtr);
if (page_no == FIL_NULL) {
fprintf(stderr,
- "InnoDB: Cannot create doublewrite buffer: you must\n"
- "InnoDB: increase your tablespace size.\n"
- "InnoDB: Cannot continue operation.\n");
+ "InnoDB: Cannot create doublewrite"
+ " buffer: you must\n"
+ "InnoDB: increase your"
+ " tablespace size.\n"
+ "InnoDB: Cannot continue operation.\n"
+ );
exit(1);
}
@@ -268,7 +269,7 @@ start_again:
has not been written to in doublewrite. */
new_page = buf_page_get(TRX_SYS_SPACE, page_no,
- RW_X_LATCH, &mtr);
+ RW_X_LATCH, &mtr);
#ifdef UNIV_SYNC_DEBUG
buf_page_dbg_add_level(new_page, SYNC_NO_ORDER_CHECK);
#endif /* UNIV_SYNC_DEBUG */
@@ -277,26 +278,26 @@ start_again:
be written to disk in a flush */
mlog_write_ulint(new_page + FIL_PAGE_DATA,
- TRX_SYS_DOUBLEWRITE_MAGIC_N,
- MLOG_4BYTES, &mtr);
+ TRX_SYS_DOUBLEWRITE_MAGIC_N,
+ MLOG_4BYTES, &mtr);
if (i == FSP_EXTENT_SIZE / 2) {
mlog_write_ulint(doublewrite
- + TRX_SYS_DOUBLEWRITE_BLOCK1,
- page_no, MLOG_4BYTES, &mtr);
+ + TRX_SYS_DOUBLEWRITE_BLOCK1,
+ page_no, MLOG_4BYTES, &mtr);
mlog_write_ulint(doublewrite
- + TRX_SYS_DOUBLEWRITE_REPEAT
- + TRX_SYS_DOUBLEWRITE_BLOCK1,
- page_no, MLOG_4BYTES, &mtr);
+ + TRX_SYS_DOUBLEWRITE_REPEAT
+ + TRX_SYS_DOUBLEWRITE_BLOCK1,
+ page_no, MLOG_4BYTES, &mtr);
} else if (i == FSP_EXTENT_SIZE / 2
- + TRX_SYS_DOUBLEWRITE_BLOCK_SIZE) {
+ + TRX_SYS_DOUBLEWRITE_BLOCK_SIZE) {
mlog_write_ulint(doublewrite
- + TRX_SYS_DOUBLEWRITE_BLOCK2,
- page_no, MLOG_4BYTES, &mtr);
+ + TRX_SYS_DOUBLEWRITE_BLOCK2,
+ page_no, MLOG_4BYTES, &mtr);
mlog_write_ulint(doublewrite
- + TRX_SYS_DOUBLEWRITE_REPEAT
- + TRX_SYS_DOUBLEWRITE_BLOCK2,
- page_no, MLOG_4BYTES, &mtr);
+ + TRX_SYS_DOUBLEWRITE_REPEAT
+ + TRX_SYS_DOUBLEWRITE_BLOCK2,
+ page_no, MLOG_4BYTES, &mtr);
} else if (i > FSP_EXTENT_SIZE / 2) {
ut_a(page_no == prev_page_no + 1);
}
@@ -305,15 +306,17 @@ start_again:
}
mlog_write_ulint(doublewrite + TRX_SYS_DOUBLEWRITE_MAGIC,
- TRX_SYS_DOUBLEWRITE_MAGIC_N, MLOG_4BYTES, &mtr);
+ TRX_SYS_DOUBLEWRITE_MAGIC_N,
+ MLOG_4BYTES, &mtr);
mlog_write_ulint(doublewrite + TRX_SYS_DOUBLEWRITE_MAGIC
- + TRX_SYS_DOUBLEWRITE_REPEAT,
- TRX_SYS_DOUBLEWRITE_MAGIC_N, MLOG_4BYTES, &mtr);
+ + TRX_SYS_DOUBLEWRITE_REPEAT,
+ TRX_SYS_DOUBLEWRITE_MAGIC_N,
+ MLOG_4BYTES, &mtr);
mlog_write_ulint(doublewrite
- + TRX_SYS_DOUBLEWRITE_SPACE_ID_STORED,
- TRX_SYS_DOUBLEWRITE_SPACE_ID_STORED_N,
- MLOG_4BYTES, &mtr);
+ + TRX_SYS_DOUBLEWRITE_SPACE_ID_STORED,
+ TRX_SYS_DOUBLEWRITE_SPACE_ID_STORED_N,
+ MLOG_4BYTES, &mtr);
mtr_commit(&mtr);
/* Flush the modified pages to disk and make a checkpoint */
@@ -361,11 +364,11 @@ trx_sys_doublewrite_init_or_restore_pages(
buffer */
fil_io(OS_FILE_READ, TRUE, TRX_SYS_SPACE, TRX_SYS_PAGE_NO, 0,
- UNIV_PAGE_SIZE, read_buf, NULL);
+ UNIV_PAGE_SIZE, read_buf, NULL);
doublewrite = read_buf + TRX_SYS_DOUBLEWRITE;
if (mach_read_from_4(doublewrite + TRX_SYS_DOUBLEWRITE_MAGIC)
- == TRX_SYS_DOUBLEWRITE_MAGIC_N) {
+ == TRX_SYS_DOUBLEWRITE_MAGIC_N) {
/* The doublewrite buffer has been created */
trx_doublewrite_init(doublewrite);
@@ -379,7 +382,7 @@ trx_sys_doublewrite_init_or_restore_pages(
}
if (mach_read_from_4(doublewrite + TRX_SYS_DOUBLEWRITE_SPACE_ID_STORED)
- != TRX_SYS_DOUBLEWRITE_SPACE_ID_STORED_N) {
+ != TRX_SYS_DOUBLEWRITE_SPACE_ID_STORED_N) {
/* We are upgrading from a version < 4.1.x to a version where
multiple tablespaces are supported. We must reset the space id
@@ -390,7 +393,8 @@ trx_sys_doublewrite_init_or_restore_pages(
trx_doublewrite_must_reset_space_ids = TRUE;
fprintf(stderr,
-"InnoDB: Resetting space id's in the doublewrite buffer\n");
+ "InnoDB: Resetting space id's in the"
+ " doublewrite buffer\n");
} else {
trx_sys_multiple_tablespace_format = TRUE;
}
@@ -398,12 +402,12 @@ trx_sys_doublewrite_init_or_restore_pages(
/* Read the pages from the doublewrite buffer to memory */
fil_io(OS_FILE_READ, TRUE, TRX_SYS_SPACE, block1, 0,
- TRX_SYS_DOUBLEWRITE_BLOCK_SIZE * UNIV_PAGE_SIZE,
- buf, NULL);
+ TRX_SYS_DOUBLEWRITE_BLOCK_SIZE * UNIV_PAGE_SIZE,
+ buf, NULL);
fil_io(OS_FILE_READ, TRUE, TRX_SYS_SPACE, block2, 0,
- TRX_SYS_DOUBLEWRITE_BLOCK_SIZE * UNIV_PAGE_SIZE,
- buf + TRX_SYS_DOUBLEWRITE_BLOCK_SIZE * UNIV_PAGE_SIZE,
- NULL);
+ TRX_SYS_DOUBLEWRITE_BLOCK_SIZE * UNIV_PAGE_SIZE,
+ buf + TRX_SYS_DOUBLEWRITE_BLOCK_SIZE * UNIV_PAGE_SIZE,
+ NULL);
/* Check if any of these pages is half-written in data files, in the
intended position */
@@ -430,12 +434,12 @@ trx_sys_doublewrite_init_or_restore_pages(
}
fil_io(OS_FILE_WRITE, TRUE, 0, source_page_no, 0,
- UNIV_PAGE_SIZE, page, NULL);
+ UNIV_PAGE_SIZE, page, NULL);
/* printf("Resetting space id in page %lu\n",
- source_page_no); */
+ source_page_no); */
} else {
- space_id = mach_read_from_4(
- page + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID);
+ space_id = mach_read_from_4
+ (page + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID);
}
if (!restore_corrupt_pages) {
@@ -447,19 +451,23 @@ trx_sys_doublewrite_init_or_restore_pages(
and this page once belonged to it: do nothing */
} else if (!fil_check_adress_in_tablespace(space_id,
- page_no)) {
+ page_no)) {
fprintf(stderr,
-"InnoDB: Warning: a page in the doublewrite buffer is not within space\n"
-"InnoDB: bounds; space id %lu page number %lu, page %lu in doublewrite buf.\n",
+ "InnoDB: Warning: a page in the"
+ " doublewrite buffer is not within space\n"
+ "InnoDB: bounds; space id %lu"
+ " page number %lu, page %lu in"
+ " doublewrite buf.\n",
(ulong) space_id, (ulong) page_no, (ulong) i);
} else if (space_id == TRX_SYS_SPACE
- && ((page_no >= block1
- && page_no
- < block1 + TRX_SYS_DOUBLEWRITE_BLOCK_SIZE)
- || (page_no >= block2
- && page_no
- < block2 + TRX_SYS_DOUBLEWRITE_BLOCK_SIZE))) {
+ && ((page_no >= block1
+ && page_no
+ < block1 + TRX_SYS_DOUBLEWRITE_BLOCK_SIZE)
+ || (page_no >= block2
+ && page_no
+ < (block2
+ + TRX_SYS_DOUBLEWRITE_BLOCK_SIZE)))) {
/* It is an unwritten doublewrite buffer page:
do nothing */
@@ -467,31 +475,42 @@ trx_sys_doublewrite_init_or_restore_pages(
/* Read in the actual page from the data files */
fil_io(OS_FILE_READ, TRUE, space_id, page_no, 0,
- UNIV_PAGE_SIZE, read_buf, NULL);
+ UNIV_PAGE_SIZE, read_buf, NULL);
/* Check if the page is corrupt */
if (buf_page_is_corrupted(read_buf)) {
fprintf(stderr,
- "InnoDB: Warning: database page corruption or a failed\n"
- "InnoDB: file read of page %lu.\n", (ulong) page_no);
+ "InnoDB: Warning: database page"
+ " corruption or a failed\n"
+ "InnoDB: file read of page %lu.\n",
+ (ulong) page_no);
fprintf(stderr,
- "InnoDB: Trying to recover it from the doublewrite buffer.\n");
+ "InnoDB: Trying to recover it from"
+ " the doublewrite buffer.\n");
if (buf_page_is_corrupted(page)) {
fprintf(stderr,
- "InnoDB: Dump of the page:\n");
+ "InnoDB: Dump of the page:\n");
buf_page_print(read_buf);
fprintf(stderr,
- "InnoDB: Dump of corresponding page in doublewrite buffer:\n");
+ "InnoDB: Dump of"
+ " corresponding page"
+ " in doublewrite buffer:\n");
buf_page_print(page);
fprintf(stderr,
- "InnoDB: Also the page in the doublewrite buffer is corrupt.\n"
- "InnoDB: Cannot continue operation.\n"
- "InnoDB: You can try to recover the database with the my.cnf\n"
- "InnoDB: option:\n"
- "InnoDB: set-variable=innodb_force_recovery=6\n");
+ "InnoDB: Also the page in the"
+ " doublewrite buffer"
+ " is corrupt.\n"
+ "InnoDB: Cannot continue"
+ " operation.\n"
+ "InnoDB: You can try to"
+ " recover the database"
+ " with the my.cnf\n"
+ "InnoDB: option:\n"
+ "InnoDB: set-variable="
+ "innodb_force_recovery=6\n");
exit(1);
}
@@ -500,10 +519,11 @@ trx_sys_doublewrite_init_or_restore_pages(
position */
fil_io(OS_FILE_WRITE, TRUE, space_id,
- page_no, 0,
- UNIV_PAGE_SIZE, page, NULL);
+ page_no, 0,
+ UNIV_PAGE_SIZE, page, NULL);
fprintf(stderr,
- "InnoDB: Recovered the page from the doublewrite buffer.\n");
+ "InnoDB: Recovered the page from"
+ " the doublewrite buffer.\n");
}
}
@@ -565,7 +585,7 @@ trx_sys_flush_max_trx_id(void)
sys_header = trx_sysf_get(&mtr);
mlog_write_dulint(sys_header + TRX_SYS_TRX_ID_STORE,
- trx_sys->max_trx_id, &mtr);
+ trx_sys->max_trx_id, &mtr);
mtr_commit(&mtr);
}
@@ -596,36 +616,38 @@ trx_sys_update_mysql_binlog_offset(
sys_header = trx_sysf_get(mtr);
if (mach_read_from_4(sys_header + field
- + TRX_SYS_MYSQL_LOG_MAGIC_N_FLD)
- != TRX_SYS_MYSQL_LOG_MAGIC_N) {
+ + TRX_SYS_MYSQL_LOG_MAGIC_N_FLD)
+ != TRX_SYS_MYSQL_LOG_MAGIC_N) {
mlog_write_ulint(sys_header + field
- + TRX_SYS_MYSQL_LOG_MAGIC_N_FLD,
- TRX_SYS_MYSQL_LOG_MAGIC_N,
- MLOG_4BYTES, mtr);
+ + TRX_SYS_MYSQL_LOG_MAGIC_N_FLD,
+ TRX_SYS_MYSQL_LOG_MAGIC_N,
+ MLOG_4BYTES, mtr);
}
- if (0 != strcmp((char*) (sys_header + field + TRX_SYS_MYSQL_LOG_NAME), file_name)) {
+ if (0 != strcmp((char*) (sys_header + field + TRX_SYS_MYSQL_LOG_NAME),
+ file_name)) {
mlog_write_string(sys_header + field
- + TRX_SYS_MYSQL_LOG_NAME,
- (byte*) file_name, 1 + ut_strlen(file_name), mtr);
+ + TRX_SYS_MYSQL_LOG_NAME,
+ (byte*) file_name, 1 + ut_strlen(file_name),
+ mtr);
}
if (mach_read_from_4(sys_header + field
- + TRX_SYS_MYSQL_LOG_OFFSET_HIGH) > 0
- || (offset >> 32) > 0) {
+ + TRX_SYS_MYSQL_LOG_OFFSET_HIGH) > 0
+ || (offset >> 32) > 0) {
mlog_write_ulint(sys_header + field
- + TRX_SYS_MYSQL_LOG_OFFSET_HIGH,
- (ulint)(offset >> 32),
- MLOG_4BYTES, mtr);
+ + TRX_SYS_MYSQL_LOG_OFFSET_HIGH,
+ (ulint)(offset >> 32),
+ MLOG_4BYTES, mtr);
}
mlog_write_ulint(sys_header + field
- + TRX_SYS_MYSQL_LOG_OFFSET_LOW,
- (ulint)(offset & 0xFFFFFFFFUL),
- MLOG_4BYTES, mtr);
+ + TRX_SYS_MYSQL_LOG_OFFSET_LOW,
+ (ulint)(offset & 0xFFFFFFFFUL),
+ MLOG_4BYTES, mtr);
}
/*********************************************************************
@@ -643,16 +665,20 @@ trx_sys_print_mysql_binlog_offset_from_page(
sys_header = page + TRX_SYS;
if (mach_read_from_4(sys_header + TRX_SYS_MYSQL_LOG_INFO
- + TRX_SYS_MYSQL_LOG_MAGIC_N_FLD)
- == TRX_SYS_MYSQL_LOG_MAGIC_N) {
+ + TRX_SYS_MYSQL_LOG_MAGIC_N_FLD)
+ == TRX_SYS_MYSQL_LOG_MAGIC_N) {
fprintf(stderr,
- "ibbackup: Last MySQL binlog file position %lu %lu, file name %s\n",
- (ulong) mach_read_from_4(sys_header + TRX_SYS_MYSQL_LOG_INFO
- + TRX_SYS_MYSQL_LOG_OFFSET_HIGH),
- (ulong) mach_read_from_4(sys_header + TRX_SYS_MYSQL_LOG_INFO
- + TRX_SYS_MYSQL_LOG_OFFSET_LOW),
- sys_header + TRX_SYS_MYSQL_LOG_INFO + TRX_SYS_MYSQL_LOG_NAME);
+ "ibbackup: Last MySQL binlog file position %lu %lu,"
+ " file name %s\n",
+ (ulong) mach_read_from_4
+ (sys_header + TRX_SYS_MYSQL_LOG_INFO
+ + TRX_SYS_MYSQL_LOG_OFFSET_HIGH),
+ (ulong) mach_read_from_4
+ (sys_header + TRX_SYS_MYSQL_LOG_INFO
+ + TRX_SYS_MYSQL_LOG_OFFSET_LOW),
+ sys_header + TRX_SYS_MYSQL_LOG_INFO
+ + TRX_SYS_MYSQL_LOG_NAME);
}
}
@@ -674,27 +700,32 @@ trx_sys_print_mysql_binlog_offset(void)
sys_header = trx_sysf_get(&mtr);
if (mach_read_from_4(sys_header + TRX_SYS_MYSQL_LOG_INFO
- + TRX_SYS_MYSQL_LOG_MAGIC_N_FLD)
- != TRX_SYS_MYSQL_LOG_MAGIC_N) {
+ + TRX_SYS_MYSQL_LOG_MAGIC_N_FLD)
+ != TRX_SYS_MYSQL_LOG_MAGIC_N) {
mtr_commit(&mtr);
return;
}
- trx_sys_mysql_bin_log_pos_high = mach_read_from_4(sys_header + TRX_SYS_MYSQL_LOG_INFO
- + TRX_SYS_MYSQL_LOG_OFFSET_HIGH);
- trx_sys_mysql_bin_log_pos_low = mach_read_from_4(sys_header + TRX_SYS_MYSQL_LOG_INFO
- + TRX_SYS_MYSQL_LOG_OFFSET_LOW);
+ trx_sys_mysql_bin_log_pos_high = mach_read_from_4
+ (sys_header + TRX_SYS_MYSQL_LOG_INFO
+ + TRX_SYS_MYSQL_LOG_OFFSET_HIGH);
+ trx_sys_mysql_bin_log_pos_low = mach_read_from_4
+ (sys_header + TRX_SYS_MYSQL_LOG_INFO
+ + TRX_SYS_MYSQL_LOG_OFFSET_LOW);
- trx_sys_mysql_bin_log_pos = (((ib_longlong)trx_sys_mysql_bin_log_pos_high) << 32) +
- (ib_longlong)trx_sys_mysql_bin_log_pos_low;
+ trx_sys_mysql_bin_log_pos
+ = (((ib_longlong)trx_sys_mysql_bin_log_pos_high) << 32)
+ + (ib_longlong)trx_sys_mysql_bin_log_pos_low;
- ut_memcpy(trx_sys_mysql_bin_log_name, sys_header + TRX_SYS_MYSQL_LOG_INFO +
- TRX_SYS_MYSQL_LOG_NAME, TRX_SYS_MYSQL_LOG_NAME_LEN);
+ ut_memcpy(trx_sys_mysql_bin_log_name,
+ sys_header + TRX_SYS_MYSQL_LOG_INFO
+ + TRX_SYS_MYSQL_LOG_NAME, TRX_SYS_MYSQL_LOG_NAME_LEN);
fprintf(stderr,
- "InnoDB: Last MySQL binlog file position %lu %lu, file name %s\n",
+ "InnoDB: Last MySQL binlog file position %lu %lu,"
+ " file name %s\n",
trx_sys_mysql_bin_log_pos_high, trx_sys_mysql_bin_log_pos_low,
trx_sys_mysql_bin_log_name);
@@ -717,8 +748,8 @@ trx_sys_print_mysql_master_log_pos(void)
sys_header = trx_sysf_get(&mtr);
if (mach_read_from_4(sys_header + TRX_SYS_MYSQL_MASTER_LOG_INFO
- + TRX_SYS_MYSQL_LOG_MAGIC_N_FLD)
- != TRX_SYS_MYSQL_LOG_MAGIC_N) {
+ + TRX_SYS_MYSQL_LOG_MAGIC_N_FLD)
+ != TRX_SYS_MYSQL_LOG_MAGIC_N) {
mtr_commit(&mtr);
@@ -726,30 +757,32 @@ trx_sys_print_mysql_master_log_pos(void)
}
fprintf(stderr,
-"InnoDB: In a MySQL replication slave the last master binlog file\n"
-"InnoDB: position %lu %lu, file name %s\n",
- (ulong) mach_read_from_4(sys_header + TRX_SYS_MYSQL_MASTER_LOG_INFO
- + TRX_SYS_MYSQL_LOG_OFFSET_HIGH),
- (ulong) mach_read_from_4(sys_header + TRX_SYS_MYSQL_MASTER_LOG_INFO
- + TRX_SYS_MYSQL_LOG_OFFSET_LOW),
+ "InnoDB: In a MySQL replication slave the last"
+ " master binlog file\n"
+ "InnoDB: position %lu %lu, file name %s\n",
+ (ulong) mach_read_from_4(sys_header
+ + TRX_SYS_MYSQL_MASTER_LOG_INFO
+ + TRX_SYS_MYSQL_LOG_OFFSET_HIGH),
+ (ulong) mach_read_from_4(sys_header
+ + TRX_SYS_MYSQL_MASTER_LOG_INFO
+ + TRX_SYS_MYSQL_LOG_OFFSET_LOW),
sys_header + TRX_SYS_MYSQL_MASTER_LOG_INFO
- + TRX_SYS_MYSQL_LOG_NAME);
+ + TRX_SYS_MYSQL_LOG_NAME);
/* Copy the master log position info to global variables we can
use in ha_innobase.cc to initialize glob_mi to right values */
ut_memcpy(trx_sys_mysql_master_log_name,
- sys_header + TRX_SYS_MYSQL_MASTER_LOG_INFO
- + TRX_SYS_MYSQL_LOG_NAME,
- TRX_SYS_MYSQL_LOG_NAME_LEN);
-
- trx_sys_mysql_master_log_pos =
- (((ib_longlong)mach_read_from_4(
- sys_header + TRX_SYS_MYSQL_MASTER_LOG_INFO
- + TRX_SYS_MYSQL_LOG_OFFSET_HIGH))
- << 32)
- + (ib_longlong)
- mach_read_from_4(sys_header + TRX_SYS_MYSQL_MASTER_LOG_INFO
- + TRX_SYS_MYSQL_LOG_OFFSET_LOW);
+ sys_header + TRX_SYS_MYSQL_MASTER_LOG_INFO
+ + TRX_SYS_MYSQL_LOG_NAME,
+ TRX_SYS_MYSQL_LOG_NAME_LEN);
+
+ trx_sys_mysql_master_log_pos
+ = (((ib_longlong) mach_read_from_4
+ (sys_header + TRX_SYS_MYSQL_MASTER_LOG_INFO
+ + TRX_SYS_MYSQL_LOG_OFFSET_HIGH)) << 32)
+ + ((ib_longlong) mach_read_from_4
+ (sys_header + TRX_SYS_MYSQL_MASTER_LOG_INFO
+ + TRX_SYS_MYSQL_LOG_OFFSET_LOW));
mtr_commit(&mtr);
}
@@ -811,21 +844,27 @@ trx_sysf_create(
/* Create the trx sys file block in a new allocated file segment */
page = fseg_create(TRX_SYS_SPACE, 0, TRX_SYS + TRX_SYS_FSEG_HEADER,
- mtr);
+ mtr);
ut_a(buf_frame_get_page_no(page) == TRX_SYS_PAGE_NO);
+ /* Reset the doublewrite buffer magic number to zero so that we
+ know that the doublewrite buffer has not yet been created (this
+ suppresses a Valgrind warning) */
+
+ mach_write_to_4(page + TRX_SYS_DOUBLEWRITE + TRX_SYS_DOUBLEWRITE_MAGIC,
+ 0);
#ifdef UNIV_SYNC_DEBUG
buf_page_dbg_add_level(page, SYNC_TRX_SYS_HEADER);
#endif /* UNIV_SYNC_DEBUG */
mlog_write_ulint(page + FIL_PAGE_TYPE, FIL_PAGE_TYPE_TRX_SYS,
- MLOG_2BYTES, mtr);
+ MLOG_2BYTES, mtr);
sys_header = trx_sysf_get(mtr);
/* Start counting transaction ids from number 1 up */
mlog_write_dulint(sys_header + TRX_SYS_TRX_ID_STORE,
- ut_dulint_create(0, 1), mtr);
+ ut_dulint_create(0, 1), mtr);
/* Reset the rollback segment slots */
for (i = 0; i < TRX_SYS_N_RSEGS; i++) {
@@ -838,7 +877,7 @@ trx_sysf_create(
/* Create the first rollback segment in the SYSTEM tablespace */
page_no = trx_rseg_header_create(TRX_SYS_SPACE, ULINT_MAX, &slot_no,
- mtr);
+ mtr);
ut_a(slot_no == TRX_SYS_SYSTEM_RSEG_ID);
ut_a(page_no != FIL_NULL);
@@ -880,12 +919,12 @@ trx_sys_init_at_db_start(void)
to the disk-based header! Thus trx id values will not overlap when
the database is repeatedly started! */
- trx_sys->max_trx_id = ut_dulint_add(
- ut_dulint_align_up(
- mtr_read_dulint(sys_header
- + TRX_SYS_TRX_ID_STORE, &mtr),
- TRX_SYS_TRX_ID_WRITE_MARGIN),
- 2 * TRX_SYS_TRX_ID_WRITE_MARGIN);
+ trx_sys->max_trx_id = ut_dulint_add
+ (ut_dulint_align_up(mtr_read_dulint
+ (sys_header
+ + TRX_SYS_TRX_ID_STORE, &mtr),
+ TRX_SYS_TRX_ID_WRITE_MARGIN),
+ 2 * TRX_SYS_TRX_ID_WRITE_MARGIN);
UT_LIST_INIT(trx_sys->mysql_trx_list);
trx_lists_init_at_db_start();
@@ -896,8 +935,8 @@ trx_sys_init_at_db_start(void)
for (;;) {
if ( trx->conc_state != TRX_PREPARED) {
- rows_to_undo +=
- ut_conv_dulint_to_longlong(trx->undo_no);
+ rows_to_undo += ut_conv_dulint_to_longlong
+ (trx->undo_no);
}
trx = UT_LIST_GET_NEXT(trx_list, trx);
@@ -913,10 +952,11 @@ trx_sys_init_at_db_start(void)
}
fprintf(stderr,
-"InnoDB: %lu transaction(s) which must be rolled back or cleaned up\n"
-"InnoDB: in total %lu%s row operations to undo\n",
- (ulong) UT_LIST_GET_LEN(trx_sys->trx_list),
- (ulong) rows_to_undo, unit);
+ "InnoDB: %lu transaction(s) which must be"
+ " rolled back or cleaned up\n"
+ "InnoDB: in total %lu%s row operations to undo\n",
+ (ulong) UT_LIST_GET_LEN(trx_sys->trx_list),
+ (ulong) rows_to_undo, unit);
fprintf(stderr, "InnoDB: Trx id counter is %lu %lu\n",
(ulong) ut_dulint_get_high(trx_sys->max_trx_id),
diff --git a/storage/innobase/trx/trx0trx.c b/storage/innobase/trx/trx0trx.c
index 50ede8a6ff1..78b9e2446cb 100644
--- a/storage/innobase/trx/trx0trx.c
+++ b/storage/innobase/trx/trx0trx.c
@@ -75,7 +75,7 @@ trx_set_detailed_error_from_file(
FILE* file) /* in: file to read message from */
{
os_file_read_string(file, trx->detailed_error,
- sizeof(trx->detailed_error));
+ sizeof(trx->detailed_error));
}
/********************************************************************
@@ -286,21 +286,21 @@ trx_free(
if (trx->declared_to_be_inside_innodb) {
ut_print_timestamp(stderr);
- fputs(
-" InnoDB: Error: Freeing a trx which is declared to be processing\n"
-"InnoDB: inside InnoDB.\n", stderr);
+ fputs(" InnoDB: Error: Freeing a trx which is declared"
+ " to be processing\n"
+ "InnoDB: inside InnoDB.\n", stderr);
trx_print(stderr, trx, 600);
putc('\n', stderr);
}
if (trx->n_mysql_tables_in_use != 0
- || trx->mysql_n_tables_locked != 0) {
+ || trx->mysql_n_tables_locked != 0) {
ut_print_timestamp(stderr);
fprintf(stderr,
-" InnoDB: Error: MySQL is freeing a thd\n"
-"InnoDB: though trx->n_mysql_tables_in_use is %lu\n"
-"InnoDB: and trx->mysql_n_tables_locked is %lu.\n",
+ " InnoDB: Error: MySQL is freeing a thd\n"
+ "InnoDB: though trx->n_mysql_tables_in_use is %lu\n"
+ "InnoDB: and trx->mysql_n_tables_locked is %lu.\n",
(ulong)trx->n_mysql_tables_in_use,
(ulong)trx->mysql_n_tables_locked);
@@ -428,7 +428,7 @@ trx_list_insert_ordered(
UT_LIST_ADD_FIRST(trx_list, trx_sys->trx_list, trx);
} else {
UT_LIST_INSERT_AFTER(trx_list, trx_sys->trx_list,
- trx2, trx);
+ trx2, trx);
}
} else {
UT_LIST_ADD_LAST(trx_list, trx_sys->trx_list, trx);
@@ -478,22 +478,28 @@ trx_lists_init_at_db_start(void)
if (undo->state == TRX_UNDO_PREPARED) {
fprintf(stderr,
-"InnoDB: Transaction %lu %lu was in the XA prepared state.\n",
- ut_dulint_get_high(trx->id),
- ut_dulint_get_low(trx->id));
+ "InnoDB: Transaction %lu %lu"
+ " was in the"
+ " XA prepared state.\n",
+ ut_dulint_get_high(trx->id),
+ ut_dulint_get_low(trx->id));
if (srv_force_recovery == 0) {
trx->conc_state = TRX_PREPARED;
} else {
fprintf(stderr,
-"InnoDB: Since innodb_force_recovery > 0, we will rollback it anyway.\n");
+ "InnoDB: Since"
+ " innodb_force_recovery"
+ " > 0, we will"
+ " rollback it"
+ " anyway.\n");
trx->conc_state = TRX_ACTIVE;
}
} else {
- trx->conc_state =
- TRX_COMMITTED_IN_MEMORY;
+ trx->conc_state
+ = TRX_COMMITTED_IN_MEMORY;
}
/* We give a dummy value for the trx no;
@@ -520,7 +526,7 @@ trx_lists_init_at_db_start(void)
if (!undo->empty) {
trx->undo_no = ut_dulint_add(undo->top_undo_no,
- 1);
+ 1);
}
trx_list_insert_ordered(trx);
@@ -547,24 +553,32 @@ trx_lists_init_at_db_start(void)
if (undo->state == TRX_UNDO_PREPARED) {
fprintf(stderr,
-"InnoDB: Transaction %lu %lu was in the XA prepared state.\n",
- ut_dulint_get_high(trx->id),
- ut_dulint_get_low(trx->id));
+ "InnoDB: Transaction"
+ " %lu %lu was in the"
+ " XA prepared state.\n",
+ ut_dulint_get_high
+ (trx->id),
+ ut_dulint_get_low
+ (trx->id));
if (srv_force_recovery == 0) {
- trx->conc_state =
- TRX_PREPARED;
+ trx->conc_state
+ = TRX_PREPARED;
} else {
fprintf(stderr,
-"InnoDB: Since innodb_force_recovery > 0, we will rollback it anyway.\n");
-
- trx->conc_state =
- TRX_ACTIVE;
+ "InnoDB: Since"
+ " innodb_force_recovery"
+ " > 0, we will"
+ " rollback it"
+ " anyway.\n");
+
+ trx->conc_state
+ = TRX_ACTIVE;
}
} else {
- trx->conc_state =
- TRX_COMMITTED_IN_MEMORY;
+ trx->conc_state
+ = TRX_COMMITTED_IN_MEMORY;
}
/* We give a dummy value for the trx
@@ -585,8 +599,8 @@ trx_lists_init_at_db_start(void)
trx_list_insert_ordered(trx);
if (undo->dict_operation) {
- trx->dict_operation =
- undo->dict_operation;
+ trx->dict_operation
+ = undo->dict_operation;
trx->table_id = undo->table_id;
}
}
@@ -594,11 +608,11 @@ trx_lists_init_at_db_start(void)
trx->update_undo = undo;
if ((!undo->empty)
- && (ut_dulint_cmp(undo->top_undo_no,
- trx->undo_no) >= 0)) {
+ && (ut_dulint_cmp(undo->top_undo_no,
+ trx->undo_no) >= 0)) {
trx->undo_no = ut_dulint_add(undo->top_undo_no,
- 1);
+ 1);
}
undo = UT_LIST_GET_NEXT(undo_list, undo);
@@ -635,7 +649,7 @@ loop:
it */
if ((rseg->id == TRX_SYS_SYSTEM_RSEG_ID)
- && (UT_LIST_GET_LEN(trx_sys->rseg_list) > 1)) {
+ && (UT_LIST_GET_LEN(trx_sys->rseg_list) > 1)) {
goto loop;
}
@@ -761,7 +775,7 @@ trx_commit_off_kernel(
if (trx->insert_undo != NULL) {
trx_undo_set_state_at_finish(trx, trx->insert_undo,
- &mtr);
+ &mtr);
}
undo = trx->update_undo;
@@ -776,8 +790,8 @@ trx_commit_off_kernel(
because only a single OS thread is allowed to do the
transaction commit for this transaction. */
- update_hdr_page = trx_undo_set_state_at_finish(trx,
- undo, &mtr);
+ update_hdr_page = trx_undo_set_state_at_finish
+ (trx, undo, &mtr);
/* We have to do the cleanup for the update log while
holding the rseg mutex because update log headers
@@ -794,20 +808,20 @@ trx_commit_off_kernel(
server is a MySQL replication slave */
if (trx->mysql_log_file_name
- && trx->mysql_log_file_name[0] != '\0') {
- trx_sys_update_mysql_binlog_offset(
- trx->mysql_log_file_name,
- trx->mysql_log_offset,
- TRX_SYS_MYSQL_LOG_INFO, &mtr);
+ && trx->mysql_log_file_name[0] != '\0') {
+ trx_sys_update_mysql_binlog_offset
+ (trx->mysql_log_file_name,
+ trx->mysql_log_offset,
+ TRX_SYS_MYSQL_LOG_INFO, &mtr);
trx->mysql_log_file_name = NULL;
}
if (trx->mysql_master_log_file_name[0] != '\0') {
/* This database server is a MySQL replication slave */
- trx_sys_update_mysql_binlog_offset(
- trx->mysql_master_log_file_name,
- trx->mysql_master_log_pos,
- TRX_SYS_MYSQL_MASTER_LOG_INFO, &mtr);
+ trx_sys_update_mysql_binlog_offset
+ (trx->mysql_master_log_file_name,
+ trx->mysql_master_log_pos,
+ TRX_SYS_MYSQL_MASTER_LOG_INFO, &mtr);
}
/* The following call commits the mini-transaction, making the
@@ -836,7 +850,7 @@ trx_commit_off_kernel(
}
ut_ad(trx->conc_state == TRX_ACTIVE
- || trx->conc_state == TRX_PREPARED);
+ || trx->conc_state == TRX_PREPARED);
#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&kernel_mutex));
#endif /* UNIV_SYNC_DEBUG */
@@ -916,7 +930,7 @@ trx_commit_off_kernel(
/* Write the log but do not flush it to disk */
log_write_up_to(lsn, LOG_WAIT_ONE_GROUP,
- FALSE);
+ FALSE);
} else {
/* Write the log to the log files AND flush
them to disk */
@@ -996,8 +1010,8 @@ trx_assign_read_view(
mutex_enter(&kernel_mutex);
if (!trx->read_view) {
- trx->read_view = read_view_open_now(trx->id,
- trx->global_read_view_heap);
+ trx->read_view = read_view_open_now
+ (trx->id, trx->global_read_view_heap);
trx->global_read_view = trx->read_view;
}
@@ -1286,7 +1300,7 @@ trx_sig_send(
receiver_trx = thr_get_trx(receiver_thr);
UT_LIST_ADD_LAST(reply_signals, receiver_trx->reply_signals,
- sig);
+ sig);
}
if (trx->sess->state == SESS_ERROR) {
@@ -1411,7 +1425,7 @@ loop:
trx_handle_commit_sig_off_kernel(trx, next_thr);
} else if ((type == TRX_SIG_TOTAL_ROLLBACK)
- || (type == TRX_SIG_ROLLBACK_TO_SAVEPT)) {
+ || (type == TRX_SIG_ROLLBACK_TO_SAVEPT)) {
trx_rollback(trx, sig, next_thr);
@@ -1467,7 +1481,7 @@ trx_sig_reply(
receiver_trx = thr_get_trx(sig->receiver);
UT_LIST_REMOVE(reply_signals, receiver_trx->reply_signals,
- sig);
+ sig);
ut_ad(receiver_trx->sess->state != SESS_ERROR);
que_thr_end_wait(sig->receiver, next_thr);
@@ -1551,7 +1565,7 @@ trx_commit_step(
/* Send the commit signal to the transaction */
trx_sig_send(thr_get_trx(thr), TRX_SIG_COMMIT, TRX_SIG_SELF,
- thr, NULL, &next_thr);
+ thr, NULL, &next_thr);
mutex_exit(&kernel_mutex);
@@ -1679,25 +1693,25 @@ trx_print(
fprintf(f, "TRANSACTION %lu %lu",
(ulong) ut_dulint_get_high(trx->id),
- (ulong) ut_dulint_get_low(trx->id));
+ (ulong) ut_dulint_get_low(trx->id));
switch (trx->conc_state) {
- case TRX_NOT_STARTED:
- fputs(", not started", f);
- break;
- case TRX_ACTIVE:
- fprintf(f, ", ACTIVE %lu sec",
- (ulong)difftime(time(NULL), trx->start_time));
- break;
- case TRX_PREPARED:
- fprintf(f, ", ACTIVE (PREPARED) %lu sec",
- (ulong)difftime(time(NULL), trx->start_time));
- break;
- case TRX_COMMITTED_IN_MEMORY:
- fputs(", COMMITTED IN MEMORY", f);
- break;
- default:
- fprintf(f, " state %lu", (ulong) trx->conc_state);
+ case TRX_NOT_STARTED:
+ fputs(", not started", f);
+ break;
+ case TRX_ACTIVE:
+ fprintf(f, ", ACTIVE %lu sec",
+ (ulong)difftime(time(NULL), trx->start_time));
+ break;
+ case TRX_PREPARED:
+ fprintf(f, ", ACTIVE (PREPARED) %lu sec",
+ (ulong)difftime(time(NULL), trx->start_time));
+ break;
+ case TRX_COMMITTED_IN_MEMORY:
+ fputs(", COMMITTED IN MEMORY", f);
+ break;
+ default:
+ fprintf(f, " state %lu", (ulong) trx->conc_state);
}
#ifdef UNIV_LINUX
@@ -1724,27 +1738,27 @@ trx_print(
if (trx->n_mysql_tables_in_use > 0 || trx->mysql_n_tables_locked > 0) {
fprintf(f, "mysql tables in use %lu, locked %lu\n",
- (ulong) trx->n_mysql_tables_in_use,
- (ulong) trx->mysql_n_tables_locked);
+ (ulong) trx->n_mysql_tables_in_use,
+ (ulong) trx->mysql_n_tables_locked);
}
newline = TRUE;
switch (trx->que_state) {
- case TRX_QUE_RUNNING:
- newline = FALSE; break;
- case TRX_QUE_LOCK_WAIT:
- fputs("LOCK WAIT ", f); break;
- case TRX_QUE_ROLLING_BACK:
- fputs("ROLLING BACK ", f); break;
- case TRX_QUE_COMMITTING:
- fputs("COMMITTING ", f); break;
- default:
- fprintf(f, "que state %lu ", (ulong) trx->que_state);
- }
-
- if (0 < UT_LIST_GET_LEN(trx->trx_locks) ||
- mem_heap_get_size(trx->lock_heap) > 400) {
+ case TRX_QUE_RUNNING:
+ newline = FALSE; break;
+ case TRX_QUE_LOCK_WAIT:
+ fputs("LOCK WAIT ", f); break;
+ case TRX_QUE_ROLLING_BACK:
+ fputs("ROLLING BACK ", f); break;
+ case TRX_QUE_COMMITTING:
+ fputs("COMMITTING ", f); break;
+ default:
+ fprintf(f, "que state %lu ", (ulong) trx->que_state);
+ }
+
+ if (0 < UT_LIST_GET_LEN(trx->trx_locks)
+ || mem_heap_get_size(trx->lock_heap) > 400) {
newline = TRUE;
fprintf(f, "%lu lock struct(s), heap size %lu",
@@ -1817,12 +1831,12 @@ trx_prepare_off_kernel(
transaction prepare for this transaction. */
trx_undo_set_state_at_prepare(trx, trx->insert_undo,
- &mtr);
+ &mtr);
}
if (trx->update_undo) {
- update_hdr_page = trx_undo_set_state_at_prepare(trx,
- trx->update_undo, &mtr);
+ update_hdr_page = trx_undo_set_state_at_prepare
+ (trx, trx->update_undo, &mtr);
}
mutex_exit(&(rseg->mutex));
@@ -1872,7 +1886,7 @@ trx_prepare_off_kernel(
/* Write the log but do not flush it to disk */
log_write_up_to(lsn, LOG_WAIT_ONE_GROUP,
- FALSE);
+ FALSE);
} else {
/* Write the log to the log files AND flush
them to disk */
@@ -1954,19 +1968,23 @@ trx_recover_for_mysql(
if (count == 0) {
ut_print_timestamp(stderr);
fprintf(stderr,
-" InnoDB: Starting recovery for XA transactions...\n");
+ " InnoDB: Starting recovery for"
+ " XA transactions...\n");
}
ut_print_timestamp(stderr);
fprintf(stderr,
-" InnoDB: Transaction %lu %lu in prepared state after recovery\n",
+ " InnoDB: Transaction %lu %lu in"
+ " prepared state after recovery\n",
(ulong) ut_dulint_get_high(trx->id),
(ulong) ut_dulint_get_low(trx->id));
ut_print_timestamp(stderr);
fprintf(stderr,
-" InnoDB: Transaction contains changes to %lu rows\n",
- (ulong)ut_conv_dulint_to_longlong(trx->undo_no));
+ " InnoDB: Transaction contains changes"
+ " to %lu rows\n",
+ (ulong) ut_conv_dulint_to_longlong
+ (trx->undo_no));
count++;
@@ -1983,7 +2001,8 @@ trx_recover_for_mysql(
if (count > 0){
ut_print_timestamp(stderr);
fprintf(stderr,
-" InnoDB: %lu transactions in prepared state after recovery\n",
+ " InnoDB: %lu transactions in prepared state"
+ " after recovery\n",
(ulong) count);
}
@@ -2017,11 +2036,10 @@ trx_get_trx_by_xid(
of gtrid_lenght+bqual_length bytes should be
the same */
- if (xid->gtrid_length == trx->xid.gtrid_length &&
- xid->bqual_length == trx->xid.bqual_length &&
- memcmp(xid->data, trx->xid.data,
- xid->gtrid_length +
- xid->bqual_length) == 0) {
+ if (xid->gtrid_length == trx->xid.gtrid_length
+ && xid->bqual_length == trx->xid.bqual_length
+ && memcmp(xid->data, trx->xid.data,
+ xid->gtrid_length + xid->bqual_length) == 0) {
break;
}
diff --git a/storage/innobase/trx/trx0undo.c b/storage/innobase/trx/trx0undo.c
index bba1a4d6996..db33c515c34 100644
--- a/storage/innobase/trx/trx0undo.c
+++ b/storage/innobase/trx/trx0undo.c
@@ -145,17 +145,16 @@ trx_undo_get_prev_rec_from_prev_page(
undo_page = buf_frame_align(rec);
prev_page_no = flst_get_prev_addr(undo_page + TRX_UNDO_PAGE_HDR
- + TRX_UNDO_PAGE_NODE, mtr)
- .page;
+ + TRX_UNDO_PAGE_NODE, mtr)
+ .page;
if (prev_page_no == FIL_NULL) {
return(NULL);
}
- prev_page = trx_undo_page_get_s_latched(
- buf_frame_get_space_id(undo_page),
- prev_page_no, mtr);
+ prev_page = trx_undo_page_get_s_latched
+ (buf_frame_get_space_id(undo_page), prev_page_no, mtr);
return(trx_undo_page_get_last_rec(prev_page, page_no, offset));
}
@@ -186,7 +185,7 @@ trx_undo_get_prev_rec(
previous record */
return(trx_undo_get_prev_rec_from_prev_page(rec, page_no, offset,
- mtr));
+ mtr));
}
/***************************************************************************
@@ -223,8 +222,8 @@ trx_undo_get_next_rec_from_next_page(
space = buf_frame_get_space_id(undo_page);
next_page_no = flst_get_next_addr(undo_page + TRX_UNDO_PAGE_HDR
- + TRX_UNDO_PAGE_NODE, mtr)
- .page;
+ + TRX_UNDO_PAGE_NODE, mtr)
+ .page;
if (next_page_no == FIL_NULL) {
return(NULL);
@@ -232,7 +231,7 @@ trx_undo_get_next_rec_from_next_page(
if (mode == RW_S_LATCH) {
next_page = trx_undo_page_get_s_latched(space, next_page_no,
- mtr);
+ mtr);
} else {
ut_ad(mode == RW_X_LATCH);
next_page = trx_undo_page_get(space, next_page_no, mtr);
@@ -263,8 +262,8 @@ trx_undo_get_next_rec(
}
return(trx_undo_get_next_rec_from_next_page(buf_frame_align(rec),
- page_no, offset,
- RW_S_LATCH, mtr));
+ page_no, offset,
+ RW_S_LATCH, mtr));
}
/***************************************************************************
@@ -297,7 +296,7 @@ trx_undo_get_first_rec(
}
return(trx_undo_get_next_rec_from_next_page(undo_page, page_no, offset,
- mode, mtr));
+ mode, mtr));
}
/*============== UNDO LOG FILE COPY CREATION AND FREEING ==================*/
@@ -362,9 +361,9 @@ trx_undo_page_init(
mach_write_to_2(page_hdr + TRX_UNDO_PAGE_TYPE, type);
mach_write_to_2(page_hdr + TRX_UNDO_PAGE_START,
- TRX_UNDO_PAGE_HDR + TRX_UNDO_PAGE_HDR_SIZE);
+ TRX_UNDO_PAGE_HDR + TRX_UNDO_PAGE_HDR_SIZE);
mach_write_to_2(page_hdr + TRX_UNDO_PAGE_FREE,
- TRX_UNDO_PAGE_HDR + TRX_UNDO_PAGE_HDR_SIZE);
+ TRX_UNDO_PAGE_HDR + TRX_UNDO_PAGE_HDR_SIZE);
fil_page_set_type(undo_page, FIL_PAGE_UNDO_LOG);
@@ -400,16 +399,18 @@ trx_undo_seg_create(
ut_ad(mutex_own(&(rseg->mutex)));
#endif /* UNIV_SYNC_DEBUG */
-/* fputs(type == TRX_UNDO_INSERT
- ? "Creating insert undo log segment\n"
- : "Creating update undo log segment\n", stderr); */
+ /* fputs(type == TRX_UNDO_INSERT
+ ? "Creating insert undo log segment\n"
+ : "Creating update undo log segment\n", stderr); */
slot_no = trx_rsegf_undo_find_free(rseg_hdr, mtr);
if (slot_no == ULINT_UNDEFINED) {
ut_print_timestamp(stderr);
fprintf(stderr,
-"InnoDB: Warning: cannot find a free slot for an undo log. Do you have too\n"
-"InnoDB: many active transactions running concurrently?\n");
+ "InnoDB: Warning: cannot find a free slot for"
+ " an undo log. Do you have too\n"
+ "InnoDB: many active transactions"
+ " running concurrently?\n");
return(NULL);
}
@@ -417,7 +418,7 @@ trx_undo_seg_create(
space = buf_frame_get_space_id(rseg_hdr);
success = fsp_reserve_free_extents(&n_reserved, space, 2, FSP_UNDO,
- mtr);
+ mtr);
if (!success) {
return(NULL);
@@ -425,7 +426,8 @@ trx_undo_seg_create(
/* Allocate a new file segment for the undo log */
undo_page = fseg_create_general(space, 0,
- TRX_UNDO_SEG_HDR + TRX_UNDO_FSEG_HEADER, TRUE, mtr);
+ TRX_UNDO_SEG_HDR
+ + TRX_UNDO_FSEG_HEADER, TRUE, mtr);
fil_space_release_free_extents(space, n_reserved);
@@ -445,18 +447,18 @@ trx_undo_seg_create(
trx_undo_page_init(undo_page, type, mtr);
mlog_write_ulint(page_hdr + TRX_UNDO_PAGE_FREE,
- TRX_UNDO_SEG_HDR + TRX_UNDO_SEG_HDR_SIZE,
- MLOG_2BYTES, mtr);
+ TRX_UNDO_SEG_HDR + TRX_UNDO_SEG_HDR_SIZE,
+ MLOG_2BYTES, mtr);
mlog_write_ulint(seg_hdr + TRX_UNDO_LAST_LOG, 0, MLOG_2BYTES, mtr);
flst_init(seg_hdr + TRX_UNDO_PAGE_LIST, mtr);
flst_add_last(seg_hdr + TRX_UNDO_PAGE_LIST,
- page_hdr + TRX_UNDO_PAGE_NODE, mtr);
+ page_hdr + TRX_UNDO_PAGE_NODE, mtr);
trx_rsegf_set_nth_undo(rseg_hdr, slot_no,
- buf_frame_get_page_no(undo_page), mtr);
+ buf_frame_get_page_no(undo_page), mtr);
*id = slot_no;
return(undo_page);
@@ -560,16 +562,16 @@ trx_undo_write_xid(
mtr_t* mtr) /* in: mtr */
{
mlog_write_ulint(log_hdr + TRX_UNDO_XA_FORMAT,
- (ulint)xid->formatID, MLOG_4BYTES, mtr);
+ (ulint)xid->formatID, MLOG_4BYTES, mtr);
mlog_write_ulint(log_hdr + TRX_UNDO_XA_TRID_LEN,
- (ulint)xid->gtrid_length, MLOG_4BYTES, mtr);
+ (ulint)xid->gtrid_length, MLOG_4BYTES, mtr);
mlog_write_ulint(log_hdr + TRX_UNDO_XA_BQUAL_LEN,
- (ulint)xid->bqual_length, MLOG_4BYTES, mtr);
+ (ulint)xid->bqual_length, MLOG_4BYTES, mtr);
mlog_write_string(log_hdr + TRX_UNDO_XA_XID, (const byte*) xid->data,
- XIDDATASIZE, mtr);
+ XIDDATASIZE, mtr);
}
/************************************************************************
@@ -583,10 +585,10 @@ trx_undo_read_xid(
{
xid->formatID = (long)mach_read_from_4(log_hdr + TRX_UNDO_XA_FORMAT);
- xid->gtrid_length =
- (long)mach_read_from_4(log_hdr + TRX_UNDO_XA_TRID_LEN);
- xid->bqual_length =
- (long)mach_read_from_4(log_hdr + TRX_UNDO_XA_BQUAL_LEN);
+ xid->gtrid_length
+ = (long) mach_read_from_4(log_hdr + TRX_UNDO_XA_TRID_LEN);
+ xid->bqual_length
+ = (long) mach_read_from_4(log_hdr + TRX_UNDO_XA_BQUAL_LEN);
memcpy(xid->data, log_hdr + TRX_UNDO_XA_XID, XIDDATASIZE);
}
@@ -614,19 +616,19 @@ trx_undo_header_add_space_for_xid(
ut_a(free == (ulint)(log_hdr - undo_page) + TRX_UNDO_LOG_OLD_HDR_SIZE);
new_free = free + (TRX_UNDO_LOG_XA_HDR_SIZE
- - TRX_UNDO_LOG_OLD_HDR_SIZE);
+ - TRX_UNDO_LOG_OLD_HDR_SIZE);
/* Add space for a XID after the header, update the free offset
fields on the undo log page and in the undo log header */
mlog_write_ulint(page_hdr + TRX_UNDO_PAGE_START, new_free,
- MLOG_2BYTES, mtr);
+ MLOG_2BYTES, mtr);
mlog_write_ulint(page_hdr + TRX_UNDO_PAGE_FREE, new_free,
- MLOG_2BYTES, mtr);
+ MLOG_2BYTES, mtr);
mlog_write_ulint(log_hdr + TRX_UNDO_LOG_START, new_free,
- MLOG_2BYTES, mtr);
+ MLOG_2BYTES, mtr);
}
/**************************************************************************
@@ -715,8 +717,8 @@ trx_undo_insert_header_reuse(
the space on the page */
ut_a(mach_read_from_2(undo_page + TRX_UNDO_PAGE_HDR
- + TRX_UNDO_PAGE_TYPE)
- == TRX_UNDO_INSERT);
+ + TRX_UNDO_PAGE_TYPE)
+ == TRX_UNDO_INSERT);
mach_write_to_2(page_hdr + TRX_UNDO_PAGE_START, new_free);
@@ -800,7 +802,8 @@ trx_undo_discard_latest_update_undo(
prev_log_hdr = undo_page + prev_hdr_offset;
mach_write_to_2(page_hdr + TRX_UNDO_PAGE_START,
- mach_read_from_2(prev_log_hdr + TRX_UNDO_LOG_START));
+ mach_read_from_2(prev_log_hdr
+ + TRX_UNDO_LOG_START));
mach_write_to_2(prev_log_hdr + TRX_UNDO_NEXT_LOG, 0);
}
@@ -849,16 +852,16 @@ trx_undo_add_page(
header_page = trx_undo_page_get(undo->space, undo->hdr_page_no, mtr);
success = fsp_reserve_free_extents(&n_reserved, undo->space, 1,
- FSP_UNDO, mtr);
+ FSP_UNDO, mtr);
if (!success) {
return(FIL_NULL);
}
page_no = fseg_alloc_free_page_general(header_page + TRX_UNDO_SEG_HDR
- + TRX_UNDO_FSEG_HEADER,
- undo->top_page_no + 1, FSP_UP,
- TRUE, mtr);
+ + TRX_UNDO_FSEG_HEADER,
+ undo->top_page_no + 1, FSP_UP,
+ TRUE, mtr);
fil_space_release_free_extents(undo->space, n_reserved);
@@ -876,7 +879,7 @@ trx_undo_add_page(
trx_undo_page_init(new_page, undo->type, mtr);
flst_add_last(header_page + TRX_UNDO_SEG_HDR + TRX_UNDO_PAGE_LIST,
- new_page + TRX_UNDO_PAGE_HDR + TRX_UNDO_PAGE_NODE, mtr);
+ new_page + TRX_UNDO_PAGE_HDR + TRX_UNDO_PAGE_NODE, mtr);
undo->size++;
rseg->curr_size++;
@@ -918,23 +921,23 @@ trx_undo_free_page(
header_page = trx_undo_page_get(space, hdr_page_no, mtr);
flst_remove(header_page + TRX_UNDO_SEG_HDR + TRX_UNDO_PAGE_LIST,
- undo_page + TRX_UNDO_PAGE_HDR + TRX_UNDO_PAGE_NODE, mtr);
+ undo_page + TRX_UNDO_PAGE_HDR + TRX_UNDO_PAGE_NODE, mtr);
fseg_free_page(header_page + TRX_UNDO_SEG_HDR + TRX_UNDO_FSEG_HEADER,
- space, page_no, mtr);
+ space, page_no, mtr);
last_addr = flst_get_last(header_page + TRX_UNDO_SEG_HDR
- + TRX_UNDO_PAGE_LIST, mtr);
+ + TRX_UNDO_PAGE_LIST, mtr);
rseg->curr_size--;
if (in_history) {
rseg_header = trx_rsegf_get(space, rseg->page_no, mtr);
hist_size = mtr_read_ulint(rseg_header + TRX_RSEG_HISTORY_SIZE,
- MLOG_4BYTES, mtr);
+ MLOG_4BYTES, mtr);
ut_ad(hist_size > 0);
mlog_write_ulint(rseg_header + TRX_RSEG_HISTORY_SIZE,
- hist_size - 1, MLOG_4BYTES, mtr);
+ hist_size - 1, MLOG_4BYTES, mtr);
}
return(last_addr.page);
@@ -963,7 +966,7 @@ trx_undo_free_page_in_rollback(
#endif /* UNIV_SYNC_DEBUG */
last_page_no = trx_undo_free_page(undo->rseg, FALSE, undo->space,
- undo->hdr_page_no, page_no, mtr);
+ undo->hdr_page_no, page_no, mtr);
undo->last_page_no = last_page_no;
undo->size--;
@@ -1030,7 +1033,7 @@ trx_undo_truncate_end(
undo_page = trx_undo_page_get(undo->space, last_page_no, &mtr);
rec = trx_undo_page_get_last_rec(undo_page, undo->hdr_page_no,
- undo->hdr_offset);
+ undo->hdr_offset);
for (;;) {
if (rec == NULL) {
if (last_page_no == undo->hdr_page_no) {
@@ -1038,13 +1041,13 @@ trx_undo_truncate_end(
goto function_exit;
}
- trx_undo_free_page_in_rollback(trx, undo,
- last_page_no, &mtr);
+ trx_undo_free_page_in_rollback
+ (trx, undo, last_page_no, &mtr);
break;
}
if (ut_dulint_cmp(trx_undo_rec_get_undo_no(rec), limit)
- >= 0) {
+ >= 0) {
/* Truncate at least this record off, maybe
more */
trunc_here = rec;
@@ -1053,8 +1056,8 @@ trx_undo_truncate_end(
}
rec = trx_undo_page_get_prev_rec(rec,
- undo->hdr_page_no,
- undo->hdr_offset);
+ undo->hdr_page_no,
+ undo->hdr_offset);
}
mtr_commit(&mtr);
@@ -1063,8 +1066,8 @@ trx_undo_truncate_end(
function_exit:
if (trunc_here) {
mlog_write_ulint(undo_page + TRX_UNDO_PAGE_HDR
- + TRX_UNDO_PAGE_FREE,
- trunc_here - undo_page, MLOG_2BYTES, &mtr);
+ + TRX_UNDO_PAGE_FREE,
+ trunc_here - undo_page, MLOG_2BYTES, &mtr);
}
mtr_commit(&mtr);
@@ -1105,7 +1108,7 @@ loop:
mtr_start(&mtr);
rec = trx_undo_get_first_rec(space, hdr_page_no, hdr_offset,
- RW_X_LATCH, &mtr);
+ RW_X_LATCH, &mtr);
if (rec == NULL) {
/* Already empty */
@@ -1117,7 +1120,7 @@ loop:
undo_page = buf_frame_align(rec);
last_rec = trx_undo_page_get_last_rec(undo_page, hdr_page_no,
- hdr_offset);
+ hdr_offset);
if (ut_dulint_cmp(trx_undo_rec_get_undo_no(last_rec), limit) >= 0) {
mtr_commit(&mtr);
@@ -1129,10 +1132,10 @@ loop:
if (page_no == hdr_page_no) {
trx_undo_empty_header_page(space, hdr_page_no, hdr_offset,
- &mtr);
+ &mtr);
} else {
trx_undo_free_page(rseg, TRUE, space, hdr_page_no,
- page_no, &mtr);
+ page_no, &mtr);
}
mtr_commit(&mtr);
@@ -1167,7 +1170,7 @@ trx_undo_seg_free(
mutex_enter(&(rseg->mutex));
seg_header = trx_undo_page_get(undo->space, undo->hdr_page_no,
- &mtr) + TRX_UNDO_SEG_HDR;
+ &mtr) + TRX_UNDO_SEG_HDR;
file_seg = seg_header + TRX_UNDO_FSEG_HEADER;
@@ -1176,9 +1179,9 @@ trx_undo_seg_free(
if (finished) {
/* Update the rseg header */
rseg_header = trx_rsegf_get(rseg->space, rseg->page_no,
- &mtr);
+ &mtr);
trx_rsegf_set_nth_undo(rseg_header, undo->id, FIL_NULL,
- &mtr);
+ &mtr);
}
mutex_exit(&(rseg->mutex));
@@ -1219,7 +1222,7 @@ trx_undo_mem_create_at_db_start(
if (id >= TRX_RSEG_N_SLOTS) {
fprintf(stderr,
- "InnoDB: Error: undo->id is %lu\n", (ulong) id);
+ "InnoDB: Error: undo->id is %lu\n", (ulong) id);
ut_error;
}
@@ -1228,7 +1231,7 @@ trx_undo_mem_create_at_db_start(
page_header = undo_page + TRX_UNDO_PAGE_HDR;
type = mtr_read_ulint(page_header + TRX_UNDO_PAGE_TYPE, MLOG_2BYTES,
- mtr);
+ mtr);
seg_header = undo_page + TRX_UNDO_SEG_HDR;
state = mach_read_from_2(seg_header + TRX_UNDO_STATE);
@@ -1240,7 +1243,7 @@ trx_undo_mem_create_at_db_start(
trx_id = mtr_read_dulint(undo_header + TRX_UNDO_TRX_ID, mtr);
xid_exists = mtr_read_ulint(undo_header + TRX_UNDO_XID_EXISTS,
- MLOG_1BYTE, mtr);
+ MLOG_1BYTE, mtr);
/* Read X/Open XA transaction identification if it exists, or
set it to NULL. */
@@ -1255,12 +1258,11 @@ trx_undo_mem_create_at_db_start(
mutex_enter(&(rseg->mutex));
undo = trx_undo_mem_create(rseg, id, type, trx_id, &xid,
- page_no, offset);
+ page_no, offset);
mutex_exit(&(rseg->mutex));
- undo->dict_operation = mtr_read_ulint(
- undo_header + TRX_UNDO_DICT_TRANS,
- MLOG_1BYTE, mtr);
+ undo->dict_operation = mtr_read_ulint
+ (undo_header + TRX_UNDO_DICT_TRANS, MLOG_1BYTE, mtr);
undo->table_id = mtr_read_dulint(undo_header + TRX_UNDO_TABLE_ID, mtr);
undo->state = state;
@@ -1292,19 +1294,19 @@ add_to_list:
if (type == TRX_UNDO_INSERT) {
if (state != TRX_UNDO_CACHED) {
UT_LIST_ADD_LAST(undo_list, rseg->insert_undo_list,
- undo);
+ undo);
} else {
UT_LIST_ADD_LAST(undo_list, rseg->insert_undo_cached,
- undo);
+ undo);
}
} else {
ut_ad(type == TRX_UNDO_UPDATE);
if (state != TRX_UNDO_CACHED) {
UT_LIST_ADD_LAST(undo_list, rseg->update_undo_list,
- undo);
+ undo);
} else {
UT_LIST_ADD_LAST(undo_list, rseg->update_undo_cached,
- undo);
+ undo);
}
}
@@ -1348,10 +1350,10 @@ trx_undo_lists_init(
high */
if (page_no != FIL_NULL
- && srv_force_recovery < SRV_FORCE_NO_UNDO_LOG_SCAN) {
+ && srv_force_recovery < SRV_FORCE_NO_UNDO_LOG_SCAN) {
undo = trx_undo_mem_create_at_db_start(rseg, i,
- page_no, &mtr);
+ page_no, &mtr);
size += undo->size;
mtr_commit(&mtr);
@@ -1359,7 +1361,7 @@ trx_undo_lists_init(
mtr_start(&mtr);
rseg_header = trx_rsegf_get(rseg->space,
- rseg->page_no, &mtr);
+ rseg->page_no, &mtr);
}
}
@@ -1393,7 +1395,7 @@ trx_undo_mem_create(
if (id >= TRX_RSEG_N_SLOTS) {
fprintf(stderr,
- "InnoDB: Error: undo->id is %lu\n", (ulong) id);
+ "InnoDB: Error: undo->id is %lu\n", (ulong) id);
ut_error;
}
@@ -1468,7 +1470,7 @@ trx_undo_mem_free(
{
if (undo->id >= TRX_RSEG_N_SLOTS) {
fprintf(stderr,
- "InnoDB: Error: undo->id is %lu\n", (ulong) undo->id);
+ "InnoDB: Error: undo->id is %lu\n", (ulong) undo->id);
ut_error;
}
@@ -1528,11 +1530,11 @@ trx_undo_create(
if (trx->support_xa) {
trx_undo_header_add_space_for_xid(undo_page,
- undo_page + offset, mtr);
+ undo_page + offset, mtr);
}
undo = trx_undo_mem_create(rseg, id, type, trx_id, xid,
- page_no, offset);
+ page_no, offset);
return(undo);
}
@@ -1599,19 +1601,19 @@ trx_undo_reuse_cached(
offset = trx_undo_insert_header_reuse(undo_page, trx_id, mtr);
if (trx->support_xa) {
- trx_undo_header_add_space_for_xid(undo_page,
- undo_page + offset, mtr);
+ trx_undo_header_add_space_for_xid
+ (undo_page, undo_page + offset, mtr);
}
} else {
ut_a(mach_read_from_2(undo_page + TRX_UNDO_PAGE_HDR
- + TRX_UNDO_PAGE_TYPE)
- == TRX_UNDO_UPDATE);
+ + TRX_UNDO_PAGE_TYPE)
+ == TRX_UNDO_UPDATE);
offset = trx_undo_header_create(undo_page, trx_id, mtr);
if (trx->support_xa) {
- trx_undo_header_add_space_for_xid(undo_page,
- undo_page + offset, mtr);
+ trx_undo_header_add_space_for_xid
+ (undo_page, undo_page + offset, mtr);
}
}
@@ -1637,12 +1639,12 @@ trx_undo_mark_as_dict_operation(
hdr_page = trx_undo_page_get(undo->space, undo->hdr_page_no, mtr);
- mlog_write_ulint(hdr_page + undo->hdr_offset +
- TRX_UNDO_DICT_TRANS,
- trx->dict_operation, MLOG_1BYTE, mtr);
+ mlog_write_ulint(hdr_page + undo->hdr_offset
+ + TRX_UNDO_DICT_TRANS,
+ trx->dict_operation, MLOG_1BYTE, mtr);
mlog_write_dulint(hdr_page + undo->hdr_offset + TRX_UNDO_TABLE_ID,
- trx->table_id, mtr);
+ trx->table_id, mtr);
undo->dict_operation = trx->dict_operation;
undo->table_id = trx->table_id;
@@ -1681,10 +1683,10 @@ trx_undo_assign_undo(
mutex_enter(&(rseg->mutex));
undo = trx_undo_reuse_cached(trx, rseg, type, trx->id, &trx->xid,
- &mtr);
+ &mtr);
if (undo == NULL) {
undo = trx_undo_create(trx, rseg, type, trx->id, &trx->xid,
- &mtr);
+ &mtr);
if (undo == NULL) {
/* Did not succeed */
@@ -1747,7 +1749,7 @@ trx_undo_set_state_at_finish(
page_hdr = undo_page + TRX_UNDO_PAGE_HDR;
if (undo->size == 1 && mach_read_from_2(page_hdr + TRX_UNDO_PAGE_FREE)
- < TRX_UNDO_PAGE_REUSE_LIMIT) {
+ < TRX_UNDO_PAGE_REUSE_LIMIT) {
state = TRX_UNDO_CACHED;
} else if (undo->type == TRX_UNDO_INSERT) {
@@ -1808,7 +1810,7 @@ trx_undo_set_state_at_prepare(
undo_header = undo_page + offset;
mlog_write_ulint(undo_header + TRX_UNDO_XID_EXISTS,
- TRUE, MLOG_1BYTE, mtr);
+ TRUE, MLOG_1BYTE, mtr);
trx_undo_write_xid(undo_header, &undo->xid, mtr);
diff --git a/storage/innobase/ut/ut0byte.c b/storage/innobase/ut/ut0byte.c
index 18f57181827..b5467fde601 100644
--- a/storage/innobase/ut/ut0byte.c
+++ b/storage/innobase/ut/ut0byte.c
@@ -27,5 +27,5 @@ ut_dulint_sort(dulint* arr, dulint* aux_arr, ulint low, ulint high)
/*===============================================================*/
{
UT_SORT_FUNCTION_BODY(ut_dulint_sort, arr, aux_arr, low, high,
- ut_dulint_cmp);
+ ut_dulint_cmp);
}
diff --git a/storage/innobase/ut/ut0dbg.c b/storage/innobase/ut/ut0dbg.c
index 87960b98556..8c4be190d77 100644
--- a/storage/innobase/ut/ut0dbg.c
+++ b/storage/innobase/ut/ut0dbg.c
@@ -50,14 +50,16 @@ ut_dbg_assertion_failed(
"InnoDB: Failing assertion: %s\n", expr);
}
- fputs(
-"InnoDB: We intentionally generate a memory trap.\n"
-"InnoDB: Submit a detailed bug report to http://bugs.mysql.com.\n"
-"InnoDB: If you get repeated assertion failures or crashes, even\n"
-"InnoDB: immediately after the mysqld startup, there may be\n"
-"InnoDB: corruption in the InnoDB tablespace. Please refer to\n"
-"InnoDB: http://dev.mysql.com/doc/refman/5.1/en/forcing-recovery.html\n"
-"InnoDB: about forcing recovery.\n", stderr);
+ fputs("InnoDB: We intentionally generate a memory trap.\n"
+ "InnoDB: Submit a detailed bug report"
+ " to http://bugs.mysql.com.\n"
+ "InnoDB: If you get repeated assertion failures"
+ " or crashes, even\n"
+ "InnoDB: immediately after the mysqld startup, there may be\n"
+ "InnoDB: corruption in the InnoDB tablespace. Please refer to\n"
+ "InnoDB: http://dev.mysql.com/doc/refman/5.1/en/"
+ "forcing-recovery.html\n"
+ "InnoDB: about forcing recovery.\n", stderr);
#if defined(UNIV_SYNC_DEBUG) || !defined(UT_DBG_USE_ABORT)
ut_dbg_stop_threads = TRUE;
#endif
diff --git a/storage/innobase/ut/ut0mem.c b/storage/innobase/ut/ut0mem.c
index 4358edba8c0..4fd515c35e6 100644
--- a/storage/innobase/ut/ut0mem.c
+++ b/storage/innobase/ut/ut0mem.c
@@ -86,23 +86,31 @@ retry:
ut_print_timestamp(stderr);
fprintf(stderr,
- " InnoDB: Error: cannot allocate %lu bytes of\n"
- "InnoDB: memory with malloc! Total allocated memory\n"
- "InnoDB: by InnoDB %lu bytes. Operating system errno: %lu\n"
- "InnoDB: Check if you should increase the swap file or\n"
- "InnoDB: ulimits of your operating system.\n"
- "InnoDB: On FreeBSD check you have compiled the OS with\n"
- "InnoDB: a big enough maximum process size.\n"
- "InnoDB: Note that in most 32-bit computers the process\n"
- "InnoDB: memory space is limited to 2 GB or 4 GB.\n"
- "InnoDB: We keep retrying the allocation for 60 seconds...\n",
- (ulong) n, (ulong) ut_total_allocated_memory,
+ " InnoDB: Error: cannot allocate"
+ " %lu bytes of\n"
+ "InnoDB: memory with malloc!"
+ " Total allocated memory\n"
+ "InnoDB: by InnoDB %lu bytes."
+ " Operating system errno: %lu\n"
+ "InnoDB: Check if you should"
+ " increase the swap file or\n"
+ "InnoDB: ulimits of your operating system.\n"
+ "InnoDB: On FreeBSD check you"
+ " have compiled the OS with\n"
+ "InnoDB: a big enough maximum process size.\n"
+ "InnoDB: Note that in most 32-bit"
+ " computers the process\n"
+ "InnoDB: memory space is limited"
+ " to 2 GB or 4 GB.\n"
+ "InnoDB: We keep retrying"
+ " the allocation for 60 seconds...\n",
+ (ulong) n, (ulong) ut_total_allocated_memory,
#ifdef __WIN__
- (ulong) GetLastError()
+ (ulong) GetLastError()
#else
- (ulong) errno
+ (ulong) errno
#endif
- );
+ );
}
os_fast_mutex_unlock(&ut_list_mutex);
@@ -135,8 +143,9 @@ retry:
ut_print_timestamp(stderr);
fprintf(stderr,
- " InnoDB: We now intentionally generate a seg fault so that\n"
- "InnoDB: on Linux we get a stack trace.\n");
+ " InnoDB: We now intentionally"
+ " generate a seg fault so that\n"
+ "InnoDB: on Linux we get a stack trace.\n");
if (*ut_mem_null_ptr) ut_mem_null_ptr = 0;
} else {
@@ -159,7 +168,7 @@ retry:
ut_total_allocated_memory += n + sizeof(ut_mem_block_t);
UT_LIST_ADD_FIRST(mem_block_list, ut_mem_block_list,
- ((ut_mem_block_t*)ret));
+ ((ut_mem_block_t*)ret));
os_fast_mutex_unlock(&ut_list_mutex);
return((void*)((byte*)ret + sizeof(ut_mem_block_t)));
@@ -196,16 +205,20 @@ ut_test_malloc(
if (ret == NULL) {
ut_print_timestamp(stderr);
fprintf(stderr,
- " InnoDB: Error: cannot allocate %lu bytes of memory for\n"
- "InnoDB: a BLOB with malloc! Total allocated memory\n"
- "InnoDB: by InnoDB %lu bytes. Operating system errno: %d\n"
- "InnoDB: Check if you should increase the swap file or\n"
- "InnoDB: ulimits of your operating system.\n"
- "InnoDB: On FreeBSD check you have compiled the OS with\n"
- "InnoDB: a big enough maximum process size.\n",
- (ulong) n,
- (ulong) ut_total_allocated_memory,
- (int) errno);
+ " InnoDB: Error: cannot allocate"
+ " %lu bytes of memory for\n"
+ "InnoDB: a BLOB with malloc! Total allocated memory\n"
+ "InnoDB: by InnoDB %lu bytes."
+ " Operating system errno: %d\n"
+ "InnoDB: Check if you should increase"
+ " the swap file or\n"
+ "InnoDB: ulimits of your operating system.\n"
+ "InnoDB: On FreeBSD check you have"
+ " compiled the OS with\n"
+ "InnoDB: a big enough maximum process size.\n",
+ (ulong) n,
+ (ulong) ut_total_allocated_memory,
+ (int) errno);
return(FALSE);
}
@@ -338,8 +351,9 @@ ut_free_all_mem(void)
if (ut_total_allocated_memory != 0) {
fprintf(stderr,
-"InnoDB: Warning: after shutdown total allocated memory is %lu\n",
- (ulong) ut_total_allocated_memory);
+ "InnoDB: Warning: after shutdown"
+ " total allocated memory is %lu\n",
+ (ulong) ut_total_allocated_memory);
}
}
@@ -453,7 +467,7 @@ ut_strcount(
ulint len = strlen(s2);
if (len == 0) {
-
+
return(0);
}
@@ -461,7 +475,7 @@ ut_strcount(
s1 = strstr(s1, s2);
if (!s1) {
-
+
break;
}
@@ -495,19 +509,19 @@ ut_strreplace(
int len_delta = (int)s2_len - (int)s1_len;
str_end = str + str_len;
-
+
if (len_delta <= 0) {
- len_delta = 0;
+ len_delta = 0;
} else {
count = ut_strcount(str, s1);
}
-
+
new_str = mem_alloc(str_len + count * len_delta + 1);
ptr = new_str;
-
+
while (str) {
const char* next = strstr(str, s1);
-
+
if (!next) {
next = str_end;
}
@@ -516,17 +530,17 @@ ut_strreplace(
ptr += next - str;
if (next == str_end) {
-
+
break;
}
memcpy(ptr, s2, s2_len);
ptr += s2_len;
-
+
str = next + s1_len;
}
*ptr = '\0';
-
+
return(new_str);
}
diff --git a/storage/innobase/ut/ut0ut.c b/storage/innobase/ut/ut0ut.c
index 703e75872f6..10641b88a17 100644
--- a/storage/innobase/ut/ut0ut.c
+++ b/storage/innobase/ut/ut0ut.c
@@ -125,12 +125,12 @@ ut_print_timestamp(
GetLocalTime(&cal_tm);
fprintf(file,"%02d%02d%02d %2d:%02d:%02d",
- (int)cal_tm.wYear % 100,
- (int)cal_tm.wMonth,
- (int)cal_tm.wDay,
- (int)cal_tm.wHour,
- (int)cal_tm.wMinute,
- (int)cal_tm.wSecond);
+ (int)cal_tm.wYear % 100,
+ (int)cal_tm.wMonth,
+ (int)cal_tm.wDay,
+ (int)cal_tm.wHour,
+ (int)cal_tm.wMinute,
+ (int)cal_tm.wSecond);
#else
struct tm cal_tm;
struct tm* cal_tm_ptr;
@@ -145,12 +145,12 @@ ut_print_timestamp(
cal_tm_ptr = localtime(&tm);
#endif
fprintf(file,"%02d%02d%02d %2d:%02d:%02d",
- cal_tm_ptr->tm_year % 100,
- cal_tm_ptr->tm_mon + 1,
- cal_tm_ptr->tm_mday,
- cal_tm_ptr->tm_hour,
- cal_tm_ptr->tm_min,
- cal_tm_ptr->tm_sec);
+ cal_tm_ptr->tm_year % 100,
+ cal_tm_ptr->tm_mon + 1,
+ cal_tm_ptr->tm_mday,
+ cal_tm_ptr->tm_hour,
+ cal_tm_ptr->tm_min,
+ cal_tm_ptr->tm_sec);
#endif
}
@@ -168,12 +168,12 @@ ut_sprintf_timestamp(
GetLocalTime(&cal_tm);
sprintf(buf, "%02d%02d%02d %2d:%02d:%02d",
- (int)cal_tm.wYear % 100,
- (int)cal_tm.wMonth,
- (int)cal_tm.wDay,
- (int)cal_tm.wHour,
- (int)cal_tm.wMinute,
- (int)cal_tm.wSecond);
+ (int)cal_tm.wYear % 100,
+ (int)cal_tm.wMonth,
+ (int)cal_tm.wDay,
+ (int)cal_tm.wHour,
+ (int)cal_tm.wMinute,
+ (int)cal_tm.wSecond);
#else
struct tm cal_tm;
struct tm* cal_tm_ptr;
@@ -188,12 +188,12 @@ ut_sprintf_timestamp(
cal_tm_ptr = localtime(&tm);
#endif
sprintf(buf, "%02d%02d%02d %2d:%02d:%02d",
- cal_tm_ptr->tm_year % 100,
- cal_tm_ptr->tm_mon + 1,
- cal_tm_ptr->tm_mday,
- cal_tm_ptr->tm_hour,
- cal_tm_ptr->tm_min,
- cal_tm_ptr->tm_sec);
+ cal_tm_ptr->tm_year % 100,
+ cal_tm_ptr->tm_mon + 1,
+ cal_tm_ptr->tm_mday,
+ cal_tm_ptr->tm_hour,
+ cal_tm_ptr->tm_min,
+ cal_tm_ptr->tm_sec);
#endif
}
@@ -212,12 +212,12 @@ ut_sprintf_timestamp_without_extra_chars(
GetLocalTime(&cal_tm);
sprintf(buf, "%02d%02d%02d_%2d_%02d_%02d",
- (int)cal_tm.wYear % 100,
- (int)cal_tm.wMonth,
- (int)cal_tm.wDay,
- (int)cal_tm.wHour,
- (int)cal_tm.wMinute,
- (int)cal_tm.wSecond);
+ (int)cal_tm.wYear % 100,
+ (int)cal_tm.wMonth,
+ (int)cal_tm.wDay,
+ (int)cal_tm.wHour,
+ (int)cal_tm.wMinute,
+ (int)cal_tm.wSecond);
#else
struct tm cal_tm;
struct tm* cal_tm_ptr;
@@ -232,12 +232,12 @@ ut_sprintf_timestamp_without_extra_chars(
cal_tm_ptr = localtime(&tm);
#endif
sprintf(buf, "%02d%02d%02d_%2d_%02d_%02d",
- cal_tm_ptr->tm_year % 100,
- cal_tm_ptr->tm_mon + 1,
- cal_tm_ptr->tm_mday,
- cal_tm_ptr->tm_hour,
- cal_tm_ptr->tm_min,
- cal_tm_ptr->tm_sec);
+ cal_tm_ptr->tm_year % 100,
+ cal_tm_ptr->tm_mon + 1,
+ cal_tm_ptr->tm_mday,
+ cal_tm_ptr->tm_hour,
+ cal_tm_ptr->tm_min,
+ cal_tm_ptr->tm_sec);
#endif
}
@@ -342,7 +342,7 @@ ut_ulint_sort(ulint* arr, ulint* aux_arr, ulint low, ulint high)
/*============================================================*/
{
UT_SORT_FUNCTION_BODY(ut_ulint_sort, arr, aux_arr, low, high,
- ut_ulint_cmp);
+ ut_ulint_cmp);
}
/*****************************************************************
@@ -433,7 +433,7 @@ ut_print_namel(
innobase_print_identifier(f, trx, TRUE, name, slash - name);
putc('.', f);
innobase_print_identifier(f, trx, TRUE, slash + 1,
- namelen - (slash - name) - 1);
+ namelen - (slash - name) - 1);
} else {
innobase_print_identifier(f, trx, table_id, name, namelen);
}
@@ -454,8 +454,9 @@ ut_copy_file(
rewind(src);
do {
- size_t maxs =
- len < (long) sizeof buf ? (size_t) len : sizeof buf;
+ size_t maxs = len < (long) sizeof buf
+ ? (size_t) len
+ : sizeof buf;
size_t size = fread(buf, 1, maxs, src);
fwrite(buf, 1, size, dest);
len -= (long) size;
diff --git a/storage/innobase/ut/ut0vec.c b/storage/innobase/ut/ut0vec.c
index 3f61c8c8386..e0d3e84d4a2 100644
--- a/storage/innobase/ut/ut0vec.c
+++ b/storage/innobase/ut/ut0vec.c
@@ -42,7 +42,7 @@ ib_vector_push(
ulint new_total = vec->total * 2;
new_data = mem_heap_alloc(vec->heap,
- sizeof(void*) * new_total);
+ sizeof(void*) * new_total);
memcpy(new_data, vec->data, sizeof(void*) * vec->total);
vec->data = new_data;
diff --git a/storage/innobase/ut/ut0wqueue.c b/storage/innobase/ut/ut0wqueue.c
index 2a6d8c19ef0..7e090e89a4f 100644
--- a/storage/innobase/ut/ut0wqueue.c
+++ b/storage/innobase/ut/ut0wqueue.c
@@ -76,7 +76,7 @@ ib_wqueue_wait(
if (!ib_list_get_first(wq->items)) {
/* We must reset the event when the list
- gets emptied. */
+ gets emptied. */
os_event_reset(wq->event);
}