summaryrefslogtreecommitdiff
path: root/storage/xtradb
diff options
context:
space:
mode:
Diffstat (limited to 'storage/xtradb')
-rw-r--r--storage/xtradb/.clang-format111
-rw-r--r--storage/xtradb/CMakeLists.txt17
-rw-r--r--storage/xtradb/buf/buf0buf.cc14
-rw-r--r--storage/xtradb/buf/buf0dump.cc5
-rw-r--r--storage/xtradb/dict/dict0crea.cc15
-rw-r--r--storage/xtradb/dict/dict0mem.cc4
-rw-r--r--storage/xtradb/fts/fts0blex.cc30
-rw-r--r--storage/xtradb/fts/fts0fts.cc4
-rw-r--r--storage/xtradb/fts/fts0que.cc6
-rw-r--r--storage/xtradb/fts/fts0tlex.cc30
-rw-r--r--storage/xtradb/handler/ha_innodb.cc20
-rw-r--r--storage/xtradb/handler/ha_innodb.h6
-rw-r--r--storage/xtradb/handler/handler0alter.cc30
-rw-r--r--storage/xtradb/include/buf0buf.h1
-rw-r--r--storage/xtradb/include/fts0fts.h2
-rw-r--r--storage/xtradb/include/fts0types.h4
-rw-r--r--storage/xtradb/include/os0proc.h3
-rw-r--r--storage/xtradb/include/univ.i4
-rw-r--r--storage/xtradb/log/log0online.cc4
-rw-r--r--storage/xtradb/os/os0proc.cc63
-rw-r--r--storage/xtradb/pars/lexyy.cc30
-rw-r--r--storage/xtradb/row/row0import.cc1
-rw-r--r--storage/xtradb/row/row0log.cc6
-rw-r--r--storage/xtradb/row/row0merge.cc15
-rw-r--r--storage/xtradb/row/row0mysql.cc184
-rw-r--r--storage/xtradb/srv/srv0conc.cc1
-rw-r--r--storage/xtradb/srv/srv0srv.cc1
-rw-r--r--storage/xtradb/srv/srv0start.cc3
-rw-r--r--storage/xtradb/trx/trx0purge.cc2
29 files changed, 409 insertions, 207 deletions
diff --git a/storage/xtradb/.clang-format b/storage/xtradb/.clang-format
new file mode 100644
index 00000000000..d757d0a5a05
--- /dev/null
+++ b/storage/xtradb/.clang-format
@@ -0,0 +1,111 @@
+# generated with:
+# clang-format-5.0 -style=Google --dump-config
+
+Language: Cpp
+# BasedOnStyle: Google
+AccessModifierOffset: -1
+AlignAfterOpenBracket: Align
+AlignConsecutiveAssignments: false
+AlignEscapedNewlines: Left
+AlignOperands: true
+AlignTrailingComments: true
+AllowAllParametersOfDeclarationOnNextLine: true
+AllowShortBlocksOnASingleLine: false
+AllowShortCaseLabelsOnASingleLine: false
+AllowShortFunctionsOnASingleLine: All
+AlwaysBreakAfterDefinitionReturnType: None
+AlwaysBreakBeforeMultilineStrings: true
+AlwaysBreakTemplateDeclarations: true
+BinPackArguments: true
+BinPackParameters: true
+BraceWrapping:
+ AfterClass: false
+ AfterControlStatement: false
+ AfterEnum: false
+ AfterFunction: false
+ AfterNamespace: false
+ AfterObjCDeclaration: false
+ AfterStruct: false
+ AfterUnion: false
+ BeforeCatch: false
+ BeforeElse: false
+ IndentBraces: false
+ SplitEmptyFunction: true
+ SplitEmptyRecord: true
+ SplitEmptyNamespace: true
+BreakBeforeBinaryOperators: None
+BreakBeforeBraces: Attach
+BreakBeforeInheritanceComma: false
+BreakBeforeTernaryOperators: true
+BreakConstructorInitializersBeforeComma: false
+BreakConstructorInitializers: BeforeColon
+BreakAfterJavaFieldAnnotations: false
+BreakStringLiterals: true
+CommentPragmas: '^ IWYU pragma:'
+CompactNamespaces: false
+ConstructorInitializerAllOnOneLineOrOnePerLine: true
+ConstructorInitializerIndentWidth: 4
+ContinuationIndentWidth: 4
+Cpp11BracedListStyle: true
+DisableFormat: false
+ExperimentalAutoDetectBinPacking: false
+FixNamespaceComments: true
+ForEachMacros:
+ - foreach
+ - Q_FOREACH
+ - BOOST_FOREACH
+IncludeCategories:
+ - Regex: '^<.*\.h>'
+ Priority: 1
+ - Regex: '^<.*'
+ Priority: 2
+ - Regex: '.*'
+ Priority: 3
+IncludeIsMainRegex: '([-_](test|unittest))?$'
+IndentCaseLabels: true
+IndentWrappedFunctionNames: false
+JavaScriptQuotes: Leave
+JavaScriptWrapImports: true
+KeepEmptyLinesAtTheStartOfBlocks: false
+MacroBlockBegin: ''
+MacroBlockEnd: ''
+NamespaceIndentation: None
+ObjCBlockIndentWidth: 2
+ObjCSpaceAfterProperty: false
+ObjCSpaceBeforeProtocolList: false
+PenaltyBreakAssignment: 2
+PenaltyBreakBeforeFirstCallParameter: 1
+PenaltyBreakComment: 300
+PenaltyBreakFirstLessLess: 120
+PenaltyBreakString: 1000
+PenaltyExcessCharacter: 1000000
+PenaltyReturnTypeOnItsOwnLine: 200
+SortUsingDeclarations: true
+SpaceAfterTemplateKeyword: true
+SpaceBeforeAssignmentOperators: true
+SpaceBeforeParens: ControlStatements
+SpaceInEmptyParentheses: false
+SpacesBeforeTrailingComments: 2
+SpacesInAngles: false
+SpacesInContainerLiterals: true
+SpacesInCStyleCastParentheses: false
+SpacesInParentheses: false
+SpacesInSquareBrackets: false
+Standard: Auto
+TabWidth: 8
+
+
+# changes for MySQL 5.x (InnoDB)
+AlignConsecutiveDeclarations: true
+AllowShortIfStatementsOnASingleLine: false
+AllowShortLoopsOnASingleLine: false
+AlwaysBreakAfterReturnType: All
+ColumnLimit: 78
+DerivePointerAlignment: false
+IndentWidth: 8
+MaxEmptyLinesToKeep: 2
+PointerAlignment: Right
+ReflowComments: false
+SortIncludes: false
+SpaceAfterCStyleCast: true
+UseTab: Always
diff --git a/storage/xtradb/CMakeLists.txt b/storage/xtradb/CMakeLists.txt
index ad1b1a0aa57..c45f88707a5 100644
--- a/storage/xtradb/CMakeLists.txt
+++ b/storage/xtradb/CMakeLists.txt
@@ -65,9 +65,6 @@ IF(UNIX)
LINK_LIBRARIES(${AIO_LIBRARY})
ENDIF()
ADD_DEFINITIONS("-DUNIV_LINUX -D_GNU_SOURCE=1")
- IF(HAVE_LIBNUMA)
- LINK_LIBRARIES(numa)
- ENDIF()
ELSEIF(CMAKE_SYSTEM_NAME MATCHES "HP*")
ADD_DEFINITIONS("-DUNIV_HPUX")
ELSEIF(CMAKE_SYSTEM_NAME STREQUAL "AIX")
@@ -505,7 +502,21 @@ SET(INNOBASE_SOURCES
ut/ut0wqueue.cc
ut/ut0timer.cc)
+IF(CMAKE_SYSTEM_PROCESSOR MATCHES "ppc64le")
+ enable_language(ASM)
+ LIST(APPEND INNOBASE_SOURCES
+ ut/crc32_power8/crc32.S
+ ut/crc32_power8/crc32_wrapper.c
+ )
+ENDIF()
+
+UNSET(NUMA_LIBRARY)
+IF(HAVE_LIBNUMA)
+ SET(NUMA_LIBRARY "numa")
+ENDIF()
+
MYSQL_ADD_PLUGIN(xtradb ${INNOBASE_SOURCES} STORAGE_ENGINE
+ DEFAULT
RECOMPILE_FOR_EMBEDDED
LINK_LIBRARIES
${ZLIB_LIBRARY}
diff --git a/storage/xtradb/buf/buf0buf.cc b/storage/xtradb/buf/buf0buf.cc
index a6b0dabe110..357fcc0c872 100644
--- a/storage/xtradb/buf/buf0buf.cc
+++ b/storage/xtradb/buf/buf0buf.cc
@@ -55,6 +55,9 @@ Created 11/5/1995 Heikki Tuuri
#include "page0zip.h"
#include "srv0mon.h"
#include "buf0checksum.h"
+
+UNIV_INTERN my_bool srv_numa_interleave = FALSE;
+
#ifdef HAVE_LIBNUMA
#include <numa.h>
#include <numaif.h>
@@ -1405,7 +1408,8 @@ buf_chunk_init(
/*===========*/
buf_pool_t* buf_pool, /*!< in: buffer pool instance */
buf_chunk_t* chunk, /*!< out: chunk of buffers */
- ulint mem_size) /*!< in: requested size in bytes */
+ ulint mem_size, /*!< in: requested size in bytes */
+ bool populate) /*!< in: virtual page preallocation */
{
buf_block_t* block;
byte* frame;
@@ -1421,7 +1425,7 @@ buf_chunk_init(
+ (UNIV_PAGE_SIZE - 1), UNIV_PAGE_SIZE);
chunk->mem_size = mem_size;
- chunk->mem = os_mem_alloc_large(&chunk->mem_size);
+ chunk->mem = os_mem_alloc_large(&chunk->mem_size, populate);
if (UNIV_UNLIKELY(chunk->mem == NULL)) {
@@ -1641,6 +1645,7 @@ buf_pool_init_instance(
/*===================*/
buf_pool_t* buf_pool, /*!< in: buffer pool instance */
ulint buf_pool_size, /*!< in: size in bytes */
+ bool populate, /*!< in: virtual page preallocation */
ulint instance_no) /*!< in: id of the instance */
{
ulint i;
@@ -1667,7 +1672,7 @@ buf_pool_init_instance(
buf_pool->chunks = chunk =
(buf_chunk_t*) mem_zalloc(sizeof *chunk);
- if (!buf_chunk_init(buf_pool, chunk, buf_pool_size)) {
+ if (!buf_chunk_init(buf_pool, chunk, buf_pool_size, populate)) {
mem_free(chunk);
mem_free(buf_pool);
@@ -1822,6 +1827,7 @@ dberr_t
buf_pool_init(
/*==========*/
ulint total_size, /*!< in: size of the total pool in bytes */
+ bool populate, /*!< in: virtual page preallocation */
ulint n_instances) /*!< in: number of instances */
{
ulint i;
@@ -1854,7 +1860,7 @@ buf_pool_init(
for (i = 0; i < n_instances; i++) {
buf_pool_t* ptr = &buf_pool_ptr[i];
- if (buf_pool_init_instance(ptr, size, i) != DB_SUCCESS) {
+ if (buf_pool_init_instance(ptr, size, populate, i) != DB_SUCCESS) {
/* Free all the instances created so far. */
buf_pool_free(i);
diff --git a/storage/xtradb/buf/buf0dump.cc b/storage/xtradb/buf/buf0dump.cc
index e9168d9f5d5..f73bf3bdc58 100644
--- a/storage/xtradb/buf/buf0dump.cc
+++ b/storage/xtradb/buf/buf0dump.cc
@@ -200,8 +200,9 @@ buf_dump(
{
#define SHOULD_QUIT() (SHUTTING_DOWN() && obey_shutdown)
+ static const char format_name[]= "%s.incomplete";
char full_filename[OS_FILE_MAX_PATH];
- char tmp_filename[OS_FILE_MAX_PATH + sizeof "incomplete"];
+ char tmp_filename[OS_FILE_MAX_PATH + sizeof(format_name)];
char now[32];
FILE* f;
ulint i;
@@ -212,7 +213,7 @@ buf_dump(
srv_buf_dump_filename);
ut_snprintf(tmp_filename, sizeof(tmp_filename),
- "%s.incomplete", full_filename);
+ format_name, full_filename);
buf_dump_status(STATUS_NOTICE, "Dumping buffer pool(s) to %s",
full_filename);
diff --git a/storage/xtradb/dict/dict0crea.cc b/storage/xtradb/dict/dict0crea.cc
index 2fe9f8af4ec..639785bf84a 100644
--- a/storage/xtradb/dict/dict0crea.cc
+++ b/storage/xtradb/dict/dict0crea.cc
@@ -1363,6 +1363,21 @@ dict_create_or_check_foreign_constraint_tables(void)
row_mysql_lock_data_dictionary(trx);
+ DBUG_EXECUTE_IF(
+ "create_and_drop_garbage",
+ err = que_eval_sql(
+ NULL,
+ "PROCEDURE CREATE_GARBAGE_TABLE_PROC () IS\n"
+ "BEGIN\n"
+ "CREATE TABLE\n"
+ "\"test/#sql-ib-garbage\"(ID CHAR);\n"
+ "CREATE UNIQUE CLUSTERED INDEX PRIMARY"
+ " ON \"test/#sql-ib-garbage\"(ID);\n"
+ "END;\n", FALSE, trx);
+ ut_ad(err == DB_SUCCESS);
+ row_drop_table_for_mysql("test/#sql-ib-garbage",
+ trx, TRUE, TRUE););
+
/* Check which incomplete table definition to drop. */
if (sys_foreign_err == DB_CORRUPTION) {
diff --git a/storage/xtradb/dict/dict0mem.cc b/storage/xtradb/dict/dict0mem.cc
index ab6167b920b..4ef3d5df750 100644
--- a/storage/xtradb/dict/dict0mem.cc
+++ b/storage/xtradb/dict/dict0mem.cc
@@ -499,9 +499,7 @@ dict_mem_table_col_rename(
s += len + 1;
}
- /* This could fail if the data dictionaries are out of sync.
- Proceed with the renaming anyway. */
- ut_ad(!strcmp(from, s));
+ ut_ad(!my_strcasecmp(system_charset_info, from, s));
dict_mem_table_col_rename_low(table, nth_col, to, s);
}
diff --git a/storage/xtradb/fts/fts0blex.cc b/storage/xtradb/fts/fts0blex.cc
index 2d71934fa0e..a8f231268ac 100644
--- a/storage/xtradb/fts/fts0blex.cc
+++ b/storage/xtradb/fts/fts0blex.cc
@@ -701,9 +701,9 @@ extern int fts0blex (yyscan_t yyscanner);
*/
YY_DECL
{
- register yy_state_type yy_current_state;
- register char *yy_cp, *yy_bp;
- register int yy_act;
+ yy_state_type yy_current_state;
+ char *yy_cp, *yy_bp;
+ int yy_act;
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
#line 43 "fts0blex.l"
@@ -753,7 +753,7 @@ YY_DECL
yy_match:
do
{
- register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
+ YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
if ( yy_accept[yy_current_state] )
{
yyg->yy_last_accepting_state = yy_current_state;
@@ -984,9 +984,9 @@ case YY_STATE_EOF(INITIAL):
static int yy_get_next_buffer (yyscan_t yyscanner)
{
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
- register char *source = yyg->yytext_ptr;
- register int number_to_move, i;
+ char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
+ char *source = yyg->yytext_ptr;
+ int number_to_move, i;
int ret_val;
if ( yyg->yy_c_buf_p > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] )
@@ -1118,15 +1118,15 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
static yy_state_type yy_get_previous_state (yyscan_t yyscanner)
{
- register yy_state_type yy_current_state;
- register char *yy_cp;
+ yy_state_type yy_current_state;
+ char *yy_cp;
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
yy_current_state = yyg->yy_start;
for ( yy_cp = yyg->yytext_ptr + YY_MORE_ADJ; yy_cp < yyg->yy_c_buf_p; ++yy_cp )
{
- register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
+ YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
if ( yy_accept[yy_current_state] )
{
yyg->yy_last_accepting_state = yy_current_state;
@@ -1151,11 +1151,11 @@ static yy_state_type yy_get_previous_state (yyscan_t yyscanner)
*/
static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state , yyscan_t yyscanner)
{
- register int yy_is_jam;
+ int yy_is_jam;
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; /* This var may be unused depending upon options. */
- register char *yy_cp = yyg->yy_c_buf_p;
+ char *yy_cp = yyg->yy_c_buf_p;
- register YY_CHAR yy_c = 1;
+ YY_CHAR yy_c = 1;
if ( yy_accept[yy_current_state] )
{
yyg->yy_last_accepting_state = yy_current_state;
@@ -1912,7 +1912,7 @@ int fts0blex_destroy (yyscan_t yyscanner)
#ifndef yytext_ptr
static void yy_flex_strncpy (char* s1, yyconst char * s2, int n , yyscan_t yyscanner MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)))
{
- register int i;
+ int i;
for ( i = 0; i < n; ++i )
s1[i] = s2[i];
}
@@ -1921,7 +1921,7 @@ static void yy_flex_strncpy (char* s1, yyconst char * s2, int n , yys
#ifdef YY_NEED_STRLEN
static int yy_flex_strlen (yyconst char * s , yyscan_t yyscanner MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)))
{
- register int n;
+ int n;
for ( n = 0; s[n]; ++n )
;
diff --git a/storage/xtradb/fts/fts0fts.cc b/storage/xtradb/fts/fts0fts.cc
index 5981c24c470..02d81551e75 100644
--- a/storage/xtradb/fts/fts0fts.cc
+++ b/storage/xtradb/fts/fts0fts.cc
@@ -67,7 +67,7 @@ UNIV_INTERN ulong fts_max_total_cache_size;
/** This is FTS result cache limit for each query and would be
a configurable variable */
-UNIV_INTERN ulong fts_result_cache_limit;
+UNIV_INTERN size_t fts_result_cache_limit;
/** Variable specifying the maximum FTS max token size */
UNIV_INTERN ulong fts_max_token_size;
@@ -4308,7 +4308,7 @@ fts_sync_begin(
if (fts_enable_diag_print) {
ib_logf(IB_LOG_LEVEL_INFO,
"FTS SYNC for table %s, deleted count: %ld size: "
- "%lu bytes",
+ "%zu bytes",
sync->table->name,
ib_vector_size(cache->deleted_doc_ids),
cache->total_size);
diff --git a/storage/xtradb/fts/fts0que.cc b/storage/xtradb/fts/fts0que.cc
index 9966656e772..b9ad43c626a 100644
--- a/storage/xtradb/fts/fts0que.cc
+++ b/storage/xtradb/fts/fts0que.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 2007, 2018, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2017, MariaDB Corporation.
+Copyright (c) 2017, 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
@@ -76,7 +76,7 @@ struct fts_query_t {
fts_table_t fts_index_table;/*!< FTS auxiliary index table def */
- ulint total_size; /*!< total memory size used by query */
+ size_t total_size; /*!< total memory size used by query */
fts_doc_ids_t* deleted; /*!< Deleted doc ids that need to be
filtered from the output */
@@ -4058,7 +4058,7 @@ fts_query(
/* Log memory consumption & result size */
ib_logf(IB_LOG_LEVEL_INFO,
"Full Search Memory: "
- "%lu (bytes), Row: %lu .",
+ "%zu (bytes), Row: %lu .",
query.total_size,
(*result)->rankings_by_id
? rbt_size((*result)->rankings_by_id)
diff --git a/storage/xtradb/fts/fts0tlex.cc b/storage/xtradb/fts/fts0tlex.cc
index d4d9b4c48d1..28fac9bf704 100644
--- a/storage/xtradb/fts/fts0tlex.cc
+++ b/storage/xtradb/fts/fts0tlex.cc
@@ -697,9 +697,9 @@ extern int fts0tlex (yyscan_t yyscanner);
*/
YY_DECL
{
- register yy_state_type yy_current_state;
- register char *yy_cp, *yy_bp;
- register int yy_act;
+ yy_state_type yy_current_state;
+ char *yy_cp, *yy_bp;
+ int yy_act;
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
#line 44 "fts0tlex.l"
@@ -749,7 +749,7 @@ YY_DECL
yy_match:
do
{
- register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
+ YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
if ( yy_accept[yy_current_state] )
{
yyg->yy_last_accepting_state = yy_current_state;
@@ -976,9 +976,9 @@ case YY_STATE_EOF(INITIAL):
static int yy_get_next_buffer (yyscan_t yyscanner)
{
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
- register char *source = yyg->yytext_ptr;
- register int number_to_move, i;
+ char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
+ char *source = yyg->yytext_ptr;
+ int number_to_move, i;
int ret_val;
if ( yyg->yy_c_buf_p > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] )
@@ -1110,15 +1110,15 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
static yy_state_type yy_get_previous_state (yyscan_t yyscanner)
{
- register yy_state_type yy_current_state;
- register char *yy_cp;
+ yy_state_type yy_current_state;
+ char *yy_cp;
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
yy_current_state = yyg->yy_start;
for ( yy_cp = yyg->yytext_ptr + YY_MORE_ADJ; yy_cp < yyg->yy_c_buf_p; ++yy_cp )
{
- register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
+ YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
if ( yy_accept[yy_current_state] )
{
yyg->yy_last_accepting_state = yy_current_state;
@@ -1143,11 +1143,11 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
*/
static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state , yyscan_t yyscanner)
{
- register int yy_is_jam;
+ int yy_is_jam;
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; /* This var may be unused depending upon options. */
- register char *yy_cp = yyg->yy_c_buf_p;
+ char *yy_cp = yyg->yy_c_buf_p;
- register YY_CHAR yy_c = 1;
+ YY_CHAR yy_c = 1;
if ( yy_accept[yy_current_state] )
{
yyg->yy_last_accepting_state = yy_current_state;
@@ -1905,7 +1905,7 @@ int fts0tlex_destroy (yyscan_t yyscanner)
#ifndef yytext_ptr
static void yy_flex_strncpy (char* s1, yyconst char * s2, int n , yyscan_t yyscanner MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)))
{
- register int i;
+ int i;
for ( i = 0; i < n; ++i )
s1[i] = s2[i];
}
@@ -1914,7 +1914,7 @@ static void yy_flex_strncpy (char* s1, yyconst char * s2, int n , yys
#ifdef YY_NEED_STRLEN
static int yy_flex_strlen (yyconst char * s , yyscan_t yyscanner MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)))
{
- register int n;
+ int n;
for ( n = 0; s[n]; ++n )
;
diff --git a/storage/xtradb/handler/ha_innodb.cc b/storage/xtradb/handler/ha_innodb.cc
index eb860ef4d62..1a63bd815df 100644
--- a/storage/xtradb/handler/ha_innodb.cc
+++ b/storage/xtradb/handler/ha_innodb.cc
@@ -5,6 +5,7 @@ Copyright (c) 2013, 2018, MariaDB Corporation.
Copyright (c) 2008, 2009 Google Inc.
Copyright (c) 2009, Percona Inc.
Copyright (c) 2012, Facebook Inc.
+Copyright (c) 2013, 2018, MariaDB Corporation.
Portions of this file contain modifications contributed and copyrighted by
Google, Inc. Those modifications are gratefully acknowledged and are described
@@ -3527,13 +3528,13 @@ innobase_convert_identifier(
ibool file_id)/*!< in: TRUE=id is a table or database name;
FALSE=id is an UTF-8 string */
{
- char nz2[MAX_TABLE_NAME_LEN + 1];
const char* s = id;
int q;
- if (file_id) {
+ char nz[MAX_TABLE_NAME_LEN + 1];
+ char nz2[MAX_TABLE_NAME_LEN + 1];
- char nz[MAX_TABLE_NAME_LEN + 1];
+ if (file_id) {
/* Decode the table name. The MySQL function expects
a NUL-terminated string. The input and output strings
@@ -20678,10 +20679,10 @@ static MYSQL_SYSVAR_ULONG(ft_total_cache_size, fts_max_total_cache_size,
"Total memory allocated for InnoDB Fulltext Search cache",
NULL, NULL, 640000000, 32000000, 1600000000, 0);
-static MYSQL_SYSVAR_ULONG(ft_result_cache_limit, fts_result_cache_limit,
+static MYSQL_SYSVAR_SIZE_T(ft_result_cache_limit, fts_result_cache_limit,
PLUGIN_VAR_RQCMDARG,
"InnoDB Fulltext search query result cache limit in bytes",
- NULL, NULL, 2000000000L, 1000000L, 4294967295UL, 0);
+ NULL, NULL, 2000000000L, 1000000L, SIZE_T_MAX, 0);
static MYSQL_SYSVAR_ULONG(ft_min_token_size, fts_min_token_size,
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
@@ -22103,15 +22104,6 @@ int ha_innobase::multi_range_read_explain_info(uint mrr_mode, char *str, size_t
return ds_mrr.dsmrr_explain_info(mrr_mode, str, size);
}
-/*
- A helper function used only in index_cond_func_innodb
-*/
-
-bool ha_innobase::is_thd_killed()
-{
- return thd_kill_level(user_thd);
-}
-
/**********************************************************************
Issue a warning that the row is too big. */
UNIV_INTERN
diff --git a/storage/xtradb/handler/ha_innodb.h b/storage/xtradb/handler/ha_innodb.h
index 3dbbc53a0e3..7f5a1b5817f 100644
--- a/storage/xtradb/handler/ha_innodb.h
+++ b/storage/xtradb/handler/ha_innodb.h
@@ -206,7 +206,7 @@ class ha_innobase: public handler
char* remote_path);
const char* check_table_options(THD *thd, TABLE* table,
HA_CREATE_INFO* create_info, const bool use_tablespace, const ulint file_format);
- int create(const char *name, register TABLE *form,
+ int create(const char *name, TABLE *form,
HA_CREATE_INFO *create_info);
int truncate();
int delete_table(const char *name);
@@ -389,10 +389,6 @@ public:
* @return idx_cond if pushed; NULL if not pushed
*/
class Item* idx_cond_push(uint keyno, class Item* idx_cond);
-
- /* An helper function for index_cond_func_innodb: */
- bool is_thd_killed();
-
private:
/** The multi range read session object */
DsMrr_impl ds_mrr;
diff --git a/storage/xtradb/handler/handler0alter.cc b/storage/xtradb/handler/handler0alter.cc
index 81077758bae..3bad086414c 100644
--- a/storage/xtradb/handler/handler0alter.cc
+++ b/storage/xtradb/handler/handler0alter.cc
@@ -4635,7 +4635,6 @@ innobase_rename_column_try(
pars_info_add_ull_literal(info, "tableid", user_table->id);
pars_info_add_int4_literal(info, "nth", nth_col);
- pars_info_add_str_literal(info, "old", from);
pars_info_add_str_literal(info, "new", to);
trx->op_info = "renaming column in SYS_COLUMNS";
@@ -4645,7 +4644,7 @@ innobase_rename_column_try(
"PROCEDURE RENAME_SYS_COLUMNS_PROC () IS\n"
"BEGIN\n"
"UPDATE SYS_COLUMNS SET NAME=:new\n"
- "WHERE TABLE_ID=:tableid AND NAME=:old\n"
+ "WHERE TABLE_ID=:tableid\n"
"AND POS=:nth;\n"
"END;\n",
FALSE, trx);
@@ -4669,8 +4668,10 @@ err_exit:
index = dict_table_get_next_index(index)) {
for (ulint i = 0; i < dict_index_get_n_fields(index); i++) {
- if (strcmp(dict_index_get_nth_field(index, i)->name,
- from)) {
+ if (my_strcasecmp(
+ system_charset_info,
+ dict_index_get_nth_field(index, i)->name,
+ from)) {
continue;
}
@@ -4678,7 +4679,6 @@ err_exit:
pars_info_add_ull_literal(info, "indexid", index->id);
pars_info_add_int4_literal(info, "nth", i);
- pars_info_add_str_literal(info, "old", from);
pars_info_add_str_literal(info, "new", to);
error = que_eval_sql(
@@ -4687,14 +4687,14 @@ err_exit:
"BEGIN\n"
"UPDATE SYS_FIELDS SET COL_NAME=:new\n"
- "WHERE INDEX_ID=:indexid AND COL_NAME=:old\n"
+ "WHERE INDEX_ID=:indexid\n"
"AND POS=:nth;\n"
/* Try again, in case there is a prefix_len
encoded in SYS_FIELDS.POS */
"UPDATE SYS_FIELDS SET COL_NAME=:new\n"
- "WHERE INDEX_ID=:indexid AND COL_NAME=:old\n"
+ "WHERE INDEX_ID=:indexid\n"
"AND POS>=65536*:nth AND POS<65536*(:nth+1);\n"
"END;\n",
@@ -4720,7 +4720,9 @@ rename_foreign:
foreign_modified = false;
for (unsigned i = 0; i < foreign->n_fields; i++) {
- if (strcmp(foreign->foreign_col_names[i], from)) {
+ if (my_strcasecmp(system_charset_info,
+ foreign->foreign_col_names[i],
+ from)) {
continue;
}
@@ -4728,7 +4730,6 @@ rename_foreign:
pars_info_add_str_literal(info, "id", foreign->id);
pars_info_add_int4_literal(info, "nth", i);
- pars_info_add_str_literal(info, "old", from);
pars_info_add_str_literal(info, "new", to);
error = que_eval_sql(
@@ -4737,8 +4738,7 @@ rename_foreign:
"BEGIN\n"
"UPDATE SYS_FOREIGN_COLS\n"
"SET FOR_COL_NAME=:new\n"
- "WHERE ID=:id AND POS=:nth\n"
- "AND FOR_COL_NAME=:old;\n"
+ "WHERE ID=:id AND POS=:nth;\n"
"END;\n",
FALSE, trx);
@@ -4762,7 +4762,9 @@ rename_foreign:
dict_foreign_t* foreign = *it;
for (unsigned i = 0; i < foreign->n_fields; i++) {
- if (strcmp(foreign->referenced_col_names[i], from)) {
+ if (my_strcasecmp(system_charset_info,
+ foreign->referenced_col_names[i],
+ from)) {
continue;
}
@@ -4770,7 +4772,6 @@ rename_foreign:
pars_info_add_str_literal(info, "id", foreign->id);
pars_info_add_int4_literal(info, "nth", i);
- pars_info_add_str_literal(info, "old", from);
pars_info_add_str_literal(info, "new", to);
error = que_eval_sql(
@@ -4779,8 +4780,7 @@ rename_foreign:
"BEGIN\n"
"UPDATE SYS_FOREIGN_COLS\n"
"SET REF_COL_NAME=:new\n"
- "WHERE ID=:id AND POS=:nth\n"
- "AND REF_COL_NAME=:old;\n"
+ "WHERE ID=:id AND POS=:nth;\n"
"END;\n",
FALSE, trx);
diff --git a/storage/xtradb/include/buf0buf.h b/storage/xtradb/include/buf0buf.h
index 0944b5d4067..b4ea4d56e31 100644
--- a/storage/xtradb/include/buf0buf.h
+++ b/storage/xtradb/include/buf0buf.h
@@ -217,6 +217,7 @@ dberr_t
buf_pool_init(
/*=========*/
ulint size, /*!< in: Size of the total pool in bytes */
+ bool populate, /*!< in: Force virtual page preallocation */
ulint n_instances); /*!< in: Number of instances */
/********************************************************************//**
Frees the buffer pool at shutdown. This must not be invoked before
diff --git a/storage/xtradb/include/fts0fts.h b/storage/xtradb/include/fts0fts.h
index 4c2d247e0a6..ce30a17c4b4 100644
--- a/storage/xtradb/include/fts0fts.h
+++ b/storage/xtradb/include/fts0fts.h
@@ -355,7 +355,7 @@ extern ulong fts_max_cache_size;
extern ulong fts_max_total_cache_size;
/** Variable specifying the FTS result cache limit for each query */
-extern ulong fts_result_cache_limit;
+extern size_t fts_result_cache_limit;
/** Variable specifying the maximum FTS max token size */
extern ulong fts_max_token_size;
diff --git a/storage/xtradb/include/fts0types.h b/storage/xtradb/include/fts0types.h
index 0dad75d8f1b..9ecd9080881 100644
--- a/storage/xtradb/include/fts0types.h
+++ b/storage/xtradb/include/fts0types.h
@@ -161,7 +161,7 @@ struct fts_cache_t {
the document from the table. Each
element is of type fts_doc_t */
- ulint total_size; /*!< total size consumed by the ilist
+ size_t total_size; /*!< total size consumed by the ilist
field of all nodes. SYNC is run
whenever this gets too big */
fts_sync_t* sync; /*!< sync structure to sync data to
@@ -243,7 +243,7 @@ struct fts_fetch_t {
fts_sql_callback
read_record; /*!< Callback for reading index
record */
- ulint total_memory; /*!< Total memory used */
+ size_t total_memory; /*!< Total memory used */
};
/** For horizontally splitting an FTS auxiliary index */
diff --git a/storage/xtradb/include/os0proc.h b/storage/xtradb/include/os0proc.h
index 613e3bd6947..d6aafccf48e 100644
--- a/storage/xtradb/include/os0proc.h
+++ b/storage/xtradb/include/os0proc.h
@@ -58,7 +58,8 @@ UNIV_INTERN
void*
os_mem_alloc_large(
/*===============*/
- ulint* n); /*!< in/out: number of bytes */
+ ulint* n, /*!< in/out: number of bytes */
+ bool populate); /*!< in: virtual page preallocation */
/****************************************************************//**
Frees large pages memory. */
UNIV_INTERN
diff --git a/storage/xtradb/include/univ.i b/storage/xtradb/include/univ.i
index 9aafb88522f..67e4d90d6df 100644
--- a/storage/xtradb/include/univ.i
+++ b/storage/xtradb/include/univ.i
@@ -45,10 +45,10 @@ Created 1/20/1994 Heikki Tuuri
#define INNODB_VERSION_MAJOR 5
#define INNODB_VERSION_MINOR 6
-#define INNODB_VERSION_BUGFIX 39
+#define INNODB_VERSION_BUGFIX 41
#ifndef PERCONA_INNODB_VERSION
-#define PERCONA_INNODB_VERSION 83.1
+#define PERCONA_INNODB_VERSION 84.1
#endif
/* Enable UNIV_LOG_ARCHIVE in XtraDB */
diff --git a/storage/xtradb/log/log0online.cc b/storage/xtradb/log/log0online.cc
index af32237243b..42e92ea6f0e 100644
--- a/storage/xtradb/log/log0online.cc
+++ b/storage/xtradb/log/log0online.cc
@@ -1522,10 +1522,10 @@ log_online_open_bitmap_file_read_only(
if (srv_data_home_len
&& srv_data_home[srv_data_home_len-1]
!= SRV_PATH_SEPARATOR) {
- ut_snprintf(bitmap_file->name, FN_REFLEN, "%s%c%s",
+ ut_snprintf(bitmap_file->name, sizeof(bitmap_file->name), "%s%c%s",
srv_data_home, SRV_PATH_SEPARATOR, name);
} else {
- ut_snprintf(bitmap_file->name, FN_REFLEN, "%s%s",
+ ut_snprintf(bitmap_file->name, sizeof(bitmap_file->name), "%s%s",
srv_data_home, name);
}
bitmap_file->file
diff --git a/storage/xtradb/os/os0proc.cc b/storage/xtradb/os/os0proc.cc
index ff6d65e4ae6..6c9116e1397 100644
--- a/storage/xtradb/os/os0proc.cc
+++ b/storage/xtradb/os/os0proc.cc
@@ -32,6 +32,14 @@ Created 9/30/1995 Heikki Tuuri
#include "ut0mem.h"
#include "ut0byte.h"
+/* Linux release version */
+#if defined(UNIV_LINUX) && defined(_GNU_SOURCE)
+#include <string.h> /* strverscmp() */
+#include <sys/utsname.h> /* uname() */
+#endif
+
+#include "ha_prototypes.h"
+
/* FreeBSD for example has only MAP_ANON, Linux has MAP_ANONYMOUS and
MAP_ANON but MAP_ANON is marked as deprecated */
#if defined(MAP_ANONYMOUS)
@@ -40,10 +48,36 @@ MAP_ANON but MAP_ANON is marked as deprecated */
#define OS_MAP_ANON MAP_ANON
#endif
+/* Linux's MAP_POPULATE */
+#if defined(MAP_POPULATE)
+#define OS_MAP_POPULATE MAP_POPULATE
+#else
+#define OS_MAP_POPULATE 0
+#endif
+
UNIV_INTERN ibool os_use_large_pages;
/* Large page size. This may be a boot-time option on some platforms */
UNIV_INTERN ulint os_large_page_size;
+
+/****************************************************************//**
+Retrieve and compare operating system release.
+@return TRUE if the OS release is equal to, or later than release. */
+UNIV_INTERN
+bool
+os_compare_release(
+/*===============*/
+ const char* release /*!< in: OS release */
+ MY_ATTRIBUTE((unused)))
+{
+#if defined(UNIV_LINUX) && defined(_GNU_SOURCE)
+ struct utsname name;
+ return uname(&name) == 0 && strverscmp(name.release, release) >= 0;
+#else
+ return false;
+#endif
+}
+
/****************************************************************//**
Converts the current process id to a number. It is not guaranteed that the
number is unique. In Linux returns the 'process number' of the current
@@ -69,7 +103,8 @@ UNIV_INTERN
void*
os_mem_alloc_large(
/*===============*/
- ulint* n) /*!< in/out: number of bytes */
+ ulint* n, /*!< in/out: number of bytes */
+ bool populate) /*!< in: virtual page preallocation */
{
void* ptr;
ulint size;
@@ -155,12 +190,13 @@ skip:
ut_ad(ut_is_2pow(size));
size = *n = ut_2pow_round(*n + (size - 1), size);
ptr = mmap(NULL, size, PROT_READ | PROT_WRITE,
- MAP_PRIVATE | OS_MAP_ANON, -1, 0);
- if (UNIV_UNLIKELY(ptr == (void*) -1)) {
+ MAP_PRIVATE | OS_MAP_ANON |
+ (populate ? OS_MAP_POPULATE : 0), -1, 0);
+ if (UNIV_UNLIKELY(ptr == MAP_FAILED)) {
fprintf(stderr, "InnoDB: mmap(%lu bytes) failed;"
" errno %lu\n",
(ulong) size, (ulong) errno);
- ptr = NULL;
+ return NULL;
} else {
os_fast_mutex_lock(&ut_list_mutex);
ut_total_allocated_memory += size;
@@ -168,6 +204,25 @@ skip:
UNIV_MEM_ALLOC(ptr, size);
}
#endif
+
+#if OS_MAP_ANON && OS_MAP_POPULATE
+ /* MAP_POPULATE is only supported for private mappings
+ since Linux 2.6.23. */
+ populate = populate && !os_compare_release("2.6.23");
+
+ if (populate) {
+ ib_logf(IB_LOG_LEVEL_WARN, "InnoDB: Warning: mmap(MAP_POPULATE) "
+ "is not supported for private mappings. "
+ "Forcing preallocation by faulting in pages.\n");
+ }
+#endif
+
+ /* Initialize the entire buffer to force the allocation
+ of physical memory page frames. */
+ if (populate) {
+ memset(ptr, '\0', size);
+ }
+
return(ptr);
}
diff --git a/storage/xtradb/pars/lexyy.cc b/storage/xtradb/pars/lexyy.cc
index 62122bb9f6f..bc6544b099d 100644
--- a/storage/xtradb/pars/lexyy.cc
+++ b/storage/xtradb/pars/lexyy.cc
@@ -1187,9 +1187,9 @@ extern int yylex (void);
*/
YY_DECL
{
- register yy_state_type yy_current_state;
- register char *yy_cp, *yy_bp;
- register int yy_act;
+ yy_state_type yy_current_state;
+ char *yy_cp, *yy_bp;
+ int yy_act;
#line 112 "pars0lex.l"
@@ -1238,7 +1238,7 @@ YY_DECL
yy_match:
do
{
- register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
+ YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
if ( yy_accept[yy_current_state] )
{
(yy_last_accepting_state) = yy_current_state;
@@ -2380,9 +2380,9 @@ case YY_STATE_EOF(id):
*/
static int yy_get_next_buffer (void)
{
- register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
- register char *source = (yytext_ptr);
- register int number_to_move, i;
+ char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
+ char *source = (yytext_ptr);
+ int number_to_move, i;
int ret_val;
if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] )
@@ -2515,14 +2515,14 @@ static int yy_get_next_buffer (void)
yy_state_type yy_get_previous_state (void)
{
- register yy_state_type yy_current_state;
- register char *yy_cp;
+ yy_state_type yy_current_state;
+ char *yy_cp;
yy_current_state = (yy_start);
for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
{
- register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
+ YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
if ( yy_accept[yy_current_state] )
{
(yy_last_accepting_state) = yy_current_state;
@@ -2547,10 +2547,10 @@ static int yy_get_next_buffer (void)
*/
static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state )
{
- register int yy_is_jam;
- register char *yy_cp = (yy_c_buf_p);
+ int yy_is_jam;
+ char *yy_cp = (yy_c_buf_p);
- register YY_CHAR yy_c = 1;
+ YY_CHAR yy_c = 1;
if ( yy_accept[yy_current_state] )
{
(yy_last_accepting_state) = yy_current_state;
@@ -3070,7 +3070,7 @@ MY_ATTRIBUTE((unused)) static int yylex_destroy (void)
#ifndef yytext_ptr
static void yy_flex_strncpy (char* s1, yyconst char * s2, int n )
{
- register int i;
+ int i;
for ( i = 0; i < n; ++i )
s1[i] = s2[i];
}
@@ -3079,7 +3079,7 @@ static void yy_flex_strncpy (char* s1, yyconst char * s2, int n )
#ifdef YY_NEED_STRLEN
static int yy_flex_strlen (yyconst char * s )
{
- register int n;
+ int n;
for ( n = 0; s[n]; ++n )
;
diff --git a/storage/xtradb/row/row0import.cc b/storage/xtradb/row/row0import.cc
index 47918e156ea..c1735f68ea2 100644
--- a/storage/xtradb/row/row0import.cc
+++ b/storage/xtradb/row/row0import.cc
@@ -4235,4 +4235,3 @@ row_import_for_mysql(
return(row_import_cleanup(prebuilt, trx, err));
}
-
diff --git a/storage/xtradb/row/row0log.cc b/storage/xtradb/row/row0log.cc
index d86dcb077e5..0fc1af64b74 100644
--- a/storage/xtradb/row/row0log.cc
+++ b/storage/xtradb/row/row0log.cc
@@ -236,7 +236,7 @@ row_log_block_allocate(
DBUG_ENTER("row_log_block_allocate");
if (log_buf.block == NULL) {
log_buf.size = srv_sort_buf_size;
- log_buf.block = (byte*) os_mem_alloc_large(&log_buf.size);
+ log_buf.block = (byte*) os_mem_alloc_large(&log_buf.size, false);
DBUG_EXECUTE_IF("simulate_row_log_allocation_failure",
if (log_buf.block)
os_mem_free_large(log_buf.block, log_buf.size);
@@ -2916,8 +2916,8 @@ row_log_allocate(
if (log_tmp_is_encrypted()) {
ulint size = srv_sort_buf_size;
- log->crypt_head = static_cast<byte *>(os_mem_alloc_large(&size));
- log->crypt_tail = static_cast<byte *>(os_mem_alloc_large(&size));
+ log->crypt_head = static_cast<byte *>(os_mem_alloc_large(&size, false));
+ log->crypt_tail = static_cast<byte *>(os_mem_alloc_large(&size, false));
if (!log->crypt_head || !log->crypt_tail) {
row_log_free(log);
diff --git a/storage/xtradb/row/row0merge.cc b/storage/xtradb/row/row0merge.cc
index 5f60f61866f..e1b0a9f0610 100644
--- a/storage/xtradb/row/row0merge.cc
+++ b/storage/xtradb/row/row0merge.cc
@@ -3343,9 +3343,17 @@ row_merge_file_create_low(
performance schema */
struct PSI_file_locker* locker = NULL;
PSI_file_locker_state state;
+ if (!path) {
+ path = mysql_tmpdir;
+ }
+ static const char label[] = "/Innodb Merge Temp File";
+ char* name = static_cast<char*>(
+ ut_malloc(strlen(path) + sizeof label));
+ strcpy(name, path);
+ strcat(name, label);
locker = PSI_FILE_CALL(get_thread_file_name_locker)(
&state, innodb_file_temp_key, PSI_FILE_OPEN,
- "Innodb Merge Temp File", &locker);
+ path ? name : label, &locker);
if (locker != NULL) {
PSI_FILE_CALL(start_file_open_wait)(locker,
__FILE__,
@@ -3358,6 +3366,7 @@ row_merge_file_create_low(
PSI_FILE_CALL(end_file_open_wait_and_bind_to_descriptor)(
locker, fd);
}
+ ut_free(name);
#endif
if (fd < 0) {
@@ -3888,7 +3897,7 @@ row_merge_build_indexes(
block_size = 3 * srv_sort_buf_size;
block = static_cast<row_merge_block_t*>(
- os_mem_alloc_large(&block_size));
+ os_mem_alloc_large(&block_size, false));
if (block == NULL) {
DBUG_RETURN(DB_OUT_OF_MEMORY);
@@ -3898,7 +3907,7 @@ row_merge_build_indexes(
encryption/decryption. */
if (log_tmp_is_encrypted()) {
crypt_block = static_cast<row_merge_block_t*>(
- os_mem_alloc_large(&block_size));
+ os_mem_alloc_large(&block_size, false));
if (crypt_block == NULL) {
DBUG_RETURN(DB_OUT_OF_MEMORY);
diff --git a/storage/xtradb/row/row0mysql.cc b/storage/xtradb/row/row0mysql.cc
index 804d55af965..88ebe24f3bb 100644
--- a/storage/xtradb/row/row0mysql.cc
+++ b/storage/xtradb/row/row0mysql.cc
@@ -4059,7 +4059,9 @@ row_drop_table_for_mysql(
dict_stats_recalc_pool_del(table);
dict_stats_defrag_pool_del(table, NULL);
- btr_defragment_remove_table(table);
+ if (btr_defragment_thread_active) {
+ btr_defragment_remove_table(table);
+ }
/* Remove stats for this table and all of its indexes from the
persistent storage if it exists and if there are stats for this
@@ -4288,95 +4290,87 @@ row_drop_table_for_mysql(
info = pars_info_create();
- pars_info_add_str_literal(info, "table_name", name);
+ pars_info_add_str_literal(info, "name", name);
- err = que_eval_sql(info,
- "PROCEDURE DROP_TABLE_PROC () IS\n"
- "sys_foreign_id CHAR;\n"
- "table_id CHAR;\n"
- "index_id CHAR;\n"
- "foreign_id CHAR;\n"
- "space_id INT;\n"
- "found INT;\n"
+ if (strcmp(name, "SYS_FOREIGN") && strcmp(name, "SYS_FOREIGN_COLS")
+ && dict_table_get_low("SYS_FOREIGN")
+ && dict_table_get_low("SYS_FOREIGN_COLS")) {
+ err = que_eval_sql(
+ info,
+ "PROCEDURE DROP_FOREIGN_PROC () IS\n"
+ "fid CHAR;\n"
- "DECLARE CURSOR cur_fk IS\n"
- "SELECT ID FROM SYS_FOREIGN\n"
- "WHERE FOR_NAME = :table_name\n"
- "AND TO_BINARY(FOR_NAME)\n"
- " = TO_BINARY(:table_name)\n"
- "LOCK IN SHARE MODE;\n"
+ "DECLARE CURSOR fk IS\n"
+ "SELECT ID FROM SYS_FOREIGN\n"
+ "WHERE FOR_NAME = :name\n"
+ "AND TO_BINARY(FOR_NAME) = TO_BINARY(:name)\n"
+ "FOR UPDATE;\n"
- "DECLARE CURSOR cur_idx IS\n"
- "SELECT ID FROM SYS_INDEXES\n"
- "WHERE TABLE_ID = table_id\n"
- "LOCK IN SHARE MODE;\n"
+ "BEGIN\n"
+ "OPEN fk;\n"
+ "WHILE 1 = 1 LOOP\n"
+ " FETCH fk INTO fid;\n"
+ " IF (SQL % NOTFOUND) THEN RETURN; END IF;\n"
+ " DELETE FROM SYS_FOREIGN_COLS WHERE ID = fid;\n"
+ " DELETE FROM SYS_FOREIGN WHERE ID = fid;\n"
+ "END LOOP;\n"
+ "CLOSE fk;\n"
+ "END;\n", FALSE, trx);
+ if (err == DB_SUCCESS) {
+ info = pars_info_create();
+ pars_info_add_str_literal(info, "name", name);
+ goto do_drop;
+ }
+ } else {
+do_drop:
+ err = que_eval_sql(
+ info,
+ "PROCEDURE DROP_TABLE_PROC () IS\n"
+ "table_id CHAR;\n"
+ "index_id CHAR;\n"
- "BEGIN\n"
- "SELECT ID INTO table_id\n"
- "FROM SYS_TABLES\n"
- "WHERE NAME = :table_name\n"
- "LOCK IN SHARE MODE;\n"
- "IF (SQL % NOTFOUND) THEN\n"
- " RETURN;\n"
- "END IF;\n"
- "SELECT SPACE INTO space_id\n"
- "FROM SYS_TABLES\n"
- "WHERE NAME = :table_name;\n"
- "IF (SQL % NOTFOUND) THEN\n"
- " RETURN;\n"
- "END IF;\n"
- "found := 1;\n"
- "SELECT ID INTO sys_foreign_id\n"
- "FROM SYS_TABLES\n"
- "WHERE NAME = 'SYS_FOREIGN'\n"
- "LOCK IN SHARE MODE;\n"
- "IF (SQL % NOTFOUND) THEN\n"
- " found := 0;\n"
- "END IF;\n"
- "IF (:table_name = 'SYS_FOREIGN') THEN\n"
- " found := 0;\n"
- "END IF;\n"
- "IF (:table_name = 'SYS_FOREIGN_COLS') THEN\n"
- " found := 0;\n"
- "END IF;\n"
- "OPEN cur_fk;\n"
- "WHILE found = 1 LOOP\n"
- " FETCH cur_fk INTO foreign_id;\n"
- " IF (SQL % NOTFOUND) THEN\n"
- " found := 0;\n"
- " ELSE\n"
- " DELETE FROM SYS_FOREIGN_COLS\n"
- " WHERE ID = foreign_id;\n"
- " DELETE FROM SYS_FOREIGN\n"
- " WHERE ID = foreign_id;\n"
- " END IF;\n"
- "END LOOP;\n"
- "CLOSE cur_fk;\n"
- "found := 1;\n"
- "OPEN cur_idx;\n"
- "WHILE found = 1 LOOP\n"
- " FETCH cur_idx INTO index_id;\n"
- " IF (SQL % NOTFOUND) THEN\n"
- " found := 0;\n"
- " ELSE\n"
- " DELETE FROM SYS_FIELDS\n"
- " WHERE INDEX_ID = index_id;\n"
- " DELETE FROM SYS_INDEXES\n"
- " WHERE ID = index_id\n"
- " AND TABLE_ID = table_id;\n"
- " END IF;\n"
- "END LOOP;\n"
- "CLOSE cur_idx;\n"
- "DELETE FROM SYS_TABLESPACES\n"
- "WHERE SPACE = space_id;\n"
- "DELETE FROM SYS_DATAFILES\n"
- "WHERE SPACE = space_id;\n"
- "DELETE FROM SYS_COLUMNS\n"
- "WHERE TABLE_ID = table_id;\n"
- "DELETE FROM SYS_TABLES\n"
- "WHERE NAME = :table_name;\n"
- "END;\n"
- , FALSE, trx);
+ "DECLARE CURSOR cur_idx IS\n"
+ "SELECT ID FROM SYS_INDEXES\n"
+ "WHERE TABLE_ID = table_id\n"
+ "FOR UPDATE;\n"
+
+ "BEGIN\n"
+ "SELECT ID INTO table_id\n"
+ "FROM SYS_TABLES WHERE NAME = :name FOR UPDATE;\n"
+ "IF (SQL % NOTFOUND) THEN RETURN; END IF;\n"
+ "OPEN cur_idx;\n"
+ "WHILE 1 = 1 LOOP\n"
+ " FETCH cur_idx INTO index_id;\n"
+ " IF (SQL % NOTFOUND) THEN EXIT; END IF;\n"
+ " DELETE FROM SYS_FIELDS\n"
+ " WHERE INDEX_ID = index_id;\n"
+ " DELETE FROM SYS_INDEXES\n"
+ " WHERE ID = index_id AND TABLE_ID = table_id;\n"
+ "END LOOP;\n"
+ "CLOSE cur_idx;\n"
+
+ "DELETE FROM SYS_COLUMNS WHERE TABLE_ID = table_id;\n"
+ "DELETE FROM SYS_TABLES WHERE NAME = :name;\n"
+
+ "END;\n", FALSE, trx);
+
+ if (err == DB_SUCCESS && table->space
+ && dict_table_get_low("SYS_TABLESPACES")
+ && dict_table_get_low("SYS_DATAFILES")) {
+ info = pars_info_create();
+ pars_info_add_int4_literal(info, "id",
+ lint(table->space));
+ err = que_eval_sql(
+ info,
+ "PROCEDURE DROP_SPACE_PROC () IS\n"
+ "BEGIN\n"
+ "DELETE FROM SYS_TABLESPACES\n"
+ "WHERE SPACE = :id;\n"
+ "DELETE FROM SYS_DATAFILES\n"
+ "WHERE SPACE = :id;\n"
+ "END;\n", FALSE, trx);
+ }
+ }
switch (err) {
ibool is_temp;
@@ -4524,7 +4518,6 @@ row_drop_table_for_mysql(
case DB_OUT_OF_FILE_SPACE:
err = DB_MUST_GET_MORE_FILE_SPACE;
-
trx->error_state = err;
row_mysql_handle_errors(&err, trx, NULL, NULL);
@@ -5135,6 +5128,18 @@ row_rename_table_for_mysql(
goto funct_exit;
}
+ /* Wait for background fts sync to finish */
+ for (retry = 1; dict_fts_index_syncing(table); ++retry) {
+ DICT_BG_YIELD(trx);
+ if (retry % 100 == 0) {
+ ib_logf(IB_LOG_LEVEL_INFO,
+ "Unable to rename table %s to new name"
+ " %s because FTS sync is running on table."
+ " Retrying\n",
+ old_name, new_name);
+ }
+ }
+
/* We use the private SQL parser of Innobase to generate the query
graphs needed in updating the dictionary data from system tables. */
@@ -5311,8 +5316,9 @@ row_rename_table_for_mysql(
}
}
- if ((dict_table_has_fts_index(table)
- || DICT_TF2_FLAG_IS_SET(table, DICT_TF2_FTS_HAS_DOC_ID))
+ if (err == DB_SUCCESS
+ && (dict_table_has_fts_index(table)
+ || DICT_TF2_FLAG_IS_SET(table, DICT_TF2_FTS_HAS_DOC_ID))
&& !dict_tables_have_same_db(old_name, new_name)) {
err = fts_rename_aux_tables(table, new_name, trx);
if (err != DB_TABLE_NOT_FOUND) {
diff --git a/storage/xtradb/srv/srv0conc.cc b/storage/xtradb/srv/srv0conc.cc
index e90f744cfa4..77749b75d99 100644
--- a/storage/xtradb/srv/srv0conc.cc
+++ b/storage/xtradb/srv/srv0conc.cc
@@ -285,6 +285,7 @@ srv_conc_enter_innodb_with_atomics(
notified_mysql = TRUE;
}
+ DEBUG_SYNC_C("user_thread_waiting");
trx->op_info = "sleeping before entering InnoDB";
sleep_in_us = srv_thread_sleep_delay;
diff --git a/storage/xtradb/srv/srv0srv.cc b/storage/xtradb/srv/srv0srv.cc
index 25f7e71a583..392ece25679 100644
--- a/storage/xtradb/srv/srv0srv.cc
+++ b/storage/xtradb/srv/srv0srv.cc
@@ -175,7 +175,6 @@ use simulated aio we build below with threads.
Currently we support native aio on windows and linux */
/* make srv_use_native_aio to be visible for other plugins */
my_bool srv_use_native_aio = TRUE;
-UNIV_INTERN my_bool srv_numa_interleave = FALSE;
/* Default compression level if page compression is used and no compression
level is set for the table*/
diff --git a/storage/xtradb/srv/srv0start.cc b/storage/xtradb/srv/srv0start.cc
index 5bef0dffa8e..6b3ffbe38eb 100644
--- a/storage/xtradb/srv/srv0start.cc
+++ b/storage/xtradb/srv/srv0start.cc
@@ -2153,7 +2153,8 @@ innobase_start_or_create_for_mysql()
ib_logf(IB_LOG_LEVEL_INFO,
"Initializing buffer pool, size = %.1f%c", size, unit);
- err = buf_pool_init(srv_buf_pool_size, srv_buf_pool_instances);
+ err = buf_pool_init(srv_buf_pool_size, static_cast<bool>(srv_numa_interleave),
+ srv_buf_pool_instances);
if (err != DB_SUCCESS) {
ib_logf(IB_LOG_LEVEL_ERROR,
diff --git a/storage/xtradb/trx/trx0purge.cc b/storage/xtradb/trx/trx0purge.cc
index 893dc8f398c..11522ea5f9c 100644
--- a/storage/xtradb/trx/trx0purge.cc
+++ b/storage/xtradb/trx/trx0purge.cc
@@ -258,7 +258,7 @@ trx_purge_add_update_undo_to_history(
fts_drop_orphaned_tables(), and roll back recovered transactions. */
ut_ad(srv_undo_sources
|| trx->undo_no == 0
- || ((srv_startup_is_before_trx_rollback_phase
+ || ((srv_is_being_started
|| trx_rollback_or_clean_is_active)
&& purge_sys->state == PURGE_STATE_INIT));