1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00

Merge 10.0 into 10.1

This commit is contained in:
Marko Mäkelä
2017-08-28 15:05:46 +03:00
21 changed files with 244 additions and 158 deletions

View File

@@ -114,8 +114,8 @@ IF(MSVC)
ENDIF() ENDIF()
#TODO: update the code and remove the disabled warnings #TODO: update the code and remove the disabled warnings
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /wd4800 /wd4805 /wd4996") SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /wd4800 /wd4805 /wd4996 /we4700")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4800 /wd4805 /wd4996 /wd4291 /wd4577 /we4099") SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4800 /wd4805 /wd4996 /wd4291 /wd4577 /we4099 /we4700")
IF(CMAKE_SIZEOF_VOID_P MATCHES 8) IF(CMAKE_SIZEOF_VOID_P MATCHES 8)
# _WIN64 is defined by the compiler itself. # _WIN64 is defined by the compiler itself.

View File

@@ -2122,6 +2122,58 @@ t1 CREATE TABLE `t1` (
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ) ENGINE=InnoDB DEFAULT CHARSET=utf8
DROP TABLE t1; 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 # Start of 10.1 tests
# #
# #

View File

@@ -4,7 +4,7 @@ XA START 'x';
UPDATE t1 set a=2; UPDATE t1 set a=2;
XA END 'x'; XA END 'x';
XA PREPARE 'x'; XA PREPARE 'x';
# Kill and restart # Kill and restart: --innodb-force-recovery=2
SELECT * FROM t1 LOCK IN SHARE MODE; SELECT * FROM t1 LOCK IN SHARE MODE;
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
SELECT * FROM t1; SELECT * FROM t1;

View File

@@ -15,7 +15,12 @@ connect (con1,localhost,root);
XA START 'x'; UPDATE t1 set a=2; XA END 'x'; XA PREPARE 'x'; XA START 'x'; UPDATE t1 set a=2; XA END 'x'; XA PREPARE 'x';
connection default; 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 --source include/kill_and_restart_mysqld.inc
--let $restart_parameters=
disconnect con1; disconnect con1;
connect (con1,localhost,root); connect (con1,localhost,root);

View File

@@ -1767,6 +1767,48 @@ ALTER TABLE t1 CONVERT TO CHARACTER SET utf8;
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
DROP 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 #
--echo # Start of 10.1 tests --echo # Start of 10.1 tests
--echo # --echo #

View File

@@ -200,7 +200,6 @@ Voluntary context switches %ld, Involuntary context switches %ld\n",
_CrtSetReportMode( _CRT_ASSERT, _CRTDBG_MODE_FILE ); _CrtSetReportMode( _CRT_ASSERT, _CRTDBG_MODE_FILE );
_CrtSetReportFile( _CRT_ASSERT, _CRTDBG_FILE_STDERR ); _CrtSetReportFile( _CRT_ASSERT, _CRTDBG_FILE_STDERR );
_CrtCheckMemory(); _CrtCheckMemory();
_CrtDumpMemoryLeaks();
#endif #endif
} }

View File

@@ -7544,9 +7544,25 @@ mysql_prepare_alter_table(THD *thd, TABLE *table,
{ {
if (def->change && ! def->field) if (def->change && ! def->field)
{ {
my_error(ER_BAD_FIELD_ERROR, MYF(0), def->change, /*
table->s->table_name.str); Check if there is modify for newly added field.
goto err; */
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 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 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) if (alter_info->alter_list.elements)
{ {

View File

@@ -266,13 +266,6 @@ IF(CONNECT_WITH_JDBC)
JdbcInterface.java ApacheInterface.java MariadbInterface.java JdbcInterface.java ApacheInterface.java MariadbInterface.java
MysqlInterface.java OracleInterface.java PostgresqlInterface.java MysqlInterface.java OracleInterface.java PostgresqlInterface.java
JavaWrappers.jar) 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) add_definitions(-DJDBC_SUPPORT)
ELSE() ELSE()
SET(JDBC_LIBRARY "") SET(JDBC_LIBRARY "")
@@ -313,3 +306,31 @@ MYSQL_ADD_PLUGIN(connect ${CONNECT_SOURCES}
LINK_LIBRARIES ${ZLIB_LIBRARY} ${XML_LIBRARY} ${ICONV_LIBRARY} LINK_LIBRARIES ${ZLIB_LIBRARY} ${XML_LIBRARY} ${ICONV_LIBRARY}
${ODBC_LIBRARY} ${JDBC_LIBRARY} ${IPHLPAPI_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()

View File

@@ -1,6 +1,7 @@
/***************************************************************************** /*****************************************************************************
Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved. 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 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
@@ -2035,15 +2036,6 @@ fseg_create_general(
mtr_x_lock(latch, mtr); 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) { if (!has_done_reservation) {
success = fsp_reserve_free_extents(&n_reserved, space, 2, success = fsp_reserve_free_extents(&n_reserved, space, 2,
FSP_NORMAL, mtr); FSP_NORMAL, mtr);
@@ -2614,15 +2606,6 @@ fseg_alloc_free_page_general(
mtr_x_lock(latch, mtr); 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); inode = fseg_inode_get(seg_header, space, zip_size, mtr);
if (!has_done_reservation if (!has_done_reservation

View File

@@ -2175,6 +2175,8 @@ ibuf_remove_free_page(void)
page_t* root; page_t* root;
page_t* bitmap_page; page_t* bitmap_page;
log_free_check();
mtr_start(&mtr); mtr_start(&mtr);
/* Acquire the fsp latch before the ibuf header, obeying the latching /* Acquire the fsp latch before the ibuf header, obeying the latching
@@ -2286,22 +2288,7 @@ ibuf_free_excess_pages(void)
{ {
ulint i; ulint i;
#ifdef UNIV_SYNC_DEBUG if (srv_force_recovery >= SRV_FORCE_NO_IBUF_MERGE) {
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. */
return; return;
} }

View File

@@ -38,6 +38,7 @@ Created 4/20/1996 Heikki Tuuri
#include "btr0btr.h" #include "btr0btr.h"
#include "btr0cur.h" #include "btr0cur.h"
#include "mach0data.h" #include "mach0data.h"
#include "ibuf0ibuf.h"
#include "que0que.h" #include "que0que.h"
#include "row0upd.h" #include "row0upd.h"
#include "row0sel.h" #include "row0sel.h"
@@ -2991,6 +2992,11 @@ row_ins_sec_index_entry(
if (err == DB_FAIL) { if (err == DB_FAIL) {
mem_heap_empty(heap); 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 */ /* Try then pessimistic descent to the B-tree */
log_free_check(); log_free_check();

View File

@@ -1,6 +1,7 @@
/***************************************************************************** /*****************************************************************************
Copyright (c) 1997, 2016, Oracle and/or its affiliates. All Rights Reserved. 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 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
@@ -201,6 +202,10 @@ row_undo_ins_remove_sec_low(
mtr_s_lock(dict_index_get_lock(index), &mtr); mtr_s_lock(dict_index_get_lock(index), &mtr);
} else { } else {
ut_ad(mode == BTR_MODIFY_TREE); 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); mtr_x_lock(dict_index_get_lock(index), &mtr);
} }

View File

@@ -1,6 +1,7 @@
/***************************************************************************** /*****************************************************************************
Copyright (c) 1997, 2016, Oracle and/or its affiliates. All Rights Reserved. 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 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
@@ -35,6 +36,7 @@ Created 2/27/1997 Heikki Tuuri
#include "trx0roll.h" #include "trx0roll.h"
#include "btr0btr.h" #include "btr0btr.h"
#include "mach0data.h" #include "mach0data.h"
#include "ibuf0ibuf.h"
#include "row0undo.h" #include "row0undo.h"
#include "row0vers.h" #include "row0vers.h"
#include "row0log.h" #include "row0log.h"
@@ -439,6 +441,11 @@ row_undo_mod_del_mark_or_remove_sec_low(
log_free_check(); log_free_check();
mtr_start_trx(&mtr, thr_get_trx(thr)); 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) { if (*index->name == TEMP_INDEX_PREFIX) {
/* The index->online_status may change if the /* The index->online_status may change if the
@@ -611,6 +618,11 @@ row_undo_mod_del_unmark_sec_and_undo_update(
log_free_check(); log_free_check();
mtr_start_trx(&mtr, thr_get_trx(thr)); 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) { if (*index->name == TEMP_INDEX_PREFIX) {
/* The index->online_status may change if the /* The index->online_status may change if the

View File

@@ -542,18 +542,9 @@ trx_resurrect_insert(
"InnoDB: Transaction " TRX_ID_FMT " was in the" "InnoDB: Transaction " TRX_ID_FMT " was in the"
" XA prepared state.\n", trx->id); " XA prepared state.\n", trx->id);
if (srv_force_recovery == 0) { trx->state = TRX_STATE_PREPARED;
trx_sys->n_prepared_trx++;
trx->state = TRX_STATE_PREPARED; trx_sys->n_prepared_recovered_trx++;
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;
}
} else { } else {
trx->state = TRX_STATE_COMMITTED_IN_MEMORY; trx->state = TRX_STATE_COMMITTED_IN_MEMORY;
} }
@@ -611,22 +602,14 @@ trx_resurrect_update_in_prepared_state(
"InnoDB: Transaction " TRX_ID_FMT "InnoDB: Transaction " TRX_ID_FMT
" was in the XA prepared state.\n", trx->id); " was in the XA prepared state.\n", trx->id);
if (srv_force_recovery == 0) { if (trx_state_eq(trx, TRX_STATE_NOT_STARTED)) {
if (trx_state_eq(trx, TRX_STATE_NOT_STARTED)) { trx_sys->n_prepared_trx++;
trx_sys->n_prepared_trx++; trx_sys->n_prepared_recovered_trx++;
trx_sys->n_prepared_recovered_trx++;
} else {
ut_ad(trx_state_eq(trx, TRX_STATE_PREPARED));
}
trx->state = TRX_STATE_PREPARED;
} else { } else {
fprintf(stderr, ut_ad(trx_state_eq(trx, TRX_STATE_PREPARED));
"InnoDB: Since innodb_force_recovery"
" > 0, we will rollback it anyway.\n");
trx->state = TRX_STATE_ACTIVE;
} }
trx->state = TRX_STATE_PREPARED;
} else { } else {
trx->state = TRX_STATE_COMMITTED_IN_MEMORY; trx->state = TRX_STATE_COMMITTED_IN_MEMORY;
} }

View File

@@ -1,6 +1,7 @@
/***************************************************************************** /*****************************************************************************
Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved. 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 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
@@ -2044,15 +2045,6 @@ fseg_create_general(
mtr_x_lock(latch, mtr); 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) { if (!has_done_reservation) {
success = fsp_reserve_free_extents(&n_reserved, space, 2, success = fsp_reserve_free_extents(&n_reserved, space, 2,
FSP_NORMAL, mtr); FSP_NORMAL, mtr);
@@ -2623,15 +2615,6 @@ fseg_alloc_free_page_general(
mtr_x_lock(latch, mtr); 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); inode = fseg_inode_get(seg_header, space, zip_size, mtr);
if (!has_done_reservation if (!has_done_reservation

View File

@@ -2216,6 +2216,8 @@ ibuf_remove_free_page(void)
page_t* root; page_t* root;
page_t* bitmap_page; page_t* bitmap_page;
log_free_check();
mtr_start(&mtr); mtr_start(&mtr);
/* Acquire the fsp latch before the ibuf header, obeying the latching /* Acquire the fsp latch before the ibuf header, obeying the latching
@@ -2327,22 +2329,7 @@ ibuf_free_excess_pages(void)
{ {
ulint i; ulint i;
#ifdef UNIV_SYNC_DEBUG if (srv_force_recovery >= SRV_FORCE_NO_IBUF_MERGE) {
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. */
return; return;
} }

View File

@@ -38,6 +38,7 @@ Created 4/20/1996 Heikki Tuuri
#include "btr0btr.h" #include "btr0btr.h"
#include "btr0cur.h" #include "btr0cur.h"
#include "mach0data.h" #include "mach0data.h"
#include "ibuf0ibuf.h"
#include "que0que.h" #include "que0que.h"
#include "row0upd.h" #include "row0upd.h"
#include "row0sel.h" #include "row0sel.h"
@@ -3064,6 +3065,11 @@ row_ins_sec_index_entry(
if (err == DB_FAIL) { if (err == DB_FAIL) {
mem_heap_empty(heap); 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 */ /* Try then pessimistic descent to the B-tree */
log_free_check(); log_free_check();

View File

@@ -1,6 +1,7 @@
/***************************************************************************** /*****************************************************************************
Copyright (c) 1997, 2016, Oracle and/or its affiliates. All Rights Reserved. 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 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
@@ -201,6 +202,10 @@ row_undo_ins_remove_sec_low(
mtr_s_lock(dict_index_get_lock(index), &mtr); mtr_s_lock(dict_index_get_lock(index), &mtr);
} else { } else {
ut_ad(mode == BTR_MODIFY_TREE); 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); mtr_x_lock(dict_index_get_lock(index), &mtr);
} }

View File

@@ -1,6 +1,7 @@
/***************************************************************************** /*****************************************************************************
Copyright (c) 1997, 2016, Oracle and/or its affiliates. All Rights Reserved. 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 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
@@ -35,6 +36,7 @@ Created 2/27/1997 Heikki Tuuri
#include "trx0roll.h" #include "trx0roll.h"
#include "btr0btr.h" #include "btr0btr.h"
#include "mach0data.h" #include "mach0data.h"
#include "ibuf0ibuf.h"
#include "row0undo.h" #include "row0undo.h"
#include "row0vers.h" #include "row0vers.h"
#include "row0log.h" #include "row0log.h"
@@ -409,6 +411,11 @@ row_undo_mod_del_mark_or_remove_sec_low(
log_free_check(); log_free_check();
mtr_start_trx(&mtr, thr_get_trx(thr)); 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) { if (*index->name == TEMP_INDEX_PREFIX) {
/* The index->online_status may change if the /* The index->online_status may change if the
@@ -581,6 +588,11 @@ row_undo_mod_del_unmark_sec_and_undo_update(
log_free_check(); log_free_check();
mtr_start_trx(&mtr, thr_get_trx(thr)); 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) { if (*index->name == TEMP_INDEX_PREFIX) {
/* The index->online_status may change if the /* The index->online_status may change if the

View File

@@ -720,25 +720,9 @@ trx_resurrect_insert(
"InnoDB: Transaction " TRX_ID_FMT " was in the" "InnoDB: Transaction " TRX_ID_FMT " was in the"
" XA prepared state.\n", trx->id); " XA prepared state.\n", trx->id);
if (srv_force_recovery == 0) { trx->state = TRX_STATE_PREPARED;
trx_sys->n_prepared_trx++;
/* XtraBackup should rollback prepared XA trx_sys->n_prepared_recovered_trx++;
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;
}
} else { } else {
trx->state = TRX_STATE_COMMITTED_IN_MEMORY; trx->state = TRX_STATE_COMMITTED_IN_MEMORY;
} }
@@ -796,25 +780,14 @@ trx_resurrect_update_in_prepared_state(
"InnoDB: Transaction " TRX_ID_FMT "InnoDB: Transaction " TRX_ID_FMT
" was in the XA prepared state.\n", trx->id); " was in the XA prepared state.\n", trx->id);
if (srv_force_recovery == 0) { if (trx_state_eq(trx, TRX_STATE_NOT_STARTED)) {
if (trx_state_eq(trx, TRX_STATE_NOT_STARTED)) { trx_sys->n_prepared_trx++;
if (!IS_XTRABACKUP()) { trx_sys->n_prepared_recovered_trx++;
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;
} else { } else {
fprintf(stderr, ut_ad(trx_state_eq(trx, TRX_STATE_PREPARED));
"InnoDB: Since innodb_force_recovery"
" > 0, we will rollback it anyway.\n");
trx->state = TRX_STATE_ACTIVE;
} }
trx->state = TRX_STATE_PREPARED;
} else { } else {
trx->state = TRX_STATE_COMMITTED_IN_MEMORY; trx->state = TRX_STATE_COMMITTED_IN_MEMORY;
} }

View File

@@ -78,13 +78,6 @@ ELSE()
ENDIF() ENDIF()
SET(ENV{VS_UNICODE_OUTPUT}) 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) INCLUDE(${CMAKE_BINARY_DIR}/CPackConfig.cmake)
@@ -441,11 +434,4 @@ ENDIF()
CONFIGURE_FILE(${CPACK_PACKAGE_FILE_NAME}.msi CONFIGURE_FILE(${CPACK_PACKAGE_FILE_NAME}.msi
${CMAKE_BINARY_DIR}/${CPACK_PACKAGE_FILE_NAME}.msi ${CMAKE_BINARY_DIR}/${CPACK_PACKAGE_FILE_NAME}.msi
COPYONLY) 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
)