summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOleksandr Byelkin <sanja@mariadb.com>2019-10-30 21:33:01 +0100
committerOleksandr Byelkin <sanja@mariadb.com>2019-10-30 21:33:01 +0100
commit36f67a7dff9087236e3c8b99452702b638fd020e (patch)
tree70835feb15dd56efaab13257ecf721f77c9295a5
parentcd1c10859d77d967aec8590fa9de4d17ed480dbf (diff)
parentc8ba98206f1b08bf02c6a6f993b8e1b6842cb665 (diff)
downloadmariadb-git-36f67a7dff9087236e3c8b99452702b638fd020e.tar.gz
Merge branch '10.1' into 10.2
-rw-r--r--dbug/dbug.c3
-rw-r--r--debian/additions/my.cnf2
-rw-r--r--mysql-test/suite/innodb/r/innodb-autoinc.result24
-rw-r--r--mysql-test/suite/innodb/t/innodb-autoinc.test2
-rw-r--r--mysql-test/suite/sys_vars/r/sysvars_innodb,32bit,xtradb.rdiff-disabled2
-rw-r--r--mysql-test/suite/sys_vars/r/sysvars_innodb,xtradb.rdiff-disabled2
-rw-r--r--sql/sql_show.cc3
-rw-r--r--storage/connect/CMakeLists.txt4
-rw-r--r--storage/connect/inihandl.cpp2
-rw-r--r--storage/heap/ha_heap.cc4
-rw-r--r--storage/heap/hp_close.c6
-rw-r--r--storage/innobase/.clang-format11
-rw-r--r--storage/innobase/handler/ha_innodb.cc57
-rw-r--r--storage/tokudb/CMakeLists.txt1
-rw-r--r--storage/tokudb/PerconaFT/cmake_modules/TokuMergeLibs.cmake2
-rw-r--r--storage/tokudb/PerconaFT/cmake_modules/TokuThirdParty.cmake34
-rw-r--r--storage/tokudb/PerconaFT/scripts/run-nightly-coverage-tests.bash2
-rw-r--r--storage/tokudb/PerconaFT/scripts/run-nightly-drd-tests.bash2
-rw-r--r--storage/tokudb/PerconaFT/scripts/run-nightly-release-tests.bash2
-rw-r--r--storage/tokudb/ha_tokudb.cc3
-rw-r--r--storage/tokudb/ha_tokudb.h3
-rw-r--r--storage/tokudb/hatoku_cmp.cc8
-rw-r--r--storage/tokudb/tests/math_test_int.cc162
-rw-r--r--storage/tokudb/tests/math_test_uint.cc84
-rw-r--r--storage/tokudb/tests/sint_test.cc1
-rw-r--r--storage/tokudb/tests/tokudb_buffer_test.cc11
-rw-r--r--storage/tokudb/tests/uint_test.cc1
-rw-r--r--storage/tokudb/tests/vlq_test.cc9
-rw-r--r--storage/tokudb/tests/vlq_test_uint32.cc15
-rw-r--r--storage/tokudb/tests/vlq_test_uint64.cc15
-rw-r--r--storage/tokudb/tokudb_buffer.h4
-rw-r--r--storage/tokudb/tokudb_math.h6
-rw-r--r--storage/xtradb/buf/buf0buf.cc3
-rw-r--r--storage/xtradb/handler/ha_innodb.cc70
-rw-r--r--storage/xtradb/include/btr0sea.ic4
-rw-r--r--storage/xtradb/include/ha_prototypes.h2
-rw-r--r--storage/xtradb/include/sync0rw.ic3
-rw-r--r--storage/xtradb/include/univ.i4
-rw-r--r--storage/xtradb/lock/lock0wait.cc1
-rw-r--r--storage/xtradb/log/log0online.cc7
-rw-r--r--storage/xtradb/ut/ut0ut.cc1
-rw-r--r--support-files/rpm/server-postin.sh3
42 files changed, 356 insertions, 229 deletions
diff --git a/dbug/dbug.c b/dbug/dbug.c
index 90bb8a16409..9845fee0948 100644
--- a/dbug/dbug.c
+++ b/dbug/dbug.c
@@ -226,11 +226,8 @@ typedef struct _db_code_state_ {
const char *file; /* Name of current user file */
struct _db_stack_frame_ *framep; /* Pointer to current frame */
struct settings *stack; /* debugging settings */
- const char *jmpfunc; /* Remember current function for setjmp */
- const char *jmpfile; /* Remember current file for setjmp */
int lineno; /* Current debugger output line number */
uint level; /* Current function nesting level */
- int jmplevel; /* Remember nesting level at setjmp() */
/*
* The following variables are used to hold the state information
diff --git a/debian/additions/my.cnf b/debian/additions/my.cnf
index d30ec182c8b..22103ec09c9 100644
--- a/debian/additions/my.cnf
+++ b/debian/additions/my.cnf
@@ -131,8 +131,6 @@ max_binlog_size = 100M
# InnoDB is enabled by default with a 10MB datafile in /var/lib/mysql/.
# Read the manual for more InnoDB related options. There are many!
default_storage_engine = InnoDB
-# you can't just change log file size, requires special procedure
-#innodb_log_file_size = 50M
innodb_buffer_pool_size = 256M
innodb_log_buffer_size = 8M
innodb_file_per_table = 1
diff --git a/mysql-test/suite/innodb/r/innodb-autoinc.result b/mysql-test/suite/innodb/r/innodb-autoinc.result
index 9451e4a84aa..87d7d1c60d3 100644
--- a/mysql-test/suite/innodb/r/innodb-autoinc.result
+++ b/mysql-test/suite/innodb/r/innodb-autoinc.result
@@ -567,7 +567,7 @@ Variable_name Value
auto_increment_increment 65535
auto_increment_offset 65535
INSERT INTO t1 VALUES (NULL),(NULL);
-ERROR HY000: Failed to read auto-increment value from storage engine
+ERROR 22003: Out of range value for column 'c1' at row 1
SELECT * FROM t1;
c1
1
@@ -677,7 +677,7 @@ SELECT a,b FROM t;
a b
1 S1
3 S2
-4 S2
+5 S2
disconnect con1;
connection default;
# Client 1: Insert a record with auto_increment_increment=1
@@ -688,14 +688,14 @@ t CREATE TABLE `t` (
`a` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`b` varchar(200) DEFAULT NULL,
PRIMARY KEY (`a`)
-) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1
+) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=latin1
INSERT INTO t(b) VALUES('S1');
SELECT a,b FROM t;
a b
1 S1
3 S2
-4 S2
-5 S1
+5 S2
+6 S1
DROP TABLE t;
# Autoincrement behaviour with mixed insert.
CREATE TABLE t(
@@ -733,22 +733,22 @@ t CREATE TABLE `t` (
`a` tinyint(4) NOT NULL AUTO_INCREMENT,
`b` varchar(200) DEFAULT NULL,
PRIMARY KEY (`a`)
-) ENGINE=InnoDB AUTO_INCREMENT=23 DEFAULT CHARSET=latin1
+) ENGINE=InnoDB AUTO_INCREMENT=32 DEFAULT CHARSET=latin1
INSERT INTO t(b) VALUES('S4');
SELECT * FROM t;
a b
1 S0
11 S1
-22 S3
-23 S4
28 S2
+31 S3
+32 S4
SHOW CREATE TABLE t;
Table Create Table
t CREATE TABLE `t` (
`a` tinyint(4) NOT NULL AUTO_INCREMENT,
`b` varchar(200) DEFAULT NULL,
PRIMARY KEY (`a`)
-) ENGINE=InnoDB AUTO_INCREMENT=24 DEFAULT CHARSET=latin1
+) ENGINE=InnoDB AUTO_INCREMENT=33 DEFAULT CHARSET=latin1
DROP TABLE t;
SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=5;
DROP TABLE IF EXISTS t1;
@@ -789,7 +789,7 @@ t2 CREATE TABLE `t2` (
`n` int(10) unsigned NOT NULL,
`o` enum('FALSE','TRUE') DEFAULT NULL,
PRIMARY KEY (`m`)
-) ENGINE=InnoDB AUTO_INCREMENT=14 DEFAULT CHARSET=latin1
+) ENGINE=InnoDB AUTO_INCREMENT=19 DEFAULT CHARSET=latin1
INSERT INTO t1 (b,c) SELECT n,o FROM t2 ;
SHOW CREATE TABLE t1;
Table Create Table
@@ -1472,13 +1472,13 @@ SELECT * FROM t;
i
1
301
-351
+601
SHOW CREATE TABLE t;
Table Create Table
t CREATE TABLE `t` (
`i` int(11) NOT NULL AUTO_INCREMENT,
KEY `i` (`i`)
-) ENGINE=InnoDB AUTO_INCREMENT=401 DEFAULT CHARSET=latin1
+) ENGINE=InnoDB AUTO_INCREMENT=651 DEFAULT CHARSET=latin1
DROP TABLE t;
SET auto_increment_increment = DEFAULT;
#
diff --git a/mysql-test/suite/innodb/t/innodb-autoinc.test b/mysql-test/suite/innodb/t/innodb-autoinc.test
index 74a52caba12..ca7727d4cef 100644
--- a/mysql-test/suite/innodb/t/innodb-autoinc.test
+++ b/mysql-test/suite/innodb/t/innodb-autoinc.test
@@ -349,7 +349,7 @@ INSERT INTO t1 VALUES (18446744073709551610); #-- 2^64 - 2
SELECT * FROM t1;
SET @@SESSION.AUTO_INCREMENT_INCREMENT=1152921504606846976, @@SESSION.AUTO_INCREMENT_OFFSET=1152921504606846976;
SHOW VARIABLES LIKE "auto_inc%";
---error 1467
+--error HA_ERR_AUTOINC_ERANGE
INSERT INTO t1 VALUES (NULL),(NULL);
SELECT * FROM t1;
DROP TABLE t1;
diff --git a/mysql-test/suite/sys_vars/r/sysvars_innodb,32bit,xtradb.rdiff-disabled b/mysql-test/suite/sys_vars/r/sysvars_innodb,32bit,xtradb.rdiff-disabled
index 8b8c69d05bf..ff3f5ba1d2c 100644
--- a/mysql-test/suite/sys_vars/r/sysvars_innodb,32bit,xtradb.rdiff-disabled
+++ b/mysql-test/suite/sys_vars/r/sysvars_innodb,32bit,xtradb.rdiff-disabled
@@ -1215,7 +1215,7 @@
VARIABLE_NAME INNODB_VERSION
SESSION_VALUE NULL
-GLOBAL_VALUE 5.6.45
-+GLOBAL_VALUE 5.6.44-86.0
++GLOBAL_VALUE 5.6.45-86.1
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE NULL
VARIABLE_SCOPE GLOBAL
diff --git a/mysql-test/suite/sys_vars/r/sysvars_innodb,xtradb.rdiff-disabled b/mysql-test/suite/sys_vars/r/sysvars_innodb,xtradb.rdiff-disabled
index d5a5a0147f5..77e8fb638a1 100644
--- a/mysql-test/suite/sys_vars/r/sysvars_innodb,xtradb.rdiff-disabled
+++ b/mysql-test/suite/sys_vars/r/sysvars_innodb,xtradb.rdiff-disabled
@@ -685,7 +685,7 @@
VARIABLE_NAME INNODB_VERSION
SESSION_VALUE NULL
-GLOBAL_VALUE 5.6.45
-+GLOBAL_VALUE 5.6.44-86.0
++GLOBAL_VALUE 5.6.45-86.1
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE NULL
VARIABLE_SCOPE GLOBAL
diff --git a/sql/sql_show.cc b/sql/sql_show.cc
index 8fc0784b77f..f54a9af5441 100644
--- a/sql/sql_show.cc
+++ b/sql/sql_show.cc
@@ -7861,8 +7861,7 @@ TABLE *create_schema_table(THD *thd, TABLE_LIST *table_list)
item->maybe_null= (fields_info->field_flags & MY_I_S_MAYBE_NULL);
field_count++;
}
- TMP_TABLE_PARAM *tmp_table_param =
- (TMP_TABLE_PARAM*) (thd->alloc(sizeof(TMP_TABLE_PARAM)));
+ TMP_TABLE_PARAM *tmp_table_param = new (thd->mem_root) TMP_TABLE_PARAM;
tmp_table_param->init();
tmp_table_param->table_charset= cs;
tmp_table_param->field_count= field_count;
diff --git a/storage/connect/CMakeLists.txt b/storage/connect/CMakeLists.txt
index a1234179311..1d02419fb4f 100644
--- a/storage/connect/CMakeLists.txt
+++ b/storage/connect/CMakeLists.txt
@@ -73,6 +73,10 @@ ELSE(NOT UNIX)
tabwmi.cpp tabwmi.h tabmac.cpp tabmac.h macutil.cpp macutil.h)
# Add exception handling to the CONNECT project)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /EHsc")
+ SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /MD")
+ SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /MDd")
+ SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} /MD")
+ SET(CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL} /MD")
SET(IPHLPAPI_LIBRARY iphlpapi.lib)
IF(MSVC AND (CMAKE_CXX_COMPILER_ID MATCHES Clang))
# Connect does not work with clang-cl
diff --git a/storage/connect/inihandl.cpp b/storage/connect/inihandl.cpp
index dacab3c485c..8e79aeac7ef 100644
--- a/storage/connect/inihandl.cpp
+++ b/storage/connect/inihandl.cpp
@@ -194,7 +194,7 @@ static void PROFILE_Save( FILE *file, PROFILESECTION *section )
}
for (key = section->key; key; key = key->next)
- if (key->name[0]) {
+ if (key->name && key->name[0]) {
fprintf(file, "%s", SVP(key->name));
if (key->value)
diff --git a/storage/heap/ha_heap.cc b/storage/heap/ha_heap.cc
index f57e505134f..51e47ea2271 100644
--- a/storage/heap/ha_heap.cc
+++ b/storage/heap/ha_heap.cc
@@ -431,6 +431,10 @@ int ha_heap::reset_auto_increment(ulonglong value)
int ha_heap::external_lock(THD *thd, int lock_type)
{
+#ifndef DBUG_OFF
+ if (lock_type == F_UNLCK && file->s->changed && heap_check_heap(file, 0))
+ return HA_ERR_CRASHED;
+#endif
return 0; // No external locking
}
diff --git a/storage/heap/hp_close.c b/storage/heap/hp_close.c
index 092048a7c1c..82d6186340a 100644
--- a/storage/heap/hp_close.c
+++ b/storage/heap/hp_close.c
@@ -35,12 +35,6 @@ int hp_close(register HP_INFO *info)
{
int error=0;
DBUG_ENTER("hp_close");
-#ifndef DBUG_OFF
- if (info->s->changed && heap_check_heap(info,0))
- {
- error=my_errno=HA_ERR_CRASHED;
- }
-#endif
info->s->changed=0;
if (info->open_list.data)
heap_open_list=list_delete(heap_open_list,&info->open_list);
diff --git a/storage/innobase/.clang-format b/storage/innobase/.clang-format
new file mode 100644
index 00000000000..54f7b47bc88
--- /dev/null
+++ b/storage/innobase/.clang-format
@@ -0,0 +1,11 @@
+UseTab: Always
+TabWidth: 8
+IndentWidth: 8
+ContinuationIndentWidth: 8
+BreakBeforeBinaryOperators: All
+PointerAlignment: Left
+BreakBeforeBraces: Custom
+ColumnLimit: 79
+BraceWrapping:
+ AfterFunction: true
+AccessModifierOffset: -8
diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc
index 3ad12c455bf..296bab00f90 100644
--- a/storage/innobase/handler/ha_innodb.cc
+++ b/storage/innobase/handler/ha_innodb.cc
@@ -2667,11 +2667,10 @@ innobase_next_autoinc(
if (next_value == 0) {
ulonglong next;
- if (current >= offset) {
+ if (current > offset) {
next = (current - offset) / step;
} else {
- next = 0;
- block -= step;
+ next = (offset - current) / step;
}
ut_a(max_value > next);
@@ -16834,6 +16833,37 @@ ha_innobase::get_auto_increment(
ut_ad(autoinc > 0);
}
+ /** The following logic is needed to avoid duplicate key error
+ for autoincrement column.
+
+ (1) InnoDB gives the current autoincrement value with respect
+ to increment and offset value.
+
+ (2) Basically it does compute_next_insert_id() logic inside InnoDB
+ to avoid the current auto increment value changed by handler layer.
+
+ (3) It is restricted only for insert operations. */
+
+ if (increment > 1 && thd_sql_command(m_user_thd) != SQLCOM_ALTER_TABLE
+ && autoinc < col_max_value) {
+
+ ulonglong prev_auto_inc = autoinc;
+
+ autoinc = ((autoinc - 1) + increment - offset)/ increment;
+
+ autoinc = autoinc * increment + offset;
+
+ /* If autoinc exceeds the col_max_value then reset
+ to old autoinc value. Because in case of non-strict
+ sql mode, boundary value is not considered as error. */
+
+ if (autoinc >= col_max_value) {
+ autoinc = prev_auto_inc;
+ }
+
+ ut_ad(autoinc > 0);
+ }
+
/* Called for the first time ? */
if (trx->n_autoinc_rows == 0) {
@@ -16871,27 +16901,6 @@ ha_innobase::get_auto_increment(
current = *first_value;
- if (m_prebuilt->autoinc_increment != increment) {
-
- WSREP_DEBUG("autoinc decrease: %llu -> %llu\n"
- "THD: %ld, current: %llu, autoinc: %llu",
- m_prebuilt->autoinc_increment,
- increment,
- thd_get_thread_id(m_user_thd),
- current, autoinc);
- if (!wsrep_on(m_user_thd)) {
- current = autoinc
- - m_prebuilt->autoinc_increment;
- current = innobase_next_autoinc(
- current, 1, increment, offset, col_max_value);
- }
-
- dict_table_autoinc_initialize(
- m_prebuilt->table, current);
-
- *first_value = current;
- }
-
/* Compute the last value in the interval */
next_value = innobase_next_autoinc(
current, *nb_reserved_values, increment, offset,
diff --git a/storage/tokudb/CMakeLists.txt b/storage/tokudb/CMakeLists.txt
index 3b4e4fb967e..f22f7c1d6b5 100644
--- a/storage/tokudb/CMakeLists.txt
+++ b/storage/tokudb/CMakeLists.txt
@@ -90,6 +90,7 @@ CONFIGURE_FILE(tokudb.cnf.in tokudb.cnf @ONLY)
MY_CHECK_AND_SET_COMPILER_FLAG("-Wno-shadow")
MY_CHECK_AND_SET_COMPILER_FLAG("-Wno-vla" DEBUG)
MY_CHECK_AND_SET_COMPILER_FLAG("-Wno-implicit-fallthrough")
+MY_CHECK_AND_SET_COMPILER_FLAG("-Wno-cpp" DEBUG)
############################################
MARK_AS_ADVANCED(BUILDNAME)
diff --git a/storage/tokudb/PerconaFT/cmake_modules/TokuMergeLibs.cmake b/storage/tokudb/PerconaFT/cmake_modules/TokuMergeLibs.cmake
index e1da095fc00..f2462afdb45 100644
--- a/storage/tokudb/PerconaFT/cmake_modules/TokuMergeLibs.cmake
+++ b/storage/tokudb/PerconaFT/cmake_modules/TokuMergeLibs.cmake
@@ -6,7 +6,7 @@ FUNCTION(TOKU_GET_DEPENDEND_OS_LIBS target result)
IF(deps)
FOREACH(lib ${deps})
# Filter out keywords for used for debug vs optimized builds
- IF(NOT lib MATCHES "general" AND NOT lib MATCHES "debug" AND NOT lib MATCHES "optimized")
+ IF(TARGET ${lib})
GET_TARGET_PROPERTY(lib_location ${lib} LOCATION)
IF(NOT lib_location)
SET(ret ${ret} ${lib})
diff --git a/storage/tokudb/PerconaFT/cmake_modules/TokuThirdParty.cmake b/storage/tokudb/PerconaFT/cmake_modules/TokuThirdParty.cmake
index 9769b7db13d..b312111a3a2 100644
--- a/storage/tokudb/PerconaFT/cmake_modules/TokuThirdParty.cmake
+++ b/storage/tokudb/PerconaFT/cmake_modules/TokuThirdParty.cmake
@@ -1,39 +1,5 @@
include(ExternalProject)
-if (CMAKE_PROJECT_NAME STREQUAL TokuDB)
- ## add jemalloc with an external project
- set(JEMALLOC_SOURCE_DIR "${TokuDB_SOURCE_DIR}/third_party/jemalloc" CACHE FILEPATH "Where to find jemalloc sources.")
- if (EXISTS "${JEMALLOC_SOURCE_DIR}/configure")
- set(jemalloc_configure_opts "CC=${CMAKE_C_COMPILER}" "--with-jemalloc-prefix=" "--with-private-namespace=tokudb_jemalloc_internal_" "--enable-cc-silence")
- option(JEMALLOC_DEBUG "Build jemalloc with --enable-debug." OFF)
- if (JEMALLOC_DEBUG)
- list(APPEND jemalloc_configure_opts --enable-debug)
- endif ()
- ExternalProject_Add(build_jemalloc
- PREFIX jemalloc
- SOURCE_DIR "${JEMALLOC_SOURCE_DIR}"
- CONFIGURE_COMMAND
- "${JEMALLOC_SOURCE_DIR}/configure" ${jemalloc_configure_opts}
- "--prefix=${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/jemalloc"
- )
-
- add_library(jemalloc STATIC IMPORTED GLOBAL)
- set_target_properties(jemalloc PROPERTIES IMPORTED_LOCATION
- "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/jemalloc/lib/libjemalloc_pic.a")
- add_dependencies(jemalloc build_jemalloc)
- add_library(jemalloc_nopic STATIC IMPORTED GLOBAL)
- set_target_properties(jemalloc_nopic PROPERTIES IMPORTED_LOCATION
- "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/jemalloc/lib/libjemalloc.a")
- add_dependencies(jemalloc_nopic build_jemalloc)
-
- # detect when we are being built as a subproject
- if (NOT DEFINED MYSQL_PROJECT_NAME_DOCSTRING)
- install(DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/jemalloc/lib" DESTINATION .
- COMPONENT tokukv_libs_extra)
- endif ()
- endif ()
-endif ()
-
## add lzma with an external project
set(xz_configure_opts --with-pic --enable-static)
if (APPLE)
diff --git a/storage/tokudb/PerconaFT/scripts/run-nightly-coverage-tests.bash b/storage/tokudb/PerconaFT/scripts/run-nightly-coverage-tests.bash
index cd5743cddf2..3daa87ce03c 100644
--- a/storage/tokudb/PerconaFT/scripts/run-nightly-coverage-tests.bash
+++ b/storage/tokudb/PerconaFT/scripts/run-nightly-coverage-tests.bash
@@ -26,7 +26,7 @@ if [ ! -d build ] ; then
-D RUN_LONG_TESTS=ON \
-D TOKUDB_DATA=$tokudbdir/../tokudb.data \
..
- ninja build_jemalloc build_lzma build_snappy
+ ninja build_lzma build_snappy
popd
fi
diff --git a/storage/tokudb/PerconaFT/scripts/run-nightly-drd-tests.bash b/storage/tokudb/PerconaFT/scripts/run-nightly-drd-tests.bash
index 3c688581385..1ef819d8e37 100644
--- a/storage/tokudb/PerconaFT/scripts/run-nightly-drd-tests.bash
+++ b/storage/tokudb/PerconaFT/scripts/run-nightly-drd-tests.bash
@@ -25,7 +25,7 @@ if [ ! -d build ] ; then
-D RUN_LONG_TESTS=ON \
-D TOKUDB_DATA=$tokudbdir/../tokudb.data \
..
- ninja build_jemalloc build_lzma build_snappy
+ ninja build_lzma build_snappy
popd
fi
diff --git a/storage/tokudb/PerconaFT/scripts/run-nightly-release-tests.bash b/storage/tokudb/PerconaFT/scripts/run-nightly-release-tests.bash
index 80938bad8a6..c1039a0b28f 100644
--- a/storage/tokudb/PerconaFT/scripts/run-nightly-release-tests.bash
+++ b/storage/tokudb/PerconaFT/scripts/run-nightly-release-tests.bash
@@ -25,7 +25,7 @@ if [ ! -d build ] ; then
-D RUN_LONG_TESTS=ON \
-D TOKUDB_DATA=$tokudbdir/../tokudb.data \
..
- ninja build_jemalloc build_lzma build_snappy
+ ninja build_lzma build_snappy
popd
fi
diff --git a/storage/tokudb/ha_tokudb.cc b/storage/tokudb/ha_tokudb.cc
index 5ddc739c5ad..ff81fbfe4a7 100644
--- a/storage/tokudb/ha_tokudb.cc
+++ b/storage/tokudb/ha_tokudb.cc
@@ -1077,7 +1077,8 @@ static inline int tokudb_generate_row(DB* dest_db,
}
buff = (uchar *)dest_key->data;
- assert_always(buff != NULL && max_key_len > 0);
+ assert_always(buff != nullptr);
+ assert_always(max_key_len > 0);
} else {
assert_unreachable();
}
diff --git a/storage/tokudb/ha_tokudb.h b/storage/tokudb/ha_tokudb.h
index 8012c051720..fbc463d0e83 100644
--- a/storage/tokudb/ha_tokudb.h
+++ b/storage/tokudb/ha_tokudb.h
@@ -387,7 +387,8 @@ inline void TOKUDB_SHARE::init_cardinality_counts(
assert_debug(_mutex.is_owned_by_me());
// can not change number of keys live
- assert_always(_rec_per_key == NULL && _rec_per_keys == 0);
+ assert_always(_rec_per_key == nullptr);
+ assert_always(_rec_per_keys == 0);
_rec_per_keys = rec_per_keys;
_rec_per_key = rec_per_key;
}
diff --git a/storage/tokudb/hatoku_cmp.cc b/storage/tokudb/hatoku_cmp.cc
index 3d3eb2ad90f..06eecf6381d 100644
--- a/storage/tokudb/hatoku_cmp.cc
+++ b/storage/tokudb/hatoku_cmp.cc
@@ -953,9 +953,8 @@ static inline int tokudb_compare_two_hidden_keys(
const void* saved_key_data,
const uint32_t saved_key_size
) {
- assert_always(
- (new_key_size >= TOKUDB_HIDDEN_PRIMARY_KEY_LENGTH) &&
- (saved_key_size >= TOKUDB_HIDDEN_PRIMARY_KEY_LENGTH));
+ assert_always(new_key_size >= TOKUDB_HIDDEN_PRIMARY_KEY_LENGTH);
+ assert_always(saved_key_size >= TOKUDB_HIDDEN_PRIMARY_KEY_LENGTH);
ulonglong a = hpk_char_to_num((uchar *) new_key_data);
ulonglong b = hpk_char_to_num((uchar *) saved_key_data);
return a < b ? -1 : (a > b ? 1 : 0);
@@ -2533,7 +2532,8 @@ static uint32_t create_toku_secondary_key_pack_descriptor (
bool is_col_in_pk = false;
if (bitmap_is_set(&kc_info->key_filters[pk_index],field_index)) {
- assert_always(!has_hpk && prim_key != NULL);
+ assert_always(!has_hpk);
+ assert_always(prim_key != nullptr);
is_col_in_pk = true;
}
else {
diff --git a/storage/tokudb/tests/math_test_int.cc b/storage/tokudb/tests/math_test_int.cc
index 10085dbd704..3313bdf5895 100644
--- a/storage/tokudb/tests/math_test_int.cc
+++ b/storage/tokudb/tests/math_test_int.cc
@@ -54,16 +54,20 @@ static void test_int8() {
assert(over);
else if (m < -max)
assert(over);
- else
- assert(!over && n == m);
+ else {
+ assert(!over);
+ assert(n == m);
+ }
n = int_sub(x, y, 8, &over);
m = x - y;
if (m > max-1)
assert(over);
else if (m < -max)
assert(over);
- else
- assert(!over && n == m);
+ else {
+ assert(!over);
+ asset(n == m);
+ }
}
}
}
@@ -82,16 +86,20 @@ static void test_int16() {
assert(over);
else if (m < -max)
assert(over);
- else
- assert(!over && n == m);
+ else {
+ assert(!over);
+ assert(n == m);
+ }
n = int_sub(x, y, 16, &over);
m = x - y;
if (m > max-1)
assert(over);
else if (m < -max)
assert(over);
- else
- assert(!over && n == m);
+ else {
+ assert(!over);
+ assert(n == m);
+ }
}
}
}
@@ -104,20 +112,42 @@ static void test_int24() {
s = int_add(1, (1ULL<<23)-1, 24, &over); assert(over);
s = int_add((1ULL<<23)-1, 1, 24, &over); assert(over);
- s = int_sub(-1, (1ULL<<23), 24, &over); assert(!over && s == (1ULL<<23)-1);
+ s = int_sub(-1, (1ULL<<23), 24, &over);
+ assert(!over);
+ assert(s == (1ULL<<23)-1);
s = int_sub((1ULL<<23), 1, 24, &over); assert(over);
- s = int_add(0, 0, 24, &over); assert(!over && s == 0);
- s = int_sub(0, 0, 24, &over); assert(!over && s == 0);
- s = int_add(0, -1, 24, &over); assert(!over && s == -1);
- s = int_sub(0, 1, 24, &over); assert(!over && s == -1);
- s = int_add(0, (1ULL<<23), 24, &over); assert(!over && (s & ((1ULL<<24)-1)) == (1ULL<<23));
- s = int_sub(0, (1ULL<<23)-1, 24, &over); assert(!over && (s & ((1ULL<<24)-1)) == (1ULL<<23)+1);
-
- s = int_add(-1, 0, 24, &over); assert(!over && s == -1);
- s = int_add(-1, 1, 24, &over); assert(!over && s == 0);
- s = int_sub(-1, -1, 24, &over); assert(!over && s == 0);
- s = int_sub(-1, (1ULL<<23)-1, 24, &over); assert(!over && (s & ((1ULL<<24)-1)) == (1ULL<<23));
+ s = int_add(0, 0, 24, &over);
+ assert(!over);
+ assert(s == 0);
+ s = int_sub(0, 0, 24, &over);
+ assert(!over);
+ assert(s == 0);
+ s = int_add(0, -1, 24, &over);
+ assert(!over);
+ assert(s == -1);
+ s = int_sub(0, 1, 24, &over);
+ assert(!over);
+ assert(s == -1);
+ s = int_add(0, (1ULL<<23), 24, &over);
+ assert(!over);
+ assert((s & ((1ULL<<24)-1)) == (1ULL<<23));
+ s = int_sub(0, (1ULL<<23)-1, 24, &over);
+ assert(!over);
+ assert((s & ((1ULL<<24)-1)) == (1ULL<<23)+1);
+
+ s = int_add(-1, 0, 24, &over);
+ assert(!over);
+ assert(s == -1);
+ s = int_add(-1, 1, 24, &over);
+ assert(!over);
+ assert(s == 0);
+ s = int_sub(-1, -1, 24, &over);
+ assert(!over);
+ assert(s == 0);
+ s = int_sub(-1, (1ULL<<23)-1, 24, &over);
+ assert(!over);
+ assert((s & ((1ULL<<24)-1)) == (1ULL<<23));
}
static void test_int32() {
@@ -128,20 +158,42 @@ static void test_int32() {
s = int_add(1, (1ULL<<31)-1, 32, &over); assert(over);
s = int_add((1ULL<<31)-1, 1, 32, &over); assert(over);
- s = int_sub(-1, (1ULL<<31), 32, &over); assert(s == (1ULL<<31)-1 && !over);
+ s = int_sub(-1, (1ULL<<31), 32, &over);
+ assert(s == (1ULL<<31)-1);
+ assert(!over);
s = int_sub((1ULL<<31), 1, 32, &over); assert(over);
- s = int_add(0, 0, 32, &over); assert(s == 0 && !over);
- s = int_sub(0, 0, 32, &over); assert(s == 0 && !over);
- s = int_add(0, -1, 32, &over); assert(s == -1 && !over);
- s = int_sub(0, 1, 32, &over); assert(s == -1 && !over);
- s = int_add(0, (1ULL<<31), 32, &over); assert((s & ((1ULL<<32)-1)) == (1ULL<<31) && !over);
- s = int_sub(0, (1ULL<<31)-1, 32, &over); assert((s & ((1ULL<<32)-1)) == (1ULL<<31)+1 && !over);
-
- s = int_add(-1, 0, 32, &over); assert(s == -1 && !over);
- s = int_add(-1, 1, 32, &over); assert(s == 0 && !over);
- s = int_sub(-1, -1, 32, &over); assert(s == 0 && !over);
- s = int_sub(-1, (1ULL<<31)-1, 32, &over); assert((s & ((1ULL<<32)-1)) == (1ULL<<31) && !over);
+ s = int_add(0, 0, 32, &over);
+ assert(s == 0);
+ assert(!over);
+ s = int_sub(0, 0, 32, &over);
+ assert(s == 0);
+ assert(!over);
+ s = int_add(0, -1, 32, &over);
+ assert(s == -1);
+ assert(!over);
+ s = int_sub(0, 1, 32, &over);
+ assert(s == -1);
+ assert(!over);
+ s = int_add(0, (1ULL<<31), 32, &over);
+ assert((s & ((1ULL<<32)-1)) == (1ULL<<31));
+ assert(!over);
+ s = int_sub(0, (1ULL<<31)-1, 32, &over);
+ assert((s & ((1ULL<<32)-1)) == (1ULL<<31)+1);
+ assert(!over);
+
+ s = int_add(-1, 0, 32, &over);
+ assert(s == -1);
+ assert(!over);
+ s = int_add(-1, 1, 32, &over);
+ assert(s == 0);
+ assert(!over);
+ s = int_sub(-1, -1, 32, &over);
+ assert(s == 0);
+ assert(!over);
+ s = int_sub(-1, (1ULL<<31)-1, 32, &over);
+ assert((s & ((1ULL<<32)-1)) == (1ULL<<31));
+ assert(!over);
}
static void test_int64() {
@@ -152,20 +204,42 @@ static void test_int64() {
s = int_add(1, (1ULL<<63)-1, 64, &over); assert(over);
s = int_add((1ULL<<63)-1, 1, 64, &over); assert(over);
- s = int_sub(-1, (1ULL<<63), 64, &over); assert(s == (1ULL<<63)-1 && !over);
+ s = int_sub(-1, (1ULL<<63), 64, &over);
+ assert(s == (1ULL<<63)-1);
+ assert(!over);
s = int_sub((1ULL<<63), 1, 64, &over); assert(over);
- s = int_add(0, 0, 64, &over); assert(s == 0 && !over);
- s = int_sub(0, 0, 64, &over); assert(s == 0 && !over);
- s = int_add(0, -1, 64, &over); assert(s == -1 && !over);
- s = int_sub(0, 1, 64, &over); assert(s == -1 && !over);
- s = int_add(0, (1ULL<<63), 64, &over); assert(s == (int64_t)(1ULL<<63) && !over);
- s = int_sub(0, (1ULL<<63)-1, 64, &over); assert(s == (int64_t)((1ULL<<63)+1) && !over);
-
- s = int_add(-1, 0, 64, &over); assert(s == -1 && !over);
- s = int_add(-1, 1, 64, &over); assert(s == 0 && !over);
- s = int_sub(-1, -1, 64, &over); assert(s == 0 && !over);
- s = int_sub(-1, (1ULL<<63)-1, 64, &over); assert(s == (int64_t)(1ULL<<63) && !over);
+ s = int_add(0, 0, 64, &over);
+ assert(s == 0);
+ assert(!over);
+ s = int_sub(0, 0, 64, &over);
+ assert(s == 0);
+ assert(!over);
+ s = int_add(0, -1, 64, &over);
+ assert(s == -1);
+ assert(!over);
+ s = int_sub(0, 1, 64, &over);
+ assert(s == -1);
+ assert(!over);
+ s = int_add(0, (1ULL<<63), 64, &over);
+ assert(s == (int64_t)(1ULL<<63));
+ assert(!over);
+ s = int_sub(0, (1ULL<<63)-1, 64, &over);
+ assert(s == (int64_t)((1ULL<<63)+1));
+ assert(!over);
+
+ s = int_add(-1, 0, 64, &over);
+ assert(s == -1);
+ assert(!over);
+ s = int_add(-1, 1, 64, &over);
+ assert(s == 0);
+ assert(!over);
+ s = int_sub(-1, -1, 64, &over);
+ assert(s == 0);
+ assert(!over);
+ s = int_sub(-1, (1ULL<<63)-1, 64, &over);
+ assert(s == (int64_t)(1ULL<<63));
+ assert(!over);
}
static void test_int_sign(uint length_bits) {
diff --git a/storage/tokudb/tests/math_test_uint.cc b/storage/tokudb/tests/math_test_uint.cc
index 2fc8de8e093..2c5c9261c89 100644
--- a/storage/tokudb/tests/math_test_uint.cc
+++ b/storage/tokudb/tests/math_test_uint.cc
@@ -51,14 +51,18 @@ static void test_uint8() {
m = x + y;
if (m > (1ULL<<8)-1)
assert(over);
- else
- assert(!over && n == (m % 256));
+ else {
+ assert(!over);
+ assert(n == (m % 256));
+ }
n = uint_sub(x, y, 8, &over);
m = x - y;
if (m > x)
assert(over);
- else
- assert(!over && n == (m % 256));
+ else {
+ assert(!over);
+ assert(n == (m % 256));
+ }
}
}
}
@@ -75,14 +79,18 @@ static void test_uint16() {
m = x + y;
if (m > (1ULL<<16)-1)
assert(over);
- else
- assert(!over && n == (m % (1ULL<<16)));
+ else {
+ assert(!over);
+ assert(n == (m % (1ULL<<16)));
+ }
n = uint_sub(x, y, 16, &over);
m = x - y;
if (m > x)
assert(over);
- else
- assert(!over && n == (m % (1ULL<<16)));
+ else {
+ assert(!over);
+ assert(n == (m % (1ULL<<16)));
+ }
}
}
}
@@ -95,13 +103,23 @@ static void test_uint24() {
s = uint_add((1ULL<<24)-1, (1ULL<<24)-1, 24, &over); assert(over);
s = uint_add((1ULL<<24)-1, 1, 24, &over); assert(over);
- s = uint_add((1ULL<<24)-1, 0, 24, &over); assert(!over && s == (1ULL<<24)-1);
- s = uint_add(0, 1, 24, &over); assert(!over && s == 1);
- s = uint_add(0, 0, 24, &over); assert(!over && s == 0);
- s = uint_sub(0, 0, 24, &over); assert(!over && s == 0);
+ s = uint_add((1ULL<<24)-1, 0, 24, &over);
+ assert(!over);
+ assert(s == (1ULL<<24)-1);
+ s = uint_add(0, 1, 24, &over);
+ assert(!over);
+ assert(s == 1);
+ s = uint_add(0, 0, 24, &over);
+ assert(!over);
+ assert(s == 0);
+ s = uint_sub(0, 0, 24, &over);
+ assert(!over);
+ assert(s == 0);
s = uint_sub(0, 1, 24, &over); assert(over);
s = uint_sub(0, (1ULL<<24)-1, 24, &over); assert(over);
- s = uint_sub((1ULL<<24)-1, (1ULL<<24)-1, 24, &over); assert(!over && s == 0);
+ s = uint_sub((1ULL<<24)-1, (1ULL<<24)-1, 24, &over);
+ assert(!over);
+ assert(s == 0);
}
static void test_uint32() {
@@ -112,13 +130,23 @@ static void test_uint32() {
s = uint_add((1ULL<<32)-1, (1ULL<<32)-1, 32, &over); assert(over);
s = uint_add((1ULL<<32)-1, 1, 32, &over); assert(over);
- s = uint_add((1ULL<<32)-1, 0, 32, &over); assert(!over && s == (1ULL<<32)-1);
- s = uint_add(0, 1, 32, &over); assert(!over && s == 1);
- s = uint_add(0, 0, 32, &over); assert(!over && s == 0);
- s = uint_sub(0, 0, 32, &over); assert(!over && s == 0);
+ s = uint_add((1ULL<<32)-1, 0, 32, &over);
+ assert(!over);
+ assert(s == (1ULL<<32)-1);
+ s = uint_add(0, 1, 32, &over);
+ assert(!over);
+ assert(s == 1);
+ s = uint_add(0, 0, 32, &over);
+ assert(!over);
+ assert(s == 0);
+ s = uint_sub(0, 0, 32, &over);
+ assert(!over);
+ assert(s == 0);
s = uint_sub(0, 1, 32, &over); assert(over);
s = uint_sub(0, (1ULL<<32)-1, 32, &over); assert(over);
- s = uint_sub((1ULL<<32)-1, (1ULL<<32)-1, 32, &over); assert(!over && s == 0);
+ s = uint_sub((1ULL<<32)-1, (1ULL<<32)-1, 32, &over);
+ assert(!over);
+ assert(s == 0);
}
static void test_uint64() {
@@ -129,13 +157,23 @@ static void test_uint64() {
s = uint_add(~0ULL, ~0ULL, 64, &over); assert(over);
s = uint_add(~0ULL, 1, 64, &over); assert(over);
- s = uint_add(~0ULL, 0, 64, &over); assert(!over && s == ~0ULL);
- s = uint_add(0, 1, 64, &over); assert(!over && s == 1);
- s = uint_add(0, 0, 64, &over); assert(!over && s == 0);
- s = uint_sub(0, 0, 64, &over); assert(!over && s == 0);
+ s = uint_add(~0ULL, 0, 64, &over);
+ assert(!over);
+ assert(s == ~0ULL);
+ s = uint_add(0, 1, 64, &over);
+ assert(!over);
+ assert(s == 1);
+ s = uint_add(0, 0, 64, &over);
+ assert(!over);
+ assert(s == 0);
+ s = uint_sub(0, 0, 64, &over);
+ assert(!over);
+ assert(s == 0);
s = uint_sub(0, 1, 64, &over); assert(over);
s = uint_sub(0, ~0ULL, 64, &over); assert(over);
- s = uint_sub(~0ULL, ~0ULL, 64, &over); assert(!over && s == 0);
+ s = uint_sub(~0ULL, ~0ULL, 64, &over);
+ assert(!over);
+ assert(s == 0);
}
int main() {
diff --git a/storage/tokudb/tests/sint_test.cc b/storage/tokudb/tests/sint_test.cc
index 9078ae87281..7823ee5a692 100644
--- a/storage/tokudb/tests/sint_test.cc
+++ b/storage/tokudb/tests/sint_test.cc
@@ -27,7 +27,6 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved.
#include <stdint.h>
#include <inttypes.h>
#include <stdlib.h>
-#include <assert.h>
#include <sys/types.h>
#include <tokudb_math.h>
diff --git a/storage/tokudb/tests/tokudb_buffer_test.cc b/storage/tokudb/tests/tokudb_buffer_test.cc
index a786cdf4592..7e296790d39 100644
--- a/storage/tokudb/tests/tokudb_buffer_test.cc
+++ b/storage/tokudb/tests/tokudb_buffer_test.cc
@@ -32,9 +32,13 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved.
static void test_null() {
tokudb::buffer b;
- assert(b.data() == NULL && b.size() == 0 && b.limit() == 0);
+ assert(b.data() == nullptr);
+ assert(b.size() == 0);
+ assert(b.limit() == 0);
b.append(NULL, 0);
- assert(b.data() == NULL && b.size() == 0 && b.limit() == 0);
+ assert(b.data() == nullptr);
+ assert(b.size() == 0);
+ assert(b.limit() == 0);
}
static void append_az(tokudb::buffer &b) {
@@ -132,7 +136,8 @@ static void test_replace_grow() {
}
for (size_t i = 0; i < a.size()/2; i++) {
unsigned char *cp = (unsigned char *) a.data() + 2*i;
- assert(cp[0] == 'a'+i && cp[1] == 'a'+i);
+ assert(cp[0] == 'a'+i);
+ assert(cp[1] == 'a'+i);
}
}
diff --git a/storage/tokudb/tests/uint_test.cc b/storage/tokudb/tests/uint_test.cc
index b2c653b8fdd..e3aa1a6fe2f 100644
--- a/storage/tokudb/tests/uint_test.cc
+++ b/storage/tokudb/tests/uint_test.cc
@@ -27,7 +27,6 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved.
#include <stdint.h>
#include <inttypes.h>
#include <stdlib.h>
-#include <assert.h>
#include <sys/types.h>
#include <tokudb_math.h>
diff --git a/storage/tokudb/tests/vlq_test.cc b/storage/tokudb/tests/vlq_test.cc
index 80d797339b4..12b222f06c1 100644
--- a/storage/tokudb/tests/vlq_test.cc
+++ b/storage/tokudb/tests/vlq_test.cc
@@ -52,7 +52,8 @@ static void test_vlq_uint32_error(void) {
in_s = tokudb::vlq_decode_ui<uint32_t>(&n, b, 1);
assert(in_s == 0);
in_s = tokudb::vlq_decode_ui<uint32_t>(&n, b, 2);
- assert(in_s == 2 && n == 128);
+ assert(in_s == 2);
+ assert(n == 128);
}
static void test_80000000(void) {
@@ -63,7 +64,8 @@ static void test_80000000(void) {
out_s = tokudb::vlq_encode_ui<uint64_t>(v, b, sizeof b);
assert(out_s == 5);
in_s = tokudb::vlq_decode_ui<uint64_t>(&n, b, out_s);
- assert(in_s == 5 && n == v);
+ assert(in_s == 5);
+ assert(n == v);
}
static void test_100000000(void) {
@@ -74,7 +76,8 @@ static void test_100000000(void) {
out_s = tokudb::vlq_encode_ui<uint64_t>(v, b, sizeof b);
assert(out_s == 5);
in_s = tokudb::vlq_decode_ui<uint64_t>(&n, b, out_s);
- assert(in_s == 5 && n == v);
+ assert(in_s == 5);
+ assert(n == v);
}
int main(void) {
diff --git a/storage/tokudb/tests/vlq_test_uint32.cc b/storage/tokudb/tests/vlq_test_uint32.cc
index c5661b33ab5..3cc8af771a9 100644
--- a/storage/tokudb/tests/vlq_test_uint32.cc
+++ b/storage/tokudb/tests/vlq_test_uint32.cc
@@ -44,7 +44,8 @@ static void test_vlq_uint32(void) {
assert(out_s == 1);
uint32_t n;
size_t in_s = tokudb::vlq_decode_ui<uint32_t>(&n, b, out_s);
- assert(in_s == 1 && n == v);
+ assert(in_s == 1);
+ assert(n == v);
}
printf("%u\n", 1<<7);
@@ -54,7 +55,8 @@ static void test_vlq_uint32(void) {
assert(out_s == 2);
uint32_t n;
size_t in_s = tokudb::vlq_decode_ui<uint32_t>(&n, b, out_s);
- assert(in_s == 2 && n == v);
+ assert(in_s == 2);
+ assert(n == v);
}
printf("%u\n", 1<<14);
@@ -64,7 +66,8 @@ static void test_vlq_uint32(void) {
assert(out_s == 3);
uint32_t n;
size_t in_s = tokudb::vlq_decode_ui<uint32_t>(&n, b, out_s);
- assert(in_s == 3 && n == v);
+ assert(in_s == 3);
+ assert(n == v);
}
printf("%u\n", 1<<21);
@@ -74,7 +77,8 @@ static void test_vlq_uint32(void) {
assert(out_s == 4);
uint32_t n;
size_t in_s = tokudb::vlq_decode_ui<uint32_t>(&n, b, out_s);
- assert(in_s == 4 && n == v);
+ assert(in_s == 4);
+ assert(n == v);
}
printf("%u\n", 1<<28);
@@ -84,7 +88,8 @@ static void test_vlq_uint32(void) {
assert(out_s == 5);
uint32_t n;
size_t in_s = tokudb::vlq_decode_ui<uint32_t>(&n, b, out_s);
- assert(in_s == 5 && n == v);
+ assert(in_s == 5);
+ assert(n == v);
}
}
diff --git a/storage/tokudb/tests/vlq_test_uint64.cc b/storage/tokudb/tests/vlq_test_uint64.cc
index a626db69487..697c597756c 100644
--- a/storage/tokudb/tests/vlq_test_uint64.cc
+++ b/storage/tokudb/tests/vlq_test_uint64.cc
@@ -46,7 +46,8 @@ static void test_vlq_uint64(uint64_t start, uint64_t stride) {
assert(out_s == 1);
uint64_t n;
size_t in_s = tokudb::vlq_decode_ui<uint64_t>(&n, b, out_s);
- assert(in_s == 1 && n == v);
+ assert(in_s == 1);
+ assert(n == v);
}
printf("%u\n", 1<<7);
@@ -56,7 +57,8 @@ static void test_vlq_uint64(uint64_t start, uint64_t stride) {
assert(out_s == 2);
uint64_t n;
size_t in_s = tokudb::vlq_decode_ui<uint64_t>(&n, b, out_s);
- assert(in_s == 2 && n == v);
+ assert(in_s == 2);
+ assert(n == v);
}
printf("%u\n", 1<<14);
@@ -66,7 +68,8 @@ static void test_vlq_uint64(uint64_t start, uint64_t stride) {
assert(out_s == 3);
uint64_t n;
size_t in_s = tokudb::vlq_decode_ui<uint64_t>(&n, b, out_s);
- assert(in_s == 3 && n == v);
+ assert(in_s == 3);
+ assert(n == v);
}
printf("%u\n", 1<<21);
@@ -76,7 +79,8 @@ static void test_vlq_uint64(uint64_t start, uint64_t stride) {
assert(out_s == 4);
uint64_t n;
size_t in_s = tokudb::vlq_decode_ui<uint64_t>(&n, b, out_s);
- assert(in_s == 4 && n == v);
+ assert(in_s == 4);
+ assert(n == v);
}
printf("%u\n", 1<<28);
@@ -90,7 +94,8 @@ static void test_vlq_uint64(uint64_t start, uint64_t stride) {
assert(out_s == 5);
uint64_t n;
size_t in_s = tokudb::vlq_decode_ui<uint64_t>(&n, b, out_s);
- assert(in_s == 5 && n == v);
+ assert(in_s == 5);
+ assert(n == v);
}
}
diff --git a/storage/tokudb/tokudb_buffer.h b/storage/tokudb/tokudb_buffer.h
index 022f1b49643..1605543c378 100644
--- a/storage/tokudb/tokudb_buffer.h
+++ b/storage/tokudb/tokudb_buffer.h
@@ -134,8 +134,8 @@ public:
char* data_offset = (char*)m_data + offset;
if (new_s != old_s) {
size_t n = m_size - (offset + old_s);
- assert_always(
- offset + new_s + n <= m_limit && offset + old_s + n <= m_limit);
+ assert_always(offset + new_s + n <= m_limit);
+ assert_always(offset + old_s + n <= m_limit);
memmove(data_offset + new_s, data_offset + old_s, n);
if (new_s > old_s)
m_size += new_s - old_s;
diff --git a/storage/tokudb/tokudb_math.h b/storage/tokudb/tokudb_math.h
index 0338bf3871e..99cebd5b1d1 100644
--- a/storage/tokudb/tokudb_math.h
+++ b/storage/tokudb/tokudb_math.h
@@ -59,7 +59,8 @@ TOKUDB_UNUSED(static uint64_t uint_add(
bool* over));
static uint64_t uint_add(uint64_t x, uint64_t y, uint length_bits, bool *over) {
uint64_t mask = uint_mask(length_bits);
- assert_always((x & ~mask) == 0 && (y & ~mask) == 0);
+ assert_always((x & ~mask) == 0);
+ assert_always((y & ~mask) == 0);
uint64_t s = (x + y) & mask;
*over = s < x; // check for overflow
return s;
@@ -75,7 +76,8 @@ TOKUDB_UNUSED(static uint64_t uint_sub(
bool* over));
static uint64_t uint_sub(uint64_t x, uint64_t y, uint length_bits, bool *over) {
uint64_t mask = uint_mask(length_bits);
- assert_always((x & ~mask) == 0 && (y & ~mask) == 0);
+ assert_always((x & ~mask) == 0);
+ assert_always((y & ~mask) == 0);
uint64_t s = (x - y) & mask;
*over = s > x; // check for overflow
return s;
diff --git a/storage/xtradb/buf/buf0buf.cc b/storage/xtradb/buf/buf0buf.cc
index 9255f741b0f..93ad1b12b00 100644
--- a/storage/xtradb/buf/buf0buf.cc
+++ b/storage/xtradb/buf/buf0buf.cc
@@ -124,7 +124,8 @@ _increment_page_get_statistics(buf_block_t* block, trx_t* trx)
byte block_hash_offset;
ut_ad(block);
- ut_ad(trx && trx->take_stats);
+ ut_ad(trx);
+ ut_ad(trx->take_stats);
if (!trx->distinct_page_access_hash) {
trx->distinct_page_access_hash
diff --git a/storage/xtradb/handler/ha_innodb.cc b/storage/xtradb/handler/ha_innodb.cc
index 1faf47b46ec..6714cae71b8 100644
--- a/storage/xtradb/handler/ha_innodb.cc
+++ b/storage/xtradb/handler/ha_innodb.cc
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 2000, 2018, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 2000, 2019, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2013, 2018, MariaDB Corporation.
Copyright (c) 2008, 2009 Google Inc.
Copyright (c) 2009, Percona Inc.
@@ -2141,12 +2141,13 @@ UNIV_INTERN
ulong
thd_flush_log_at_trx_commit(
/*================================*/
- void* thd)
+ THD* thd)
{
/* THDVAR cannot be used in xtrabackup,
plugin variables for innodb are not loaded,
this makes xtrabackup crash when trying to use them. */
- return (thd || !IS_XTRABACKUP())? THDVAR((THD*)thd, flush_log_at_trx_commit) : FALSE;
+ return (thd || !IS_XTRABACKUP())
+ ? THDVAR(thd, flush_log_at_trx_commit) : 0;
}
/********************************************************************//**
@@ -2871,11 +2872,10 @@ innobase_next_autoinc(
if (next_value == 0) {
ulonglong next;
- if (current >= offset) {
+ if (current > offset) {
next = (current - offset) / step;
} else {
- next = 0;
- block -= step;
+ next = (offset - current) / step;
}
ut_a(max_value > next);
@@ -16600,6 +16600,37 @@ ha_innobase::get_auto_increment(
ut_ad(autoinc > 0);
}
+ /** The following logic is needed to avoid duplicate key error
+ for autoincrement column.
+
+ (1) InnoDB gives the current autoincrement value with respect
+ to increment and offset value.
+
+ (2) Basically it does compute_next_insert_id() logic inside InnoDB
+ to avoid the current auto increment value changed by handler layer.
+
+ (3) It is restricted only for insert operations. */
+
+ if (increment > 1 && thd_sql_command(user_thd) != SQLCOM_ALTER_TABLE
+ && autoinc < col_max_value) {
+
+ ulonglong prev_auto_inc = autoinc;
+
+ autoinc = ((autoinc - 1) + increment - offset)/ increment;
+
+ autoinc = autoinc * increment + offset;
+
+ /* If autoinc exceeds the col_max_value then reset
+ to old autoinc value. Because in case of non-strict
+ sql mode, boundary value is not considered as error. */
+
+ if (autoinc >= col_max_value) {
+ autoinc = prev_auto_inc;
+ }
+
+ ut_ad(autoinc > 0);
+ }
+
/* Called for the first time ? */
if (trx->n_autoinc_rows == 0) {
@@ -16637,27 +16668,6 @@ ha_innobase::get_auto_increment(
current = *first_value;
- if (prebuilt->autoinc_increment != increment) {
-
- WSREP_DEBUG("autoinc decrease: %llu -> %llu\n"
- "THD: %ld, current: %llu, autoinc: %llu",
- prebuilt->autoinc_increment,
- increment,
- thd_get_thread_id(ha_thd()),
- current, autoinc);
- if (!wsrep_on(ha_thd()))
- {
- current = autoinc - prebuilt->autoinc_increment;
- }
-
- current = innobase_next_autoinc(
- current, 1, increment, offset, col_max_value);
-
- dict_table_autoinc_initialize(prebuilt->table, current);
-
- *first_value = current;
- }
-
/* Compute the last value in the interval */
next_value = innobase_next_autoinc(
current, *nb_reserved_values, increment, offset,
@@ -18921,7 +18931,7 @@ innodb_sched_priority_master_update(
push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
ER_WRONG_ARGUMENTS,
"Failed to set the master thread "
- "priority to %lu, "
+ "priority to %lu, "
"the nice is %lu and the current priority is %lu", priority,
nice, actual_priority);
}
@@ -21052,14 +21062,14 @@ static MYSQL_SYSVAR_BOOL(force_primary_key,
"Do not allow to create table without primary key (off by default)",
NULL, NULL, FALSE);
-const char *corrupt_table_action_names[]=
+static const char *corrupt_table_action_names[]=
{
"assert", /* 0 */
"warn", /* 1 */
"salvage", /* 2 */
NullS
};
-TYPELIB corrupt_table_action_typelib=
+static TYPELIB corrupt_table_action_typelib=
{
array_elements(corrupt_table_action_names) - 1, "corrupt_table_action_typelib",
corrupt_table_action_names, NULL
diff --git a/storage/xtradb/include/btr0sea.ic b/storage/xtradb/include/btr0sea.ic
index 4838799e906..f7cff91f9d0 100644
--- a/storage/xtradb/include/btr0sea.ic
+++ b/storage/xtradb/include/btr0sea.ic
@@ -104,8 +104,8 @@ btr_search_get_latch(
/*=================*/
const dict_index_t* index) /*!< in: index */
{
- ut_ad(index->search_latch >= btr_search_latch_arr &&
- index->search_latch < btr_search_latch_arr +
+ ut_ad(index->search_latch >= btr_search_latch_arr);
+ ut_ad(index->search_latch < btr_search_latch_arr +
btr_search_index_num);
return(index->search_latch);
diff --git a/storage/xtradb/include/ha_prototypes.h b/storage/xtradb/include/ha_prototypes.h
index 7fd31da528f..2488918436f 100644
--- a/storage/xtradb/include/ha_prototypes.h
+++ b/storage/xtradb/include/ha_prototypes.h
@@ -419,7 +419,7 @@ innobase_get_table_cache_size(void);
ulong
thd_flush_log_at_trx_commit(
/*================================*/
- void* thd);
+ THD* thd);
/**********************************************************************//**
Get the current setting of the lower_case_table_names global parameter from
diff --git a/storage/xtradb/include/sync0rw.ic b/storage/xtradb/include/sync0rw.ic
index 075858bd3ce..125c4d90b24 100644
--- a/storage/xtradb/include/sync0rw.ic
+++ b/storage/xtradb/include/sync0rw.ic
@@ -453,7 +453,8 @@ rw_lock_higher_prio_waiters_exist(
return(false);
}
- ut_ad(priority_lock && !high_priority);
+ ut_ad(priority_lock);
+ ut_ad(!high_priority);
prio_rw_lock_t *prio_rw_lock = (prio_rw_lock_t *) lock;
return prio_rw_lock->high_priority_wait_ex_waiter > 0
diff --git a/storage/xtradb/include/univ.i b/storage/xtradb/include/univ.i
index 69d5cbac5d1..011921d9a39 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 44
+#define INNODB_VERSION_BUGFIX 45
#ifndef PERCONA_INNODB_VERSION
-#define PERCONA_INNODB_VERSION 86.0
+#define PERCONA_INNODB_VERSION 86.1
#endif
/* Enable UNIV_LOG_ARCHIVE in XtraDB */
diff --git a/storage/xtradb/lock/lock0wait.cc b/storage/xtradb/lock/lock0wait.cc
index 3efc28967db..fe43ef3cc73 100644
--- a/storage/xtradb/lock/lock0wait.cc
+++ b/storage/xtradb/lock/lock0wait.cc
@@ -207,6 +207,7 @@ functions to get some info from THD.
@param[in] trx requested trx
@param[in] blocking blocking info array
@param[in] blocking_count blocking info array size */
+static
void
print_lock_wait_timeout(
const trx_t &trx,
diff --git a/storage/xtradb/log/log0online.cc b/storage/xtradb/log/log0online.cc
index 460fb19cf8a..601babc54a9 100644
--- a/storage/xtradb/log/log0online.cc
+++ b/storage/xtradb/log/log0online.cc
@@ -91,7 +91,7 @@ static const char* bmp_file_name_stem = "ib_modified_log_";
/** File name template for bitmap files. The 1st format tag is a directory
name, the 2nd tag is the stem, the 3rd tag is a file sequence number, the 4th
tag is the start LSN for the file. */
-static const char* bmp_file_name_template = "%s%s%lu_%llu.xdb";
+static const char* bmp_file_name_template = "%s%s%lu_" LSN_PF ".xdb";
/* On server startup with empty database srv_start_lsn == 0, in
which case the first LSN of actual log records will be this. */
@@ -586,9 +586,8 @@ log_online_is_bitmap_file(
return ((file_info->type == OS_FILE_TYPE_FILE
|| file_info->type == OS_FILE_TYPE_LINK)
- && (sscanf(file_info->name, "%[a-z_]%lu_%llu.xdb", stem,
- bitmap_file_seq_num,
- (unsigned long long *)bitmap_file_start_lsn) == 3)
+ && (sscanf(file_info->name, "%[a-z_]%lu_" LSN_PF ".xdb", stem,
+ bitmap_file_seq_num, bitmap_file_start_lsn) == 3)
&& (!strcmp(stem, bmp_file_name_stem)));
}
diff --git a/storage/xtradb/ut/ut0ut.cc b/storage/xtradb/ut/ut0ut.cc
index a9f24fcf18a..aa228a33bdc 100644
--- a/storage/xtradb/ut/ut0ut.cc
+++ b/storage/xtradb/ut/ut0ut.cc
@@ -40,7 +40,6 @@ Created 5/11/1994 Heikki Tuuri
#include <ctype.h>
#ifndef UNIV_HOTBACKUP
-# include "btr0types.h"
# include "trx0trx.h"
# include "ha_prototypes.h"
# include "mysql_com.h" /* NAME_LEN */
diff --git a/support-files/rpm/server-postin.sh b/support-files/rpm/server-postin.sh
index deb27c98ac1..71518423687 100644
--- a/support-files/rpm/server-postin.sh
+++ b/support-files/rpm/server-postin.sh
@@ -16,7 +16,8 @@ fi
# Make MySQL start/shutdown automatically when the machine does it.
if [ $1 = 1 ] ; then
if [ -x /usr/bin/systemctl ] ; then
- /usr/bin/systemctl daemon-reload >/dev/null 2>&1
+ /usr/bin/systemctl daemon-reload >/dev/null 2>&1 || :
+ /usr/bin/systemctl preset mariadb.service >/dev/null 2>&1 || :
elif [ -x /sbin/chkconfig ] ; then
/sbin/chkconfig --add mysql
fi