Commit c74848ba authored by Sergei Golubchik's avatar Sergei Golubchik

Merge branch 'merge-xtradb-5.6' into 10.0

parents 58413787 6b84fdb2
# Copyright (c) 2006, 2015, Oracle and/or its affiliates. All rights reserved. # Copyright (c) 2006, 2017, Oracle and/or its affiliates. All rights reserved.
# #
# This program is free software; you can redistribute it and/or modify # 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 # it under the terms of the GNU General Public License as published by
...@@ -489,7 +489,9 @@ MYSQL_ADD_PLUGIN(xtradb ${INNOBASE_SOURCES} STORAGE_ENGINE ...@@ -489,7 +489,9 @@ MYSQL_ADD_PLUGIN(xtradb ${INNOBASE_SOURCES} STORAGE_ENGINE
RECOMPILE_FOR_EMBEDDED RECOMPILE_FOR_EMBEDDED
LINK_LIBRARIES ${ZLIB_LIBRARY} ${LINKER_SCRIPT}) LINK_LIBRARIES ${ZLIB_LIBRARY} ${LINKER_SCRIPT})
IF(TARGET xtradb AND NOT XTRADB_OK) IF(TARGET xtradb)
MESSAGE(FATAL_ERROR "Percona XtraDB is not supported on this platform") IF(NOT XTRADB_OK)
MESSAGE(FATAL_ERROR "Percona XtraDB is not supported on this platform")
ENDIF()
ADD_DEPENDENCIES(xtradb GenError)
ENDIF() ENDIF()
/***************************************************************************** /*****************************************************************************
Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 1996, 2017, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2012, Facebook Inc. Copyright (c) 2012, Facebook Inc.
Copyright (c) 2014, 2017, MariaDB Corporation. Copyright (c) 2014, 2017, MariaDB Corporation.
...@@ -2059,6 +2059,30 @@ dict_table_remove_from_cache_low( ...@@ -2059,6 +2059,30 @@ dict_table_remove_from_cache_low(
foreign->referenced_index = NULL; foreign->referenced_index = NULL;
} }
/* The check for dropped index should happen before we release
all the indexes */
if (lru_evict && table->drop_aborted) {
/* When evicting the table definition,
drop the orphan indexes from the data dictionary
and free the index pages. */
trx_t* trx = trx_allocate_for_background();
ut_ad(mutex_own(&dict_sys->mutex));
#ifdef UNIV_SYNC_DEBUG
ut_ad(rw_lock_own(&dict_operation_lock, RW_LOCK_EX));
#endif /* UNIV_SYNC_DEBUG */
/* Mimic row_mysql_lock_data_dictionary(). */
trx->dict_operation_lock_mode = RW_X_LATCH;
trx_set_dict_operation(trx, TRX_DICT_OP_INDEX);
row_merge_drop_indexes_dict(trx, table->id);
trx_commit_for_mysql(trx);
trx->dict_operation_lock_mode = 0;
trx_free_for_background(trx);
}
/* Remove the indexes from the cache */ /* Remove the indexes from the cache */
for (index = UT_LIST_GET_LAST(table->indexes); for (index = UT_LIST_GET_LAST(table->indexes);
...@@ -2091,27 +2115,6 @@ dict_table_remove_from_cache_low( ...@@ -2091,27 +2115,6 @@ dict_table_remove_from_cache_low(
dict_table_autoinc_store(table); dict_table_autoinc_store(table);
} }
if (lru_evict && table->drop_aborted) {
/* When evicting the table definition,
drop the orphan indexes from the data dictionary
and free the index pages. */
trx_t* trx = trx_allocate_for_background();
ut_ad(mutex_own(&dict_sys->mutex));
#ifdef UNIV_SYNC_DEBUG
ut_ad(rw_lock_own(&dict_operation_lock, RW_LOCK_EX));
#endif /* UNIV_SYNC_DEBUG */
/* Mimic row_mysql_lock_data_dictionary(). */
trx->dict_operation_lock_mode = RW_X_LATCH;
trx_set_dict_operation(trx, TRX_DICT_OP_INDEX);
row_merge_drop_indexes_dict(trx, table->id);
trx_commit_for_mysql(trx);
trx->dict_operation_lock_mode = 0;
trx_free_for_background(trx);
}
dict_mem_table_free(table); dict_mem_table_free(table);
} }
......
/***************************************************************************** /*****************************************************************************
Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 1996, 2017, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2012, Facebook Inc. Copyright (c) 2012, Facebook Inc.
Copyright (c) 2018, MariaDB Corporation. Copyright (c) 2018, MariaDB Corporation.
...@@ -138,8 +138,6 @@ dict_mem_table_create( ...@@ -138,8 +138,6 @@ dict_mem_table_create(
table->fts = NULL; table->fts = NULL;
} }
table->is_corrupt = FALSE;
#endif /* !UNIV_HOTBACKUP */ #endif /* !UNIV_HOTBACKUP */
new(&table->foreign_set) dict_foreign_set(); new(&table->foreign_set) dict_foreign_set();
......
...@@ -4747,9 +4747,17 @@ fts_process_token( ...@@ -4747,9 +4747,17 @@ fts_process_token(
t_str.f_str = static_cast<byte*>( t_str.f_str = static_cast<byte*>(
mem_heap_alloc(heap, t_str.f_len)); mem_heap_alloc(heap, t_str.f_len));
newlen = innobase_fts_casedn_str( /* For binary collations, a case sensitive search is
doc->charset, (char*) str.f_str, str.f_len, performed. Hence don't convert to lower case. */
(char*) t_str.f_str, t_str.f_len); if (my_binary_compare(result_doc->charset)) {
memcpy(t_str.f_str, str.f_str, str.f_len);
t_str.f_str[str.f_len]= 0;
newlen= str.f_len;
} else {
newlen = innobase_fts_casedn_str(
doc->charset, (char*) str.f_str, str.f_len,
(char*) t_str.f_str, t_str.f_len);
}
t_str.f_len = newlen; t_str.f_len = newlen;
t_str.f_str[newlen] = 0; t_str.f_str[newlen] = 0;
......
...@@ -3783,10 +3783,19 @@ fts_query_str_preprocess( ...@@ -3783,10 +3783,19 @@ fts_query_str_preprocess(
str_len = query_len * charset->casedn_multiply + 1; str_len = query_len * charset->casedn_multiply + 1;
str_ptr = static_cast<byte*>(ut_malloc(str_len)); str_ptr = static_cast<byte*>(ut_malloc(str_len));
*result_len = innobase_fts_casedn_str( /* For binary collations, a case sensitive search is
charset, const_cast<char*>(reinterpret_cast<const char*>( performed. Hence don't convert to lower case. */
query_str)), query_len, if (my_binary_compare(charset)) {
reinterpret_cast<char*>(str_ptr), str_len); memcpy(str_ptr, query_str, query_len);
str_ptr[query_len]= 0;
*result_len= query_len;
} else {
*result_len = innobase_fts_casedn_str(
charset, const_cast<char*>
(reinterpret_cast<const char*>( query_str)),
query_len,
reinterpret_cast<char*>(str_ptr), str_len);
}
ut_ad(*result_len < str_len); ut_ad(*result_len < str_len);
......
...@@ -4134,6 +4134,14 @@ innobase_init( ...@@ -4134,6 +4134,14 @@ innobase_init(
/* Turn on monitor counters that are default on */ /* Turn on monitor counters that are default on */
srv_mon_default_on(); srv_mon_default_on();
#ifndef UNIV_HOTBACKUP
#ifdef _WIN32
if (ut_win_init_time()) {
goto mem_free_and_error;
}
#endif /* _WIN32 */
#endif /* !UNIV_HOTBACKUP */
DBUG_RETURN(FALSE); DBUG_RETURN(FALSE);
error: error:
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
......
...@@ -45,10 +45,10 @@ Created 1/20/1994 Heikki Tuuri ...@@ -45,10 +45,10 @@ Created 1/20/1994 Heikki Tuuri
#define INNODB_VERSION_MAJOR 5 #define INNODB_VERSION_MAJOR 5
#define INNODB_VERSION_MINOR 6 #define INNODB_VERSION_MINOR 6
#define INNODB_VERSION_BUGFIX 38 #define INNODB_VERSION_BUGFIX 39
#ifndef PERCONA_INNODB_VERSION #ifndef PERCONA_INNODB_VERSION
#define PERCONA_INNODB_VERSION 83.0 #define PERCONA_INNODB_VERSION 83.1
#endif #endif
/* Enable UNIV_LOG_ARCHIVE in XtraDB */ /* Enable UNIV_LOG_ARCHIVE in XtraDB */
......
/***************************************************************************** /*****************************************************************************
Copyright (c) 1994, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 1994, 2017, Oracle and/or its affiliates. All Rights Reserved.
This program is free software; you can redistribute it and/or modify it under 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 the terms of the GNU General Public License as published by the Free Software
...@@ -268,6 +268,15 @@ UNIV_INTERN ...@@ -268,6 +268,15 @@ UNIV_INTERN
ulint ulint
ut_time_ms(void); ut_time_ms(void);
/*============*/ /*============*/
#ifdef _WIN32
/**********************************************************//**
Initialise highest available time resolution API on Windows
@return 0 if all OK else -1 */
int
ut_win_init_time();
#endif /* _WIN32 */
#endif /* !UNIV_HOTBACKUP */ #endif /* !UNIV_HOTBACKUP */
/**********************************************************//** /**********************************************************//**
......
/***************************************************************************** /*****************************************************************************
Copyright (c) 1994, 2014, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 1994, 2017, Oracle and/or its affiliates. All Rights Reserved.
This program is free software; you can redistribute it and/or modify it under 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 the terms of the GNU General Public License as published by the Free Software
...@@ -50,6 +50,10 @@ Created 5/11/1994 Heikki Tuuri ...@@ -50,6 +50,10 @@ Created 5/11/1994 Heikki Tuuri
UNIV_INTERN ibool ut_always_false = FALSE; UNIV_INTERN ibool ut_always_false = FALSE;
#ifdef __WIN__ #ifdef __WIN__
#include <innodb_priv.h> /* For sql_print_error */
typedef VOID(WINAPI *time_fn)(LPFILETIME);
static time_fn ut_get_system_time_as_file_time = GetSystemTimeAsFileTime;
/*****************************************************************//** /*****************************************************************//**
NOTE: The Windows epoch starts from 1601/01/01 whereas the Unix NOTE: The Windows epoch starts from 1601/01/01 whereas the Unix
epoch starts from 1970/1/1. For selection of constant see: epoch starts from 1970/1/1. For selection of constant see:
...@@ -57,6 +61,28 @@ epoch starts from 1970/1/1. For selection of constant see: ...@@ -57,6 +61,28 @@ epoch starts from 1970/1/1. For selection of constant see:
#define WIN_TO_UNIX_DELTA_USEC ((ib_int64_t) 11644473600000000ULL) #define WIN_TO_UNIX_DELTA_USEC ((ib_int64_t) 11644473600000000ULL)
/**
Initialise highest available time resolution API on Windows
@return 0 if all OK else -1 */
int
ut_win_init_time()
{
HMODULE h = LoadLibrary("kernel32.dll");
if (h != NULL)
{
time_fn pfn = (time_fn)GetProcAddress(h, "GetSystemTimePreciseAsFileTime");
if (pfn != NULL)
{
ut_get_system_time_as_file_time = pfn;
}
return false;
}
DWORD error = GetLastError();
sql_print_error(
"LoadLibrary(\"kernel32.dll\") failed: GetLastError returns %lu", error);
return(-1);
}
/*****************************************************************//** /*****************************************************************//**
This is the Windows version of gettimeofday(2). This is the Windows version of gettimeofday(2).
@return 0 if all OK else -1 */ @return 0 if all OK else -1 */
...@@ -75,7 +101,7 @@ ut_gettimeofday( ...@@ -75,7 +101,7 @@ ut_gettimeofday(
return(-1); return(-1);
} }
GetSystemTimeAsFileTime(&ft); ut_get_system_time_as_file_time(&ft);
tm = (ib_int64_t) ft.dwHighDateTime << 32; tm = (ib_int64_t) ft.dwHighDateTime << 32;
tm |= ft.dwLowDateTime; tm |= ft.dwLowDateTime;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment