summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2018-06-06 11:25:33 +0300
committerMarko Mäkelä <marko.makela@mariadb.com>2018-06-06 11:25:33 +0300
commitdf42830b286ab2d603d0ed1340925b8199c8d70e (patch)
tree11097704363a28b8bb4676b954562c13b88ba76f
parent738c5c84245f27c839a0713f52452a45f141b3d4 (diff)
parent1d4e1d3263bf3b87b473c12d4876f368dc3450b6 (diff)
downloadmariadb-git-df42830b286ab2d603d0ed1340925b8199c8d70e.tar.gz
Merge 10.1 into 10.2
-rw-r--r--mysql-test/suite/innodb/r/innodb-blob.result2
-rw-r--r--mysql-test/suite/innodb/r/innodb_defragment_small.result21
-rw-r--r--mysql-test/suite/innodb/t/innodb-blob.test4
-rw-r--r--mysql-test/suite/innodb/t/innodb_defragment_small.test23
-rw-r--r--storage/innobase/btr/btr0defragment.cc51
-rw-r--r--storage/innobase/fil/fil0fil.cc106
-rw-r--r--storage/innobase/handler/ha_innodb.cc16
-rw-r--r--storage/innobase/include/fil0fil.h4
-rw-r--r--storage/innobase/include/ut0timer.h39
-rw-r--r--storage/innobase/include/ut0timer.ic61
-rw-r--r--storage/innobase/os/os0file.cc7
-rw-r--r--storage/xtradb/btr/btr0defragment.cc50
-rw-r--r--storage/xtradb/fil/fil0fil.cc111
-rw-r--r--storage/xtradb/handler/ha_innodb.cc24
-rw-r--r--storage/xtradb/handler/ha_innodb.h5
-rw-r--r--storage/xtradb/include/fil0fil.h4
-rw-r--r--storage/xtradb/include/ut0timer.h39
-rw-r--r--storage/xtradb/include/ut0timer.ic61
-rw-r--r--storage/xtradb/os/os0file.cc7
-rw-r--r--support-files/CMakeLists.txt11
20 files changed, 80 insertions, 566 deletions
diff --git a/mysql-test/suite/innodb/r/innodb-blob.result b/mysql-test/suite/innodb/r/innodb-blob.result
index d48bfdf0f80..c2b46661e31 100644
--- a/mysql-test/suite/innodb/r/innodb-blob.result
+++ b/mysql-test/suite/innodb/r/innodb-blob.result
@@ -1,4 +1,4 @@
-call mtr.add_suppression("InnoDB: The log sequence numbers [0-9]+ and [0-9]+ in ibdata files do not match the log sequence number [0-9]+ in the ib_logfiles!");
+FLUSH TABLES;
CREATE TABLE t1 (a INT PRIMARY KEY, b TEXT) ENGINE=InnoDB;
CREATE TABLE t2 (a INT PRIMARY KEY) ENGINE=InnoDB;
CREATE TABLE t3 (a INT PRIMARY KEY, b TEXT, c TEXT) ENGINE=InnoDB;
diff --git a/mysql-test/suite/innodb/r/innodb_defragment_small.result b/mysql-test/suite/innodb/r/innodb_defragment_small.result
index 7471c84bb44..fcb3bf2e07f 100644
--- a/mysql-test/suite/innodb/r/innodb_defragment_small.result
+++ b/mysql-test/suite/innodb/r/innodb_defragment_small.result
@@ -1,6 +1,13 @@
SET @innodb_defragment_orig=@@GLOBAL.innodb_defragment;
+SET @innodb_optimize_fulltext_orig=@@GLOBAL.innodb_optimize_fulltext_only;
SET GLOBAL innodb_defragment = 1;
-CREATE TABLE t1 (a INT PRIMARY KEY, b VARCHAR(256), KEY(a, b)) ENGINE=INNODB;
+SET GLOBAL innodb_optimize_fulltext_only = 0;
+#
+# MDEV-12198 innodb_defragment=1 crashes server on
+# OPTIMIZE TABLE when FULLTEXT index exists
+#
+CREATE TABLE t1 (a INT PRIMARY KEY, b VARCHAR(256),
+KEY(a, b), FULLTEXT KEY(b)) ENGINE=INNODB;
OPTIMIZE TABLE t1;
Table Op Msg_type Msg_text
test.t1 optimize status OK
@@ -11,12 +18,15 @@ INSERT INTO t1 VALUES (400000, REPEAT('A', 256));
OPTIMIZE TABLE t1;
Table Op Msg_type Msg_text
test.t1 optimize status OK
-DROP TABLE t1;
#
-# MDEV-12198 innodb_defragment=1 crashes server on
-# OPTIMIZE TABLE when FULLTEXT index exists
+# MDEV-15824 innodb_defragment=ON trumps
+# innodb_optimize_fulltext_only=ON in OPTIMIZE TABLE
#
-CREATE TABLE t1 (c TEXT, FULLTEXT KEY (c)) ENGINE=InnoDB;
+SET GLOBAL innodb_optimize_fulltext_only = 1;
+OPTIMIZE TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 optimize status OK
+SET GLOBAL innodb_defragment = 0;
OPTIMIZE TABLE t1;
Table Op Msg_type Msg_text
test.t1 optimize status OK
@@ -27,3 +37,4 @@ Table Op Msg_type Msg_text
test.t1 optimize status OK
DROP TABLE t1;
SET GLOBAL innodb_defragment = @innodb_defragment_orig;
+SET GLOBAL innodb_optimize_fulltext_only = @innodb_optimize_fulltext_orig;
diff --git a/mysql-test/suite/innodb/t/innodb-blob.test b/mysql-test/suite/innodb/t/innodb-blob.test
index 1c91305b0ee..fbf0641880b 100644
--- a/mysql-test/suite/innodb/t/innodb-blob.test
+++ b/mysql-test/suite/innodb/t/innodb-blob.test
@@ -6,13 +6,13 @@
# The 7000 in this test is a bit less than half the innodb_page_size.
--source include/have_innodb_16k.inc
-# DEBUG_SYNC must be compiled in.
+--source include/have_debug.inc
--source include/have_debug_sync.inc
# Embedded server does not support restarting
--source include/not_embedded.inc
-call mtr.add_suppression("InnoDB: The log sequence numbers [0-9]+ and [0-9]+ in ibdata files do not match the log sequence number [0-9]+ in the ib_logfiles!");
+FLUSH TABLES;
CREATE TABLE t1 (a INT PRIMARY KEY, b TEXT) ENGINE=InnoDB;
CREATE TABLE t2 (a INT PRIMARY KEY) ENGINE=InnoDB;
diff --git a/mysql-test/suite/innodb/t/innodb_defragment_small.test b/mysql-test/suite/innodb/t/innodb_defragment_small.test
index 8500c173af7..6259dac448e 100644
--- a/mysql-test/suite/innodb/t/innodb_defragment_small.test
+++ b/mysql-test/suite/innodb/t/innodb_defragment_small.test
@@ -1,10 +1,17 @@
--source include/have_innodb.inc
SET @innodb_defragment_orig=@@GLOBAL.innodb_defragment;
+SET @innodb_optimize_fulltext_orig=@@GLOBAL.innodb_optimize_fulltext_only;
SET GLOBAL innodb_defragment = 1;
+SET GLOBAL innodb_optimize_fulltext_only = 0;
-# Small tests copied from innodb.innodb_defragment
-CREATE TABLE t1 (a INT PRIMARY KEY, b VARCHAR(256), KEY(a, b)) ENGINE=INNODB;
+--echo #
+--echo # MDEV-12198 innodb_defragment=1 crashes server on
+--echo # OPTIMIZE TABLE when FULLTEXT index exists
+--echo #
+
+CREATE TABLE t1 (a INT PRIMARY KEY, b VARCHAR(256),
+ KEY(a, b), FULLTEXT KEY(b)) ENGINE=INNODB;
OPTIMIZE TABLE t1;
INSERT INTO t1 VALUES (100000, REPEAT('A', 256));
@@ -13,16 +20,17 @@ INSERT INTO t1 VALUES (300000, REPEAT('A', 256));
INSERT INTO t1 VALUES (400000, REPEAT('A', 256));
OPTIMIZE TABLE t1;
-DROP TABLE t1;
--echo #
---echo # MDEV-12198 innodb_defragment=1 crashes server on
---echo # OPTIMIZE TABLE when FULLTEXT index exists
+--echo # MDEV-15824 innodb_defragment=ON trumps
+--echo # innodb_optimize_fulltext_only=ON in OPTIMIZE TABLE
--echo #
-CREATE TABLE t1 (c TEXT, FULLTEXT KEY (c)) ENGINE=InnoDB;
-
+SET GLOBAL innodb_optimize_fulltext_only = 1;
OPTIMIZE TABLE t1;
+SET GLOBAL innodb_defragment = 0;
+OPTIMIZE TABLE t1;
+
DROP TABLE t1;
CREATE TABLE t1 (c POINT PRIMARY KEY, SPATIAL INDEX(c)) ENGINE=InnoDB;
@@ -30,3 +38,4 @@ OPTIMIZE TABLE t1;
DROP TABLE t1;
SET GLOBAL innodb_defragment = @innodb_defragment_orig;
+SET GLOBAL innodb_optimize_fulltext_only = @innodb_optimize_fulltext_orig;
diff --git a/storage/innobase/btr/btr0defragment.cc b/storage/innobase/btr/btr0defragment.cc
index 70444ca1830..7a8899ee22f 100644
--- a/storage/innobase/btr/btr0defragment.cc
+++ b/storage/innobase/btr/btr0defragment.cc
@@ -40,57 +40,6 @@ Modified 30/07/2014 Jan Lindström jan.lindstrom@mariadb.com
#include <list>
-/**************************************************//**
-Custom nullptr implementation for under g++ 4.6
-*******************************************************/
-// #pragma once
-/*
-namespace std
-{
- // based on SC22/WG21/N2431 = J16/07-0301
- struct nullptr_t
- {
- template<typename any> operator any * () const
- {
- return 0;
- }
- template<class any, typename T> operator T any:: * () const
- {
- return 0;
- }
-
-#ifdef _MSC_VER
- struct pad {};
- pad __[sizeof(void*)/sizeof(pad)];
-#else
- char __[sizeof(void*)];
-#endif
-private:
- // nullptr_t();// {}
- // nullptr_t(const nullptr_t&);
- // void operator = (const nullptr_t&);
- void operator &() const;
- template<typename any> void operator +(any) const
- {
- // I Love MSVC 2005!
- }
- template<typename any> void operator -(any) const
- {
- // I Love MSVC 2005!
- }
- };
-static const nullptr_t __nullptr = {};
-}
-
-#ifndef nullptr
-#define nullptr std::__nullptr
-#endif
-*/
-
-/**************************************************//**
-End of Custom nullptr implementation for under g++ 4.6
-*******************************************************/
-
/* When there's no work, either because defragment is disabled, or because no
query is submitted, thread checks state every BTR_DEFRAGMENT_SLEEP_IN_USECS.*/
#define BTR_DEFRAGMENT_SLEEP_IN_USECS 1000000
diff --git a/storage/innobase/fil/fil0fil.cc b/storage/innobase/fil/fil0fil.cc
index c889e8f688e..feebe5d2162 100644
--- a/storage/innobase/fil/fil0fil.cc
+++ b/storage/innobase/fil/fil0fil.cc
@@ -1140,7 +1140,7 @@ fil_mutex_enter_and_prepare_for_io(
/*===============================*/
ulint space_id) /*!< in: space id */
{
- for (ulint count = 0, count2 = 0;;) {
+ for (ulint count = 0;;) {
mutex_enter(&fil_system->mutex);
if (space_id >= SRV_LOG_SPACE_FIRST_ID) {
@@ -1154,41 +1154,6 @@ fil_mutex_enter_and_prepare_for_io(
break;
}
- if (space->stop_ios) {
- ut_ad(space->id != 0);
- /* We are going to do a rename file and want to stop
- new i/o's for a while. */
-
- if (count2 > 20000) {
- ib::warn() << "Tablespace " << space->name
- << " has i/o ops stopped for a long"
- " time " << count2;
- }
-
- mutex_exit(&fil_system->mutex);
-
- /* Wake the i/o-handler threads to make sure pending
- i/o's are performed */
- os_aio_simulated_wake_handler_threads();
-
- /* The sleep here is just to give IO helper threads a
- bit of time to do some work. It is not required that
- all IO related to the tablespace being renamed must
- be flushed here as we do fil_flush() in
- fil_rename_tablespace() as well. */
- os_thread_sleep(20000);
-
- /* Flush tablespaces so that we can close modified
- files in the LRU list */
- fil_flush_file_spaces(FIL_TYPE_TABLESPACE);
-
- os_thread_sleep(20000);
-
- count2++;
-
- continue;
- }
-
fil_node_t* node = UT_LIST_GET_LAST(space->chain);
ut_ad(space->id == 0
|| node == UT_LIST_GET_FIRST(space->chain));
@@ -3497,31 +3462,16 @@ fil_rename_tablespace(
const char* new_name,
const char* new_path_in)
{
- bool sleep = false;
- bool flush = false;
fil_space_t* space;
fil_node_t* node;
- ulint count = 0;
ut_a(id != 0);
ut_ad(strchr(new_name, '/') != NULL);
-retry:
- count++;
-
- if (!(count % 1000)) {
- ib::warn() << "Cannot rename file " << old_path
- << " (space id " << id << "), retried " << count
- << " times."
- " There are either pending IOs or flushes or"
- " the file is being extended.";
- }
mutex_enter(&fil_system->mutex);
space = fil_space_get_by_id(id);
- DBUG_EXECUTE_IF("fil_rename_tablespace_failure_1", space = NULL; );
-
if (space == NULL) {
ib::error() << "Cannot find space id " << id
<< " in the tablespace memory cache, though the file '"
@@ -3532,64 +3482,26 @@ func_exit:
return(false);
}
- if (count > 25000) {
- space->stop_ios = false;
- goto func_exit;
- }
if (space != fil_space_get_by_name(space->name)) {
ib::error() << "Cannot find " << space->name
<< " in tablespace memory cache";
- space->stop_ios = false;
goto func_exit;
}
if (fil_space_get_by_name(new_name)) {
ib::error() << new_name
<< " is already in tablespace memory cache";
- space->stop_ios = false;
goto func_exit;
}
- /* We temporarily close the .ibd file because we do not trust that
- operating systems can rename an open file. For the closing we have to
- wait until there are no pending i/o's or flushes on the file. */
-
- space->stop_ios = true;
-
/* The following code must change when InnoDB supports
multiple datafiles per tablespace. */
ut_a(UT_LIST_GET_LEN(space->chain) == 1);
node = UT_LIST_GET_FIRST(space->chain);
-
- if (node->n_pending > 0
- || node->n_pending_flushes > 0
- || node->being_extended) {
- /* There are pending i/o's or flushes or the file is
- currently being extended, sleep for a while and
- retry */
- sleep = true;
- } else if (node->modification_counter > node->flush_counter) {
- /* Flush the space */
- sleep = flush = true;
- } else if (node->is_open()) {
- /* Close the file */
-
- fil_node_close_file(node);
- }
+ space->n_pending_ops++;
mutex_exit(&fil_system->mutex);
- if (sleep) {
- os_thread_sleep(20000);
-
- if (flush) {
- fil_flush(id);
- }
-
- sleep = flush = false;
- goto retry;
- }
- ut_ad(space->stop_ios);
char* new_file_name = new_path_in == NULL
? fil_make_filepath(NULL, new_name, IBD, false)
: mem_strdup(new_path_in);
@@ -3615,23 +3527,17 @@ func_exit:
/* log_sys->mutex is above fil_system->mutex in the latching order */
ut_ad(log_mutex_own());
mutex_enter(&fil_system->mutex);
+ ut_ad(space->n_pending_ops);
+ space->n_pending_ops--;
ut_ad(space->name == old_space_name);
/* We already checked these. */
ut_ad(space == fil_space_get_by_name(old_space_name));
ut_ad(!fil_space_get_by_name(new_space_name));
ut_ad(node->name == old_file_name);
- bool success;
-
- DBUG_EXECUTE_IF("fil_rename_tablespace_failure_2",
- goto skip_rename; );
-
- success = os_file_rename(
+ bool success = os_file_rename(
innodb_data_file_key, old_file_name, new_file_name);
- DBUG_EXECUTE_IF("fil_rename_tablespace_failure_2",
- skip_rename: success = false; );
-
ut_ad(node->name == old_file_name);
if (success) {
@@ -3656,8 +3562,6 @@ func_exit:
old_space_name = new_space_name;
}
- ut_ad(space->stop_ios);
- space->stop_ios = false;
mutex_exit(&fil_system->mutex);
ut_free(old_file_name);
diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc
index 02457db7ee9..ba7a476c754 100644
--- a/storage/innobase/handler/ha_innodb.cc
+++ b/storage/innobase/handler/ha_innodb.cc
@@ -14626,6 +14626,7 @@ ha_innobase::optimize(
This works OK otherwise, but MySQL locks the entire table during
calls to OPTIMIZE, which is undesirable. */
+ bool try_alter = true;
/* TODO: Defragment is disabled for now */
if (srv_defragment) {
@@ -14634,17 +14635,15 @@ ha_innobase::optimize(
err = defragment_table(m_prebuilt->table->name.m_name, NULL, false);
if (err == 0) {
- return (HA_ADMIN_OK);
+ try_alter = false;
} else {
push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
err,
"InnoDB: Cannot defragment table %s: returned error code %d\n",
m_prebuilt->table->name, err);
- if (err == ER_SP_ALREADY_EXISTS) {
- return (HA_ADMIN_OK);
- } else {
- return (HA_ADMIN_TRY_ALTER);
+ if(err == ER_SP_ALREADY_EXISTS) {
+ try_alter = false;
}
}
}
@@ -14655,11 +14654,10 @@ ha_innobase::optimize(
fts_sync_table(m_prebuilt->table, false, true, false);
fts_optimize_table(m_prebuilt->table);
}
- return(HA_ADMIN_OK);
- } else {
-
- return(HA_ADMIN_TRY_ALTER);
+ try_alter = false;
}
+
+ return try_alter ? HA_ADMIN_TRY_ALTER : HA_ADMIN_OK;
}
/*******************************************************************//**
diff --git a/storage/innobase/include/fil0fil.h b/storage/innobase/include/fil0fil.h
index d79aa0415a6..9797de6df0b 100644
--- a/storage/innobase/include/fil0fil.h
+++ b/storage/innobase/include/fil0fil.h
@@ -89,10 +89,6 @@ struct fil_space_t {
Protected by log_sys->mutex.
If and only if this is nonzero, the
tablespace will be in named_spaces. */
- bool stop_ios;/*!< true if we want to rename the
- .ibd file of tablespace and want to
- stop temporarily posting of new i/o
- requests on the file */
bool stop_new_ops;
/*!< we set this true when we start
deleting a single-table tablespace.
diff --git a/storage/innobase/include/ut0timer.h b/storage/innobase/include/ut0timer.h
index ea4dddec683..71bcd29cf48 100644
--- a/storage/innobase/include/ut0timer.h
+++ b/storage/innobase/include/ut0timer.h
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 2013, 2014, Facebook, Inc. All Rights Reserved.
-Copyright (c) 2014, SkySQL Ab. All Rights Reserved.
+Copyright (c) 2014, 2018, 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
@@ -19,7 +19,7 @@ this program; if not, write to the Free Software Foundation, Inc.,
/********************************************************************//**
@file include/ut0timer.h
-Timer rountines
+Timer routines
Created 30/07/2014 Jan Lindström jan.lindstrom@skysql.com
modified from https://github.com/facebook/mysql-5.6/commit/c75a413edeb96eb99bf11d7269bdfea06f96d6b6
@@ -28,8 +28,6 @@ modified from https://github.com/facebook/mysql-5.6/commit/c75a413edeb96eb99bf11
#define ut0timer_h
#include "univ.i"
-#include "data0type.h"
-#include <my_rdtsc.h>
/* Current timer stats */
extern struct my_timer_unit_info ut_timer;
@@ -48,39 +46,6 @@ UNIV_INTERN
void ut_init_timer(void);
/**************************************************************//**
-Return time passed since time then, automatically adjusted
-for the estimated timer overhead.
-@return time passed since "then" */
-UNIV_INLINE
-ulonglong
-ut_timer_since(
-/*===========*/
- ulonglong then); /*!< in: time where to calculate */
-/**************************************************************//**
-Get time passed since "then", and update then to now
-@return time passed sinche "then" */
-UNIV_INLINE
-ulonglong
-ut_timer_since_and_update(
-/*======================*/
- ulonglong *then); /*!< in: time where to calculate */
-/**************************************************************//**
-Convert native timer units in a ulonglong into seconds in a double
-@return time in a seconds */
-UNIV_INLINE
-double
-ut_timer_to_seconds(
-/*=================*/
- ulonglong when); /*!< in: time where to calculate */
-/**************************************************************//**
-Convert native timer units in a ulonglong into milliseconds in a double
-@return time in milliseconds */
-UNIV_INLINE
-double
-ut_timer_to_milliseconds(
-/*=====================*/
- ulonglong when); /*!< in: time where to calculate */
-/**************************************************************//**
Convert native timer units in a ulonglong into microseconds in a double
@return time in microseconds */
UNIV_INLINE
diff --git a/storage/innobase/include/ut0timer.ic b/storage/innobase/include/ut0timer.ic
index 46dcd0cb718..34886481efa 100644
--- a/storage/innobase/include/ut0timer.ic
+++ b/storage/innobase/include/ut0timer.ic
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 2013, 2014, Facebook, Inc. All Rights Reserved.
-Copyright (c) 2014, SkySQL Ab. All Rights Reserved.
+Copyright (c) 2014, 2018, 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
@@ -19,70 +19,13 @@ this program; if not, write to the Free Software Foundation, Inc.,
/********************************************************************//**
@file include/ut0timer.ic
-Timer rountines
+Timer routines
Created 30/07/2014 Jan Lindström jan.lindstrom@skysql.com
modified from https://github.com/facebook/mysql-5.6/commit/c75a413edeb96eb99bf11d7269bdfea06f96d6b6
*************************************************************************/
/**************************************************************//**
-Return time passed since time then, automatically adjusted
-for the estimated timer overhead.
-@return time passed since "then" */
-UNIV_INLINE
-ulonglong
-ut_timer_since(
-/*===========*/
- ulonglong then) /*!< in: time where to calculate */
-{
- return (ut_timer_now() - then) - ut_timer.overhead;
-}
-
-/**************************************************************//**
-Get time passed since "then", and update then to now
-@return time passed sinche "then" */
-UNIV_INLINE
-ulonglong
-ut_timer_since_and_update(
-/*======================*/
- ulonglong *then) /*!< in: time where to calculate */
-{
- ulonglong now = ut_timer_now();
- ulonglong ret = (now - (*then)) - ut_timer.overhead;
- *then = now;
- return ret;
-}
-
-/**************************************************************//**
-Convert native timer units in a ulonglong into seconds in a double
-@return time in a seconds */
-UNIV_INLINE
-double
-ut_timer_to_seconds(
-/*=================*/
- ulonglong when) /*!< in: time where to calculate */
-{
- double ret = (double)(when);
- ret /= (double)(ut_timer.frequency);
- return ret;
-}
-
-/**************************************************************//**
-Convert native timer units in a ulonglong into milliseconds in a double
-@return time in milliseconds */
-UNIV_INLINE
-double
-ut_timer_to_milliseconds(
-/*=====================*/
- ulonglong when) /*!< in: time where to calculate */
-{
- double ret = (double)(when);
- ret *= 1000.0;
- ret /= (double)(ut_timer.frequency);
- return ret;
-}
-
-/**************************************************************//**
Convert native timer units in a ulonglong into microseconds in a double
@return time in microseconds */
UNIV_INLINE
diff --git a/storage/innobase/os/os0file.cc b/storage/innobase/os/os0file.cc
index 0041c1861f8..9fb1c398e6e 100644
--- a/storage/innobase/os/os0file.cc
+++ b/storage/innobase/os/os0file.cc
@@ -3891,7 +3891,8 @@ os_file_create_simple_func(
/* Use default security attributes and no template file. */
file = CreateFile(
- (LPCTSTR) name, access, FILE_SHARE_READ, NULL,
+ (LPCTSTR) name, access,
+ FILE_SHARE_READ | FILE_SHARE_DELETE, NULL,
create_flag, attributes, NULL);
if (file == INVALID_HANDLE_VALUE) {
@@ -4135,7 +4136,7 @@ os_file_create_func(
DWORD create_flag;
DWORD share_mode = srv_operation != SRV_OPERATION_NORMAL
? FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE
- : FILE_SHARE_READ;
+ : FILE_SHARE_READ | FILE_SHARE_DELETE;
if (create_mode != OS_FILE_OPEN && create_mode != OS_FILE_OPEN_RAW) {
WAIT_ALLOW_WRITES();
@@ -4341,7 +4342,7 @@ os_file_create_simple_no_error_handling_func(
DWORD attributes = 0;
DWORD share_mode = srv_operation != SRV_OPERATION_NORMAL
? FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE
- : FILE_SHARE_READ;
+ : FILE_SHARE_READ | FILE_SHARE_DELETE;
ut_a(name);
diff --git a/storage/xtradb/btr/btr0defragment.cc b/storage/xtradb/btr/btr0defragment.cc
index c2f58a8e1cf..f7a36d352a8 100644
--- a/storage/xtradb/btr/btr0defragment.cc
+++ b/storage/xtradb/btr/btr0defragment.cc
@@ -40,56 +40,6 @@ Modified 30/07/2014 Jan Lindström jan.lindstrom@mariadb.com
#include <list>
-/**************************************************//**
-Custom nullptr implementation for under g++ 4.6
-*******************************************************/
-/*
-// #pragma once
-namespace std
-{
- // based on SC22/WG21/N2431 = J16/07-0301
- struct nullptr_t
- {
- template<typename any> operator any * () const
- {
- return 0;
- }
- template<class any, typename T> operator T any:: * () const
- {
- return 0;
- }
-
-#ifdef _MSC_VER
- struct pad {};
- pad __[sizeof(void*)/sizeof(pad)];
-#else
- char __[sizeof(void*)];
-#endif
-private:
- // nullptr_t();// {}
- // nullptr_t(const nullptr_t&);
- // void operator = (const nullptr_t&);
- void operator &() const;
- template<typename any> void operator +(any) const
- {
- // I Love MSVC 2005!
- }
- template<typename any> void operator -(any) const
- {
- // I Love MSVC 2005!
- }
- };
-static const nullptr_t __nullptr = {};
-}
-
-#ifndef nullptr
-#define nullptr std::__nullptr
-#endif
-*/
-/**************************************************//**
-End of Custom nullptr implementation for under g++ 4.6
-*******************************************************/
-
/* When there's no work, either because defragment is disabled, or because no
query is submitted, thread checks state every BTR_DEFRAGMENT_SLEEP_IN_USECS.*/
#define BTR_DEFRAGMENT_SLEEP_IN_USECS 1000000
diff --git a/storage/xtradb/fil/fil0fil.cc b/storage/xtradb/fil/fil0fil.cc
index 4f1235769ba..c656dc37071 100644
--- a/storage/xtradb/fil/fil0fil.cc
+++ b/storage/xtradb/fil/fil0fil.cc
@@ -1098,7 +1098,6 @@ fil_mutex_enter_and_prepare_for_io(
{
fil_space_t* space;
ulint count = 0;
- ulint count2 = 0;
retry:
mutex_enter(&fil_system->mutex);
@@ -1114,47 +1113,6 @@ retry:
return;
}
- if (space->stop_ios) {
- ut_ad(space->id != 0);
- /* We are going to do a rename file and want to stop new i/o's
- for a while */
-
- if (count2 > 20000) {
- fputs("InnoDB: Warning: tablespace ", stderr);
- ut_print_filename(stderr, space->name);
- fprintf(stderr,
- " has i/o ops stopped for a long time %lu\n",
- (ulong) count2);
- }
-
- mutex_exit(&fil_system->mutex);
-
-#ifndef UNIV_HOTBACKUP
-
- /* Wake the i/o-handler threads to make sure pending
- i/o's are performed */
- os_aio_simulated_wake_handler_threads();
-
- /* The sleep here is just to give IO helper threads a
- bit of time to do some work. It is not required that
- all IO related to the tablespace being renamed must
- be flushed here as we do fil_flush() in
- fil_rename_tablespace() as well. */
- os_thread_sleep(20000);
-
-#endif /* UNIV_HOTBACKUP */
-
- /* Flush tablespaces so that we can close modified
- files in the LRU list */
- fil_flush_file_spaces(FIL_TABLESPACE);
-
- os_thread_sleep(20000);
-
- count2++;
-
- goto retry;
- }
-
fil_node_t* node = UT_LIST_GET_LAST(space->chain);
ut_ad(space->id == 0 || node == UT_LIST_GET_FIRST(space->chain));
@@ -3249,7 +3207,6 @@ fil_rename_tablespace(
ibool success;
fil_space_t* space;
fil_node_t* node;
- ulint count = 0;
char* new_path;
char* old_name;
char* old_path;
@@ -3257,25 +3214,10 @@ fil_rename_tablespace(
ut_a(id != 0);
-retry:
- count++;
-
- if (!(count % 1000)) {
- ut_print_timestamp(stderr);
- fputs(" InnoDB: Warning: problems renaming ", stderr);
- ut_print_filename(stderr,
- old_name_in ? old_name_in : not_given);
- fputs(" to ", stderr);
- ut_print_filename(stderr, new_name);
- fprintf(stderr, ", %lu iterations\n", (ulong) count);
- }
-
mutex_enter(&fil_system->mutex);
space = fil_space_get_by_id(id);
- DBUG_EXECUTE_IF("fil_rename_tablespace_failure_1", space = NULL; );
-
if (space == NULL) {
ib_logf(IB_LOG_LEVEL_ERROR,
"Cannot find space id %lu in the tablespace "
@@ -3287,54 +3229,11 @@ retry:
return(FALSE);
}
- if (count > 25000) {
- space->stop_ios = FALSE;
- mutex_exit(&fil_system->mutex);
-
- return(FALSE);
- }
-
- /* We temporarily close the .ibd file because we do not trust that
- operating systems can rename an open file. For the closing we have to
- wait until there are no pending i/o's or flushes on the file. */
-
- space->stop_ios = TRUE;
-
/* The following code must change when InnoDB supports
multiple datafiles per tablespace. */
ut_a(UT_LIST_GET_LEN(space->chain) == 1);
node = UT_LIST_GET_FIRST(space->chain);
- if (node->n_pending > 0
- || node->n_pending_flushes > 0
- || node->being_extended) {
- /* There are pending i/o's or flushes or the file is
- currently being extended, sleep for a while and
- retry */
-
- mutex_exit(&fil_system->mutex);
-
- os_thread_sleep(20000);
-
- goto retry;
-
- } else if (node->modification_counter > node->flush_counter) {
- /* Flush the space */
-
- mutex_exit(&fil_system->mutex);
-
- os_thread_sleep(20000);
-
- fil_flush(id);
-
- goto retry;
-
- } else if (node->open) {
- /* Close the file */
-
- fil_node_close_file(node, fil_system);
- }
-
/* Check that the old name in the space is right */
if (old_name_in) {
@@ -3353,17 +3252,9 @@ retry:
space, node, new_name, new_path);
if (success) {
-
- DBUG_EXECUTE_IF("fil_rename_tablespace_failure_2",
- goto skip_second_rename; );
-
success = os_file_rename(
innodb_file_data_key, old_path, new_path);
- DBUG_EXECUTE_IF("fil_rename_tablespace_failure_2",
-skip_second_rename:
- success = FALSE; );
-
if (!success) {
/* We have to revert the changes we made
to the tablespace memory cache */
@@ -3373,8 +3264,6 @@ skip_second_rename:
}
}
- space->stop_ios = FALSE;
-
mutex_exit(&fil_system->mutex);
#ifndef UNIV_HOTBACKUP
diff --git a/storage/xtradb/handler/ha_innodb.cc b/storage/xtradb/handler/ha_innodb.cc
index fb3afcc9a03..97de34b9083 100644
--- a/storage/xtradb/handler/ha_innodb.cc
+++ b/storage/xtradb/handler/ha_innodb.cc
@@ -3231,8 +3231,7 @@ ha_innobase::ha_innobase(
(srv_force_primary_key ? HA_REQUIRE_PRIMARY_KEY : 0 ) |
HA_CAN_FULLTEXT_EXT | HA_CAN_EXPORT),
start_of_scan(0),
- num_write_row(0),
- ha_partition_stats(NULL)
+ num_write_row(0)
{}
/*********************************************************************//**
@@ -14486,6 +14485,7 @@ ha_innobase::optimize(
This works OK otherwise, but MySQL locks the entire table during
calls to OPTIMIZE, which is undesirable. */
+ bool try_alter = true;
if (srv_defragment) {
int err;
@@ -14493,7 +14493,7 @@ ha_innobase::optimize(
err = defragment_table(prebuilt->table->name, NULL, false);
if (err == 0) {
- return (HA_ADMIN_OK);
+ try_alter = false;
} else {
push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
err,
@@ -14501,9 +14501,7 @@ ha_innobase::optimize(
prebuilt->table->name, err);
if(err == ER_SP_ALREADY_EXISTS) {
- return (HA_ADMIN_OK);
- } else {
- return (HA_ADMIN_TRY_ALTER);
+ try_alter = false;
}
}
}
@@ -14514,11 +14512,10 @@ ha_innobase::optimize(
fts_sync_table(prebuilt->table, false, true, false);
fts_optimize_table(prebuilt->table);
}
- return(HA_ADMIN_OK);
- } else {
-
- return(HA_ADMIN_TRY_ALTER);
+ try_alter = false;
}
+
+ return try_alter ? HA_ADMIN_TRY_ALTER : HA_ADMIN_OK;
}
/*******************************************************************//**
@@ -17490,13 +17487,6 @@ innodb_max_dirty_pages_pct_lwm_update(
srv_max_dirty_pages_pct_lwm = in_val;
}
-UNIV_INTERN
-void
-ha_innobase::set_partition_owner_stats(ha_statistics *stats)
-{
- ha_partition_stats= stats;
-}
-
/************************************************************//**
Validate the file format name and return its corresponding id.
@return valid file format id */
diff --git a/storage/xtradb/handler/ha_innodb.h b/storage/xtradb/handler/ha_innodb.h
index c5b0e723702..3dbbc53a0e3 100644
--- a/storage/xtradb/handler/ha_innodb.h
+++ b/storage/xtradb/handler/ha_innodb.h
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 2000, 2017, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2013, 2017, MariaDB Corporation.
+Copyright (c) 2013, 2018, 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
@@ -100,8 +100,6 @@ class ha_innobase: public handler
or undefined */
uint num_write_row; /*!< number of write_row() calls */
- ha_statistics* ha_partition_stats; /*!< stats of the partition owner
- handler (if there is one) */
uint store_key_val_for_row(uint keynr, char* buff, uint buff_len,
const uchar* record);
inline void update_thd(THD* thd);
@@ -318,7 +316,6 @@ class ha_innobase: public handler
Alter_inplace_info* ha_alter_info,
bool commit);
/** @} */
- void set_partition_owner_stats(ha_statistics *stats);
bool check_if_incompatible_data(HA_CREATE_INFO *info,
uint table_changes);
diff --git a/storage/xtradb/include/fil0fil.h b/storage/xtradb/include/fil0fil.h
index 8a4aa9b7dff..a0db48f7037 100644
--- a/storage/xtradb/include/fil0fil.h
+++ b/storage/xtradb/include/fil0fil.h
@@ -275,10 +275,6 @@ struct fil_space_t {
an insert buffer merge request for a
page because it actually was for the
previous incarnation of the space */
- ibool stop_ios;/*!< TRUE if we want to rename the
- .ibd file of tablespace and want to
- stop temporarily posting of new i/o
- requests on the file */
bool stop_new_ops;
/*!< we set this true when we start
deleting a single-table tablespace.
diff --git a/storage/xtradb/include/ut0timer.h b/storage/xtradb/include/ut0timer.h
index f361ae79bf5..3015771b434 100644
--- a/storage/xtradb/include/ut0timer.h
+++ b/storage/xtradb/include/ut0timer.h
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 2013, 2014, Facebook, Inc. All Rights Reserved.
-Copyright (c) 2014, SkySQL Ab. All Rights Reserved.
+Copyright (c) 2014, 2018, 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
@@ -19,7 +19,7 @@ this program; if not, write to the Free Software Foundation, Inc.,
/********************************************************************//**
@file include/ut0timer.h
-Timer rountines
+Timer routines
Created 30/07/2014 Jan Lindström jan.lindstrom@skysql.com
modified from https://github.com/facebook/mysql-5.6/commit/c75a413edeb96eb99bf11d7269bdfea06f96d6b6
@@ -28,8 +28,6 @@ modified from https://github.com/facebook/mysql-5.6/commit/c75a413edeb96eb99bf11
#define ut0timer_h
#include "univ.i"
-#include "data0type.h"
-#include <my_rdtsc.h>
/* Current timer stats */
extern struct my_timer_unit_info ut_timer;
@@ -48,39 +46,6 @@ UNIV_INTERN
void ut_init_timer(void);
/**************************************************************//**
-Return time passed since time then, automatically adjusted
-for the estimated timer overhead.
-@return time passed since "then" */
-UNIV_INLINE
-ulonglong
-ut_timer_since(
-/*===========*/
- ulonglong then); /*!< in: time where to calculate */
-/**************************************************************//**
-Get time passed since "then", and update then to now
-@return time passed sinche "then" */
-UNIV_INLINE
-ulonglong
-ut_timer_since_and_update(
-/*======================*/
- ulonglong *then); /*!< in: time where to calculate */
-/**************************************************************//**
-Convert native timer units in a ulonglong into seconds in a double
-@return time in a seconds */
-UNIV_INLINE
-double
-ut_timer_to_seconds(
-/*=================*/
- ulonglong when); /*!< in: time where to calculate */
-/**************************************************************//**
-Convert native timer units in a ulonglong into milliseconds in a double
-@return time in milliseconds */
-UNIV_INLINE
-double
-ut_timer_to_milliseconds(
-/*=====================*/
- ulonglong when); /*!< in: time where to calculate */
-/**************************************************************//**
Convert native timer units in a ulonglong into microseconds in a double
@return time in microseconds */
UNIV_INLINE
diff --git a/storage/xtradb/include/ut0timer.ic b/storage/xtradb/include/ut0timer.ic
index 815726e9d0a..02af23cdc6d 100644
--- a/storage/xtradb/include/ut0timer.ic
+++ b/storage/xtradb/include/ut0timer.ic
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 2013, 2014, Facebook, Inc. All Rights Reserved.
-Copyright (c) 2014, SkySQL Ab. All Rights Reserved.
+Copyright (c) 2014, 2018, 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
@@ -19,70 +19,13 @@ this program; if not, write to the Free Software Foundation, Inc.,
/********************************************************************//**
@file include/ut0timer.ic
-Timer rountines
+Timer routines
Created 30/07/2014 Jan Lindström jan.lindstrom@skysql.com
modified from https://github.com/facebook/mysql-5.6/commit/c75a413edeb96eb99bf11d7269bdfea06f96d6b6
*************************************************************************/
/**************************************************************//**
-Return time passed since time then, automatically adjusted
-for the estimated timer overhead.
-@return time passed since "then" */
-UNIV_INLINE
-ulonglong
-ut_timer_since(
-/*===========*/
- ulonglong then) /*!< in: time where to calculate */
-{
- return (ut_timer_now() - then) - ut_timer.overhead;
-}
-
-/**************************************************************//**
-Get time passed since "then", and update then to now
-@return time passed sinche "then" */
-UNIV_INLINE
-ulonglong
-ut_timer_since_and_update(
-/*======================*/
- ulonglong *then) /*!< in: time where to calculate */
-{
- ulonglong now = ut_timer_now();
- ulonglong ret = (now - (*then)) - ut_timer.overhead;
- *then = now;
- return ret;
-}
-
-/**************************************************************//**
-Convert native timer units in a ulonglong into seconds in a double
-@return time in a seconds */
-UNIV_INLINE
-double
-ut_timer_to_seconds(
-/*=================*/
- ulonglong when) /*!< in: time where to calculate */
-{
- double ret = (double)(when);
- ret /= (double)(ut_timer.frequency);
- return ret;
-}
-
-/**************************************************************//**
-Convert native timer units in a ulonglong into milliseconds in a double
-@return time in milliseconds */
-UNIV_INLINE
-double
-ut_timer_to_milliseconds(
-/*=====================*/
- ulonglong when) /*!< in: time where to calculate */
-{
- double ret = (double)(when);
- ret *= 1000.0;
- ret /= (double)(ut_timer.frequency);
- return ret;
-}
-
-/**************************************************************//**
Convert native timer units in a ulonglong into microseconds in a double
@return time in microseconds */
UNIV_INLINE
diff --git a/storage/xtradb/os/os0file.cc b/storage/xtradb/os/os0file.cc
index 6a63f31b37a..da8548f0fa8 100644
--- a/storage/xtradb/os/os0file.cc
+++ b/storage/xtradb/os/os0file.cc
@@ -1437,7 +1437,8 @@ os_file_create_simple_func(
/* Use default security attributes and no template file. */
file = CreateFile(
- (LPCTSTR) name, access, FILE_SHARE_READ, NULL,
+ (LPCTSTR) name, access,
+ FILE_SHARE_READ | FILE_SHARE_DELETE, NULL,
create_flag, attributes, NULL);
if (file == INVALID_HANDLE_VALUE) {
@@ -1603,7 +1604,7 @@ os_file_create_simple_no_error_handling_func(
DWORD access;
DWORD create_flag;
DWORD attributes = 0;
- DWORD share_mode = FILE_SHARE_READ;
+ DWORD share_mode = FILE_SHARE_READ | FILE_SHARE_DELETE;
ut_a(name);
ut_a(!(create_mode & OS_FILE_ON_ERROR_SILENT));
@@ -1925,7 +1926,7 @@ os_file_create_func(
#ifdef __WIN__
DWORD create_flag;
- DWORD share_mode = FILE_SHARE_READ;
+ DWORD share_mode = FILE_SHARE_READ | FILE_SHARE_DELETE;
on_error_no_exit = create_mode & OS_FILE_ON_ERROR_NO_EXIT
? TRUE : FALSE;
diff --git a/support-files/CMakeLists.txt b/support-files/CMakeLists.txt
index 3b6e86030ab..dff4610d490 100644
--- a/support-files/CMakeLists.txt
+++ b/support-files/CMakeLists.txt
@@ -41,13 +41,20 @@ ELSE()
SET(inst_location ${INSTALL_SUPPORTFILESDIR})
ENDIF()
-FOREACH(inifile my-huge my-innodb-heavy-4G my-large my-medium my-small wsrep)
- CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/${inifile}.cnf.sh
+FOREACH(inifile my-huge my-innodb-heavy-4G my-large my-medium my-small)
+ CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/${inifile}.cnf.sh
${CMAKE_CURRENT_BINARY_DIR}/${inifile}.${ini_file_extension} @ONLY)
INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${inifile}.${ini_file_extension}
DESTINATION ${inst_location} COMPONENT IniFiles)
ENDFOREACH()
+IF(WITH_WSREP)
+ CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/wsrep.cnf.sh
+ ${CMAKE_CURRENT_BINARY_DIR}/wsrep.${ini_file_extension} @ONLY)
+ INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/wsrep.${ini_file_extension}
+ DESTINATION ${inst_location} COMPONENT IniFiles)
+ENDIF()
+
IF(UNIX)
SET(prefix ${CMAKE_INSTALL_PREFIX})
FOREACH(script mysqld_multi.server mysql-log-rotate binary-configure wsrep_notify)