summaryrefslogtreecommitdiff
path: root/storage/innobase
diff options
context:
space:
mode:
Diffstat (limited to 'storage/innobase')
-rw-r--r--storage/innobase/btr/btr0bulk.cc3
-rw-r--r--storage/innobase/handler/ha_innodb.cc4
-rw-r--r--storage/innobase/handler/handler0alter.cc12
-rw-r--r--storage/innobase/include/db0err.h5
-rw-r--r--storage/innobase/include/trx0roll.h6
-rw-r--r--storage/innobase/os/os0file.cc20
-rw-r--r--storage/innobase/que/que0que.cc2
-rw-r--r--storage/innobase/row/row0log.cc18
-rw-r--r--storage/innobase/row/row0merge.cc4
-rw-r--r--storage/innobase/srv/srv0srv.cc20
-rw-r--r--storage/innobase/trx/trx0roll.cc7
11 files changed, 65 insertions, 36 deletions
diff --git a/storage/innobase/btr/btr0bulk.cc b/storage/innobase/btr/btr0bulk.cc
index 6a9b71987c5..82fac3bce2d 100644
--- a/storage/innobase/btr/btr0bulk.cc
+++ b/storage/innobase/btr/btr0bulk.cc
@@ -1046,6 +1046,7 @@ BtrBulk::finish(dberr_t err)
ut_ad(!sync_check_iterate(dict_sync_check()));
- ut_ad(err != DB_SUCCESS || btr_validate_index(m_index, NULL));
+ ut_ad(err != DB_SUCCESS
+ || btr_validate_index(m_index, NULL) == DB_SUCCESS);
return(err);
}
diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc
index e9a5d350f8b..dd79dceed0b 100644
--- a/storage/innobase/handler/ha_innodb.cc
+++ b/storage/innobase/handler/ha_innodb.cc
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 2000, 2018, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 2000, 2019, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2008, 2009 Google Inc.
Copyright (c) 2009, Percona Inc.
Copyright (c) 2012, Facebook Inc.
@@ -10854,7 +10854,7 @@ innodb_base_col_setup_for_stored(
for (uint i= 0; i < field->table->s->fields; ++i) {
const Field* base_field = field->table->field[i];
- if (!base_field->vcol_info
+ if (base_field->stored_in_db()
&& bitmap_is_set(&field->table->tmp_set, i)) {
ulint z;
for (z = 0; z < table->n_cols; z++) {
diff --git a/storage/innobase/handler/handler0alter.cc b/storage/innobase/handler/handler0alter.cc
index e19c63cd18f..729208dd04c 100644
--- a/storage/innobase/handler/handler0alter.cc
+++ b/storage/innobase/handler/handler0alter.cc
@@ -2777,14 +2777,10 @@ innobase_col_check_fk(
{
dict_s_col_list::const_iterator it;
- for (it = s_cols->begin();
- it != s_cols->end(); ++it) {
- dict_s_col_t s_col = *it;
-
- for (ulint j = 0; j < s_col.num_base; j++) {
- if (strcmp(col_name, dict_table_get_col_name(
- table,
- s_col.base_col[j]->ind)) == 0) {
+ for (it = s_cols->begin(); it != s_cols->end(); ++it) {
+ for (ulint j = it->num_base; j--; ) {
+ if (!strcmp(col_name, dict_table_get_col_name(
+ table, it->base_col[j]->ind))) {
return(true);
}
}
diff --git a/storage/innobase/include/db0err.h b/storage/innobase/include/db0err.h
index 2110018b6d4..53e75e695ae 100644
--- a/storage/innobase/include/db0err.h
+++ b/storage/innobase/include/db0err.h
@@ -30,12 +30,13 @@ Created 5/24/1996 Heikki Tuuri
/* Do not include univ.i because univ.i includes this. */
enum dberr_t {
+ DB_SUCCESS,
+
DB_SUCCESS_LOCKED_REC = 9, /*!< like DB_SUCCESS, but a new
explicit record lock was created */
- DB_SUCCESS = 10,
/* The following are error codes */
- DB_ERROR,
+ DB_ERROR = 11,
DB_INTERRUPTED,
DB_OUT_OF_MEMORY,
DB_OUT_OF_FILE_SPACE,
diff --git a/storage/innobase/include/trx0roll.h b/storage/innobase/include/trx0roll.h
index 93432cde74e..e73b5c5d2b8 100644
--- a/storage/innobase/include/trx0roll.h
+++ b/storage/innobase/include/trx0roll.h
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2015, 2018, MariaDB Corporation.
+Copyright (c) 2015, 2019, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -183,9 +183,7 @@ enum roll_node_state {
struct roll_node_t{
que_common_t common; /*!< node type: QUE_NODE_ROLLBACK */
enum roll_node_state state; /*!< node execution state */
- bool partial;/*!< TRUE if we want a partial
- rollback */
- trx_savept_t savept; /*!< savepoint to which to
+ const trx_savept_t* savept; /*!< savepoint to which to
roll back, in the case of a
partial rollback */
que_thr_t* undo_thr;/*!< undo query graph */
diff --git a/storage/innobase/os/os0file.cc b/storage/innobase/os/os0file.cc
index 23e0a401c1e..ded109138dc 100644
--- a/storage/innobase/os/os0file.cc
+++ b/storage/innobase/os/os0file.cc
@@ -1841,10 +1841,24 @@ LinuxAIOHandler::collect()
will be done in the calling function. */
m_array->acquire();
- slot->ret = events[i].res2;
+ /* events[i].res2 should always be ZERO */
+ ut_ad(events[i].res2 == 0);
slot->io_already_done = true;
- slot->n_bytes = events[i].res;
+ /*Even though events[i].res is an unsigned number
+ in libaio, it is used to return a negative value
+ (negated errno value) to indicate error and a positive
+ value to indicate number of bytes read or written. */
+
+ if (events[i].res > slot->len) {
+ /* failure */
+ slot->n_bytes = 0;
+ slot->ret = events[i].res;
+ } else {
+ /* success */
+ slot->n_bytes = events[i].res;
+ slot->ret = 0;
+ }
m_array->release();
}
@@ -7678,7 +7692,7 @@ bool fil_node_t::read_page0(bool first)
/* Align the memory for file i/o if we might have O_DIRECT set */
byte* page = static_cast<byte*>(ut_align(buf2, psize));
IORequest request(IORequest::READ);
- if (!os_file_read(request, handle, page, 0, psize)) {
+ if (os_file_read(request, handle, page, 0, psize) != DB_SUCCESS) {
ib::error() << "Unable to read first page of file " << name;
ut_free(buf2);
return false;
diff --git a/storage/innobase/que/que0que.cc b/storage/innobase/que/que0que.cc
index ef40c3479a0..ceb48c4b298 100644
--- a/storage/innobase/que/que0que.cc
+++ b/storage/innobase/que/que0que.cc
@@ -1230,7 +1230,5 @@ que_eval_sql(
mutex_exit(&dict_sys->mutex);
}
- ut_a(trx->error_state != 0);
-
DBUG_RETURN(trx->error_state);
}
diff --git a/storage/innobase/row/row0log.cc b/storage/innobase/row/row0log.cc
index 55a3865b783..834a31684b2 100644
--- a/storage/innobase/row/row0log.cc
+++ b/storage/innobase/row/row0log.cc
@@ -445,11 +445,12 @@ row_log_online_op(
}
log->tail.blocks++;
- if (!os_file_write(
+ if (os_file_write(
request,
"(modification log)",
log->fd,
- buf, byte_offset, srv_sort_buf_size)) {
+ buf, byte_offset, srv_sort_buf_size)
+ != DB_SUCCESS) {
write_failed:
/* We set the flag directly instead of invoking
dict_set_corrupted_index_cache_only(index) here,
@@ -583,11 +584,12 @@ row_log_table_close_func(
}
log->tail.blocks++;
- if (!os_file_write(
+ if (os_file_write(
request,
"(modification log)",
log->fd,
- buf, byte_offset, srv_sort_buf_size)) {
+ buf, byte_offset, srv_sort_buf_size)
+ != DB_SUCCESS) {
write_failed:
log->error = DB_ONLINE_LOG_TOO_BIG;
}
@@ -2862,9 +2864,9 @@ all_done:
IORequest request(IORequest::READ);
byte* buf = index->online_log->head.block;
- if (!os_file_read_no_error_handling(
+ if (os_file_read_no_error_handling(
request, index->online_log->fd,
- buf, ofs, srv_sort_buf_size, 0)) {
+ buf, ofs, srv_sort_buf_size, 0) != DB_SUCCESS) {
ib::error()
<< "Unable to read temporary file"
" for table " << index->table->name;
@@ -3766,9 +3768,9 @@ all_done:
byte* buf = index->online_log->head.block;
- if (!os_file_read_no_error_handling(
+ if (os_file_read_no_error_handling(
request, index->online_log->fd,
- buf, ofs, srv_sort_buf_size, 0)) {
+ buf, ofs, srv_sort_buf_size, 0) != DB_SUCCESS) {
ib::error()
<< "Unable to read temporary file"
" for index " << index->name;
diff --git a/storage/innobase/row/row0merge.cc b/storage/innobase/row/row0merge.cc
index 64b1b0c5119..989f242cf6c 100644
--- a/storage/innobase/row/row0merge.cc
+++ b/storage/innobase/row/row0merge.cc
@@ -1094,7 +1094,7 @@ row_merge_read(
DBUG_EXECUTE_IF("row_merge_read_failure", DBUG_RETURN(FALSE););
IORequest request(IORequest::READ);
- const bool success = os_file_read_no_error_handling(
+ const bool success = DB_SUCCESS == os_file_read_no_error_handling(
request, fd, buf, ofs, srv_sort_buf_size, 0);
/* If encryption is enabled decrypt buffer */
@@ -1156,7 +1156,7 @@ row_merge_write(
}
IORequest request(IORequest::WRITE);
- const bool success = os_file_write(
+ const bool success = DB_SUCCESS == os_file_write(
request, "(merge)", fd, out_buf, ofs, buf_len);
#ifdef POSIX_FADV_DONTNEED
diff --git a/storage/innobase/srv/srv0srv.cc b/storage/innobase/srv/srv0srv.cc
index 3d1415b07c6..528384eaa3f 100644
--- a/storage/innobase/srv/srv0srv.cc
+++ b/storage/innobase/srv/srv0srv.cc
@@ -2168,6 +2168,16 @@ srv_master_do_active_tasks(void)
MONITOR_SRV_DICT_LRU_MICROSECOND, counter_time);
}
+ /* The periodic log_checkpoint() call here makes it harder to
+ reproduce bugs in crash recovery or mariabackup --prepare, or
+ in code that writes the redo log records. Omitting the call
+ here should not affect correctness, because log_free_check()
+ should still be invoking checkpoints when needed. In a
+ production server, those calls could cause "furious flushing"
+ and stall the server. Normally we want to perform checkpoints
+ early and often to avoid those situations. */
+ DBUG_EXECUTE_IF("ib_log_checkpoint_avoid", return;);
+
if (srv_shutdown_state != SRV_SHUTDOWN_NONE) {
return;
}
@@ -2247,6 +2257,16 @@ srv_master_do_idle_tasks(void)
MONITOR_INC_TIME_IN_MICRO_SECS(
MONITOR_SRV_LOG_FLUSH_MICROSECOND, counter_time);
+ /* The periodic log_checkpoint() call here makes it harder to
+ reproduce bugs in crash recovery or mariabackup --prepare, or
+ in code that writes the redo log records. Omitting the call
+ here should not affect correctness, because log_free_check()
+ should still be invoking checkpoints when needed. In a
+ production server, those calls could cause "furious flushing"
+ and stall the server. Normally we want to perform checkpoints
+ early and often to avoid those situations. */
+ DBUG_EXECUTE_IF("ib_log_checkpoint_avoid", return;);
+
if (srv_shutdown_state != SRV_SHUTDOWN_NONE) {
return;
}
diff --git a/storage/innobase/trx/trx0roll.cc b/storage/innobase/trx/trx0roll.cc
index 0c43b8ca681..a64097fb0fd 100644
--- a/storage/innobase/trx/trx0roll.cc
+++ b/storage/innobase/trx/trx0roll.cc
@@ -112,8 +112,7 @@ trx_rollback_to_savepoint_low(
roll_node = roll_node_create(heap);
if (savept != NULL) {
- roll_node->partial = TRUE;
- roll_node->savept = *savept;
+ roll_node->savept = savept;
check_trx_state(trx);
} else {
assert_trx_nonlocking_or_in_list(trx);
@@ -912,7 +911,7 @@ que_thr_t*
trx_rollback_start(
/*===============*/
trx_t* trx, /*!< in: transaction */
- ib_id_t roll_limit) /*!< in: rollback to undo no (for
+ undo_no_t roll_limit) /*!< in: rollback to undo no (for
partial undo), 0 if we are rolling back
the entire transaction */
{
@@ -990,7 +989,7 @@ trx_rollback_step(
ut_a(node->undo_thr == NULL);
- roll_limit = node->partial ? node->savept.least_undo_no : 0;
+ roll_limit = node->savept ? node->savept->least_undo_no : 0;
trx_commit_or_rollback_prepare(trx);