1
0
mirror of https://github.com/MariaDB/server.git synced 2025-12-07 17:42:39 +03:00

Style cleanups: Convert spaces to tabs, remove trailing whitespace, other

misc cleanups.
This commit is contained in:
osku
2006-02-21 12:37:54 +00:00
parent 9596f6d82d
commit ac69f8c21b
203 changed files with 11091 additions and 11051 deletions

View File

@@ -1416,15 +1416,12 @@ btr_insert_on_non_leaf_level(
first parameter for btr_cur_search_to_nth_level. */
btr_cur_search_to_nth_level(UT_LIST_GET_FIRST(tree->tree_indexes),
level, tuple, PAGE_CUR_LE,
BTR_CONT_MODIFY_TREE,
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);
}

View File

@@ -798,8 +798,8 @@ 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);
}

View File

@@ -335,10 +335,10 @@ buf_page_is_corrupted(
}
#endif
/* If we use checksums validation, make additional check before returning
TRUE to ensure that the checksum is not equal to BUF_NO_CHECKSUM_MAGIC which
might be stored by InnoDB with checksums disabled.
Otherwise, skip checksum calculation and return FALSE */
/* If we use checksums validation, make additional check before
returning TRUE to ensure that the checksum is not equal to
BUF_NO_CHECKSUM_MAGIC which might be stored by InnoDB with checksums
disabled. Otherwise, skip checksum calculation and return FALSE */
if (srv_use_checksums) {
old_checksum = buf_calc_page_old_checksum(read_buf);
@@ -347,11 +347,15 @@ buf_page_is_corrupted(
- FIL_PAGE_END_LSN_OLD_CHKSUM);
/* There are 2 valid formulas for old_checksum_field:
1. Very old versions of InnoDB only stored 8 byte lsn to the start
and the end of the page.
2. Newer InnoDB versions store the old formula checksum there. */
if (old_checksum_field != mach_read_from_4(read_buf + FIL_PAGE_LSN)
1. Very old versions of InnoDB only stored 8 byte lsn to the
start and the end of the page.
2. Newer InnoDB versions store the old formula checksum
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) {
@@ -359,7 +363,8 @@ buf_page_is_corrupted(
}
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 */
@@ -2338,9 +2343,8 @@ buf_print_io(
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))
(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",

View File

@@ -357,7 +357,8 @@ buf_flush_buffered_writes(void)
"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->buf_fix_count,
(ulong)block->io_fix,
(ulong)block->state);
}
ut_a(block->state == BUF_BLOCK_FILE_PAGE);

View File

@@ -458,7 +458,8 @@ buf_read_ahead_linear(
/* Not accessed */
fail_count++;
} else if (pred_block && (ut_ulint_cmp(block->LRU_position,
} else if (pred_block
&& (ut_ulint_cmp(block->LRU_position,
pred_block->LRU_position)
!= asc_or_desc)) {
/* Accesses not in the right order */

View File

@@ -238,8 +238,7 @@ dict_boot(void)
dict_sys->row_id = ut_dulint_add(
ut_dulint_align_up(
mtr_read_dulint(dict_hdr + DICT_HDR_ROW_ID,
&mtr),
mtr_read_dulint(dict_hdr + DICT_HDR_ROW_ID, &mtr),
DICT_HDR_ROW_ID_WRITE_MARGIN),
DICT_HDR_ROW_ID_WRITE_MARGIN);

View File

@@ -1324,7 +1324,7 @@ 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 from internal data dictionary\n");
return(DB_ERROR);
}

View File

@@ -1739,9 +1739,7 @@ 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->name, table->space, index->type,
index->n_fields + table->n_cols);
/* Copy other relevant data from the old index struct to the new
@@ -1922,11 +1920,8 @@ dict_index_build_internal_non_clust(
/* 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);
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 */

View File

@@ -3124,7 +3124,7 @@ fil_load_single_table_tablespaces(void)
&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) {
@@ -3612,8 +3612,8 @@ fil_extend_tablespaces_to_stored_len(void)
ut_a(space->purpose == FIL_TABLESPACE);
mutex_exit(&(system->mutex)); /* no need to protect with a
mutex, because this is a single-
threaded operation */
mutex, because this is a
single-threaded operation */
error = fil_read(TRUE, space->id, 0, 0, UNIV_PAGE_SIZE, buf,
NULL);
ut_a(error == DB_SUCCESS);
@@ -4297,8 +4297,8 @@ fil_flush_file_spaces(
while (space) {
if (space->purpose == purpose && !space->is_being_deleted) {
space->n_pending_flushes++; /* prevent dropping of the
space while we are
space->n_pending_flushes++; /* prevent dropping of
the space while we are
flushing */
mutex_exit(&(system->mutex));

View File

@@ -941,8 +941,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",
(ulong) fsp_id,
(ulong) id);
(ulong) fsp_id, (ulong) id);
return(ULINT_UNDEFINED);
}
@@ -2857,8 +2857,9 @@ fsp_get_available_space_in_free_extents(
if (size < FSP_EXTENT_SIZE) {
ut_a(space != 0); /* This must be a single-table
tablespace */
return(0); /* TODO: count free frag pages and return
a value based on that */
return(0); /* TODO: count free frag pages and
return a value based on that */
}
/* Below we play safe when counting free extents above the free limit:
@@ -3734,18 +3735,22 @@ 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),
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);
descr_count += flst_get_len(seg_inode + FSEG_FULL, &mtr);
descr_count += flst_get_len(seg_inode + FSEG_NOT_FULL, &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);
@@ -3775,22 +3780,24 @@ 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),
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
@@ -3809,6 +3816,7 @@ fsp_validate(
ut_a(frag_n_used == n_used);
mtr_commit(&mtr2);
return(TRUE);
}
@@ -3897,12 +3905,13 @@ 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),
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);
@@ -3932,12 +3941,13 @@ 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),
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);

View File

@@ -1648,8 +1648,8 @@ innobase_commit(
if (trx->active_trans == 0
&& trx->conc_state != TRX_NOT_STARTED) {
sql_print_error("trx->active_trans == 0, but trx->conc_state != "
"TRX_NOT_STARTED");
sql_print_error("trx->active_trans == 0, but"
" trx->conc_state != TRX_NOT_STARTED");
}
if (all
|| (!(thd->options & (OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN)))) {
@@ -1658,22 +1658,24 @@ innobase_commit(
this is an SQL statement end and autocommit is on */
/* We need current binlog position for ibbackup to work.
Note, the position is current because of prepare_commit_mutex */
Note, the position is current because of
prepare_commit_mutex */
retry:
if (srv_commit_concurrency > 0)
{
if (srv_commit_concurrency > 0) {
pthread_mutex_lock(&commit_cond_m);
commit_threads++;
if (commit_threads > srv_commit_concurrency)
{
if (commit_threads > srv_commit_concurrency) {
commit_threads--;
pthread_cond_wait(&commit_cond, &commit_cond_m);
pthread_cond_wait(&commit_cond,
&commit_cond_m);
pthread_mutex_unlock(&commit_cond_m);
goto retry;
}
else
else {
pthread_mutex_unlock(&commit_cond_m);
}
}
trx->mysql_log_file_name = mysql_bin_log.get_log_fname();
trx->mysql_log_offset =
@@ -1681,8 +1683,7 @@ retry:
innobase_commit_low(trx);
if (srv_commit_concurrency > 0)
{
if (srv_commit_concurrency > 0) {
pthread_mutex_lock(&commit_cond_m);
commit_threads--;
pthread_cond_signal(&commit_cond);
@@ -1792,7 +1793,7 @@ This function stores the binlog offset and flushes logs. */
void
innobase_store_binlog_offset_and_flush_log(
/*=======================================*/
char *binlog_name, /* in: binlog name */
char* binlog_name, /* in: binlog name */
longlong offset) /* in: binlog offset */
{
mtr_t mtr;
@@ -1888,7 +1889,8 @@ try_again:
cmp = strcmp(trx->repl_wait_binlog_name,
innobase_repl_wait_file_name);
if (cmp < 0
|| (cmp == 0 && (my_off_t)trx->repl_wait_binlog_pos
|| (cmp == 0
&& (my_off_t)trx->repl_wait_binlog_pos
<= innobase_repl_wait_pos)) {
/* This thd has an even lower position, let
us update the minimum info */
@@ -2154,7 +2156,7 @@ innobase_rollback_to_savepoint(
no savepoint with the given name */
THD* thd, /* in: handle to the MySQL thread of the user
whose transaction should be rolled back */
void *savepoint) /* in: savepoint data */
void* savepoint) /* in: savepoint data */
{
ib_longlong mysql_binlog_cache_pos;
int error = 0;
@@ -2271,17 +2273,19 @@ innobase_close_connection(
if (trx->active_trans == 0
&& trx->conc_state != TRX_NOT_STARTED) {
sql_print_error("trx->active_trans == 0, but trx->conc_state != "
"TRX_NOT_STARTED");
sql_print_error("trx->active_trans == 0, but"
" trx->conc_state != TRX_NOT_STARTED");
}
if (trx->conc_state != TRX_NOT_STARTED &&
global_system_variables.log_warnings)
sql_print_warning("MySQL is closing a connection that has an active "
global_system_variables.log_warnings) {
sql_print_warning(
"MySQL is closing a connection that has an active "
"InnoDB transaction. %lu row modifications will "
"roll back.",
(ulong)trx->undo_no.low);
(ulong) trx->undo_no.low);
}
innobase_rollback_trx(trx);
@@ -2431,6 +2435,7 @@ ha_innobase::open(
ib_table = dict_table_get_and_increment_handle_count(
norm_name, NULL);
if (NULL == ib_table) {
ut_print_timestamp(stderr);
sql_print_error("Cannot find table %s from the internal data "
@@ -2528,7 +2533,8 @@ ha_innobase::open(
and it will never be updated anyway. */
if (key_used_on_scan != MAX_KEY) {
sql_print_warning("Table %s key_used_on_scan is %lu even "
sql_print_warning(
"Table %s key_used_on_scan is %lu even "
"though there is no primary key inside "
"InnoDB.", name, (ulong) key_used_on_scan);
}
@@ -2768,8 +2774,8 @@ get_innobase_type_from_mysql_type(
}
switch (field->type()) {
/* NOTE that we only allow string types in DATA_MYSQL
and DATA_VARMYSQL */
/* NOTE that we only allow string types in DATA_MYSQL and
DATA_VARMYSQL */
case MYSQL_TYPE_VAR_STRING: /* old <= 4.1 VARCHAR */
case MYSQL_TYPE_VARCHAR: /* new >= 5.0.3 true VARCHAR */
if (field->binary()) {
@@ -3165,16 +3171,16 @@ build_template(
if (prebuilt->hint_need_to_fetch_extra_cols
== ROW_RETRIEVE_ALL_COLS) {
/* We know we must at least fetch all columns in the key, or
all columns in the table */
/* We know we must at least fetch all columns in the
key, or all columns in the table */
if (prebuilt->read_just_key) {
/* MySQL has instructed us that it is enough to
fetch the columns in the key; looks like MySQL
can set this flag also when there is only a
prefix of the column in the key: in that case we
retrieve the whole column from the clustered
index */
/* MySQL has instructed us that it is enough
to fetch the columns in the key; looks like
MySQL can set this flag also when there is
only a prefix of the column in the key: in
that case we retrieve the whole column from
the clustered index */
fetch_all_in_key = TRUE;
} else {
@@ -3182,11 +3188,12 @@ build_template(
}
} else if (prebuilt->hint_need_to_fetch_extra_cols
== ROW_RETRIEVE_PRIMARY_KEY) {
/* We must at least fetch all primary key cols. Note that if
the clustered index was internally generated by InnoDB on the
row id (no primary key was defined), then
row_search_for_mysql() will always retrieve the row id to a
special buffer in the prebuilt struct. */
/* We must at least fetch all primary key cols. Note
that if the clustered index was internally generated
by InnoDB on the row id (no primary key was
defined), then row_search_for_mysql() will always
retrieve the row id to a special buffer in the
prebuilt struct. */
fetch_primary_key_cols = TRUE;
}
@@ -3254,8 +3261,8 @@ build_template(
}
if (fetch_primary_key_cols
&& dict_table_col_in_clustered_key(index->table,
i)) {
&& dict_table_col_in_clustered_key(
index->table, i)) {
/* This field is needed in the query */
goto include_field;
@@ -4171,18 +4178,19 @@ ha_innobase::change_active_index(
key = table->key_info + active_index;
prebuilt->index = dict_table_get_index_noninline(
prebuilt->table,
key->name);
prebuilt->table, key->name);
} else {
prebuilt->index = dict_table_get_first_index_noninline(
prebuilt->table);
}
if (!prebuilt->index) {
sql_print_error("Innodb could not find key n:o %u with name %s "
sql_print_error(
"Innodb could not find key n:o %u with name %s "
"from dict cache for table %s",
keynr, key ? key->name : "NULL",
prebuilt->table->name);
DBUG_RETURN(1);
}
@@ -4766,7 +4774,8 @@ create_index(
|| col_type == DATA_FLOAT
|| col_type == DATA_DOUBLE
|| col_type == DATA_DECIMAL) {
sql_print_error("MySQL is trying to create a column "
sql_print_error(
"MySQL is trying to create a column "
"prefix index field, on an "
"inappropriate data type. Table "
"name %s, column name %s.",
@@ -4814,8 +4823,7 @@ create_clustered_index_when_no_primary(
id where to store the table */
index = dict_mem_index_create((char*) table_name,
(char*) "GEN_CLUST_INDEX",
0, DICT_CLUSTERED, 0);
(char*) "GEN_CLUST_INDEX", 0, DICT_CLUSTERED, 0);
error = row_create_index_for_mysql(index, trx, NULL);
error = convert_error_code_to_mysql(error, NULL);
@@ -5595,13 +5603,11 @@ ha_innobase::info(
if (ib_table->space != 0) {
my_snprintf(path, sizeof(path), "%s/%s%s",
mysql_data_home, ib_table->name,
".ibd");
mysql_data_home, ib_table->name, ".ibd");
unpack_filename(path,path);
} else {
my_snprintf(path, sizeof(path), "%s/%s%s",
mysql_data_home, ib_table->name,
reg_ext);
mysql_data_home, ib_table->name, reg_ext);
unpack_filename(path,path);
}
@@ -5731,8 +5737,7 @@ ha_innobase::info(
ut_a(prebuilt->trx && prebuilt->trx->magic_n == TRX_MAGIC_N);
errkey = (unsigned int) row_get_mysql_key_number_for_index(
(dict_index_t*)
trx_get_error_info(prebuilt->trx));
(dict_index_t*) trx_get_error_info(prebuilt->trx));
}
if (flag & HA_STATUS_AUTO && table->found_next_number_field) {
@@ -5987,8 +5992,7 @@ ha_innobase::get_foreign_key_list(THD *thd, List<FOREIGN_KEY_INFO> *f_key_list)
mutex_enter_noninline(&(dict_sys->mutex));
foreign = UT_LIST_GET_FIRST(prebuilt->table->foreign_list);
while (foreign != NULL)
{
while (foreign != NULL) {
uint i;
FOREIGN_KEY_INFO f_key_info;
LEX_STRING *name= 0;
@@ -6011,46 +6015,41 @@ ha_innobase::get_foreign_key_list(THD *thd, List<FOREIGN_KEY_INFO> *f_key_list)
f_key_info.referenced_table= make_lex_string(thd, 0, tmp_buff,
(uint) strlen(tmp_buff), 1);
for (i= 0;;)
{
for (i= 0;;) {
tmp_buff= foreign->foreign_col_names[i];
name= make_lex_string(thd, name, tmp_buff, (uint) strlen(tmp_buff), 1);
name= make_lex_string(thd, name, tmp_buff,
(uint) strlen(tmp_buff), 1);
f_key_info.foreign_fields.push_back(name);
tmp_buff= foreign->referenced_col_names[i];
name= make_lex_string(thd, name, tmp_buff, (uint) strlen(tmp_buff), 1);
name= make_lex_string(thd, name, tmp_buff,
(uint) strlen(tmp_buff), 1);
f_key_info.referenced_fields.push_back(name);
if (++i >= foreign->n_fields)
break;
}
ulong length= 0;
if (foreign->type == DICT_FOREIGN_ON_DELETE_CASCADE)
{
if (foreign->type == DICT_FOREIGN_ON_DELETE_CASCADE) {
length=17;
tmp_buff= "ON DELETE CASCADE";
}
else if (foreign->type == DICT_FOREIGN_ON_DELETE_SET_NULL)
{
else if (foreign->type == DICT_FOREIGN_ON_DELETE_SET_NULL) {
length=18;
tmp_buff= "ON DELETE SET NULL";
}
else if (foreign->type == DICT_FOREIGN_ON_DELETE_NO_ACTION)
{
else if (foreign->type == DICT_FOREIGN_ON_DELETE_NO_ACTION) {
length=19;
tmp_buff= "ON DELETE NO ACTION";
}
else if (foreign->type == DICT_FOREIGN_ON_UPDATE_CASCADE)
{
else if (foreign->type == DICT_FOREIGN_ON_UPDATE_CASCADE) {
length=17;
tmp_buff= "ON UPDATE CASCADE";
}
else if (foreign->type == DICT_FOREIGN_ON_UPDATE_SET_NULL)
{
else if (foreign->type == DICT_FOREIGN_ON_UPDATE_SET_NULL) {
length=18;
tmp_buff= "ON UPDATE SET NULL";
}
else if (foreign->type == DICT_FOREIGN_ON_UPDATE_NO_ACTION)
{
else if (foreign->type == DICT_FOREIGN_ON_UPDATE_NO_ACTION) {
length=19;
tmp_buff= "ON UPDATE NO ACTION";
}
@@ -6066,6 +6065,7 @@ ha_innobase::get_foreign_key_list(THD *thd, List<FOREIGN_KEY_INFO> *f_key_list)
}
mutex_exit_noninline(&(dict_sys->mutex));
prebuilt->trx->op_info = (char*)"";
DBUG_RETURN(0);
}
@@ -6269,7 +6269,8 @@ ha_innobase::start_stmt(
if (prebuilt->stored_select_lock_type != LOCK_S
&& prebuilt->stored_select_lock_type != LOCK_X) {
sql_print_error("stored_select_lock_type is %lu inside "
sql_print_error(
"stored_select_lock_type is %lu inside "
"::start_stmt()!",
prebuilt->stored_select_lock_type);
@@ -6412,9 +6413,8 @@ ha_innobase::external_lock(
thd->variables.innodb_table_locks &&
(thd->options & OPTION_NOT_AUTOCOMMIT)) {
ulint error;
error = row_lock_table_for_mysql(prebuilt,
NULL, 0);
ulint error = row_lock_table_for_mysql(
prebuilt, NULL, 0);
if (error != DB_SUCCESS) {
error = convert_error_code_to_mysql(
@@ -6565,8 +6565,10 @@ int
innodb_export_status()
/*==================*/
{
if (innodb_inited)
if (innodb_inited) {
srv_export_innodb_status();
}
return 0;
}
@@ -6668,8 +6670,9 @@ Implements the SHOW MUTEX STATUS command. . */
bool
innodb_mutex_show_status(
/*=====================*/
THD* thd, /* in: the MySQL query thread of the caller */
stat_print_fn *stat_print)
THD* thd, /* in: the MySQL query thread of the
caller */
stat_print_fn* stat_print)
{
char buf1[IO_SIZE], buf2[IO_SIZE];
mutex_t* mutex;
@@ -6688,24 +6691,27 @@ innodb_mutex_show_status(
mutex = UT_LIST_GET_FIRST(mutex_list);
while ( mutex != NULL )
{
if (mutex->mutex_type != 1)
{
if (mutex->count_using > 0)
{
buf1len= my_snprintf(buf1, sizeof(buf1), "%s:%s",
while (mutex != NULL) {
if (mutex->mutex_type != 1) {
if (mutex->count_using > 0) {
buf1len= my_snprintf(buf1, sizeof(buf1),
"%s:%s",
mutex->cmutex_name, mutex->cfile_name);
buf2len= my_snprintf(buf2, sizeof(buf2),
"count=%lu, spin_waits=%lu, spin_rounds=%lu, "
"os_waits=%lu, os_yields=%lu, os_wait_times=%lu",
mutex->count_using, mutex->count_spin_loop,
"count=%lu, spin_waits=%lu,"
" spin_rounds=%lu, "
"os_waits=%lu, os_yields=%lu,"
" os_wait_times=%lu",
mutex->count_using,
mutex->count_spin_loop,
mutex->count_spin_rounds,
mutex->count_os_wait, mutex->count_os_yield,
mutex->count_os_wait,
mutex->count_os_yield,
mutex->lspent_time/1000);
if (stat_print(thd, innobase_hton.name, hton_name_len,
buf1, buf1len, buf2, buf2len))
{
if (stat_print(thd, innobase_hton.name,
hton_name_len, buf1, buf1len,
buf2, buf2len)) {
#ifdef MUTEX_PROTECT_TO_BE_ADDED_LATER
mutex_exit(&mutex_list_mutex);
#endif
@@ -6713,8 +6719,7 @@ innodb_mutex_show_status(
}
}
}
else
{
else {
rw_lock_count += mutex->count_using;
rw_lock_count_spin_loop += mutex->count_spin_loop;
rw_lock_count_spin_rounds += mutex->count_spin_rounds;
@@ -6735,14 +6740,14 @@ innodb_mutex_show_status(
rw_lock_wait_time/1000);
if (stat_print(thd, innobase_hton.name, hton_name_len,
STRING_WITH_LEN("rw_lock_mutexes"), buf2, buf2len))
{
STRING_WITH_LEN("rw_lock_mutexes"), buf2, buf2len)) {
DBUG_RETURN(1);
}
#ifdef MUTEX_PROTECT_TO_BE_ADDED_LATER
mutex_exit(&mutex_list_mutex);
#endif
DBUG_RETURN(FALSE);
}
@@ -6765,53 +6770,59 @@ bool innobase_show_status(THD* thd, stat_print_fn* stat_print,
locking.
****************************************************************************/
static mysql_byte* innobase_get_key(INNOBASE_SHARE *share,uint *length,
static mysql_byte* innobase_get_key(INNOBASE_SHARE* share, uint* length,
my_bool not_used __attribute__((unused)))
{
*length=share->table_name_length;
return (mysql_byte*) share->table_name;
}
static INNOBASE_SHARE *get_share(const char *table_name)
static INNOBASE_SHARE* get_share(const char* table_name)
{
INNOBASE_SHARE *share;
pthread_mutex_lock(&innobase_share_mutex);
uint length=(uint) strlen(table_name);
if (!(share=(INNOBASE_SHARE*) hash_search(&innobase_open_tables,
(mysql_byte*) table_name,
length)))
{
length))) {
if ((share=(INNOBASE_SHARE *) my_malloc(sizeof(*share)+length+1,
MYF(MY_WME | MY_ZEROFILL))))
{
MYF(MY_WME | MY_ZEROFILL)))) {
share->table_name_length=length;
share->table_name=(char*) (share+1);
strmov(share->table_name,table_name);
if (my_hash_insert(&innobase_open_tables, (mysql_byte*) share))
{
if (my_hash_insert(&innobase_open_tables,
(mysql_byte*) share)) {
pthread_mutex_unlock(&innobase_share_mutex);
my_free((gptr) share,0);
return 0;
}
thr_lock_init(&share->lock);
pthread_mutex_init(&share->mutex,MY_MUTEX_INIT_FAST);
}
}
share->use_count++;
pthread_mutex_unlock(&innobase_share_mutex);
return share;
}
static void free_share(INNOBASE_SHARE *share)
static void free_share(INNOBASE_SHARE* share)
{
pthread_mutex_lock(&innobase_share_mutex);
if (!--share->use_count)
{
if (!--share->use_count) {
hash_delete(&innobase_open_tables, (mysql_byte*) share);
thr_lock_delete(&share->lock);
pthread_mutex_destroy(&share->mutex);
my_free((gptr) share, MYF(0));
}
pthread_mutex_unlock(&innobase_share_mutex);
}
@@ -7583,22 +7594,28 @@ innobase_set_cursor_view(
}
bool ha_innobase::check_if_incompatible_data(HA_CREATE_INFO *info,
bool ha_innobase::check_if_incompatible_data(
HA_CREATE_INFO* info,
uint table_changes)
{
if (table_changes != IS_EQUAL_YES)
if (table_changes != IS_EQUAL_YES) {
return COMPATIBLE_DATA_NO;
}
/* Check that auto_increment value was not changed */
if ((info->used_fields & HA_CREATE_USED_AUTO) &&
info->auto_increment_value != 0)
info->auto_increment_value != 0) {
return COMPATIBLE_DATA_NO;
}
/* Check that row format didn't change */
if ((info->used_fields & HA_CREATE_USED_AUTO) &&
get_row_type() != info->row_type)
get_row_type() != info->row_type) {
return COMPATIBLE_DATA_NO;
}
return COMPATIBLE_DATA_YES;
}

View File

@@ -233,10 +233,11 @@ extern my_bool innobase_log_archive,
innobase_file_per_table, innobase_locks_unsafe_for_binlog,
innobase_create_status_file;
extern my_bool innobase_very_fast_shutdown; /* set this to 1 just before
calling innobase_end() if you want
InnoDB to shut down without
flushing the buffer pool: this
is equivalent to a 'crash' */
calling innobase_end() if
you want InnoDB to shut down
without flushing the buffer
pool: this is equivalent to
a 'crash' */
extern "C" {
extern ulong srv_max_buf_pool_modified_pct;
extern ulong srv_max_purge_lag;

View File

@@ -621,8 +621,9 @@ ibuf_bitmap_page_get_bits(
page_t* page, /* in: bitmap page */
ulint page_no,/* in: page whose bits to get */
ulint bit, /* in: IBUF_BITMAP_FREE, IBUF_BITMAP_BUFFERED, ... */
mtr_t* mtr __attribute__((unused))) /* in: mtr containing an x-latch
to the bitmap page */
mtr_t* mtr __attribute__((unused))) /* in: mtr containing an
x-latch to the bitmap
page */
{
ulint byte_offset;
ulint bit_offset;
@@ -681,7 +682,8 @@ ibuf_bitmap_page_set_bits(
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;

View File

@@ -82,7 +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);
}

View File

@@ -147,7 +147,8 @@ dfield_datas_are_binary_equal(
if ((len != field2->len)
|| ((len != UNIV_SQL_NULL)
&& (0 != ut_memcmp(field1->data, field2->data, len)))) {
&& (0 != ut_memcmp(field1->data, field2->data,
len)))) {
return(FALSE);
}

View File

@@ -42,7 +42,7 @@ Created 5/24/1996 Heikki Tuuri
#define DB_CANNOT_ADD_CONSTRAINT 38 /* adding a foreign key constraint
to a table failed */
#define DB_CORRUPTION 39 /* data structure corruption noticed */
#define DB_COL_APPEARS_TWICE_IN_INDEX 40 /* InnoDB cannot handle an index
#define DB_COL_APPEARS_TWICE_IN_INDEX 40/* InnoDB cannot handle an index
where same column appears twice */
#define DB_CANNOT_DROP_CONSTRAINT 41 /* dropping a foreign key constraint
from a table failed */

View File

@@ -25,8 +25,7 @@ UNIV_MEM_ALIGNMENT. In the debug version there are also
check fields at the both ends of the field. */
#ifdef UNIV_MEM_DEBUG
#define MEM_SPACE_NEEDED(N) ut_calc_align((N) + MEM_FIELD_HEADER_SIZE\
+ MEM_FIELD_TRAILER_SIZE,\
UNIV_MEM_ALIGNMENT)
+ MEM_FIELD_TRAILER_SIZE, UNIV_MEM_ALIGNMENT)
#else
#define MEM_SPACE_NEEDED(N) ut_calc_align((N), UNIV_MEM_ALIGNMENT)
#endif

View File

@@ -68,22 +68,19 @@ Use this macro instead of the corresponding function! Macro for memory
heap creation. */
#define mem_heap_create(N) mem_heap_create_func(\
(N), NULL, MEM_HEAP_DYNAMIC,\
__FILE__, __LINE__)
(N), NULL, MEM_HEAP_DYNAMIC, __FILE__, __LINE__)
/******************************************************************
Use this macro instead of the corresponding function! Macro for memory
heap creation. */
#define mem_heap_create_in_buffer(N) mem_heap_create_func(\
(N), NULL, MEM_HEAP_BUFFER,\
__FILE__, __LINE__)
(N), NULL, MEM_HEAP_BUFFER, __FILE__, __LINE__)
/******************************************************************
Use this macro instead of the corresponding function! Macro for memory
heap creation. */
#define mem_heap_create_in_btr_search(N) mem_heap_create_func(\
(N), NULL, MEM_HEAP_BTR_SEARCH |\
MEM_HEAP_BUFFER,\
(N), NULL, MEM_HEAP_BTR_SEARCH | MEM_HEAP_BUFFER,\
__FILE__, __LINE__)
/******************************************************************
Use this macro instead of the corresponding function! Macro for fast
@@ -92,8 +89,7 @@ caller, N is its size, and this memory block is not freed by
mem_heap_free. See the parameter comment in mem_heap_create_func below. */
#define mem_heap_fast_create(N, B) mem_heap_create_func(\
(N), (B), MEM_HEAP_DYNAMIC,\
__FILE__, __LINE__)
(N), (B), MEM_HEAP_DYNAMIC, __FILE__, __LINE__)
/******************************************************************
Use this macro instead of the corresponding function! Macro for memory

View File

@@ -119,10 +119,11 @@ os_mem_alloc_large(
/*===============*/
/* out: allocated memory */
ulint n, /* in: number of bytes */
ibool set_to_zero, /* in: TRUE if allocated memory should be set
to zero if UNIV_SET_MEM_TO_ZERO is defined */
ibool assert_on_error); /* in: if TRUE, we crash mysqld if the memory
cannot be allocated */
ibool set_to_zero, /* in: TRUE if allocated memory
should be set to zero if
UNIV_SET_MEM_TO_ZERO is defined */
ibool assert_on_error);/* in: if TRUE, we crash mysqld if
the memory cannot be allocated */
/********************************************************************
Frees large pages memory. */

View File

@@ -233,6 +233,7 @@ que_thr_peek_stop(
|| trx->que_state == TRX_QUE_LOCK_WAIT
|| (UT_LIST_GET_LEN(trx->signals) > 0
&& trx->que_state == TRX_QUE_RUNNING)) {
return(TRUE);
}

View File

@@ -263,11 +263,13 @@ typedef struct srv_sys_struct srv_sys_t;
/* The server system */
extern srv_sys_t* srv_sys;
/* Alternatives for the file flush option in Unix; see the InnoDB manual about
what these mean */
#define SRV_UNIX_FDATASYNC 1 /* This is the default; it is currently mapped
to a call of fsync() because fdatasync()
seemed to corrupt files in Linux and Solaris */
/* Alternatives for the file flush option in Unix; see the InnoDB manual
about what these mean */
#define SRV_UNIX_FDATASYNC 1 /* This is the default; it is
currently mapped to a call of
fsync() because fdatasync() seemed
to corrupt files in Linux and
Solaris */
#define SRV_UNIX_O_DSYNC 2
#define SRV_UNIX_LITTLESYNC 3
#define SRV_UNIX_NOSYNC 4

View File

@@ -23,7 +23,8 @@ void
mutex_spin_wait(
/*============*/
mutex_t* mutex, /* in: pointer to mutex */
const char* file_name,/* in: file name where mutex requested */
const char* file_name, /* in: file name where mutex
requested */
ulint line); /* in: line where requested */
#ifdef UNIV_SYNC_DEBUG
/**********************************************************************
@@ -148,9 +149,9 @@ mutex_reset_lock_word(
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 ':' */
"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;

View File

@@ -38,10 +38,11 @@ ut_malloc_low(
/*==========*/
/* out, own: allocated memory */
ulint n, /* in: number of bytes to allocate */
ibool set_to_zero, /* in: TRUE if allocated memory should be set
to zero if UNIV_SET_MEM_TO_ZERO is defined */
ibool assert_on_error); /* in: if TRUE, we crash mysqld if the memory
cannot be allocated */
ibool set_to_zero, /* in: TRUE if allocated memory
should be set to zero if
UNIV_SET_MEM_TO_ZERO is defined */
ibool assert_on_error); /* in: if TRUE, we crash mysqld if
the memory cannot be allocated */
/**************************************************************************
Allocates memory. Sets it also to zero if UNIV_SET_MEM_TO_ZERO is
defined. */

View File

@@ -3888,9 +3888,9 @@ lock_release_off_kernel(
&& 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 all currently active transactions. */
/* The trx may have modified the table. We
block the use of the MySQL query cache for
all currently active transactions. */
table = lock->un_member.tab_lock.table;
@@ -4313,7 +4313,7 @@ loop:
if (trx->read_view) {
fprintf(file,
"Trx read view will not see trx with id >= %lu %lu, sees < %lu %lu\n",
"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),
@@ -4476,8 +4476,7 @@ 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_COMMITTED_IN_MEMORY);
ut_a(trx_in_trx_list(lock->trx));
@@ -4884,8 +4883,7 @@ lock_rec_convert_impl_to_expl(
impl_trx)) {
lock_rec_add_to_queue(LOCK_REC | LOCK_X
| LOCK_REC_NOT_GAP, rec, index,
impl_trx);
| LOCK_REC_NOT_GAP, rec, index, impl_trx);
}
}
}

View File

@@ -1344,7 +1344,8 @@ 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
|| (ut_dulint_cmp(log_sys->written_to_some_lsn, lsn)
>= 0
&& wait != LOG_WAIT_ALL_GROUPS))) {
mutex_exit(&(log_sys->mutex));
@@ -1356,7 +1357,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 */
@@ -3063,9 +3065,10 @@ loop:
mutex_enter(&kernel_mutex);
/* Check that there are no longer transactions. We need this wait even
for the 'very fast' shutdown, because the InnoDB layer may have
committed or prepared transactions and we don't want to lose them. */
/* Check that there are no longer transactions. We need this wait
even for the 'very fast' shutdown, because the InnoDB layer may have
committed or prepared transactions and we don't want to lose
them. */
if (trx_n_mysql_transactions > 0
|| UT_LIST_GET_LEN(trx_sys->trx_list) > 0) {
@@ -3077,19 +3080,18 @@ loop:
if (srv_fast_shutdown == 2) {
/* In this fastest shutdown we do not flush the buffer pool:
it is essentially a 'crash' of the InnoDB server.
Make sure that the log is all flushed to disk, so that
we can recover all committed transactions in a crash
recovery.
We must not write the lsn stamps to the data files, since at a
startup InnoDB deduces from the stamps if the previous
shutdown was clean. */
it is essentially a 'crash' of the InnoDB server. Make sure
that the log is all flushed to disk, so that we can recover
all committed transactions in a crash recovery. We must not
write the lsn stamps to the data files, since at a startup
InnoDB deduces from the stamps if the previous shutdown was
clean. */
log_buffer_flush_to_disk();
return; /* We SKIP ALL THE REST !! */
}
/* Check that the master thread is suspended */
if (srv_n_threads_active[SRV_MASTER] != 0) {
@@ -3136,7 +3138,8 @@ loop:
#ifdef UNIV_LOG_ARCHIVE
|| (srv_log_archive_on
&& ut_dulint_cmp(lsn,
ut_dulint_add(log_sys->archived_lsn, LOG_BLOCK_HDR_SIZE))
ut_dulint_add(log_sys->archived_lsn,
LOG_BLOCK_HDR_SIZE))
!= 0)
#endif /* UNIV_LOG_ARCHIVE */
) {

View File

@@ -1505,7 +1505,7 @@ recv_apply_log_recs_for_backup(void)
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);
recv_addr->space, recv_addr->page_no);
*/
recv_addr->state = RECV_PROCESSED;
@@ -1536,7 +1536,8 @@ recv_apply_log_recs_for_backup(void)
recv_addr->page_no + 1);
if (!success) {
fprintf(stderr,
"InnoDB: Fatal error: cannot extend tablespace %lu to hold %lu pages\n",
"InnoDB: Fatal error: cannot extend"
" tablespace %lu to hold %lu pages\n",
recv_addr->space, recv_addr->page_no);
exit(1);
@@ -1550,8 +1551,10 @@ recv_apply_log_recs_for_backup(void)
page, NULL);
if (error != DB_SUCCESS) {
fprintf(stderr,
"InnoDB: Fatal error: cannot read from tablespace %lu page number %lu\n",
(ulong) recv_addr->space, (ulong) recv_addr->page_no);
"InnoDB: Fatal error: cannot read from tablespace"
" %lu page number %lu\n",
(ulong) recv_addr->space,
(ulong) recv_addr->page_no);
exit(1);
}

View File

@@ -3481,9 +3481,10 @@ try_again:
/* aio was queued successfully! */
if (mode == OS_AIO_SYNC) {
/* We want a synchronous i/o operation on a file
where we also use async i/o: in Windows we must
use the same wait mechanism as for async i/o */
/* We want a synchronous i/o operation on a
file where we also use async i/o: in Windows
we must use the same wait mechanism as for
async i/o */
retval = os_aio_windows_handle(ULINT_UNDEFINED,
slot->pos,
@@ -3861,8 +3862,8 @@ consecutive_loop:
if (slot2->reserved && slot2 != slot
&& slot2->offset == slot->offset + slot->len
&& slot->offset + slot->len > slot->offset /* check that
sum does not wrap over */
/* 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) {

View File

@@ -102,8 +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",
@@ -260,8 +259,7 @@ 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",
@@ -536,10 +534,11 @@ os_mem_alloc_large(
/*===============*/
/* out: allocated memory */
ulint n, /* in: number of bytes */
ibool set_to_zero, /* in: TRUE if allocated memory should be set
to zero if UNIV_SET_MEM_TO_ZERO is defined */
ibool assert_on_error) /* in: if TRUE, we crash mysqld if the memory
cannot be allocated */
ibool set_to_zero, /* in: TRUE if allocated memory
should be set to zero if
UNIV_SET_MEM_TO_ZERO is defined */
ibool assert_on_error)/* in: if TRUE, we crash mysqld if
the memory cannot be allocated */
{
#ifdef HAVE_LARGE_PAGES
ulint size;
@@ -557,18 +556,17 @@ os_mem_alloc_large(
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);
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);
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
*/
/* 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

View File

@@ -173,7 +173,8 @@ page_cur_rec_field_extends(
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),
&& 0 == cmp_data_data_slow(type,
dfield_get_data(dfield),
dfield_get_len(dfield),
rec_f, dfield_get_len(dfield))) {
@@ -259,10 +260,8 @@ page_cur_search_with_match(
&& (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,
iup_matched_fields, iup_matched_bytes,
ilow_matched_fields, ilow_matched_bytes,
cursor)) {
return;
}

View File

@@ -518,6 +518,7 @@ page_copy_rec_list_end_no_locks(
(ulong)(rec - page),
(ulong)(page_cur_get_rec(&cur1) - page),
(ulong)(page_cur_get_rec(&cur2) - new_page));
ut_error;
}

View File

@@ -503,6 +503,7 @@ pars_resolve_exp_columns(
dfield_set_type(&(sym_node->common.val),
dict_col_get_type(col));
return;
}
}

View File

@@ -764,11 +764,13 @@ 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;
ored_offset = end_offset | REC_1BYTE_SQL_NULL_MASK;
ored_offset = end_offset
| REC_1BYTE_SQL_NULL_MASK;
} else {
/* If the data is not SQL null, store it */
ut_memcpy(rec + end_offset, data, len);
@@ -790,11 +792,13 @@ 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;
ored_offset = end_offset | REC_2BYTE_SQL_NULL_MASK;
ored_offset = end_offset
| REC_2BYTE_SQL_NULL_MASK;
} else {
/* If the data is not SQL null, store it */
ut_memcpy(rec + end_offset, data, len);

View File

@@ -1403,7 +1403,8 @@ run_again:
thr->lock_state= QUE_THR_LOCK_ROW;
was_lock_wait = row_mysql_handle_errors(&err, trx, thr,
&savept);
thr->lock_state= QUE_THR_LOCK_NOLOCK;;
thr->lock_state= QUE_THR_LOCK_NOLOCK;
if (was_lock_wait) {
goto run_again;
}

View File

@@ -2278,7 +2278,8 @@ row_sel_store_row_id_to_prebuilt(
dict_index_name_print(stderr, prebuilt->trx, index);
fprintf(stderr, "\n"
"InnoDB: Field number %lu, record:\n",
(ulong) dict_index_get_sys_col_pos(index, DATA_ROW_ID));
(ulong) dict_index_get_sys_col_pos(index,
DATA_ROW_ID));
rec_print_new(stderr, index_rec, offsets);
putc('\n', stderr);
ut_error;
@@ -2761,8 +2762,8 @@ 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' */
@@ -2794,15 +2795,16 @@ row_sel_get_clust_rec_for_mysql(
exist in our snapshot. */
if (clust_rec && (old_vers
|| rec_get_deleted_flag(rec, sec_index->table->comp))
|| rec_get_deleted_flag(rec,
sec_index->table->comp))
&& !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));
row_sel_sec_rec_is_for_clust_rec(rec,
sec_index, clust_rec, clust_index));
#endif
}
}
@@ -3176,7 +3178,7 @@ 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);
stderr);
trx_print(stderr, trx, 600);
fputc('\n', stderr);
*/
@@ -3780,8 +3782,8 @@ wrong_offs:
if (!set_also_gap_locks
|| srv_locks_unsafe_for_binlog
|| (unique_search && !UNIV_UNLIKELY(rec_get_deleted_flag(
rec, comp)))) {
|| (unique_search && !UNIV_UNLIKELY(
rec_get_deleted_flag(rec, comp)))) {
goto no_gap_lock;
} else {
@@ -4315,7 +4317,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;

View File

@@ -196,8 +196,9 @@ row_upd_check_references_constraints(
if (foreign->referenced_index == index
&& (node->is_delete
|| row_upd_changes_first_fields_binary(entry, index,
node->update, foreign->n_fields))) {
|| 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,
@@ -396,7 +397,8 @@ row_upd_changes_field_size_or_external(
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
@@ -1050,7 +1052,8 @@ row_upd_changes_ord_field_binary(
&& (row == NULL
|| ind_field->prefix_len > 0
|| !dfield_datas_are_binary_equal(
dtuple_get_nth_field(row, col_no),
dtuple_get_nth_field(row,
col_no),
&(upd_field->new_val)))) {
return(TRUE);
}
@@ -1135,6 +1138,7 @@ row_upd_changes_first_fields_binary(
&& !dfield_datas_are_binary_equal(
dtuple_get_nth_field(entry, i),
&(upd_field->new_val))) {
return(TRUE);
}
}

View File

@@ -1055,8 +1055,7 @@ retry:
situations of lots of thread switches. Simply put some
threads aside for a while to reduce the number of thread
switches. */
if (SRV_THREAD_SLEEP_DELAY > 0)
{
if (SRV_THREAD_SLEEP_DELAY > 0) {
os_thread_sleep(SRV_THREAD_SLEEP_DELAY);
}

View File

@@ -730,14 +730,14 @@ sync_array_detect_deadlock(
&& !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 thread) is holding
s-lock, or someone (cannot be cell thread) (wait)
x-lock, and he is blocked by start thread */
/* The (wait) x-lock request can block
infinitely only if someone (can be also cell
thread) is holding s-lock, or someone
(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:
fprintf(stderr, "rw-lock %p ", lock);
@@ -764,13 +764,13 @@ sync_array_detect_deadlock(
if ((debug->lock_type == RW_LOCK_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 */
/* 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;
}

View File

@@ -369,8 +369,8 @@ void
mutex_spin_wait(
/*============*/
mutex_t* mutex, /* in: pointer to mutex */
const char* file_name, /* in: file name where
mutex requested */
const char* file_name, /* in: file name where mutex
requested */
ulint line) /* in: line where requested */
{
ulint index; /* index of the reserved wait cell */
@@ -388,11 +388,11 @@ mutex_loop:
i = 0;
/* Spin waiting for the lock word to become zero. Note that we do not
have to assume that the read access to the lock word is atomic, as the
actual locking is always committed with atomic test-and-set. In
reality, however, all processors probably have an atomic read of a
memory word. */
/* Spin waiting for the lock word to become zero. Note that we do
not have to assume that the read access to the lock word is atomic,
as the actual locking is always committed with atomic test-and-set.
In reality, however, all processors probably have an atomic read of
a memory word. */
spin_loop:
#ifndef UNIV_HOTBACKUP
@@ -400,22 +400,18 @@ spin_loop:
mutex->count_spin_loop++;
#endif /* !UNIV_HOTBACKUP */
while (mutex_get_lock_word(mutex) != 0 && i < SYNC_SPIN_ROUNDS)
{
if (srv_spin_wait_delay)
{
while (mutex_get_lock_word(mutex) != 0 && i < SYNC_SPIN_ROUNDS) {
if (srv_spin_wait_delay) {
ut_delay(ut_rnd_interval(0, srv_spin_wait_delay));
}
i++;
}
if (i == SYNC_SPIN_ROUNDS)
{
if (i == SYNC_SPIN_ROUNDS) {
#ifndef UNIV_HOTBACKUP
mutex->count_os_yield++;
if (timed_mutexes == 1 && timer_started==0)
{
if (timed_mutexes == 1 && timer_started==0) {
ut_usectime(&sec, &ms);
lstart_time= (ib_longlong)sec * 1000000 + ms;
timer_started = 1;
@@ -437,8 +433,7 @@ spin_loop:
mutex->count_spin_rounds += i;
#endif /* !UNIV_HOTBACKUP */
if (mutex_test_and_set(mutex) == 0)
{
if (mutex_test_and_set(mutex) == 0) {
/* Succeeded! */
#ifdef UNIV_SYNC_DEBUG
@@ -448,17 +443,16 @@ spin_loop:
goto finish_timing;
}
/* We may end up with a situation where lock_word is
0 but the OS fast mutex is still reserved. On FreeBSD
the OS does not seem to schedule a thread which is constantly
calling pthread_mutex_trylock (in mutex_test_and_set
implementation). Then we could end up spinning here indefinitely.
The following 'i++' stops this infinite spin. */
/* We may end up with a situation where lock_word is 0 but the OS
fast mutex is still reserved. On FreeBSD the OS does not seem to
schedule a thread which is constantly calling pthread_mutex_trylock
(in mutex_test_and_set implementation). Then we could end up
spinning here indefinitely. The following 'i++' stops this infinite
spin. */
i++;
if (i < SYNC_SPIN_ROUNDS)
{
if (i < SYNC_SPIN_ROUNDS) {
goto spin_loop;
}
@@ -476,13 +470,12 @@ spin_loop:
mutex_set_waiters(mutex, 1);
/* Try to reserve still a few times */
for (i = 0; i < 4; i++)
{
if (mutex_test_and_set(mutex) == 0)
{
for (i = 0; i < 4; i++) {
if (mutex_test_and_set(mutex) == 0) {
/* Succeeded! Free the reserved wait cell */
sync_array_free_cell_protected(sync_primary_wait_array, index);
sync_array_free_cell_protected(sync_primary_wait_array,
index);
#ifdef UNIV_SYNC_DEBUG
mutex_set_debug_info(mutex, file_name, line);
@@ -498,14 +491,14 @@ spin_loop:
goto finish_timing;
/* Note that in this case we leave the waiters field
set to 1. We cannot reset it to zero, as we do not know
if there are other waiters. */
set to 1. We cannot reset it to zero, as we do not
know if there are other waiters. */
}
}
/* Now we know that there has been some thread holding the mutex
after the change in the wait array and the waiters field was made.
Now there is no risk of infinite wait on the event. */
Now there is no risk of infinite wait on the event. */
#ifdef UNIV_SRV_PRINT_LATCH_WAITS
fprintf(stderr,
@@ -519,12 +512,9 @@ Now there is no risk of infinite wait on the event. */
#ifndef UNIV_HOTBACKUP
mutex->count_os_wait++;
/*
!!!!! Sometimes os_wait can be called without os_thread_yield
*/
/* !!!!! Sometimes os_wait can be called without os_thread_yield */
if (timed_mutexes == 1 && timer_started==0)
{
if (timed_mutexes == 1 && timer_started==0) {
ut_usectime(&sec, &ms);
lstart_time= (ib_longlong)sec * 1000000 + ms;
timer_started = 1;
@@ -536,15 +526,14 @@ Now there is no risk of infinite wait on the event. */
finish_timing:
#ifndef UNIV_HOTBACKUP
if (timed_mutexes == 1 && timer_started==1)
{
if (timed_mutexes == 1 && timer_started==1) {
ut_usectime(&sec, &ms);
lfinish_time= (ib_longlong)sec * 1000000 + ms;
ltime_diff= (ulint) (lfinish_time - lstart_time);
mutex->lspent_time += ltime_diff;
if (mutex->lmax_spent_time < ltime_diff)
{
if (mutex->lmax_spent_time < ltime_diff) {
mutex->lmax_spent_time= ltime_diff;
}
}

View File

@@ -732,8 +732,8 @@ 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;

View File

@@ -562,18 +562,19 @@ trx_undo_page_report_modify(
}
if (rec_offs_nth_extern(offsets, pos)) {
/* If a field has external storage, we add to
flen the flag */
/* If a field has external storage, we add
to flen the flag */
len = mach_write_compressed(ptr,
UNIV_EXTERN_STORAGE_FIELD + flen);
/* Notify purge that it eventually has to free the old
externally stored field */
/* Notify purge that it eventually has to
free the old externally stored field */
trx->update_undo->del_marks = TRUE;
*type_cmpl_ptr = *type_cmpl_ptr | TRX_UNDO_UPD_EXTERN;
*type_cmpl_ptr = *type_cmpl_ptr
| TRX_UNDO_UPD_EXTERN;
} else {
len = mach_write_compressed(ptr, flen);
}
@@ -615,18 +616,20 @@ trx_undo_page_report_modify(
old_ptr = ptr;
/* Reserve 2 bytes to write the number of bytes the stored fields
take in this undo record */
/* Reserve 2 bytes to write the number of bytes the stored
fields take in this undo record */
ptr += 2;
for (col_no = 0; col_no < dict_table_get_n_cols(table); col_no++) {
for (col_no = 0; col_no < dict_table_get_n_cols(table);
col_no++) {
col = dict_table_get_nth_col(table, col_no);
if (col->ord_part > 0) {
pos = dict_index_get_nth_col_pos(index, col_no);
pos = dict_index_get_nth_col_pos(index,
col_no);
/* Write field number to undo log */
if (trx_undo_left(undo_page, ptr) < 5) {
@@ -638,7 +641,8 @@ trx_undo_page_report_modify(
ptr += len;
/* Save the old value of field */
field = rec_get_nth_field(rec, offsets, pos, &flen);
field = rec_get_nth_field(rec, offsets, pos,
&flen);
if (trx_undo_left(undo_page, ptr) < 5) {
@@ -649,7 +653,8 @@ trx_undo_page_report_modify(
ptr += len;
if (flen != UNIV_SQL_NULL) {
if (trx_undo_left(undo_page, ptr) < flen) {
if (trx_undo_left(undo_page, ptr)
< flen) {
return(0);
}

View File

@@ -178,8 +178,7 @@ trx_rseg_mem_create(
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);

View File

@@ -455,7 +455,7 @@ trx_sys_doublewrite_init_or_restore_pages(
(ulong) space_id, (ulong) page_no, (ulong) i);
} else if (space_id == TRX_SYS_SPACE
&& ( (page_no >= block1
&& ((page_no >= block1
&& page_no
< block1 + TRX_SYS_DOUBLEWRITE_BLOCK_SIZE)
|| (page_no >= block2

View File

@@ -556,12 +556,14 @@ trx_lists_init_at_db_start(void)
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;
trx->conc_state =
TRX_ACTIVE;
}
} else {
trx->conc_state =
@@ -595,8 +597,8 @@ 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);

View File

@@ -1167,8 +1167,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;

View File

@@ -62,10 +62,11 @@ ut_malloc_low(
/*==========*/
/* out, own: allocated memory */
ulint n, /* in: number of bytes to allocate */
ibool set_to_zero, /* in: TRUE if allocated memory should be set
to zero if UNIV_SET_MEM_TO_ZERO is defined */
ibool assert_on_error) /* in: if TRUE, we crash mysqld if the memory
cannot be allocated */
ibool set_to_zero, /* in: TRUE if allocated memory should be
set to zero if UNIV_SET_MEM_TO_ZERO is
defined */
ibool assert_on_error)/* in: if TRUE, we crash mysqld if the
memory cannot be allocated */
{
ulint retry_count = 0;
void* ret;