summaryrefslogtreecommitdiff
path: root/storage/innobase
diff options
context:
space:
mode:
Diffstat (limited to 'storage/innobase')
-rw-r--r--storage/innobase/fil/fil0fil.cc2
-rw-r--r--storage/innobase/gis/gis0geo.cc32
-rw-r--r--storage/innobase/handler/ha_innodb.cc21
-rw-r--r--storage/innobase/handler/handler0alter.cc3
-rw-r--r--storage/innobase/ibuf/ibuf0ibuf.cc4
-rw-r--r--storage/innobase/include/fil0fil.h2
-rw-r--r--storage/innobase/include/fil0fil.ic2
-rw-r--r--storage/innobase/include/gis0geo.h13
-rw-r--r--storage/innobase/include/mtr0log.ic3
-rw-r--r--storage/innobase/os/os0file.cc112
-rw-r--r--storage/innobase/os/os0thread.cc10
-rw-r--r--storage/innobase/row/row0sel.cc4
-rw-r--r--storage/innobase/srv/srv0mon.cc2
13 files changed, 104 insertions, 106 deletions
diff --git a/storage/innobase/fil/fil0fil.cc b/storage/innobase/fil/fil0fil.cc
index b13e1397522..7d6edeb8752 100644
--- a/storage/innobase/fil/fil0fil.cc
+++ b/storage/innobase/fil/fil0fil.cc
@@ -159,7 +159,7 @@ current working directory ".", but in the MySQL Embedded Server Library
it is an absolute path. */
const char* fil_path_to_mysql_datadir;
-/** Common InnoDB file extentions */
+/** Common InnoDB file extensions */
const char* dot_ext[] = { "", ".ibd", ".isl", ".cfg" };
/** The number of fsyncs done to the log */
diff --git a/storage/innobase/gis/gis0geo.cc b/storage/innobase/gis/gis0geo.cc
index d60a304f2f3..a65616db127 100644
--- a/storage/innobase/gis/gis0geo.cc
+++ b/storage/innobase/gis/gis0geo.cc
@@ -791,35 +791,3 @@ rtree_area_overlapping(
return(area);
}
-
-/** Get the wkb of default POINT value, which represents POINT(0 0)
-if it's of dimension 2, etc.
-@param[in] n_dims dimensions
-@param[out] wkb wkb buffer for default POINT
-@param[in] len length of wkb buffer
-@return non-0 indicate the length of wkb of the default POINT,
-0 if the buffer is too small */
-uint
-get_wkb_of_default_point(
- uint n_dims,
- uchar* wkb,
- uint len)
-{
- // JAN: TODO: MYSQL 5.7 GIS
- #define GEOM_HEADER_SIZE 16
- if (len < GEOM_HEADER_SIZE + sizeof(double) * n_dims) {
- return(0);
- }
-
- /** POINT wkb comprises SRID, wkb header(byte order and type)
- and coordinates of the POINT */
- len = GEOM_HEADER_SIZE + sizeof(double) * n_dims;
- /** We always use 0 as default coordinate */
- memset(wkb, 0, len);
- /** We don't need to write SRID, write 0x01 for Byte Order */
- mach_write_to_n_little_endian(wkb + SRID_SIZE, 1, 0x01);
- /** Write wkbType::wkbPoint for the POINT type */
- mach_write_to_n_little_endian(wkb + SRID_SIZE + 1, 4, wkbPoint);
-
- return(len);
-}
diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc
index e6cef3a57c6..36f295749aa 100644
--- a/storage/innobase/handler/ha_innodb.cc
+++ b/storage/innobase/handler/ha_innodb.cc
@@ -12725,15 +12725,18 @@ bool create_table_info_t::row_size_is_acceptable(
const dict_field_t *field= dict_index_get_nth_field(&index, idx);
ut_ad((!field->name) == field->col->is_dropped());
- ib::error_or_warn eow(strict);
- if (field->name)
- eow << "Cannot add field " << field->name << " in table ";
- else
- eow << "Cannot add an instantly dropped column in table ";
- eow << index.table->name << " because after adding it, the row size is "
- << info.get_overrun_size()
- << " which is greater than maximum allowed size ("
- << info.max_leaf_size << " bytes) for a record on index leaf page.";
+ if (strict || global_system_variables.log_warnings > 2)
+ {
+ ib::error_or_warn eow(strict);
+ if (field->name)
+ eow << "Cannot add field " << field->name << " in table ";
+ else
+ eow << "Cannot add an instantly dropped column in table ";
+ eow << index.table->name << " because after adding it, the row size is "
+ << info.get_overrun_size()
+ << " which is greater than maximum allowed size ("
+ << info.max_leaf_size << " bytes) for a record on index leaf page.";
+ }
if (strict)
{
diff --git a/storage/innobase/handler/handler0alter.cc b/storage/innobase/handler/handler0alter.cc
index 047f81fef6d..c5447417969 100644
--- a/storage/innobase/handler/handler0alter.cc
+++ b/storage/innobase/handler/handler0alter.cc
@@ -6749,6 +6749,7 @@ new_table_failed:
if (index) {
dict_mem_index_free(index);
}
+error_handling_drop_uncached_1:
while (++a < ctx->num_to_add_index) {
dict_mem_index_free(ctx->add_index[a]);
}
@@ -6760,7 +6761,7 @@ new_table_failed:
ctx->add_index[a] = index;
if (!info.row_size_is_acceptable(*index)) {
error = DB_TOO_BIG_RECORD;
- goto error_handling;
+ goto error_handling_drop_uncached_1;
}
index->parser = index_defs[a].parser;
index->has_new_v_col = has_new_v_col;
diff --git a/storage/innobase/ibuf/ibuf0ibuf.cc b/storage/innobase/ibuf/ibuf0ibuf.cc
index e7ba7872082..6e50f02469c 100644
--- a/storage/innobase/ibuf/ibuf0ibuf.cc
+++ b/storage/innobase/ibuf/ibuf0ibuf.cc
@@ -4509,7 +4509,7 @@ loop:
}
if (!btr_pcur_is_on_user_rec(&pcur)) {
- ut_ad(btr_pcur_is_after_last_in_tree(&pcur));
+ ut_ad(btr_pcur_is_after_last_on_page(&pcur));
goto reset_bit;
}
@@ -4737,7 +4737,7 @@ loop:
&pcur, &mtr);
if (!btr_pcur_is_on_user_rec(&pcur)) {
- ut_ad(btr_pcur_is_after_last_in_tree(&pcur));
+ ut_ad(btr_pcur_is_after_last_on_page(&pcur));
goto leave_loop;
}
diff --git a/storage/innobase/include/fil0fil.h b/storage/innobase/include/fil0fil.h
index a1efd28f7ed..afb8debd853 100644
--- a/storage/innobase/include/fil0fil.h
+++ b/storage/innobase/include/fil0fil.h
@@ -629,7 +629,7 @@ inline bool fil_space_t::is_rotational() const
return false;
}
-/** Common InnoDB file extentions */
+/** Common InnoDB file extensions */
enum ib_extention {
NO_EXT = 0,
IBD = 1,
diff --git a/storage/innobase/include/fil0fil.ic b/storage/innobase/include/fil0fil.ic
index 34d360ee531..24e4157d1f3 100644
--- a/storage/innobase/include/fil0fil.ic
+++ b/storage/innobase/include/fil0fil.ic
@@ -69,7 +69,7 @@ fil_get_page_type_name(
case FIL_PAGE_TYPE_ZBLOB2:
return "ZBLOB2";
case FIL_PAGE_TYPE_UNKNOWN:
- return "OLD UNKOWN PAGE TYPE";
+ return "OLD UNKNOWN PAGE TYPE";
default:
return "PAGE TYPE CORRUPTED";
}
diff --git a/storage/innobase/include/gis0geo.h b/storage/innobase/include/gis0geo.h
index 3b71815d0fe..dea6d63f4e0 100644
--- a/storage/innobase/include/gis0geo.h
+++ b/storage/innobase/include/gis0geo.h
@@ -54,19 +54,6 @@ enum wkbByteOrder
wkbNDR = 1 /* Little Endian */
};
-/** Get the wkb of default POINT value, which represents POINT(0 0)
-if it's of dimension 2, etc.
-@param[in] n_dims dimensions
-@param[out] wkb wkb buffer for default POINT
-@param[in] len length of wkb buffer
-@return non-0 indicate the length of wkb of the default POINT,
-0 if the buffer is too small */
-uint
-get_wkb_of_default_point(
- uint n_dims,
- uchar* wkb,
- uint len);
-
/*************************************************************//**
Calculate minimal bounding rectangle (mbr) of the spatial object
stored in "well-known binary representation" (wkb) format.
diff --git a/storage/innobase/include/mtr0log.ic b/storage/innobase/include/mtr0log.ic
index b7ba92ff1a5..23a840d95a6 100644
--- a/storage/innobase/include/mtr0log.ic
+++ b/storage/innobase/include/mtr0log.ic
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2017, MariaDB Corporation.
+Copyright (c) 2017, 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
@@ -187,7 +187,6 @@ mlog_write_initial_log_record_low(
|| type == MLOG_FILE_CREATE2
|| type == MLOG_FILE_RENAME2
|| type == MLOG_INDEX_LOAD
- || type == MLOG_TRUNCATE
|| type == MLOG_FILE_WRITE_CRYPT_DATA
|| mtr->is_named_space(space_id));
diff --git a/storage/innobase/os/os0file.cc b/storage/innobase/os/os0file.cc
index a2243dec9cf..1eb3c4f202d 100644
--- a/storage/innobase/os/os0file.cc
+++ b/storage/innobase/os/os0file.cc
@@ -409,7 +409,7 @@ public:
/** Accessor for the AIO context
@param[in] segment Segment for which to get the context
@return the AIO context for the segment */
- io_context* io_ctx(ulint segment)
+ io_context_t io_ctx(ulint segment)
MY_ATTRIBUTE((warn_unused_result))
{
ut_ad(segment < get_n_segments());
@@ -417,11 +417,11 @@ public:
return(m_aio_ctx[segment]);
}
- /** Creates an io_context for native linux AIO.
+ /** Creates an io_context_t for native linux AIO.
@param[in] max_events number of events
@param[out] io_ctx io_ctx to initialize.
@return true on success. */
- static bool linux_create_io_ctx(unsigned max_events, io_context_t* io_ctx)
+ static bool linux_create_io_ctx(unsigned max_events, io_context_t& io_ctx)
MY_ATTRIBUTE((warn_unused_result));
/** Checks if the system supports native linux aio. On some kernel
@@ -618,7 +618,7 @@ private:
/** completion queue for IO. There is one such queue per
segment. Each thread will work on one ctx exclusively. */
- io_context_t* m_aio_ctx;
+ std::vector<io_context_t> m_aio_ctx;
/** The array to collect completed IOs. There is one such
event for each possible pending IO. The size of the array
@@ -1675,10 +1675,14 @@ LinuxAIOHandler::resubmit(Slot* slot)
iocb->data = slot;
+ ut_a(reinterpret_cast<size_t>(iocb->u.c.buf) % OS_FILE_LOG_BLOCK_SIZE
+ == 0);
+
/* Resubmit an I/O request */
int ret = io_submit(m_array->io_ctx(m_segment), 1, &iocb);
+ ut_a(ret != -EINVAL);
- if (ret < -1) {
+ if (ret < 0) {
errno = -ret;
}
@@ -1779,8 +1783,8 @@ LinuxAIOHandler::collect()
ut_ad(m_array != NULL);
ut_ad(m_segment < m_array->get_n_segments());
- /* Which io_context we are going to use. */
- io_context* io_ctx = m_array->io_ctx(m_segment);
+ /* Which io_context_t we are going to use. */
+ io_context_t io_ctx = m_array->io_ctx(m_segment);
/* Starting point of the m_segment we will be working on. */
ulint start_pos = m_segment * m_n_slots;
@@ -1807,6 +1811,8 @@ LinuxAIOHandler::collect()
int ret;
ret = io_getevents(io_ctx, 1, m_n_slots, events, &timeout);
+ ut_a(ret != -EINVAL);
+ ut_ad(ret != -EFAULT);
for (int i = 0; i < ret; ++i) {
@@ -2033,14 +2039,18 @@ AIO::linux_dispatch(Slot* slot)
/* Find out what we are going to work with.
The iocb struct is directly in the slot.
- The io_context is one per segment. */
+ The io_context_t is one per segment. */
ulint io_ctx_index;
struct iocb* iocb = &slot->control;
io_ctx_index = (slot->pos * m_n_segments) / m_slots.size();
- int ret = io_submit(m_aio_ctx[io_ctx_index], 1, &iocb);
+ ut_a(reinterpret_cast<size_t>(iocb->u.c.buf) % OS_FILE_LOG_BLOCK_SIZE
+ == 0);
+
+ int ret = io_submit(io_ctx(io_ctx_index), 1, &iocb);
+ ut_a(ret != -EINVAL);
/* io_submit() returns number of successfully queued requests
or -errno. */
@@ -2052,25 +2062,26 @@ AIO::linux_dispatch(Slot* slot)
return(ret == 1);
}
-/** Creates an io_context for native linux AIO.
+/** Creates an io_context_t for native linux AIO.
@param[in] max_events number of events
@param[out] io_ctx io_ctx to initialize.
@return true on success. */
bool
AIO::linux_create_io_ctx(
unsigned max_events,
- io_context_t* io_ctx)
+ io_context_t& io_ctx)
{
ssize_t n_retries = 0;
for (;;) {
- memset(io_ctx, 0x0, sizeof(*io_ctx));
+ memset(&io_ctx, 0x0, sizeof(io_ctx));
/* Initialize the io_ctx. Tell it how many pending
IO requests this context will handle. */
- int ret = io_setup(max_events, io_ctx);
+ int ret = io_setup(max_events, &io_ctx);
+ ut_a(ret != -EINVAL);
if (ret == 0) {
/* Success. Return now. */
@@ -2149,7 +2160,7 @@ AIO::is_linux_native_aio_supported()
io_context_t io_ctx;
char name[1000];
- if (!linux_create_io_ctx(1, &io_ctx)) {
+ if (!linux_create_io_ctx(1, io_ctx)) {
/* The platform does not support native aio. */
@@ -2165,6 +2176,10 @@ AIO::is_linux_native_aio_supported()
<< "Unable to create temp file to check"
" native AIO support.";
+ int ret = io_destroy(io_ctx);
+ ut_a(ret != -EINVAL);
+ ut_ad(ret != -EFAULT);
+
return(false);
}
} else {
@@ -2194,6 +2209,10 @@ AIO::is_linux_native_aio_supported()
<< " \"" << name << "\" to check native"
<< " AIO read support.";
+ int ret = io_destroy(io_ctx);
+ ut_a(ret != EINVAL);
+ ut_ad(ret != EFAULT);
+
return(false);
}
}
@@ -2222,11 +2241,15 @@ AIO::is_linux_native_aio_supported()
io_prep_pread(p_iocb, fd, ptr, 512, 0);
}
+ ut_a(reinterpret_cast<size_t>(p_iocb->u.c.buf) % OS_FILE_LOG_BLOCK_SIZE
+ == 0);
int err = io_submit(io_ctx, 1, &p_iocb);
+ ut_a(err != -EINVAL);
if (err >= 1) {
/* Now collect the submitted IO request. */
err = io_getevents(io_ctx, 1, 1, &io_event, NULL);
+ ut_a(err != -EINVAL);
}
ut_free(buf);
@@ -2234,7 +2257,13 @@ AIO::is_linux_native_aio_supported()
switch (err) {
case 1:
- return(true);
+ {
+ int ret = io_destroy(io_ctx);
+ ut_a(ret != -EINVAL);
+ ut_ad(ret != -EFAULT);
+
+ return(true);
+ }
case -EINVAL:
case -ENOSYS:
@@ -2254,6 +2283,10 @@ AIO::is_linux_native_aio_supported()
<< "returned error[" << -err << "]";
}
+ int ret = io_destroy(io_ctx);
+ ut_a(ret != -EINVAL);
+ ut_ad(ret != -EFAULT);
+
return(false);
}
@@ -5602,8 +5635,7 @@ AIO::AIO(
m_n_segments(segments),
m_n_reserved()
# ifdef LINUX_NATIVE_AIO
- ,m_aio_ctx(),
- m_events(m_slots.size())
+ ,m_events(m_slots.size())
# endif /* LINUX_NATIVE_AIO */
#ifdef WIN_ASYNC_IO
,m_completion_port(new_completion_port())
@@ -5659,29 +5691,20 @@ AIO::init_slots()
dberr_t
AIO::init_linux_native_aio()
{
- /* Initialize the io_context array. One io_context
- per segment in the array. */
- ut_a(m_aio_ctx == NULL);
-
- m_aio_ctx = static_cast<io_context**>(
- ut_zalloc_nokey(m_n_segments * sizeof(*m_aio_ctx)));
-
- if (m_aio_ctx == NULL) {
- return(DB_OUT_OF_MEMORY);
- }
+ /* Initialize the io_context_t array. One io_context_t
+ per segment in the array. */
+ m_aio_ctx.resize(get_n_segments());
- io_context** ctx = m_aio_ctx;
ulint max_events = slots_per_segment();
- for (ulint i = 0; i < m_n_segments; ++i, ++ctx) {
+ for (std::vector<io_context_t>::iterator it = m_aio_ctx.begin(),
+ end = m_aio_ctx.end();
+ it != end; ++it) {
- if (!linux_create_io_ctx(max_events, ctx)) {
+ if (!linux_create_io_ctx(max_events, *it)) {
/* If something bad happened during aio setup
we disable linux native aio.
- The disadvantage will be a small memory leak
- at shutdown but that's ok compared to a crash
- or a not working server.
This frequently happens when running the test suite
with many threads on a system with low fs.aio-max-nr!
*/
@@ -5693,8 +5716,15 @@ AIO::init_linux_native_aio()
<< "try increasing system "
<< "fs.aio-max-nr to 1048576 or larger or "
<< "setting innodb_use_native_aio = 0 in my.cnf";
- ut_free(m_aio_ctx);
- m_aio_ctx = 0;
+
+ for (std::vector<io_context_t>::iterator it2
+ = m_aio_ctx.begin();
+ it2 != it; ++it2) {
+ int ret = io_destroy(*it2);
+ ut_a(ret != -EINVAL);
+ }
+
+ m_aio_ctx.clear();
srv_use_native_aio = FALSE;
return(DB_SUCCESS);
}
@@ -5770,15 +5800,15 @@ AIO::~AIO()
#if defined(LINUX_NATIVE_AIO)
if (srv_use_native_aio) {
- m_events.clear();
- ut_free(m_aio_ctx);
+ for (ulint i = 0; i < m_aio_ctx.size(); i++) {
+ int ret = io_destroy(m_aio_ctx[i]);
+ ut_a(ret != -EINVAL);
+ }
}
#endif /* LINUX_NATIVE_AIO */
#if defined(WIN_ASYNC_IO)
CloseHandle(m_completion_port);
#endif
-
- m_slots.clear();
}
/** Initializes the asynchronous io system. Creates one array each for ibuf
@@ -6072,6 +6102,10 @@ AIO::reserve_slot(
os_offset_t offset,
ulint len)
{
+ ut_ad(reinterpret_cast<size_t>(buf) % OS_FILE_LOG_BLOCK_SIZE == 0);
+ ut_ad(offset % OS_FILE_LOG_BLOCK_SIZE == 0);
+ ut_ad(len % OS_FILE_LOG_BLOCK_SIZE == 0);
+
#ifdef WIN_ASYNC_IO
ut_a((len & 0xFFFFFFFFUL) == len);
#endif /* WIN_ASYNC_IO */
diff --git a/storage/innobase/os/os0thread.cc b/storage/innobase/os/os0thread.cc
index 6e077d88067..bb5da7df7c4 100644
--- a/storage/innobase/os/os0thread.cc
+++ b/storage/innobase/os/os0thread.cc
@@ -125,11 +125,17 @@ os_thread_create_func(
pthread_attr_t attr;
- pthread_attr_init(&attr);
+ int ret = pthread_attr_init(&attr);
+ if (UNIV_UNLIKELY(ret)) {
+ fprintf(stderr,
+ "InnoDB: Error: pthread_attr_init() returned %d\n",
+ ret);
+ abort();
+ }
os_thread_count++;
- int ret = pthread_create(&new_thread_id, &attr, func, arg);
+ ret = pthread_create(&new_thread_id, &attr, func, arg);
ut_a(ret == 0);
diff --git a/storage/innobase/row/row0sel.cc b/storage/innobase/row/row0sel.cc
index 6c7a54ece7d..f8b3a5ff8ed 100644
--- a/storage/innobase/row/row0sel.cc
+++ b/storage/innobase/row/row0sel.cc
@@ -4254,7 +4254,7 @@ row_search_mvcc(
|| prebuilt->m_read_virtual_key);
/* Reset the new record lock info if srv_locks_unsafe_for_binlog
- is set or session is using a READ COMMITED isolation level. Then
+ is set or session is using a READ COMMITTED isolation level. Then
we are able to remove the record locks set here on an individual
row. */
prebuilt->new_rec_locks = 0;
@@ -4968,7 +4968,7 @@ wrong_offs:
existence with LOCK_REC_NOT_GAP. */
/* If innodb_locks_unsafe_for_binlog option is used
- or this session is using a READ COMMITED isolation
+ or this session is using a READ COMMITTED isolation
level we lock only the record, i.e., next-key locking is
not used. */
diff --git a/storage/innobase/srv/srv0mon.cc b/storage/innobase/srv/srv0mon.cc
index 80beddd7f5e..c759a5b75fe 100644
--- a/storage/innobase/srv/srv0mon.cc
+++ b/storage/innobase/srv/srv0mon.cc
@@ -417,7 +417,7 @@ static monitor_info_t innodb_counter_info[] =
MONITOR_DEFAULT_START, MONITOR_FLUSH_AVG_TIME},
{"buffer_flush_adaptive_avg_pass", "buffer",
- "Numner of adaptive flushes passed during the recent Avg period.",
+ "Number of adaptive flushes passed during the recent Avg period.",
MONITOR_NONE,
MONITOR_DEFAULT_START, MONITOR_FLUSH_ADAPTIVE_AVG_PASS},