summaryrefslogtreecommitdiff
path: root/storage
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2018-02-19 09:01:06 +0200
committerMarko Mäkelä <marko.makela@mariadb.com>2018-02-19 09:01:06 +0200
commit278c03627596610f285614774cc573ca81c82169 (patch)
tree317d3db9b72d0d1d74a77ef44205e5367dc04312 /storage
parentfed51b80fb434bebfe240b4d11ccffed945b7c7e (diff)
parent112cb56182d578d5e0a56a2c34c5b456dcc7e115 (diff)
downloadmariadb-git-278c03627596610f285614774cc573ca81c82169.tar.gz
Merge 10.2 into bb-10.2-ext
Diffstat (limited to 'storage')
-rw-r--r--storage/innobase/fil/fil0fil.cc3
-rw-r--r--storage/innobase/fsp/fsp0file.cc57
-rw-r--r--storage/innobase/handler/ha_innodb.cc4
-rw-r--r--storage/innobase/include/buf0buf.h2
-rw-r--r--storage/innobase/include/sync0types.h40
-rw-r--r--storage/innobase/include/trx0purge.h4
-rw-r--r--storage/innobase/srv/srv0conc.cc16
-rw-r--r--storage/innobase/srv/srv0srv.cc4
-rw-r--r--storage/mroonga/vendor/groonga/lib/CMakeLists.txt5
-rw-r--r--storage/xtradb/fil/fil0fil.cc12
10 files changed, 84 insertions, 63 deletions
diff --git a/storage/innobase/fil/fil0fil.cc b/storage/innobase/fil/fil0fil.cc
index e778e086fec..9ba61404b10 100644
--- a/storage/innobase/fil/fil0fil.cc
+++ b/storage/innobase/fil/fil0fil.cc
@@ -4227,7 +4227,8 @@ skip_validate:
err = DB_ERROR;
}
- if (purpose != FIL_TYPE_IMPORT && !srv_read_only_mode) {
+ if (err == DB_SUCCESS && validate
+ && purpose != FIL_TYPE_IMPORT && !srv_read_only_mode) {
df_remote.close();
df_dict.close();
df_default.close();
diff --git a/storage/innobase/fsp/fsp0file.cc b/storage/innobase/fsp/fsp0file.cc
index eaadaad851d..6e9f307ebc8 100644
--- a/storage/innobase/fsp/fsp0file.cc
+++ b/storage/innobase/fsp/fsp0file.cc
@@ -516,8 +516,18 @@ Datafile::validate_first_page(lsn_t* flush_lsn)
}
}
+ if (error_txt != NULL) {
+err_exit:
+ ib::error() << error_txt << " in datafile: " << m_filepath
+ << ", Space ID:" << m_space_id << ", Flags: "
+ << m_flags << ". " << TROUBLESHOOT_DATADICT_MSG;
+ m_is_valid = false;
+ free_first_page();
+ return(DB_CORRUPTION);
+ }
+
/* Check if the whole page is blank. */
- if (error_txt == NULL && !m_space_id && !m_flags) {
+ if (!m_space_id && !m_flags) {
const byte* b = m_first_page;
ulint nonzero_bytes = UNIV_PAGE_SIZE;
@@ -528,56 +538,45 @@ Datafile::validate_first_page(lsn_t* flush_lsn)
if (nonzero_bytes == 0) {
error_txt = "Header page consists of zero bytes";
+ goto err_exit;
}
}
- const page_size_t page_size(m_flags);
-
- if (error_txt != NULL) {
+ if (!fsp_flags_is_valid(m_flags, m_space_id)) {
+ /* Tablespace flags must be valid. */
+ error_txt = "Tablespace flags are invalid";
+ goto err_exit;
+ }
- /* skip the next few tests */
- } else if (univ_page_size.logical() != page_size.logical()) {
+ const page_size_t page_size(m_flags);
+ if (univ_page_size.logical() != page_size.logical()) {
/* Page size must be univ_page_size. */
-
ib::error()
<< "Data file '" << m_filepath << "' uses page size "
<< page_size.logical() << ", but the innodb_page_size"
" start-up parameter is "
<< univ_page_size.logical();
-
free_first_page();
-
return(DB_ERROR);
- } else if (!fsp_flags_is_valid(m_flags, m_space_id)) {
- /* Tablespace flags must be valid. */
- error_txt = "Tablespace flags are invalid";
- } else if (page_get_page_no(m_first_page) != 0) {
+ }
+ if (page_get_page_no(m_first_page) != 0) {
/* First page must be number 0 */
error_txt = "Header page contains inconsistent data";
+ goto err_exit;
+ }
- } else if (m_space_id == ULINT_UNDEFINED) {
-
+ if (m_space_id == ULINT_UNDEFINED) {
/* The space_id can be most anything, except -1. */
error_txt = "A bad Space ID was found";
+ goto err_exit;
+ }
- } else if (buf_page_is_corrupted(false, m_first_page, page_size)) {
-
+ if (buf_page_is_corrupted(false, m_first_page, page_size)) {
/* Look for checksum and other corruptions. */
error_txt = "Checksum mismatch";
- }
-
- if (error_txt != NULL) {
- ib::error() << error_txt << " in datafile: " << m_filepath
- << ", Space ID:" << m_space_id << ", Flags: "
- << m_flags << ". " << TROUBLESHOOT_DATADICT_MSG;
- m_is_valid = false;
-
- free_first_page();
-
- return(DB_CORRUPTION);
-
+ goto err_exit;
}
if (fil_space_read_name_and_filepath(
diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc
index 1c7746ed75f..6fb88500c2e 100644
--- a/storage/innobase/handler/ha_innodb.cc
+++ b/storage/innobase/handler/ha_innodb.cc
@@ -15049,7 +15049,7 @@ ha_innobase::check(
&& !dict_index_is_corrupted(index)) {
/* Enlarge the fatal lock wait timeout during
CHECK TABLE. */
- my_atomic_addlint(
+ my_atomic_addlong(
&srv_fatal_semaphore_wait_threshold,
SRV_SEMAPHORE_WAIT_EXTENSION);
@@ -15058,7 +15058,7 @@ ha_innobase::check(
/* Restore the fatal lock wait timeout after
CHECK TABLE. */
- my_atomic_addlint(
+ my_atomic_addlong(
&srv_fatal_semaphore_wait_threshold,
-SRV_SEMAPHORE_WAIT_EXTENSION);
diff --git a/storage/innobase/include/buf0buf.h b/storage/innobase/include/buf0buf.h
index 4a54c30629b..063eb6b6fab 100644
--- a/storage/innobase/include/buf0buf.h
+++ b/storage/innobase/include/buf0buf.h
@@ -1827,7 +1827,7 @@ struct buf_block_t{
} while (0)
# define assert_block_ahi_valid(block) \
ut_a((block)->index \
- || my_atomic_addlint(&(block)->n_pointers, 0) == 0)
+ || my_atomic_loadlint(&(block)->n_pointers) == 0)
# else /* UNIV_AHI_DEBUG || UNIV_DEBUG */
# define assert_block_ahi_empty(block) /* nothing */
# define assert_block_ahi_empty_on_init(block) /* nothing */
diff --git a/storage/innobase/include/sync0types.h b/storage/innobase/include/sync0types.h
index d0a6feb877b..19f992f5f50 100644
--- a/storage/innobase/include/sync0types.h
+++ b/storage/innobase/include/sync0types.h
@@ -1156,9 +1156,41 @@ enum rw_lock_flag_t {
#endif /* UNIV_INNOCHECKSUM */
#ifdef _WIN64
-#define my_atomic_addlint(A,B) my_atomic_add64((int64*) (A), (B))
-#define my_atomic_loadlint(A) my_atomic_load64((int64*) (A))
-#define my_atomic_caslint(A,B,C) my_atomic_cas64((int64*) (A), (int64*) (B), (C))
+static inline ulint my_atomic_addlint(ulint *A, ulint B)
+{
+ return ulint(my_atomic_add64((volatile int64*)A, B));
+}
+
+static inline ulint my_atomic_loadlint(const ulint *A)
+{
+ return ulint(my_atomic_load64((volatile int64*)A));
+}
+
+static inline lint my_atomic_addlint(volatile lint *A, lint B)
+{
+ return my_atomic_add64((volatile int64*)A, B);
+}
+
+static inline lint my_atomic_loadlint(const lint *A)
+{
+ return lint(my_atomic_load64((volatile int64*)A));
+}
+
+static inline void my_atomic_storelint(ulint *A, ulint B)
+{
+ my_atomic_store64((volatile int64*)A, B);
+}
+
+static inline lint my_atomic_caslint(volatile lint *A, lint *B, lint C)
+{
+ return my_atomic_cas64((volatile int64*)A, (int64 *)B, C);
+}
+
+static inline ulint my_atomic_caslint(ulint *A, ulint *B, ulint C)
+{
+ return my_atomic_cas64((volatile int64*)A, (int64 *)B, (int64)C);
+}
+
#else
#define my_atomic_addlint my_atomic_addlong
#define my_atomic_loadlint my_atomic_loadlong
@@ -1188,7 +1220,7 @@ struct MY_ALIGNED(CPU_LEVEL1_DCACHE_LINESIZE) simple_counter
#pragma warning (push)
#pragma warning (disable : 4244)
#endif
- return Type(my_atomic_addlint(reinterpret_cast<lint*>
+ return Type(my_atomic_addlint(reinterpret_cast<ulint*>
(&m_counter), i));
#ifdef _MSC_VER
#pragma warning (pop)
diff --git a/storage/innobase/include/trx0purge.h b/storage/innobase/include/trx0purge.h
index e605e7a67a6..4885809b311 100644
--- a/storage/innobase/include/trx0purge.h
+++ b/storage/innobase/include/trx0purge.h
@@ -514,9 +514,9 @@ public:
parallelized purge operation */
ReadView view; /*!< The purge will not remove undo logs
which are >= this view (purge view) */
- volatile ulint n_submitted; /*!< Count of total tasks submitted
+ ulint n_submitted; /*!< Count of total tasks submitted
to the task queue */
- volatile ulint n_completed; /*!< Count of total tasks completed */
+ ulint n_completed; /*!< Count of total tasks completed */
/*------------------------------*/
/* The following two fields form the 'purge pointer' which advances
diff --git a/storage/innobase/srv/srv0conc.cc b/storage/innobase/srv/srv0conc.cc
index 9f589b57d9c..a1ffa8986a8 100644
--- a/storage/innobase/srv/srv0conc.cc
+++ b/storage/innobase/srv/srv0conc.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 2011, 2015, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2015, 2016, MariaDB Corporation.
+Copyright (c) 2015, 2018, MariaDB Corporation.
Portions of this file contain modifications contributed and copyrighted by
Google, Inc. Those modifications are gratefully acknowledged and are described
@@ -73,16 +73,12 @@ ulong srv_thread_concurrency = 0;
struct srv_conc_t {
char pad[CACHE_LINE_SIZE - (sizeof(ulint) + sizeof(lint))];
- /** Number of transactions that have declared_to_be_inside_innodb set.
- It used to be a non-error for this value to drop below zero temporarily.
- This is no longer true. We'll, however, keep the lint datatype to add
- assertions to catch any corner cases that we may have missed. */
-
- volatile lint n_active;
+ /** Number of transactions that have declared_to_be_inside_innodb */
+ ulint n_active;
/** Number of OS threads waiting in the FIFO for permission to
enter InnoDB */
- volatile lint n_waiting;
+ ulint n_waiting;
};
/* Control variables for tracking concurrency. */
@@ -152,7 +148,7 @@ srv_conc_enter_innodb_with_atomics(
return;
}
- if (srv_conc.n_active < (lint) srv_thread_concurrency) {
+ if (srv_conc.n_active < srv_thread_concurrency) {
ulint n_active;
/* Check if there are any free tickets. */
@@ -273,8 +269,6 @@ srv_conc_force_enter_innodb(
return;
}
- ut_ad(srv_conc.n_active >= 0);
-
(void) my_atomic_addlint(&srv_conc.n_active, 1);
trx->n_tickets_to_enter_innodb = 1;
diff --git a/storage/innobase/srv/srv0srv.cc b/storage/innobase/srv/srv0srv.cc
index 06c01725247..16318bad8f5 100644
--- a/storage/innobase/srv/srv0srv.cc
+++ b/storage/innobase/srv/srv0srv.cc
@@ -2588,8 +2588,8 @@ DECLARE_THREAD(srv_worker_thread)(
slot = srv_reserve_slot(SRV_WORKER);
ut_a(srv_n_purge_threads > 1);
- ut_a(my_atomic_loadlint(&srv_sys.n_threads_active[SRV_WORKER])
- < static_cast<lint>(srv_n_purge_threads));
+ ut_a(ulong(my_atomic_loadlint(&srv_sys.n_threads_active[SRV_WORKER]))
+ < srv_n_purge_threads);
/* We need to ensure that the worker threads exit after the
purge coordinator thread. Otherwise the purge coordinator can
diff --git a/storage/mroonga/vendor/groonga/lib/CMakeLists.txt b/storage/mroonga/vendor/groonga/lib/CMakeLists.txt
index 6765261feb7..2274e95aa24 100644
--- a/storage/mroonga/vendor/groonga/lib/CMakeLists.txt
+++ b/storage/mroonga/vendor/groonga/lib/CMakeLists.txt
@@ -177,3 +177,8 @@ if(GRN_WITH_MRUBY)
FILES ${EXPRESSION_TREE_RUBY_SCRIPTS}
DESTINATION "${GRN_RELATIVE_RUBY_SCRIPTS_DIR}/expression_tree")
endif()
+
+# Workaround GCC ICE on ARM64
+IF(CMAKE_COMPILER_IS_GNUCXX AND CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64")
+ ADD_COMPILE_FLAGS(ts/ts_expr_node.c COMPILE_FLAGS "-fno-tree-loop-vectorize")
+ENDIF()
diff --git a/storage/xtradb/fil/fil0fil.cc b/storage/xtradb/fil/fil0fil.cc
index 54e6a891424..7985700367d 100644
--- a/storage/xtradb/fil/fil0fil.cc
+++ b/storage/xtradb/fil/fil0fil.cc
@@ -4468,17 +4468,7 @@ cleanup_and_exit:
mem_free(def.filepath);
- /* We need to check fsp flags when no errors has happened and
- server was not started on read only mode and tablespace validation
- was requested or flags contain other table options except
- low order bits to FSP_FLAGS_POS_PAGE_SSIZE position.
- Note that flag comparison is pessimistic. Adjust is required
- only when flags contain buggy MariaDB 10.1.0 -
- MariaDB 10.1.20 flags. */
- if (err == DB_SUCCESS
- && !srv_read_only_mode
- && (validate
- || flags >= (1U << FSP_FLAGS_POS_PAGE_SSIZE))) {
+ if (err == DB_SUCCESS && validate && !srv_read_only_mode) {
fsp_flags_try_adjust(id, flags & ~FSP_FLAGS_MEM_MASK);
}