Skip to content

Commit

Permalink
dirty merge
Browse files Browse the repository at this point in the history
  • Loading branch information
sanja-byelkin committed Feb 7, 2019
2 parents 7293ce0 + 625994b commit 65c5ef9
Show file tree
Hide file tree
Showing 185 changed files with 5,958 additions and 1,871 deletions.
10 changes: 8 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -242,8 +242,14 @@ ENDIF()

MY_CHECK_AND_SET_COMPILER_FLAG(-ggdb3 DEBUG)

OPTION(ENABLED_LOCAL_INFILE
"If we should should enable LOAD DATA LOCAL by default" ${IF_WIN})
SET(ENABLED_LOCAL_INFILE "AUTO" CACHE STRING "If we should should enable LOAD DATA LOCAL by default (OFF/ON/AUTO)")
IF (ENABLED_LOCAL_INFILE MATCHES "^(0|FALSE)$")
SET(ENABLED_LOCAL_INFILE OFF)
ELSEIF(ENABLED_LOCAL_INFILE MATCHES "^(1|TRUE)$")
SET(ENABLED_LOCAL_INFILE ON)
ELSEIF (NOT ENABLED_LOCAL_INFILE MATCHES "^(ON|OFF|AUTO)$")
MESSAGE(FATAL_ERROR "ENABLED_LOCAL_INFILE must be one of OFF, ON, AUTO")
ENDIF()

# Set DBUG_OFF and other optional release-only flags for non-debug project types
FOREACH(BUILD_TYPE RELEASE RELWITHDEBINFO MINSIZEREL)
Expand Down
27 changes: 23 additions & 4 deletions client/mysqlbinlog.cc
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ ulong mysqld_net_retry_count = 10L;
ulong open_files_limit;
ulong opt_binlog_rows_event_max_size;
ulonglong test_flags = 0;
ulong opt_binlog_rows_event_max_encoded_size= MAX_MAX_ALLOWED_PACKET;
static uint opt_protocol= 0;
static FILE *result_file;
static char *result_file_name= 0;
Expand Down Expand Up @@ -852,8 +853,14 @@ write_event_header_and_base64(Log_event *ev, FILE *result_file,
DBUG_ENTER("write_event_header_and_base64");

/* Write header and base64 output to cache */
if (ev->print_header(head, print_event_info, FALSE) ||
ev->print_base64(body, print_event_info, FALSE))
if (ev->print_header(head, print_event_info, FALSE))
DBUG_RETURN(ERROR_STOP);

DBUG_ASSERT(print_event_info->base64_output_mode == BASE64_OUTPUT_ALWAYS);

if (ev->print_base64(body, print_event_info,
print_event_info->base64_output_mode !=
BASE64_OUTPUT_DECODE_ROWS))
DBUG_RETURN(ERROR_STOP);

/* Read data from cache and write to result file */
Expand Down Expand Up @@ -889,12 +896,15 @@ static bool print_base64(PRINT_EVENT_INFO *print_event_info, Log_event *ev)
type_str);
return 1;
}
return ev->print(result_file, print_event_info);
ev->print(result_file, print_event_info);
return
print_event_info->head_cache.error == -1 ||
print_event_info->body_cache.error == -1;
}


static bool print_row_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev,
ulong table_id, bool is_stmt_end)
ulonglong table_id, bool is_stmt_end)
{
Table_map_log_event *ignored_map=
print_event_info->m_table_map_ignored.get_table(table_id);
Expand Down Expand Up @@ -1769,6 +1779,15 @@ that may lead to an endless loop.",
"This value must be a multiple of 256.",
&opt_binlog_rows_event_max_size, &opt_binlog_rows_event_max_size, 0,
GET_ULONG, REQUIRED_ARG, UINT_MAX, 256, ULONG_MAX, 0, 256, 0},
#ifndef DBUG_OFF
{"debug-binlog-row-event-max-encoded-size", 0,
"The maximum size of base64-encoded rows-event in one BINLOG pseudo-query "
"instance. When the computed actual size exceeds the limit "
"the BINLOG's argument string is fragmented in two.",
&opt_binlog_rows_event_max_encoded_size,
&opt_binlog_rows_event_max_encoded_size, 0,
GET_ULONG, REQUIRED_ARG, UINT_MAX/4, 256, ULONG_MAX, 0, 256, 0},
#endif
{"verify-binlog-checksum", 'c', "Verify checksum binlog events.",
(uchar**) &opt_verify_binlog_checksum, (uchar**) &opt_verify_binlog_checksum,
0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
Expand Down
7 changes: 5 additions & 2 deletions client/mysqltest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6118,7 +6118,6 @@ void do_connect(struct st_command *command)
#endif
if (opt_compress || con_compress)
mysql_options(con_slot->mysql, MYSQL_OPT_COMPRESS, NullS);
mysql_options(con_slot->mysql, MYSQL_OPT_LOCAL_INFILE, 0);
mysql_options(con_slot->mysql, MYSQL_SET_CHARSET_NAME,
csname?csname: charset_info->csname);
if (opt_charsets_dir)
Expand Down Expand Up @@ -6218,6 +6217,11 @@ void do_connect(struct st_command *command)
if (con_slot == next_con)
next_con++; /* if we used the next_con slot, advance the pointer */
}
else // Failed to connect. Free the memory.
{
mysql_close(con_slot->mysql);
con_slot->mysql= NULL;
}

dynstr_free(&ds_connection_name);
dynstr_free(&ds_host);
Expand Down Expand Up @@ -9326,7 +9330,6 @@ int main(int argc, char **argv)
(void *) &opt_connect_timeout);
if (opt_compress)
mysql_options(con->mysql,MYSQL_OPT_COMPRESS,NullS);
mysql_options(con->mysql, MYSQL_OPT_LOCAL_INFILE, 0);
mysql_options(con->mysql, MYSQL_SET_CHARSET_NAME,
charset_info->csname);
if (opt_charsets_dir)
Expand Down
1 change: 0 additions & 1 deletion cmake/build_configurations/mysql_release.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ IF(FEATURE_SET)
ENDIF()
ENDIF()

OPTION(ENABLED_LOCAL_INFILE "" ON)
SET(WITH_INNODB_SNAPPY OFF CACHE STRING "")
IF(WIN32)
SET(INSTALL_MYSQLTESTDIR "" CACHE STRING "")
Expand Down
2 changes: 1 addition & 1 deletion cmake/wsrep.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ ENDIF()
OPTION(WITH_WSREP "WSREP replication API (to use, e.g. Galera Replication library)" ${with_wsrep_default})

# Set the patch version
SET(WSREP_PATCH_VERSION "23")
SET(WSREP_PATCH_VERSION "24")

# Obtain wsrep API version
FILE(STRINGS "${MySQL_SOURCE_DIR}/wsrep/wsrep_api.h" WSREP_API_VERSION
Expand Down
6 changes: 5 additions & 1 deletion config.h.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,11 @@
/*
MySQL features
*/
#cmakedefine ENABLED_LOCAL_INFILE 1
#define LOCAL_INFILE_MODE_OFF 0
#define LOCAL_INFILE_MODE_ON 1
#define LOCAL_INFILE_MODE_AUTO 2
#define ENABLED_LOCAL_INFILE LOCAL_INFILE_MODE_@ENABLED_LOCAL_INFILE@

#cmakedefine ENABLED_PROFILING 1
#cmakedefine EXTRA_DEBUG 1
#cmakedefine USE_SYMDIR 1
Expand Down
34 changes: 16 additions & 18 deletions extra/mariabackup/xtrabackup.cc
Original file line number Diff line number Diff line change
Expand Up @@ -234,8 +234,6 @@ long innobase_write_io_threads = 4;
longlong innobase_page_size = (1LL << 14); /* 16KB */
char* innobase_buffer_pool_filename = NULL;

longlong innobase_buffer_pool_size = 8*1024*1024L;

/* The default values for the following char* start-up parameters
are determined in innobase_init below: */

Expand Down Expand Up @@ -1258,11 +1256,6 @@ struct my_option xb_server_options[] =
(G_PTR*) &sys_tablespace_auto_extend_increment,
(G_PTR*) &sys_tablespace_auto_extend_increment,
0, GET_ULONG, REQUIRED_ARG, 8L, 1L, 1000L, 0, 1L, 0},
{"innodb_buffer_pool_size", OPT_INNODB_BUFFER_POOL_SIZE,
"The size of the memory buffer InnoDB uses to cache data and indexes of its tables.",
(G_PTR*) &innobase_buffer_pool_size, (G_PTR*) &innobase_buffer_pool_size, 0,
GET_LL, REQUIRED_ARG, 8*1024*1024L, 1024*1024L, LONGLONG_MAX, 0,
1024*1024L, 0},
{"innodb_data_file_path", OPT_INNODB_DATA_FILE_PATH,
"Path to individual files and their sizes.", &innobase_data_file_path,
&innobase_data_file_path, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
Expand Down Expand Up @@ -1576,11 +1569,23 @@ static int prepare_export()
}


static const char *xb_client_default_groups[]=
{ "xtrabackup", "mariabackup", "client", 0, 0, 0 };
static const char *xb_client_default_groups[]={
"xtrabackup", "mariabackup",
"client", "client-server",
"client-mariadb",
0, 0, 0
};

static const char *xb_server_default_groups[]=
{ "xtrabackup", "mariabackup", "mysqld", 0, 0, 0 };
static const char *xb_server_default_groups[]={
"xtrabackup", "mariabackup",
"mysqld", "server", MYSQL_BASE_VERSION,
"mariadb", MARIADB_BASE_VERSION,
"client-server",
#ifdef WITH_WSREP
"galera",
#endif
0, 0, 0
};

static void print_version(void)
{
Expand Down Expand Up @@ -1822,13 +1827,6 @@ static bool innodb_init_param()
msg("mariabackup: use-memory can't be over 4GB"
" on 32-bit systems");
}

if (innobase_buffer_pool_size > UINT_MAX32) {
msg("mariabackup: innobase_buffer_pool_size can't be "
"over 4GB on 32-bit systems");

goto error;
}
}

static char default_path[2] = { FN_CURLIB, 0 };
Expand Down
4 changes: 3 additions & 1 deletion include/my_sys.h
Original file line number Diff line number Diff line change
Expand Up @@ -614,7 +614,9 @@ static inline size_t my_b_bytes_in_cache(const IO_CACHE *info)
return (size_t) (info->read_end - info->read_pos);
}

int my_b_copy_to_file(IO_CACHE *cache, FILE *file);
int my_b_copy_to_file (IO_CACHE *cache, FILE *file, size_t count);
int my_b_copy_all_to_file(IO_CACHE *cache, FILE *file);

my_off_t my_b_append_tell(IO_CACHE* info);
my_off_t my_b_safe_tell(IO_CACHE* info); /* picks the correct tell() */
int my_b_pread(IO_CACHE *info, uchar *Buffer, size_t Count, my_off_t pos);
Expand Down
4 changes: 2 additions & 2 deletions include/my_valgrind.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
# define MEM_CHECK_ADDRESSABLE(a,len) ((void) 0)
# define MEM_CHECK_DEFINED(a,len) ((void) 0)
#else
# define MEM_UNDEFINED(a,len) ((void) 0)
# define MEM_UNDEFINED(a,len) ((void) (a), (void) (len))
# define MEM_NOACCESS(a,len) ((void) 0)
# define MEM_CHECK_ADDRESSABLE(a,len) ((void) 0)
# define MEM_CHECK_DEFINED(a,len) ((void) 0)
Expand All @@ -51,7 +51,7 @@
#if !defined(DBUG_OFF) || defined(TRASH_FREED_MEMORY)
#define TRASH_FILL(A,B,C) do { const size_t trash_tmp= (B); MEM_UNDEFINED(A, trash_tmp); memset(A, C, trash_tmp); } while (0)
#else
#define TRASH_FILL(A,B,C) do { const size_t trash_tmp __attribute__((unused))= (B); MEM_UNDEFINED(A,trash_tmp); } while (0)
#define TRASH_FILL(A,B,C) do { MEM_UNDEFINED((A), (B)); } while (0)
#endif

#define TRASH_ALLOC(A,B) do { TRASH_FILL(A,B,0xA5); MEM_UNDEFINED(A,B); } while(0)
Expand Down
2 changes: 1 addition & 1 deletion include/mysql.h
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ typedef struct st_mysql

/* session-wide random string */
char scramble[SCRAMBLE_LENGTH+1];
my_bool unused1;
my_bool auto_local_infile;
void *unused2, *unused3, *unused4, *unused5;

LIST *stmts; /* list of all statements */
Expand Down
2 changes: 1 addition & 1 deletion include/mysql.h.pp
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@
my_bool free_me;
my_bool reconnect;
char scramble[20 +1];
my_bool unused1;
my_bool auto_local_infile;
void *unused2, *unused3, *unused4, *unused5;
LIST *stmts;
const struct st_mysql_methods *methods;
Expand Down
1 change: 0 additions & 1 deletion mysql-test/include/check-testcase.test
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ call mtr.check_testcase();
let $datadir=`select @@datadir`;
list_files $datadir mysql_upgrade_info;
list_files_write_file $datadir.tempfiles.txt $datadir/test #sql*;
--replace_regex /#sql-ib[0-9a-f]+-[0-9a-f]+\.ibd\n//
cat_file $datadir.tempfiles.txt;
remove_file $datadir.tempfiles.txt;
list_files $datadir/mysql #sql*;
Expand Down
49 changes: 49 additions & 0 deletions mysql-test/main/alter_table.result
Original file line number Diff line number Diff line change
Expand Up @@ -2467,6 +2467,55 @@ ERROR 23000: Duplicate entry '1' for key 'i'
UNLOCK TABLES;
DROP TABLE t1;
#
# MDEV-17599 ALTER TABLE DROP CONSTRAINT does not work for foreign keys.
#
CREATE TABLE t1(id INT PRIMARY KEY, c1 INT) ENGINE= INNODB;
CREATE TABLE t2(id INT PRIMARY KEY, c1 INT, c2 INT NOT NULL,
CONSTRAINT sid FOREIGN KEY (`c1`) REFERENCES t1 (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
CONSTRAINT UNIQUE `ui`(c2)) ENGINE= INNODB;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`id` int(11) NOT NULL,
`c1` int(11) DEFAULT NULL,
`c2` int(11) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `ui` (`c2`),
KEY `sid` (`c1`),
CONSTRAINT `sid` FOREIGN KEY (`c1`) REFERENCES `t1` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=latin1
ALTER TABLE t2 DROP CONSTRAINT sid;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`id` int(11) NOT NULL,
`c1` int(11) DEFAULT NULL,
`c2` int(11) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `ui` (`c2`),
KEY `sid` (`c1`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
ALTER TABLE t2 DROP CONSTRAINT ui;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`id` int(11) NOT NULL,
`c1` int(11) DEFAULT NULL,
`c2` int(11) NOT NULL,
PRIMARY KEY (`id`),
KEY `sid` (`c1`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
ALTER TABLE t2 DROP CONSTRAINT PRIMARY KEY;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`id` int(11) NOT NULL,
`c1` int(11) DEFAULT NULL,
`c2` int(11) NOT NULL,
KEY `sid` (`c1`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
DROP TABLE t2, t1;
#
# End of 10.2 tests
#
#
Expand Down
17 changes: 17 additions & 0 deletions mysql-test/main/alter_table.test
Original file line number Diff line number Diff line change
Expand Up @@ -2018,6 +2018,23 @@ UNLOCK TABLES;
DROP TABLE t1;


--echo #
--echo # MDEV-17599 ALTER TABLE DROP CONSTRAINT does not work for foreign keys.
--echo #

CREATE TABLE t1(id INT PRIMARY KEY, c1 INT) ENGINE= INNODB;
CREATE TABLE t2(id INT PRIMARY KEY, c1 INT, c2 INT NOT NULL,
CONSTRAINT sid FOREIGN KEY (`c1`) REFERENCES t1 (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
CONSTRAINT UNIQUE `ui`(c2)) ENGINE= INNODB;
SHOW CREATE TABLE t2;
ALTER TABLE t2 DROP CONSTRAINT sid;
SHOW CREATE TABLE t2;
ALTER TABLE t2 DROP CONSTRAINT ui;
SHOW CREATE TABLE t2;
ALTER TABLE t2 DROP CONSTRAINT PRIMARY KEY;
SHOW CREATE TABLE t2;
DROP TABLE t2, t1;

--echo #
--echo # End of 10.2 tests
--echo #
Expand Down
6 changes: 6 additions & 0 deletions mysql-test/main/alter_table_errors.result
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,9 @@ t2 CREATE TEMPORARY TABLE `t2` (
`a` int(11) DEFAULT NULL,
`v` int(11) GENERATED ALWAYS AS (`a`) VIRTUAL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop temporary table t1, t2;
create temporary table t1 (a int);
alter table t1 add column f text;
insert into t1 values ('x','foo');
ERROR 22007: Incorrect integer value: 'x' for column `test`.`t1`.`a` at row 1
drop temporary table t1;
10 changes: 10 additions & 0 deletions mysql-test/main/alter_table_errors.test
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,13 @@ lock table t2 write;
--error ER_ALTER_OPERATION_NOT_SUPPORTED
alter table t2 change column a b int, algorithm=inplace;
show create table t2;
drop temporary table t1, t2;

#
# MDEV-18083 ASAN heap-use-after-free in Field::set_warning_truncated_wrong_value upon inserting into temporary table
#
create temporary table t1 (a int);
alter table t1 add column f text;
--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
insert into t1 values ('x','foo');
drop temporary table t1;
7 changes: 7 additions & 0 deletions mysql-test/main/check.result
Original file line number Diff line number Diff line change
Expand Up @@ -95,3 +95,10 @@ Warnings:
Warning 4025 CONSTRAINT `CONSTRAINT_1` failed for `test`.`t1`
alter table t1;
drop table t1;
create temporary table t1 (a int default 0, check (a > 0));
alter table t1 drop constraint if exists non_existing_constraint;
Warnings:
Note 1091 Can't DROP CONSTRAINT `non_existing_constraint`; check that it exists
insert into t1 () values ();
ERROR 23000: CONSTRAINT `CONSTRAINT_1` failed for `test`.`t1`
drop table t1;
9 changes: 9 additions & 0 deletions mysql-test/main/check.test
Original file line number Diff line number Diff line change
Expand Up @@ -115,3 +115,12 @@ insert into t1 () values ();
alter ignore table t1 add constraint check (f > 0);
alter table t1;
drop table t1;

#
# MDEV-16905 ASAN heap-use-after-free in __interceptor_strnlen / ... / TABLE::verify_constraints upon INSERT into temporary table with CHECK constraint
#
create temporary table t1 (a int default 0, check (a > 0));
alter table t1 drop constraint if exists non_existing_constraint;
--error ER_CONSTRAINT_FAILED
insert into t1 () values ();
drop table t1;
2 changes: 1 addition & 1 deletion mysql-test/main/check_constraint.result
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ a b
103 103
set check_constraint_checks=@save_check_constraint;
alter table t1 add c int default 0 check (c < 10);
ERROR 23000: CONSTRAINT `max` failed for table
ERROR 23000: CONSTRAINT `max` failed for `test`.`t1`
set check_constraint_checks=0;
alter table t1 add c int default 0 check (c < 10);
alter table t1 add check (a+b+c < 500);
Expand Down
1 change: 0 additions & 1 deletion mysql-test/main/check_constraint.test
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ insert into t1 values (101,101),(102,102),(600,600),(103,103);
select * from t1;
set check_constraint_checks=@save_check_constraint;

--replace_regex /failed for.*/failed for table/
--error ER_CONSTRAINT_FAILED
alter table t1 add c int default 0 check (c < 10);

Expand Down
Loading

0 comments on commit 65c5ef9

Please sign in to comment.