summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2017-08-28 15:05:46 +0300
committerMarko Mäkelä <marko.makela@mariadb.com>2017-08-28 15:05:46 +0300
commit11352d52cd35f89b1d573405fca92932e112cba9 (patch)
tree77e2880d62fca5c7aa93d4a6bcfa299606e7f831
parent61096ff214dec68a66efb811aa3a70ef49f06a11 (diff)
parent582545a38421ea0e43f326db84550773411c3261 (diff)
downloadmariadb-git-11352d52cd35f89b1d573405fca92932e112cba9.tar.gz
Merge 10.0 into 10.1
-rw-r--r--cmake/os/Windows.cmake4
-rw-r--r--mysql-test/r/alter_table.result52
-rw-r--r--mysql-test/suite/innodb/r/xa_recovery.result2
-rw-r--r--mysql-test/suite/innodb/t/xa_recovery.test5
-rw-r--r--mysql-test/t/alter_table.test42
-rw-r--r--mysys/my_init.c1
-rw-r--r--sql/sql_table.cc45
-rw-r--r--storage/connect/CMakeLists.txt35
-rw-r--r--storage/innobase/fsp/fsp0fsp.cc19
-rw-r--r--storage/innobase/ibuf/ibuf0ibuf.cc19
-rw-r--r--storage/innobase/row/row0ins.cc6
-rw-r--r--storage/innobase/row/row0uins.cc5
-rw-r--r--storage/innobase/row/row0umod.cc12
-rw-r--r--storage/innobase/trx/trx0trx.cc35
-rw-r--r--storage/xtradb/fsp/fsp0fsp.cc19
-rw-r--r--storage/xtradb/ibuf/ibuf0ibuf.cc19
-rw-r--r--storage/xtradb/row/row0ins.cc6
-rw-r--r--storage/xtradb/row/row0uins.cc5
-rw-r--r--storage/xtradb/row/row0umod.cc12
-rw-r--r--storage/xtradb/trx/trx0trx.cc45
-rw-r--r--win/packaging/create_msi.cmake.in14
21 files changed, 244 insertions, 158 deletions
diff --git a/cmake/os/Windows.cmake b/cmake/os/Windows.cmake
index 67108132d8a..5b45c144b67 100644
--- a/cmake/os/Windows.cmake
+++ b/cmake/os/Windows.cmake
@@ -114,8 +114,8 @@ IF(MSVC)
ENDIF()
#TODO: update the code and remove the disabled warnings
- SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /wd4800 /wd4805 /wd4996")
- SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4800 /wd4805 /wd4996 /wd4291 /wd4577 /we4099")
+ SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /wd4800 /wd4805 /wd4996 /we4700")
+ SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4800 /wd4805 /wd4996 /wd4291 /wd4577 /we4099 /we4700")
IF(CMAKE_SIZEOF_VOID_P MATCHES 8)
# _WIN64 is defined by the compiler itself.
diff --git a/mysql-test/r/alter_table.result b/mysql-test/r/alter_table.result
index 35d9e97a380..d7e902259df 100644
--- a/mysql-test/r/alter_table.result
+++ b/mysql-test/r/alter_table.result
@@ -2122,6 +2122,58 @@ t1 CREATE TABLE `t1` (
) ENGINE=InnoDB DEFAULT CHARSET=utf8
DROP TABLE t1;
#
+# MDEV-8960 Can't refer the same column twice in one ALTER TABLE
+#
+CREATE TABLE t1 (
+`a` int(11) DEFAULT NULL
+) DEFAULT CHARSET=utf8;
+ALTER TABLE t1 ADD COLUMN `consultant_id` integer NOT NULL,
+ALTER COLUMN `consultant_id` DROP DEFAULT;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `consultant_id` int(11) NOT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=utf8
+DROP TABLE t1;
+CREATE TABLE t1 (
+`a` int(11) DEFAULT NULL
+) DEFAULT CHARSET=utf8;
+ALTER TABLE t1 ADD COLUMN `consultant_id` integer NOT NULL,
+ALTER COLUMN `consultant_id` SET DEFAULT 2;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `consultant_id` int(11) NOT NULL DEFAULT '2'
+) ENGINE=MyISAM DEFAULT CHARSET=utf8
+DROP TABLE t1;
+CREATE TABLE t1 (
+`a` int(11) DEFAULT NULL
+) DEFAULT CHARSET=utf8;
+ALTER TABLE t1 ADD COLUMN `consultant_id` integer NOT NULL DEFAULT 2,
+ALTER COLUMN `consultant_id` DROP DEFAULT;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `consultant_id` int(11) NOT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=utf8
+DROP TABLE t1;
+CREATE TABLE t1 (
+`a` int(11) DEFAULT NULL
+) DEFAULT CHARSET=utf8;
+ALTER TABLE t1 ADD COLUMN `consultant_id` integer NOT NULL DEFAULT 2,
+ALTER COLUMN `consultant_id` DROP DEFAULT,
+MODIFY COLUMN `consultant_id` BIGINT;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL,
+ `consultant_id` bigint(20) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=utf8
+DROP TABLE t1;
+#
# Start of 10.1 tests
#
#
diff --git a/mysql-test/suite/innodb/r/xa_recovery.result b/mysql-test/suite/innodb/r/xa_recovery.result
index 4441701f961..3b560b79657 100644
--- a/mysql-test/suite/innodb/r/xa_recovery.result
+++ b/mysql-test/suite/innodb/r/xa_recovery.result
@@ -4,7 +4,7 @@ XA START 'x';
UPDATE t1 set a=2;
XA END 'x';
XA PREPARE 'x';
-# Kill and restart
+# Kill and restart: --innodb-force-recovery=2
SELECT * FROM t1 LOCK IN SHARE MODE;
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
SELECT * FROM t1;
diff --git a/mysql-test/suite/innodb/t/xa_recovery.test b/mysql-test/suite/innodb/t/xa_recovery.test
index f5c2b655545..d4f957c7bf4 100644
--- a/mysql-test/suite/innodb/t/xa_recovery.test
+++ b/mysql-test/suite/innodb/t/xa_recovery.test
@@ -15,7 +15,12 @@ connect (con1,localhost,root);
XA START 'x'; UPDATE t1 set a=2; XA END 'x'; XA PREPARE 'x';
connection default;
+# innodb_force_recovery=2 prevents the purge and tests that the fix of
+# MDEV-13606 XA PREPARE transactions should survive innodb_force_recovery=1 or 2
+# is present.
+--let $restart_parameters= --innodb-force-recovery=2
--source include/kill_and_restart_mysqld.inc
+--let $restart_parameters=
disconnect con1;
connect (con1,localhost,root);
diff --git a/mysql-test/t/alter_table.test b/mysql-test/t/alter_table.test
index 32116cdaf55..eef6f17efec 100644
--- a/mysql-test/t/alter_table.test
+++ b/mysql-test/t/alter_table.test
@@ -1768,6 +1768,48 @@ SHOW CREATE TABLE t1;
DROP TABLE t1;
--echo #
+--echo # MDEV-8960 Can't refer the same column twice in one ALTER TABLE
+--echo #
+
+CREATE TABLE t1 (
+ `a` int(11) DEFAULT NULL
+) DEFAULT CHARSET=utf8;
+
+ALTER TABLE t1 ADD COLUMN `consultant_id` integer NOT NULL,
+ALTER COLUMN `consultant_id` DROP DEFAULT;
+
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (
+ `a` int(11) DEFAULT NULL
+) DEFAULT CHARSET=utf8;
+
+ALTER TABLE t1 ADD COLUMN `consultant_id` integer NOT NULL,
+ALTER COLUMN `consultant_id` SET DEFAULT 2;
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (
+ `a` int(11) DEFAULT NULL
+) DEFAULT CHARSET=utf8;
+
+ALTER TABLE t1 ADD COLUMN `consultant_id` integer NOT NULL DEFAULT 2,
+ALTER COLUMN `consultant_id` DROP DEFAULT;
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (
+ `a` int(11) DEFAULT NULL
+) DEFAULT CHARSET=utf8;
+
+ALTER TABLE t1 ADD COLUMN `consultant_id` integer NOT NULL DEFAULT 2,
+ALTER COLUMN `consultant_id` DROP DEFAULT,
+MODIFY COLUMN `consultant_id` BIGINT;
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+
+--echo #
--echo # Start of 10.1 tests
--echo #
diff --git a/mysys/my_init.c b/mysys/my_init.c
index 7f0f7a8cc44..84489a994e3 100644
--- a/mysys/my_init.c
+++ b/mysys/my_init.c
@@ -200,7 +200,6 @@ Voluntary context switches %ld, Involuntary context switches %ld\n",
_CrtSetReportMode( _CRT_ASSERT, _CRTDBG_MODE_FILE );
_CrtSetReportFile( _CRT_ASSERT, _CRTDBG_FILE_STDERR );
_CrtCheckMemory();
- _CrtDumpMemoryLeaks();
#endif
}
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index 29c382f57d6..a3a7fa2cb44 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -7544,9 +7544,25 @@ mysql_prepare_alter_table(THD *thd, TABLE *table,
{
if (def->change && ! def->field)
{
- my_error(ER_BAD_FIELD_ERROR, MYF(0), def->change,
- table->s->table_name.str);
- goto err;
+ /*
+ Check if there is modify for newly added field.
+ */
+ Create_field *find;
+ find_it.rewind();
+ while((find=find_it++))
+ {
+ if (!my_strcasecmp(system_charset_info,find->field_name, def->field_name))
+ break;
+ }
+
+ if (find && !find->field)
+ find_it.remove();
+ else
+ {
+ my_error(ER_BAD_FIELD_ERROR, MYF(0), def->change,
+ table->s->table_name.str);
+ goto err;
+ }
}
/*
Check that the DATE/DATETIME not null field we are going to add is
@@ -7612,6 +7628,29 @@ mysql_prepare_alter_table(THD *thd, TABLE *table,
find_it.after(def); // Put column after this
}
}
+ /*
+ Check if there is alter for newly added field.
+ */
+ alter_it.rewind();
+ Alter_column *alter;
+ while ((alter=alter_it++))
+ {
+ if (!my_strcasecmp(system_charset_info,def->field_name, alter->name))
+ break;
+ }
+ if (alter)
+ {
+ if (def->sql_type == MYSQL_TYPE_BLOB)
+ {
+ my_error(ER_BLOB_CANT_HAVE_DEFAULT, MYF(0), def->change);
+ goto err;
+ }
+ if ((def->def=alter->def)) // Use new default
+ def->flags&= ~NO_DEFAULT_VALUE_FLAG;
+ else
+ def->flags|= NO_DEFAULT_VALUE_FLAG;
+ alter_it.remove();
+ }
}
if (alter_info->alter_list.elements)
{
diff --git a/storage/connect/CMakeLists.txt b/storage/connect/CMakeLists.txt
index 81441892215..9f42b7a87dd 100644
--- a/storage/connect/CMakeLists.txt
+++ b/storage/connect/CMakeLists.txt
@@ -266,13 +266,6 @@ IF(CONNECT_WITH_JDBC)
JdbcInterface.java ApacheInterface.java MariadbInterface.java
MysqlInterface.java OracleInterface.java PostgresqlInterface.java
JavaWrappers.jar)
- # TODO: Find how to compile and install the java wrapper classes
- # Find required libraries and include directories
- SET (JAVA_SOURCES JdbcInterface.java)
- add_jar(JdbcInterface ${JAVA_SOURCES})
- INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/JavaWrappers.jar
- ${CMAKE_CURRENT_BINARY_DIR}/JdbcInterface.jar
- DESTINATION ${INSTALL_PLUGINDIR} COMPONENT connect-engine)
add_definitions(-DJDBC_SUPPORT)
ELSE()
SET(JDBC_LIBRARY "")
@@ -313,3 +306,31 @@ MYSQL_ADD_PLUGIN(connect ${CONNECT_SOURCES}
LINK_LIBRARIES ${ZLIB_LIBRARY} ${XML_LIBRARY} ${ICONV_LIBRARY}
${ODBC_LIBRARY} ${JDBC_LIBRARY} ${IPHLPAPI_LIBRARY})
+IF(NOT TARGET connect)
+ RETURN()
+ENDIF()
+
+# Install some extra files that belong to connect engine
+IF(WIN32)
+ # install ha_connect.lib
+ GET_TARGET_PROPERTY(CONNECT_LOCATION connect LOCATION)
+ STRING(REPLACE "dll" "lib" CONNECT_LIB ${CONNECT_LOCATION})
+ IF(CMAKE_CONFIGURATION_TYPES)
+ STRING(REPLACE "${CMAKE_CFG_INTDIR}" "\${CMAKE_INSTALL_CONFIG_NAME}"
+ CONNECT_LIB ${CONNECT_LIB})
+ ENDIF()
+ INSTALL(FILES ${CONNECT_LIB}
+ DESTINATION ${INSTALL_PLUGINDIR} COMPONENT connect-engine)
+ENDIF(WIN32)
+
+IF(CONNECT_WITH_JDBC AND JAVA_FOUND AND JNI_FOUND)
+ # TODO: Find how to compile and install the java wrapper classes
+ # Find required libraries and include directories
+ SET (JAVA_SOURCES JdbcInterface.java)
+ add_jar(JdbcInterface ${JAVA_SOURCES})
+ INSTALL(FILES
+ ${CMAKE_CURRENT_SOURCE_DIR}/JavaWrappers.jar
+ ${CMAKE_CURRENT_BINARY_DIR}/JdbcInterface.jar
+ DESTINATION ${INSTALL_PLUGINDIR} COMPONENT connect-engine)
+ENDIF()
+
diff --git a/storage/innobase/fsp/fsp0fsp.cc b/storage/innobase/fsp/fsp0fsp.cc
index ab96befb700..0b66856d2c3 100644
--- a/storage/innobase/fsp/fsp0fsp.cc
+++ b/storage/innobase/fsp/fsp0fsp.cc
@@ -1,6 +1,7 @@
/*****************************************************************************
Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 2017, 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
@@ -2035,15 +2036,6 @@ fseg_create_general(
mtr_x_lock(latch, mtr);
- if (rw_lock_get_x_lock_count(latch) == 1) {
- /* This thread did not own the latch before this call: free
- excess pages from the insert buffer free list */
-
- if (space == IBUF_SPACE_ID) {
- ibuf_free_excess_pages();
- }
- }
-
if (!has_done_reservation) {
success = fsp_reserve_free_extents(&n_reserved, space, 2,
FSP_NORMAL, mtr);
@@ -2614,15 +2606,6 @@ fseg_alloc_free_page_general(
mtr_x_lock(latch, mtr);
- if (rw_lock_get_x_lock_count(latch) == 1) {
- /* This thread did not own the latch before this call: free
- excess pages from the insert buffer free list */
-
- if (space == IBUF_SPACE_ID) {
- ibuf_free_excess_pages();
- }
- }
-
inode = fseg_inode_get(seg_header, space, zip_size, mtr);
if (!has_done_reservation
diff --git a/storage/innobase/ibuf/ibuf0ibuf.cc b/storage/innobase/ibuf/ibuf0ibuf.cc
index 5398deeefcb..3c4955b5c9e 100644
--- a/storage/innobase/ibuf/ibuf0ibuf.cc
+++ b/storage/innobase/ibuf/ibuf0ibuf.cc
@@ -2175,6 +2175,8 @@ ibuf_remove_free_page(void)
page_t* root;
page_t* bitmap_page;
+ log_free_check();
+
mtr_start(&mtr);
/* Acquire the fsp latch before the ibuf header, obeying the latching
@@ -2286,22 +2288,7 @@ ibuf_free_excess_pages(void)
{
ulint i;
-#ifdef UNIV_SYNC_DEBUG
- ut_ad(rw_lock_own(fil_space_get_latch(IBUF_SPACE_ID, NULL),
- RW_LOCK_EX));
-#endif /* UNIV_SYNC_DEBUG */
-
- ut_ad(rw_lock_get_x_lock_count(
- fil_space_get_latch(IBUF_SPACE_ID, NULL)) == 1);
-
- /* NOTE: We require that the thread did not own the latch before,
- because then we know that we can obey the correct latching order
- for ibuf latches */
-
- if (!ibuf) {
- /* Not yet initialized; not sure if this is possible, but
- does no harm to check for it. */
-
+ if (srv_force_recovery >= SRV_FORCE_NO_IBUF_MERGE) {
return;
}
diff --git a/storage/innobase/row/row0ins.cc b/storage/innobase/row/row0ins.cc
index c9d616cfb2a..a24cc328e85 100644
--- a/storage/innobase/row/row0ins.cc
+++ b/storage/innobase/row/row0ins.cc
@@ -38,6 +38,7 @@ Created 4/20/1996 Heikki Tuuri
#include "btr0btr.h"
#include "btr0cur.h"
#include "mach0data.h"
+#include "ibuf0ibuf.h"
#include "que0que.h"
#include "row0upd.h"
#include "row0sel.h"
@@ -2991,6 +2992,11 @@ row_ins_sec_index_entry(
if (err == DB_FAIL) {
mem_heap_empty(heap);
+ if (index->space == IBUF_SPACE_ID
+ && !dict_index_is_unique(index)) {
+ ibuf_free_excess_pages();
+ }
+
/* Try then pessimistic descent to the B-tree */
log_free_check();
diff --git a/storage/innobase/row/row0uins.cc b/storage/innobase/row/row0uins.cc
index f14a4ef9bcf..29660055fad 100644
--- a/storage/innobase/row/row0uins.cc
+++ b/storage/innobase/row/row0uins.cc
@@ -1,6 +1,7 @@
/*****************************************************************************
Copyright (c) 1997, 2016, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 2017, 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
@@ -201,6 +202,10 @@ row_undo_ins_remove_sec_low(
mtr_s_lock(dict_index_get_lock(index), &mtr);
} else {
ut_ad(mode == BTR_MODIFY_TREE);
+ if (index->space == IBUF_SPACE_ID
+ && !dict_index_is_unique(index)) {
+ ibuf_free_excess_pages();
+ }
mtr_x_lock(dict_index_get_lock(index), &mtr);
}
diff --git a/storage/innobase/row/row0umod.cc b/storage/innobase/row/row0umod.cc
index 632dc67dd9c..a97c89212a2 100644
--- a/storage/innobase/row/row0umod.cc
+++ b/storage/innobase/row/row0umod.cc
@@ -1,6 +1,7 @@
/*****************************************************************************
Copyright (c) 1997, 2016, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 2017, 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
@@ -35,6 +36,7 @@ Created 2/27/1997 Heikki Tuuri
#include "trx0roll.h"
#include "btr0btr.h"
#include "mach0data.h"
+#include "ibuf0ibuf.h"
#include "row0undo.h"
#include "row0vers.h"
#include "row0log.h"
@@ -439,6 +441,11 @@ row_undo_mod_del_mark_or_remove_sec_low(
log_free_check();
mtr_start_trx(&mtr, thr_get_trx(thr));
+ if (mode == BTR_MODIFY_TREE
+ && index->space == IBUF_SPACE_ID
+ && !dict_index_is_unique(index)) {
+ ibuf_free_excess_pages();
+ }
if (*index->name == TEMP_INDEX_PREFIX) {
/* The index->online_status may change if the
@@ -611,6 +618,11 @@ row_undo_mod_del_unmark_sec_and_undo_update(
log_free_check();
mtr_start_trx(&mtr, thr_get_trx(thr));
+ if (mode == BTR_MODIFY_TREE
+ && index->space == IBUF_SPACE_ID
+ && !dict_index_is_unique(index)) {
+ ibuf_free_excess_pages();
+ }
if (*index->name == TEMP_INDEX_PREFIX) {
/* The index->online_status may change if the
diff --git a/storage/innobase/trx/trx0trx.cc b/storage/innobase/trx/trx0trx.cc
index df323304482..c7db5cb5efb 100644
--- a/storage/innobase/trx/trx0trx.cc
+++ b/storage/innobase/trx/trx0trx.cc
@@ -542,18 +542,9 @@ trx_resurrect_insert(
"InnoDB: Transaction " TRX_ID_FMT " was in the"
" XA prepared state.\n", trx->id);
- if (srv_force_recovery == 0) {
-
- trx->state = TRX_STATE_PREPARED;
- trx_sys->n_prepared_trx++;
- trx_sys->n_prepared_recovered_trx++;
- } else {
- fprintf(stderr,
- "InnoDB: Since innodb_force_recovery"
- " > 0, we will rollback it anyway.\n");
-
- trx->state = TRX_STATE_ACTIVE;
- }
+ trx->state = TRX_STATE_PREPARED;
+ trx_sys->n_prepared_trx++;
+ trx_sys->n_prepared_recovered_trx++;
} else {
trx->state = TRX_STATE_COMMITTED_IN_MEMORY;
}
@@ -611,22 +602,14 @@ trx_resurrect_update_in_prepared_state(
"InnoDB: Transaction " TRX_ID_FMT
" was in the XA prepared state.\n", trx->id);
- if (srv_force_recovery == 0) {
- if (trx_state_eq(trx, TRX_STATE_NOT_STARTED)) {
- trx_sys->n_prepared_trx++;
- trx_sys->n_prepared_recovered_trx++;
- } else {
- ut_ad(trx_state_eq(trx, TRX_STATE_PREPARED));
- }
-
- trx->state = TRX_STATE_PREPARED;
+ if (trx_state_eq(trx, TRX_STATE_NOT_STARTED)) {
+ trx_sys->n_prepared_trx++;
+ trx_sys->n_prepared_recovered_trx++;
} else {
- fprintf(stderr,
- "InnoDB: Since innodb_force_recovery"
- " > 0, we will rollback it anyway.\n");
-
- trx->state = TRX_STATE_ACTIVE;
+ ut_ad(trx_state_eq(trx, TRX_STATE_PREPARED));
}
+
+ trx->state = TRX_STATE_PREPARED;
} else {
trx->state = TRX_STATE_COMMITTED_IN_MEMORY;
}
diff --git a/storage/xtradb/fsp/fsp0fsp.cc b/storage/xtradb/fsp/fsp0fsp.cc
index b5491ac6550..68d8413e3b7 100644
--- a/storage/xtradb/fsp/fsp0fsp.cc
+++ b/storage/xtradb/fsp/fsp0fsp.cc
@@ -1,6 +1,7 @@
/*****************************************************************************
Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 2017, 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
@@ -2044,15 +2045,6 @@ fseg_create_general(
mtr_x_lock(latch, mtr);
- if (rw_lock_get_x_lock_count(latch) == 1) {
- /* This thread did not own the latch before this call: free
- excess pages from the insert buffer free list */
-
- if (space == IBUF_SPACE_ID) {
- ibuf_free_excess_pages();
- }
- }
-
if (!has_done_reservation) {
success = fsp_reserve_free_extents(&n_reserved, space, 2,
FSP_NORMAL, mtr);
@@ -2623,15 +2615,6 @@ fseg_alloc_free_page_general(
mtr_x_lock(latch, mtr);
- if (rw_lock_get_x_lock_count(latch) == 1) {
- /* This thread did not own the latch before this call: free
- excess pages from the insert buffer free list */
-
- if (space == IBUF_SPACE_ID) {
- ibuf_free_excess_pages();
- }
- }
-
inode = fseg_inode_get(seg_header, space, zip_size, mtr);
if (!has_done_reservation
diff --git a/storage/xtradb/ibuf/ibuf0ibuf.cc b/storage/xtradb/ibuf/ibuf0ibuf.cc
index 0445bb557e1..b920c2ae594 100644
--- a/storage/xtradb/ibuf/ibuf0ibuf.cc
+++ b/storage/xtradb/ibuf/ibuf0ibuf.cc
@@ -2216,6 +2216,8 @@ ibuf_remove_free_page(void)
page_t* root;
page_t* bitmap_page;
+ log_free_check();
+
mtr_start(&mtr);
/* Acquire the fsp latch before the ibuf header, obeying the latching
@@ -2327,22 +2329,7 @@ ibuf_free_excess_pages(void)
{
ulint i;
-#ifdef UNIV_SYNC_DEBUG
- ut_ad(rw_lock_own(fil_space_get_latch(IBUF_SPACE_ID, NULL),
- RW_LOCK_EX));
-#endif /* UNIV_SYNC_DEBUG */
-
- ut_ad(rw_lock_get_x_lock_count(
- fil_space_get_latch(IBUF_SPACE_ID, NULL)) == 1);
-
- /* NOTE: We require that the thread did not own the latch before,
- because then we know that we can obey the correct latching order
- for ibuf latches */
-
- if (!ibuf) {
- /* Not yet initialized; not sure if this is possible, but
- does no harm to check for it. */
-
+ if (srv_force_recovery >= SRV_FORCE_NO_IBUF_MERGE) {
return;
}
diff --git a/storage/xtradb/row/row0ins.cc b/storage/xtradb/row/row0ins.cc
index 00b8ce17b26..3a9aa91d52e 100644
--- a/storage/xtradb/row/row0ins.cc
+++ b/storage/xtradb/row/row0ins.cc
@@ -38,6 +38,7 @@ Created 4/20/1996 Heikki Tuuri
#include "btr0btr.h"
#include "btr0cur.h"
#include "mach0data.h"
+#include "ibuf0ibuf.h"
#include "que0que.h"
#include "row0upd.h"
#include "row0sel.h"
@@ -3064,6 +3065,11 @@ row_ins_sec_index_entry(
if (err == DB_FAIL) {
mem_heap_empty(heap);
+ if (index->space == IBUF_SPACE_ID
+ && !dict_index_is_unique(index)) {
+ ibuf_free_excess_pages();
+ }
+
/* Try then pessimistic descent to the B-tree */
log_free_check();
diff --git a/storage/xtradb/row/row0uins.cc b/storage/xtradb/row/row0uins.cc
index f14a4ef9bcf..29660055fad 100644
--- a/storage/xtradb/row/row0uins.cc
+++ b/storage/xtradb/row/row0uins.cc
@@ -1,6 +1,7 @@
/*****************************************************************************
Copyright (c) 1997, 2016, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 2017, 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
@@ -201,6 +202,10 @@ row_undo_ins_remove_sec_low(
mtr_s_lock(dict_index_get_lock(index), &mtr);
} else {
ut_ad(mode == BTR_MODIFY_TREE);
+ if (index->space == IBUF_SPACE_ID
+ && !dict_index_is_unique(index)) {
+ ibuf_free_excess_pages();
+ }
mtr_x_lock(dict_index_get_lock(index), &mtr);
}
diff --git a/storage/xtradb/row/row0umod.cc b/storage/xtradb/row/row0umod.cc
index 8deba4f00a5..f23d7e9dc68 100644
--- a/storage/xtradb/row/row0umod.cc
+++ b/storage/xtradb/row/row0umod.cc
@@ -1,6 +1,7 @@
/*****************************************************************************
Copyright (c) 1997, 2016, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 2017, 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
@@ -35,6 +36,7 @@ Created 2/27/1997 Heikki Tuuri
#include "trx0roll.h"
#include "btr0btr.h"
#include "mach0data.h"
+#include "ibuf0ibuf.h"
#include "row0undo.h"
#include "row0vers.h"
#include "row0log.h"
@@ -409,6 +411,11 @@ row_undo_mod_del_mark_or_remove_sec_low(
log_free_check();
mtr_start_trx(&mtr, thr_get_trx(thr));
+ if (mode == BTR_MODIFY_TREE
+ && index->space == IBUF_SPACE_ID
+ && !dict_index_is_unique(index)) {
+ ibuf_free_excess_pages();
+ }
if (*index->name == TEMP_INDEX_PREFIX) {
/* The index->online_status may change if the
@@ -581,6 +588,11 @@ row_undo_mod_del_unmark_sec_and_undo_update(
log_free_check();
mtr_start_trx(&mtr, thr_get_trx(thr));
+ if (mode == BTR_MODIFY_TREE
+ && index->space == IBUF_SPACE_ID
+ && !dict_index_is_unique(index)) {
+ ibuf_free_excess_pages();
+ }
if (*index->name == TEMP_INDEX_PREFIX) {
/* The index->online_status may change if the
diff --git a/storage/xtradb/trx/trx0trx.cc b/storage/xtradb/trx/trx0trx.cc
index 1d2f7ada54e..cfc1f83053a 100644
--- a/storage/xtradb/trx/trx0trx.cc
+++ b/storage/xtradb/trx/trx0trx.cc
@@ -720,25 +720,9 @@ trx_resurrect_insert(
"InnoDB: Transaction " TRX_ID_FMT " was in the"
" XA prepared state.\n", trx->id);
- if (srv_force_recovery == 0) {
-
- /* XtraBackup should rollback prepared XA
- transactions */
- if (IS_XTRABACKUP()) {
- trx->state = TRX_STATE_ACTIVE;
- }
- else {
- trx->state = TRX_STATE_PREPARED;
- trx_sys->n_prepared_trx++;
- trx_sys->n_prepared_recovered_trx++;
- }
- } else {
- fprintf(stderr,
- "InnoDB: Since innodb_force_recovery"
- " > 0, we will rollback it anyway.\n");
-
- trx->state = TRX_STATE_ACTIVE;
- }
+ trx->state = TRX_STATE_PREPARED;
+ trx_sys->n_prepared_trx++;
+ trx_sys->n_prepared_recovered_trx++;
} else {
trx->state = TRX_STATE_COMMITTED_IN_MEMORY;
}
@@ -796,25 +780,14 @@ trx_resurrect_update_in_prepared_state(
"InnoDB: Transaction " TRX_ID_FMT
" was in the XA prepared state.\n", trx->id);
- if (srv_force_recovery == 0) {
- if (trx_state_eq(trx, TRX_STATE_NOT_STARTED)) {
- if (!IS_XTRABACKUP()) {
- trx_sys->n_prepared_trx++;
- trx_sys->n_prepared_recovered_trx++;
- }
- } else {
- ut_ad(trx_state_eq(trx, TRX_STATE_PREPARED));
- }
- /* XtraBackup should rollback prepared XA
- transactions */
- trx->state = IS_XTRABACKUP()?TRX_STATE_ACTIVE: TRX_STATE_PREPARED;
+ if (trx_state_eq(trx, TRX_STATE_NOT_STARTED)) {
+ trx_sys->n_prepared_trx++;
+ trx_sys->n_prepared_recovered_trx++;
} else {
- fprintf(stderr,
- "InnoDB: Since innodb_force_recovery"
- " > 0, we will rollback it anyway.\n");
-
- trx->state = TRX_STATE_ACTIVE;
+ ut_ad(trx_state_eq(trx, TRX_STATE_PREPARED));
}
+
+ trx->state = TRX_STATE_PREPARED;
} else {
trx->state = TRX_STATE_COMMITTED_IN_MEMORY;
}
diff --git a/win/packaging/create_msi.cmake.in b/win/packaging/create_msi.cmake.in
index 1f847a39695..62ce5f1edd2 100644
--- a/win/packaging/create_msi.cmake.in
+++ b/win/packaging/create_msi.cmake.in
@@ -78,13 +78,6 @@ ELSE()
ENDIF()
SET(ENV{VS_UNICODE_OUTPUT})
-# Workaround for CMake bug#11452
-# Switch off the monolithic install
-EXECUTE_PROCESS(
- COMMAND ${CMAKE_COMMAND} -DCPACK_MONOLITHIC_INSTALL=0 ${CMAKE_BINARY_DIR}
- OUTPUT_QUIET
-)
-
INCLUDE(${CMAKE_BINARY_DIR}/CPackConfig.cmake)
@@ -441,11 +434,4 @@ ENDIF()
CONFIGURE_FILE(${CPACK_PACKAGE_FILE_NAME}.msi
${CMAKE_BINARY_DIR}/${CPACK_PACKAGE_FILE_NAME}.msi
COPYONLY)
-
-# Workaround for CMake bug#11452
-# Switch monolithic install on again
-EXECUTE_PROCESS(
- COMMAND ${CMAKE_COMMAND} -DCPACK_MONOLITHIC_INSTALL=1 ${CMAKE_BINARY_DIR}
- OUTPUT_QUIET
-)