Commit a3df9bca authored by Oleksandr Byelkin's avatar Oleksandr Byelkin

Merge branch '5.5' into 10.0

parents e6fcd723 ad220b96
......@@ -6205,6 +6205,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);
......
......@@ -174,15 +174,24 @@ MACRO (MYSQL_CHECK_SSL)
OPENSSL_MAJOR_VERSION "${OPENSSL_VERSION_NUMBER}"
)
INCLUDE(CheckSymbolExists)
INCLUDE(CheckCSourceCompiles)
SET(CMAKE_REQUIRED_INCLUDES ${OPENSSL_INCLUDE_DIR})
CHECK_SYMBOL_EXISTS(SHA512_DIGEST_LENGTH "openssl/sha.h"
HAVE_SHA512_DIGEST_LENGTH)
CHECK_C_SOURCE_COMPILES("
#include <openssl/dh.h>
int main()
{
DH dh;
return sizeof(dh.version);
}" OLD_OPENSSL_API)
SET(OPENSSL_FOUND TRUE)
ELSE()
SET(OPENSSL_FOUND FALSE)
ENDIF()
IF(OPENSSL_FOUND AND OPENSSL_MAJOR_VERSION STRLESS "101" AND
IF(OPENSSL_FOUND AND OLD_OPENSSL_API AND
HAVE_SHA512_DIGEST_LENGTH)
MESSAGE(STATUS "OPENSSL_INCLUDE_DIR = ${OPENSSL_INCLUDE_DIR}")
MESSAGE(STATUS "OPENSSL_LIBRARIES = ${OPENSSL_LIBRARIES}")
......
......@@ -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)
......@@ -51,7 +51,7 @@
#ifndef DBUG_OFF
#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)
#define TRASH_FREE(A,B) do { TRASH_FILL(A,B,0x8F); MEM_NOACCESS(A,B); } while(0)
......@@ -85,3 +85,19 @@ checksum table t1 extended;
Table Checksum
test.t1 4108368782
drop table t1;
#
# MDEV-17085: CHECKSUM TABLE EXTENDED does not work correctly
#
CREATE TABLE t1 ( c1 int NOT NULL, c2 int NOT NULL, c4 varchar(20), c5 varchar(20), c6 varchar(20), c7 varchar(20), c8 varchar(20), c9 varchar(20), c10 varchar(20), c11 varchar(20), c12 varchar(20), c13 varchar(20), c14 varchar(20), c15 varchar(20), c16 varchar(20), c19 int NOT NULL, c20 int NOT NULL, c21 varchar(20), c22 VARCHAR(20), c23 varchar(20));
insert into t1 values (5,0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,"dog",NULL,NULL);
# Important is that checksum is different from following
CHECKSUM TABLE t1 EXTENDED;
Table Checksum
test.t1 2514025256
UPDATE t1 SET c21='cat' WHERE c1=5;
# Important is that checksum is different from above
CHECKSUM TABLE t1 EXTENDED;
Table Checksum
test.t1 2326430205
drop table t1;
# End of 5.5 tests
......@@ -85,3 +85,19 @@ checksum table t1 extended;
Table Checksum
test.t1 3885665021
drop table t1;
#
# MDEV-17085: CHECKSUM TABLE EXTENDED does not work correctly
#
CREATE TABLE t1 ( c1 int NOT NULL, c2 int NOT NULL, c4 varchar(20), c5 varchar(20), c6 varchar(20), c7 varchar(20), c8 varchar(20), c9 varchar(20), c10 varchar(20), c11 varchar(20), c12 varchar(20), c13 varchar(20), c14 varchar(20), c15 varchar(20), c16 varchar(20), c19 int NOT NULL, c20 int NOT NULL, c21 varchar(20), c22 VARCHAR(20), c23 varchar(20));
insert into t1 values (5,0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,"dog",NULL,NULL);
# Important is that checksum is different from following
CHECKSUM TABLE t1 EXTENDED;
Table Checksum
test.t1 2514025256
UPDATE t1 SET c21='cat' WHERE c1=5;
# Important is that checksum is different from above
CHECKSUM TABLE t1 EXTENDED;
Table Checksum
test.t1 2326430205
drop table t1;
# End of 5.5 tests
......@@ -394,3 +394,25 @@ select null in (select a from t1 where a < out3.a union select a from t2 where
(select a from t3) +1 < out3.a+1) from t3 out3;
ERROR 21000: Subquery returns more than 1 row
drop table t1, t2, t3;
CREATE TABLE t1(
q11 int, q12 int, q13 int, q14 int, q15 int, q16 int, q17 int, q18 int, q19 int,
q21 int, q22 int, q23 int, q24 int, q25 int, q26 int, q27 int, q28 int, q29 int,
f1 int
);
CREATE TABLE t2(f2 int, f21 int, f3 timestamp, f4 int, f5 int, f6 int);
INSERT INTO t1 (f1) VALUES (1),(1),(2),(2);
INSERT INTO t2 VALUES (1,1,"2004-02-29 11:11:11",0,0,0), (2,2,"2004-02-29 11:11:11",0,0,0);
SELECT f1,
(SELECT t.f21 from t2 t where max(
q11+q12+q13+q14+q15+q16+q17+q18+q19+
q21+q22+q23+q24+q25+q26+q27+q28+q29) = t.f2 UNION
SELECT t.f3 FROM t2 AS t WHERE t1.f1=t.f2 AND t.f3=MAX(t1.f1) UNION
SELECT 1 LIMIT 1) AS test
FROM t1 GROUP BY f1;
f1 test
1 1
2 1
Warnings:
Warning 1292 Incorrect datetime value: '1'
Warning 1292 Incorrect datetime value: '2'
DROP TABLE t1,t2;
......@@ -60,3 +60,20 @@ checksum table t1;
checksum table t1 quick;
checksum table t1 extended;
drop table t1;
--echo #
--echo # MDEV-17085: CHECKSUM TABLE EXTENDED does not work correctly
--echo #
CREATE TABLE t1 ( c1 int NOT NULL, c2 int NOT NULL, c4 varchar(20), c5 varchar(20), c6 varchar(20), c7 varchar(20), c8 varchar(20), c9 varchar(20), c10 varchar(20), c11 varchar(20), c12 varchar(20), c13 varchar(20), c14 varchar(20), c15 varchar(20), c16 varchar(20), c19 int NOT NULL, c20 int NOT NULL, c21 varchar(20), c22 VARCHAR(20), c23 varchar(20));
insert into t1 values (5,0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,"dog",NULL,NULL);
--echo # Important is that checksum is different from following
CHECKSUM TABLE t1 EXTENDED;
UPDATE t1 SET c21='cat' WHERE c1=5;
--echo # Important is that checksum is different from above
CHECKSUM TABLE t1 EXTENDED;
drop table t1;
--echo # End of 5.5 tests
......@@ -411,3 +411,23 @@ insert into t3 select a from t1;
select null in (select a from t1 where a < out3.a union select a from t2 where
(select a from t3) +1 < out3.a+1) from t3 out3;
drop table t1, t2, t3;
#
# Bug #28499924: INCORRECT BEHAVIOR WITH UNION IN SUBQUERY
#
CREATE TABLE t1(
q11 int, q12 int, q13 int, q14 int, q15 int, q16 int, q17 int, q18 int, q19 int,
q21 int, q22 int, q23 int, q24 int, q25 int, q26 int, q27 int, q28 int, q29 int,
f1 int
);
CREATE TABLE t2(f2 int, f21 int, f3 timestamp, f4 int, f5 int, f6 int);
INSERT INTO t1 (f1) VALUES (1),(1),(2),(2);
INSERT INTO t2 VALUES (1,1,"2004-02-29 11:11:11",0,0,0), (2,2,"2004-02-29 11:11:11",0,0,0);
SELECT f1,
(SELECT t.f21 from t2 t where max(
q11+q12+q13+q14+q15+q16+q17+q18+q19+
q21+q22+q23+q24+q25+q26+q27+q28+q29) = t.f2 UNION
SELECT t.f3 FROM t2 AS t WHERE t1.f1=t.f2 AND t.f3=MAX(t1.f1) UNION
SELECT 1 LIMIT 1) AS test
FROM t1 GROUP BY f1;
DROP TABLE t1,t2;
......@@ -36,6 +36,9 @@ in_rpm=0
ip_only=0
cross_bootstrap=0
dirname0=`dirname $0 2>/dev/null`
dirname0=`dirname $dirname0 2>/dev/null`
usage()
{
cat <<EOF
......@@ -207,11 +210,6 @@ cannot_find_file()
done
fi
echo
echo "If you compiled from source, you need to either run 'make install' to"
echo "copy the software into the correct location ready for operation."
echo "If you don't want to do a full install, you can use the --srcdir"
echo "option to only install the mysql database and privilege tables"
echo
echo "If you compiled from source, you need to either run 'make install' to"
echo "copy the software into the correct location ready for operation."
......@@ -258,6 +256,9 @@ then
cannot_find_file my_print_defaults $basedir/bin $basedir/extra
exit 1
fi
elif test -n "$dirname0" -a -x "$dirname0/@bindir@/my_print_defaults"
then
print_defaults="$dirname0/@bindir@/my_print_defaults"
else
print_defaults="@bindir@/my_print_defaults"
fi
......@@ -309,6 +310,14 @@ then
cannot_find_file fill_help_tables.sql @pkgdata_locations@
exit 1
fi
# relative from where the script was run for a relocatable install
elif test -n "$dirname0" -a -x "$dirname0/@INSTALL_SBINDIR@/mysqld"
then
basedir="$dirname0"
bindir="$basedir/@INSTALL_SBINDIR@"
resolveip="$bindir/resolveip"
mysqld="$basedir/@INSTALL_SBINDIR@/mysqld"
pkgdatadir="$basedir/@INSTALL_MYSQLSHAREDIR@"
else
basedir="@prefix@"
bindir="@bindir@"
......
......@@ -426,7 +426,7 @@ IF(WIN32)
COMPONENT Server
)
SET_TARGET_PROPERTIES(mysql_install_db PROPERTIES COMPILE_FLAGS -DINSTALL_PLUGINDIR=${INSTALL_PLUGINDIR})
TARGET_LINK_LIBRARIES(mysql_install_db mysys)
TARGET_LINK_LIBRARIES(mysql_install_db mysys shlwapi)
ADD_LIBRARY(winservice STATIC winservice.c)
TARGET_LINK_LIBRARIES(winservice shell32)
......
/* Copyright (c) 2000, 2016, Oracle and/or its affiliates.
Copyright (c) 2009, 2017, MariaDB
/* Copyright (c) 2000, 2018, Oracle and/or its affiliates.
Copyright (c) 2009, 2019, 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
......@@ -3758,7 +3758,7 @@ int MYSQL_BIN_LOG::find_log_pos(LOG_INFO *linfo, const char *log_name,
// if the log entry matches, null string matching anything
if (!log_name ||
(log_name_len == fname_len-1 && full_fname[log_name_len] == '\n' &&
!memcmp(full_fname, full_log_name, log_name_len)))
!strncmp(full_fname, full_log_name, log_name_len)))
{
DBUG_PRINT("info", ("Found log file entry"));
full_fname[fname_len-1]= 0; // remove last \n
......
......@@ -27,6 +27,8 @@
#include <shellapi.h>
#include <accctrl.h>
#include <aclapi.h>
struct IUnknown;
#include <shlwapi.h>
#define USAGETEXT \
"mysql_install_db.exe Ver 1.00 for Windows\n" \
......@@ -549,20 +551,78 @@ static int create_db_instance()
DWORD cwd_len= MAX_PATH;
char cmdline[3*MAX_PATH];
FILE *in;
bool cleanup_datadir= true;
DWORD last_error;
verbose("Running bootstrap");
GetCurrentDirectory(cwd_len, cwd);
CreateDirectory(opt_datadir, NULL); /*ignore error, it might already exist */
/* Create datadir and datadir/mysql, if they do not already exist. */
if (!CreateDirectory(opt_datadir, NULL) && (GetLastError() != ERROR_ALREADY_EXISTS))
{
last_error = GetLastError();
switch(last_error)
{
case ERROR_ACCESS_DENIED:
die("Can't create data directory '%s' (access denied)\n",
opt_datadir);
break;
case ERROR_PATH_NOT_FOUND:
die("Can't create data directory '%s' "
"(one or more intermediate directories do not exist)\n",
opt_datadir);
break;
default:
die("Can't create data directory '%s', last error %u\n",
opt_datadir, last_error);
break;
}
}
if (!SetCurrentDirectory(opt_datadir))
{
die("Cannot set current directory to '%s'\n",opt_datadir);
return -1;
last_error = GetLastError();
switch (last_error)
{
case ERROR_DIRECTORY:
die("Can't set current directory to '%s', the path is not a valid directory \n",
opt_datadir);
break;
default:
die("Can' set current directory to '%s', last error %u\n",
opt_datadir, last_error);
break;
}
}
if (PathIsDirectoryEmpty(opt_datadir))
{
cleanup_datadir= false;
}
CreateDirectory("mysql",NULL);
CreateDirectory("test", NULL);
if (!CreateDirectory("mysql",NULL))
{
last_error = GetLastError();
DWORD attributes;
switch(last_error)
{
case ERROR_ACCESS_DENIED:
die("Can't create subdirectory 'mysql' in '%s' (access denied)\n",opt_datadir);
break;
case ERROR_ALREADY_EXISTS:
attributes = GetFileAttributes("mysql");
if (attributes == INVALID_FILE_ATTRIBUTES)
die("GetFileAttributes() failed for existing file '%s\\mysql', last error %u",
opt_datadir, GetLastError());
else if (!(attributes & FILE_ATTRIBUTE_DIRECTORY))
die("File '%s\\mysql' exists, but it is not a directory", opt_datadir);
break;
}
}
/*
Set data directory permissions for both current user and
......@@ -675,7 +735,7 @@ static int create_db_instance()
}
end:
if (ret)
if (ret && cleanup_datadir)
{
SetCurrentDirectory(cwd);
clean_directory(opt_datadir);
......
/* Copyright (c) 2000, 2017, Oracle and/or its affiliates.
Copyright (c) 2008, 2017, MariaDB Corporation
/* Copyright (c) 2000, 2018, Oracle and/or its affiliates.
Copyright (c) 2008, 2019, 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
......@@ -481,7 +481,7 @@ bool log_in_use(const char* log_name)
if ((linfo = tmp->current_linfo))
{
mysql_mutex_lock(&linfo->lock);
result = !memcmp(log_name, linfo->log_file_name, log_name_len);
result = !strncmp(log_name, linfo->log_file_name, log_name_len);
mysql_mutex_unlock(&linfo->lock);
if (result)
break;
......
......@@ -9878,7 +9878,10 @@ bool mysql_checksum_table(THD *thd, TABLE_LIST *tables,
{
/* calculating table's checksum */
ha_checksum crc= 0;
uchar null_mask=256 - (1 << t->s->last_null_bit_pos);
DBUG_ASSERT(t->s->last_null_bit_pos < 8);
uchar null_mask= (t->s->last_null_bit_pos ?
(256 - (1 << t->s->last_null_bit_pos)):
0);
t->use_all_columns();
......
......@@ -15776,19 +15776,21 @@ subselect_end:
lex->current_select = lex->current_select->return_after_parsing();
lex->nest_level--;
lex->current_select->n_child_sum_items += child->n_sum_items;
/*
A subselect can add fields to an outer select. Reserve space for
them.
*/
lex->current_select->select_n_where_fields+=
child->select_n_where_fields;
/*
Aggregate functions in having clause may add fields to an outer
select. Count them also.
A subquery (and all the subsequent query blocks in a UNION) can
add columns to an outer query block. Reserve space for them.
Aggregate functions in having clause can also add fields to an
outer select.
*/
lex->current_select->select_n_having_items+=
child->select_n_having_items;
for (SELECT_LEX *temp= child->master_unit()->first_select();
temp != NULL; temp= temp->next_select())
{
lex->current_select->select_n_where_fields+=
temp->select_n_where_fields;
lex->current_select->select_n_having_items+=
temp->select_n_having_items;
}
}
;
......
......@@ -181,7 +181,11 @@ fi
user='@MYSQLD_USER@'
su_kill() {
su - $user -s /bin/sh -c "kill $*" >/dev/null 2>&1
if test "$USER" = "$user"; then
kill $* >/dev/null 2>&1
else
su - $user -s /bin/sh -c "kill $*" >/dev/null 2>&1
fi
}
#
......
......@@ -34,7 +34,7 @@ void test_concurrently(const char *test, pthread_handler handler, int n, int m)
bad= 0;
diag("Testing %s with %d threads, %d iterations... ", test, n, m);
for (i= n; i; i--)
for (i= 0; i < n; i++)
{
if (pthread_create(&threads[i], 0, handler, &m) != 0)
{
......@@ -43,7 +43,7 @@ void test_concurrently(const char *test, pthread_handler handler, int n, int m)
}
}
for (i= n; i; i--)
for (i= 0; i < n; i++)
pthread_join(threads[i], 0);
now= my_interval_timer() - now;
......
SET(HEIDISQL_BASE_NAME "HeidiSQL_9.4_Portable")
SET(HEIDISQL_BASE_NAME "HeidiSQL_9.5_Portable")
SET(HEIDISQL_ZIP "${HEIDISQL_BASE_NAME}.zip")
SET(HEIDISQL_URL "http://www.heidisql.com/downloads/releases/${HEIDISQL_ZIP}")
SET(HEIDISQL_DOWNLOAD_DIR ${THIRD_PARTY_DOWNLOAD_LOCATION}/${HEIDISQL_BASE_NAME})
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment