Commit 5f35e103 authored by Marko Mäkelä's avatar Marko Mäkelä

Merge 10.1 into 10.2

parents 9cd6e7ad 4ba20e0a
......@@ -121,6 +121,7 @@ ENDIF()
IF(UNIX)
SET(WITH_EXTRA_CHARSETS all CACHE STRING "")
SET(PLUGIN_AUTH_PAM YES)
IF(CMAKE_SYSTEM_NAME STREQUAL "Linux")
IF(NOT IGNORE_AIO_CHECK)
......
......@@ -37,7 +37,8 @@ IF(CMAKE_VERSION VERSION_LESS "3.6.0")
SET(CPACK_PACKAGE_FILE_NAME "${CPACK_RPM_PACKAGE_NAME}-${VERSION}-${RPM}-${CMAKE_SYSTEM_PROCESSOR}")
ELSE()
SET(CPACK_RPM_FILE_NAME "RPM-DEFAULT")
SET(CPACK_RPM_DEBUGINFO_PACKAGE ON CACHE INTERNAL "")
OPTION(CPACK_RPM_DEBUGINFO_PACKAGE "" ON)
MARK_AS_ADVANCED(CPACK_RPM_DEBUGINFO_PACKAGE)
ENDIF()
SET(CPACK_RPM_PACKAGE_RELEASE "1%{?dist}")
......
......@@ -120,7 +120,7 @@ longlong number_to_datetime(longlong nr, ulong sec_part, MYSQL_TIME *time_res,
static inline
longlong double_to_datetime(double nr, MYSQL_TIME *ltime, uint flags, int *cut)
{
if (nr < 0 || nr > LONGLONG_MAX)
if (nr < 0 || nr > (double)LONGLONG_MAX)
nr= (double)LONGLONG_MAX;
return number_to_datetime((longlong) floor(nr),
(ulong)((nr-floor(nr))*TIME_SECOND_PART_FACTOR),
......
......@@ -150,16 +150,16 @@ RESET MASTER;
--echo # Test case for DROP query.
--connection default
CREATE TABLE t1 (a INT) ENGINE=INNODB;
CREATE TABLE t2 (a INT) ENGINE=INNODB;
--connection con1
CREATE TEMPORARY TABLE t1 (b BLOB) ENGINE=INNODB;
CREATE TEMPORARY TABLE t2 (b BLOB) ENGINE=INNODB;
--connection default
DROP TABLE t1;
DROP TABLE t2;
--connection con1
DROP TABLE t1;
DROP TABLE t2;
--connection default
--exec $MYSQL_BINLOG --force-if-open $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/bug28642318.sql
......
......@@ -863,12 +863,14 @@ SELECT group_concat(d1/(CASE 'b' WHEN 'j' THEN 'c' END))
FROM v1 GROUP BY greatest(pk, 0, d2);
group_concat(d1/(CASE 'b' WHEN 'j' THEN 'c' END))
NULL
NULL
Warnings:
Warning 1292 Incorrect datetime value: '1' for column `test`.`t1`.`pk` at row 1
Warning 1292 Incorrect datetime value: '2' for column `test`.`t1`.`pk` at row 1
Warning 1292 Incorrect datetime value: '1' for column `test`.`t1`.`pk` at row 1
Warning 1292 Incorrect datetime value: '1' for column `test`.`t1`.`pk` at row 1
Warning 1292 Incorrect datetime value: '2' for column `test`.`t1`.`pk` at row 2
Warning 1292 Incorrect datetime value: '2' for column `test`.`t1`.`pk` at row 2
CREATE TABLE t2 AS SELECT greatest(pk, 0, d2) AS c1 FROM t1 LIMIT 0;
SHOW CREATE TABLE t2;
Table Create Table
......@@ -879,5 +881,36 @@ DROP TABLE t2;
DROP VIEW v1;
DROP TABLE t1;
#
# MDEV-19699 Server crashes in Item_null_result::field_type upon SELECT with ROLLUP on constant table
#
CREATE TABLE t1 (d DATE) ENGINE=MyISAM;
INSERT INTO t1 VALUES ('1999-11-04');
SELECT d FROM t1 GROUP BY d WITH ROLLUP HAVING d > '1990-01-01';
d
1999-11-04
DROP TABLE t1;
#
# MDEV-20431 GREATEST(int_col,date_col) returns wrong results in a view
#
CREATE TABLE t1 (pk INT NOT NULL, d DATE NOT NULL);
CREATE VIEW v1 AS SELECT * FROM t1;
INSERT INTO t1 VALUES (1,'2018-06-22'),(2,'2018-07-11');
SELECT GREATEST(pk, d) FROM t1;
GREATEST(pk, d)
2018-06-22
2018-07-11
Warnings:
Warning 1292 Incorrect datetime value: '1' for column `test`.`t1`.`pk` at row 1
Warning 1292 Incorrect datetime value: '2' for column `test`.`t1`.`pk` at row 2
SELECT GREATEST(pk, d) FROM v1;
GREATEST(pk, d)
2018-06-22
2018-07-11
Warnings:
Warning 1292 Incorrect datetime value: '1' for column `test`.`t1`.`pk` at row 1
Warning 1292 Incorrect datetime value: '2' for column `test`.`t1`.`pk` at row 2
DROP VIEW v1;
DROP TABLE t1;
#
# End of 10.1 tests
#
......@@ -1167,6 +1167,37 @@ INSERT INTO t2 SELECT * FROM t1;
DROP TABLE t1, t2;
SET SQL_MODE=DEFAULT;
#
# MDEV-19699 Server crashes in Item_null_result::field_type upon SELECT with ROLLUP on constant table
#
CREATE TABLE t1 (d DATETIME) ENGINE=MyISAM;
INSERT INTO t1 VALUES ('1999-11-04');
SELECT d FROM t1 GROUP BY d WITH ROLLUP HAVING d > '1990-01-01';
d
1999-11-04 00:00:00
DROP TABLE t1;
#
# MDEV-20431 GREATEST(int_col,date_col) returns wrong results in a view
#
CREATE TABLE t1 (pk INT NOT NULL, d DATETIME NOT NULL);
CREATE VIEW v1 AS SELECT * FROM t1;
INSERT INTO t1 VALUES (1,'2018-06-22 00:00:00'),(2,'2018-07-11 00:00:00');
SELECT GREATEST(pk, d) FROM t1;
GREATEST(pk, d)
2018-06-22 00:00:00
2018-07-11 00:00:00
Warnings:
Warning 1292 Incorrect datetime value: '1' for column `test`.`t1`.`pk` at row 1
Warning 1292 Incorrect datetime value: '2' for column `test`.`t1`.`pk` at row 2
SELECT GREATEST(pk, d) FROM v1;
GREATEST(pk, d)
2018-06-22 00:00:00
2018-07-11 00:00:00
Warnings:
Warning 1292 Incorrect datetime value: '1' for column `test`.`t1`.`pk` at row 1
Warning 1292 Incorrect datetime value: '2' for column `test`.`t1`.`pk` at row 2
DROP VIEW v1;
DROP TABLE t1;
#
# End of 10.1 tests
#
#
......
......@@ -88,13 +88,13 @@ DROP TABLE IF EXISTS t1;
RESET MASTER;
# Test case for DROP query.
connection default;
CREATE TABLE t1 (a INT) ENGINE=INNODB;
CREATE TABLE t2 (a INT) ENGINE=INNODB;
connection con1;
CREATE TEMPORARY TABLE t1 (b BLOB) ENGINE=INNODB;
CREATE TEMPORARY TABLE t2 (b BLOB) ENGINE=INNODB;
connection default;
DROP TABLE t1;
DROP TABLE t2;
connection con1;
DROP TABLE t1;
DROP TABLE t2;
connection default;
# DROP table query fails with unknown table error without patch.
# Clean up
......
......@@ -116,13 +116,13 @@ DROP TABLE IF EXISTS t1;
RESET MASTER;
# Test case for DROP query.
connection default;
CREATE TABLE t1 (a INT) ENGINE=INNODB;
CREATE TABLE t2 (a INT) ENGINE=INNODB;
connection con1;
CREATE TEMPORARY TABLE t1 (b BLOB) ENGINE=INNODB;
CREATE TEMPORARY TABLE t2 (b BLOB) ENGINE=INNODB;
connection default;
DROP TABLE t1;
DROP TABLE t2;
connection con1;
DROP TABLE t1;
DROP TABLE t2;
connection default;
# DROP table query fails with unknown table error without patch.
# Clean up
......
......@@ -600,6 +600,30 @@ DROP TABLE t2;
DROP VIEW v1;
DROP TABLE t1;
--echo #
--echo # MDEV-19699 Server crashes in Item_null_result::field_type upon SELECT with ROLLUP on constant table
--echo #
CREATE TABLE t1 (d DATE) ENGINE=MyISAM;
INSERT INTO t1 VALUES ('1999-11-04');
SELECT d FROM t1 GROUP BY d WITH ROLLUP HAVING d > '1990-01-01';
DROP TABLE t1;
--echo #
--echo # MDEV-20431 GREATEST(int_col,date_col) returns wrong results in a view
--echo #
CREATE TABLE t1 (pk INT NOT NULL, d DATE NOT NULL);
CREATE VIEW v1 AS SELECT * FROM t1;
INSERT INTO t1 VALUES (1,'2018-06-22'),(2,'2018-07-11');
SELECT GREATEST(pk, d) FROM t1;
SELECT GREATEST(pk, d) FROM v1;
DROP VIEW v1;
DROP TABLE t1;
--echo #
--echo # End of 10.1 tests
--echo #
......@@ -724,6 +724,29 @@ DROP TABLE t1, t2;
SET SQL_MODE=DEFAULT;
--echo #
--echo # MDEV-19699 Server crashes in Item_null_result::field_type upon SELECT with ROLLUP on constant table
--echo #
CREATE TABLE t1 (d DATETIME) ENGINE=MyISAM;
INSERT INTO t1 VALUES ('1999-11-04');
SELECT d FROM t1 GROUP BY d WITH ROLLUP HAVING d > '1990-01-01';
DROP TABLE t1;
--echo #
--echo # MDEV-20431 GREATEST(int_col,date_col) returns wrong results in a view
--echo #
CREATE TABLE t1 (pk INT NOT NULL, d DATETIME NOT NULL);
CREATE VIEW v1 AS SELECT * FROM t1;
INSERT INTO t1 VALUES (1,'2018-06-22 00:00:00'),(2,'2018-07-11 00:00:00');
SELECT GREATEST(pk, d) FROM t1;
SELECT GREATEST(pk, d) FROM v1;
DROP VIEW v1;
DROP TABLE t1;
--echo #
--echo # End of 10.1 tests
--echo #
......
......@@ -166,7 +166,11 @@ case "$1" in
shift
while [ $# -gt 0 ]; do
option=${1%%=*}
if [ "$option" != "--defaults-file" ]; then
if [[ "$option" != "--defaults-file" && \
"$option" != "--defaults-extra-file" && \
"$option" != "--defaults-group-suffix" && \
"$option" != "--port" && \
"$option" != "--socket" ]]; then
value=${1#*=}
case "$option" in
'--innodb-data-home-dir')
......@@ -193,7 +197,7 @@ case "$1" in
if [ -z "$original_cmd" ]; then
original_cmd="$1"
else
original_cmd+=" $1"
original_cmd="$original_cmd $1"
fi
fi
shift
......@@ -249,7 +253,15 @@ else
MY_PRINT_DEFAULTS=$(which my_print_defaults)
fi
readonly WSREP_SST_OPT_CONF="$WSREP_SST_OPT_DEFAULT $WSREP_SST_OPT_EXTRA_DEFAULT $WSREP_SST_OPT_SUFFIX_DEFAULT"
wsrep_defaults="$WSREP_SST_OPT_DEFAULT"
if [ -n "$wsrep_defaults" ]; then
wsrep_defaults="$wsrep_defaults "
fi
wsrep_defaults="$wsrep_defaults$WSREP_SST_OPT_EXTRA_DEFAULT"
if [ -n "$wsrep_defaults" ]; then
wsrep_defaults="$wsrep_defaults "
fi
readonly WSREP_SST_OPT_CONF="$wsrep_defaults$WSREP_SST_OPT_SUFFIX_DEFAULT"
readonly MY_PRINT_DEFAULTS="$MY_PRINT_DEFAULTS $WSREP_SST_OPT_CONF"
wsrep_auth_not_set()
......
......@@ -130,7 +130,7 @@ get_keys()
if [[ $encrypt -eq 0 ]];then
if $MY_PRINT_DEFAULTS xtrabackup | grep -q encrypt;then
wsrep_log_error "Unexpected option combination. SST may fail. Refer to http://www.percona.com/doc/percona-xtradb-cluster/manual/xtrabackup_sst.html "
wsrep_log_error "Unexpected option combination. SST may fail. Refer to http://www.percona.com/doc/percona-xtradb-cluster/manual/xtrabackup_sst.html"
fi
return
fi
......@@ -465,7 +465,7 @@ cleanup_donor()
if [[ -n ${XTRABACKUP_PID:-} ]];then
if check_pid $XTRABACKUP_PID
then
wsrep_log_error "xtrabackup process is still running. Killing... "
wsrep_log_error "xtrabackup process is still running. Killing..."
kill_xtrabackup
fi
......@@ -567,7 +567,7 @@ check_extra()
# Xtrabackup works only locally.
# Hence, setting host to 127.0.0.1 unconditionally.
wsrep_log_info "SST through extra_port $eport"
INNOEXTRA+=" --host=127.0.0.1 --port=$eport "
INNOEXTRA+=" --host=127.0.0.1 --port=$eport"
use_socket=0
else
wsrep_log_error "Extra port $eport null, failing"
......@@ -577,8 +577,8 @@ check_extra()
wsrep_log_info "Thread pool not set, ignore the option use_extra"
fi
fi
if [[ $use_socket -eq 1 ]] && [[ -n "${WSREP_SST_OPT_SOCKET}" ]];then
INNOEXTRA+=" --socket=${WSREP_SST_OPT_SOCKET}"
if [[ $use_socket -eq 1 ]] && [[ -n "$WSREP_SST_OPT_SOCKET" ]];then
INNOEXTRA+=" --socket=$WSREP_SST_OPT_SOCKET"
fi
}
......@@ -744,8 +744,8 @@ if [[ $ssyslog -eq 1 ]];then
logger -p daemon.info -t ${ssystag}wsrep-sst-$WSREP_SST_OPT_ROLE "$@"
}
INNOAPPLY="${INNOBACKUPEX_BIN} --innobackupex $disver $iapts \$INNOEXTRA --apply-log \$rebuildcmd \${DATA} 2>&1 | logger -p daemon.err -t ${ssystag}innobackupex-apply "
INNOMOVE="${INNOBACKUPEX_BIN} --innobackupex ${WSREP_SST_OPT_CONF} $disver $impts --move-back --force-non-empty-directories \${DATA} 2>&1 | logger -p daemon.err -t ${ssystag}innobackupex-move "
INNOAPPLY="${INNOBACKUPEX_BIN} --innobackupex $disver $iapts \$INNOEXTRA --apply-log \$rebuildcmd \${DATA} 2>&1 | logger -p daemon.err -t ${ssystag}innobackupex-apply"
INNOMOVE="${INNOBACKUPEX_BIN} --innobackupex ${WSREP_SST_OPT_CONF} $disver $impts --move-back --force-non-empty-directories \${DATA} 2>&1 | logger -p daemon.err -t ${ssystag}innobackupex-move"
INNOBACKUP="${INNOBACKUPEX_BIN} --innobackupex ${WSREP_SST_OPT_CONF} $disver $iopts \$tmpopts \$INNOEXTRA --galera-info --stream=\$sfmt \$itmpdir 2> >(logger -p daemon.err -t ${ssystag}innobackupex-backup)"
fi
......@@ -833,7 +833,7 @@ then
-z $(parse_cnf --mysqld tmpdir "") && \
-z $(parse_cnf xtrabackup tmpdir "") ]]; then
xtmpdir=$(mktemp -d)
tmpopts=" --tmpdir=$xtmpdir "
tmpopts=" --tmpdir=$xtmpdir"
wsrep_log_info "Using $xtmpdir as xtrabackup temporary directory"
fi
......@@ -855,13 +855,12 @@ then
get_keys
if [[ $encrypt -eq 1 ]];then
if [[ -n $ekey ]];then
INNOEXTRA+=" --encrypt=$ealgo --encrypt-key=$ekey "
INNOEXTRA+=" --encrypt=$ealgo --encrypt-key=$ekey"
else
INNOEXTRA+=" --encrypt=$ealgo --encrypt-key-file=$ekeyfile "
INNOEXTRA+=" --encrypt=$ealgo --encrypt-key-file=$ekeyfile"
fi
fi
check_extra
wsrep_log_info "Streaming GTID file before SST"
......@@ -882,7 +881,6 @@ then
tcmd=" $scomp | $tcmd "
fi
send_donor $DATA "${stagemsg}-gtid"
tcmd="$ttcmd"
......
......@@ -675,7 +675,7 @@ check_extra()
# Xtrabackup works only locally.
# Hence, setting host to 127.0.0.1 unconditionally.
wsrep_log_info "SST through extra_port $eport"
INNOEXTRA+=" --host=127.0.0.1 --port=$eport "
INNOEXTRA+=" --host=127.0.0.1 --port=$eport"
use_socket=0
else
wsrep_log_error "Extra port $eport null, failing"
......@@ -685,8 +685,8 @@ check_extra()
wsrep_log_info "Thread pool not set, ignore the option use_extra"
fi
fi
if [[ $use_socket -eq 1 ]] && [[ -n "${WSREP_SST_OPT_SOCKET}" ]];then
INNOEXTRA+=" --socket=${WSREP_SST_OPT_SOCKET}"
if [[ $use_socket -eq 1 ]] && [[ -n "$WSREP_SST_OPT_SOCKET" ]];then
INNOEXTRA+=" --socket=$WSREP_SST_OPT_SOCKET"
fi
}
......@@ -906,7 +906,10 @@ if [ ! -z "$INNODB_DATA_HOME_DIR_ARG" ]; then
fi
# if INNODB_DATA_HOME_DIR env. variable is not set, try to get it from my.cnf
if [ -z "$INNODB_DATA_HOME_DIR" ]; then
INNODB_DATA_HOME_DIR=$(parse_cnf --mysqld innodb-data-home-dir "")
INNODB_DATA_HOME_DIR=$(parse_cnf mysqld$WSREP_SST_OPT_SUFFIX_VALUE innodb-data-home-dir '')
fi
if [ -z "$INNODB_DATA_HOME_DIR" ]; then
INNODB_DATA_HOME_DIR=$(parse_cnf --mysqld innodb-data-home-dir '')
fi
if [ ! -z "$INNODB_DATA_HOME_DIR" ]; then
INNOEXTRA+=" --innodb-data-home-dir=$INNODB_DATA_HOME_DIR"
......@@ -937,9 +940,11 @@ then
exit 93
fi
if [[ -z $(parse_cnf --mysqld tmpdir "") && -z $(parse_cnf xtrabackup tmpdir "") ]];then
if [[ -z $(parse_cnf mysqld$WSREP_SST_OPT_SUFFIX_VALUE tmpdir "") && \
-z $(parse_cnf --mysqld tmpdir "") && \
-z $(parse_cnf xtrabackup tmpdir "") ]]; then
xtmpdir=$(mktemp -d)
tmpopts=" --tmpdir=$xtmpdir "
tmpopts=" --tmpdir=$xtmpdir"
wsrep_log_info "Using $xtmpdir as xtrabackup temporary directory"
fi
......@@ -1057,8 +1062,24 @@ then
[[ -n $SST_PROGRESS_FILE ]] && touch $SST_PROGRESS_FILE
ib_home_dir=$INNODB_DATA_HOME_DIR
# Try to set ib_log_dir from the command line:
ib_log_dir=$INNODB_LOG_GROUP_HOME_ARG
if [ -z "$ib_log_dir" ]; then
ib_log_dir=$(parse_cnf mysqld$WSREP_SST_OPT_SUFFIX_VALUE innodb-log-group-home-dir "")
fi
if [ -z "$ib_log_dir" ]; then
ib_log_dir=$(parse_cnf --mysqld innodb-log-group-home-dir "")
fi
# Try to set ib_undo_dir from the command line:
ib_undo_dir=$INNODB_UNDO_DIR_ARG
if [ -z "$ib_undo_dir" ]; then
ib_undo_dir=$(parse_cnf mysqld$WSREP_SST_OPT_SUFFIX_VALUE innodb-undo-directory "")
fi
if [ -z "$ib_undo_dir" ]; then
ib_undo_dir=$(parse_cnf --mysqld innodb-undo-directory "")
fi
stagemsg="Joiner-Recv"
......@@ -1124,7 +1145,13 @@ then
find $ib_home_dir $ib_log_dir $ib_undo_dir $DATA -mindepth 1 -prune -regex $cpat -o -exec rm -rfv {} 1>&2 \+
fi
tempdir=$LOG_BIN_ARG
if [ -z "$tempdir" ]; then
tempdir=$(parse_cnf mysqld$WSREP_SST_OPT_SUFFIX_VALUE log-bin "")
fi
if [ -z "$tempdir" ]; then
tempdir=$(parse_cnf --mysqld log-bin "")
fi
if [[ -n ${tempdir:-} ]];then
binlog_dir=$(dirname $tempdir)
binlog_file=$(basename $tempdir)
......
......@@ -380,7 +380,7 @@ check_extra()
# Xtrabackup works only locally.
# Hence, setting host to 127.0.0.1 unconditionally.
wsrep_log_info "SST through extra_port $eport"
INNOEXTRA+=" --host=127.0.0.1 --port=$eport "
INNOEXTRA+=" --host=127.0.0.1 --port=$eport"
use_socket=0
else
wsrep_log_error "Extra port $eport null, failing"
......@@ -390,8 +390,8 @@ check_extra()
wsrep_log_info "Thread pool not set, ignore the option use_extra"
fi
fi
if [[ $use_socket -eq 1 ]] && [[ -n "${WSREP_SST_OPT_SOCKET}" ]];then
INNOEXTRA+=" --socket=${WSREP_SST_OPT_SOCKET}"
if [[ $use_socket -eq 1 ]] && [[ -n "$WSREP_SST_OPT_SOCKET" ]];then
INNOEXTRA+=" --socket=$WSREP_SST_OPT_SOCKET"
fi
}
......@@ -439,14 +439,14 @@ then
get_keys
if [[ $encrypt -eq 1 ]];then
if [[ -n $ekey ]];then
INNOEXTRA+=" --encrypt=$ealgo --encrypt-key=$ekey "
INNOEXTRA+=" --encrypt=$ealgo --encrypt-key=$ekey"
else
INNOEXTRA+=" --encrypt=$ealgo --encrypt-key-file=$ekeyfile "
INNOEXTRA+=" --encrypt=$ealgo --encrypt-key-file=$ekeyfile"
fi
fi
if [[ -n $lsn ]];then
INNOEXTRA+=" --incremental --incremental-lsn=$lsn "
INNOEXTRA+=" --incremental --incremental-lsn=$lsn"
fi
check_extra
......
......@@ -3400,6 +3400,20 @@ my_decimal *Item_null::val_decimal(my_decimal *decimal_value)
}
longlong Item_null::val_datetime_packed()
{
null_value= true;
return 0;
}
longlong Item_null::val_time_packed()
{
null_value= true;
return 0;
}
bool Item_null::get_date(MYSQL_TIME *ltime, ulonglong fuzzydate)
{
// following assert is redundant, because fixed=1 assigned in constructor
......@@ -7997,6 +8011,24 @@ bool Item_ref::get_date(MYSQL_TIME *ltime,ulonglong fuzzydate)
}
longlong Item_ref::val_datetime_packed()
{
DBUG_ASSERT(fixed);
longlong tmp= (*ref)->val_datetime_packed();
null_value= (*ref)->null_value;
return tmp;
}
longlong Item_ref::val_time_packed()
{
DBUG_ASSERT(fixed);
longlong tmp= (*ref)->val_time_packed();
null_value= (*ref)->null_value;
return tmp;
}
my_decimal *Item_ref::val_decimal(my_decimal *decimal_value)
{
my_decimal *val= (*ref)->val_decimal_result(decimal_value);
......
......@@ -2869,6 +2869,8 @@ class Item_null :public Item_basic_constant
String *val_str(String *str);
my_decimal *val_decimal(my_decimal *);
bool get_date(MYSQL_TIME *ltime, ulonglong fuzzydate);
longlong val_datetime_packed();
longlong val_time_packed();
int save_in_field(Field *field, bool no_conversions);
int save_safe_in_field(Field *field);
bool send(Protocol *protocol, String *str);
......@@ -4389,6 +4391,8 @@ class Item_ref :public Item_ident
String *val_str(String* tmp);
bool is_null();
bool get_date(MYSQL_TIME *ltime, ulonglong fuzzydate);
longlong val_datetime_packed();
longlong val_time_packed();
double val_result();
longlong val_int_result();
String *str_result(String* tmp);
......
This diff is collapsed.
......@@ -1317,7 +1317,7 @@ char *ha_connect::GetRealString(PCSZ s)
{
char *sv;
if (IsPartitioned() && s && partname && *partname) {
if (IsPartitioned() && s && *partname) {
sv= (char*)PlugSubAlloc(xp->g, NULL, 0);
sprintf(sv, s, partname);
PlugSubAlloc(xp->g, NULL, strlen(sv) + 1);
......
......@@ -1265,7 +1265,6 @@ find_or_create_file(PFS_thread *thread, PFS_file_class *klass,
char dirbuffer[FN_REFLEN];
size_t dirlen;
const char *normalized_filename;
int normalized_length;
dirlen= dirname_length(safe_filename);
if (dirlen == 0)
......@@ -1296,7 +1295,7 @@ find_or_create_file(PFS_thread *thread, PFS_file_class *klass,
*buf_end= '\0';
normalized_filename= buffer;
normalized_length= strlen(normalized_filename);
size_t normalized_length= strlen(normalized_filename);
PFS_file **entry;
uint retry_count= 0;
......@@ -1345,7 +1344,7 @@ find_or_create_file(PFS_thread *thread, PFS_file_class *klass,
pfs->m_class= klass;
pfs->m_enabled= klass->m_enabled && flag_global_instrumentation;
pfs->m_timed= klass->m_timed;
strncpy(pfs->m_filename, normalized_filename, normalized_length);
strncpy(pfs->m_filename, normalized_filename, normalized_length + 1);
pfs->m_filename[normalized_length]= '\0';
pfs->m_filename_length= normalized_length;
pfs->m_file_stat.m_open_count= 1;
......
......@@ -2291,7 +2291,8 @@ int ha_sphinx::HandleMysqlError ( MYSQL * pConn, int iErrCode )
CSphSEThreadTable * pTable = GetTls ();
if ( pTable )
{
strncpy ( pTable->m_tStats.m_sLastMessage, mysql_error ( pConn ), sizeof ( pTable->m_tStats.m_sLastMessage ) );
strncpy ( pTable->m_tStats.m_sLastMessage, mysql_error ( pConn ), sizeof pTable->m_tStats.m_sLastMessage - 1 );
pTable->m_tStats.m_sLastMessage[sizeof pTable->m_tStats.m_sLastMessage - 1] = '\0';
pTable->m_tStats.m_bLastError = true;
}
......@@ -2558,7 +2559,8 @@ bool ha_sphinx::UnpackSchema ()
CSphSEThreadTable * pTable = GetTls ();
if ( pTable )
{
strncpy ( pTable->m_tStats.m_sLastMessage, sMessage, sizeof(pTable->m_tStats.m_sLastMessage) );
strncpy ( pTable->m_tStats.m_sLastMessage, sMessage, sizeof pTable->m_tStats.m_sLastMessage - 1 );
pTable->m_tStats.m_sLastMessage[sizeof pTable->m_tStats.m_sLastMessage - 1] = '\0';
pTable->m_tStats.m_bLastError = ( uStatus==SEARCHD_ERROR );
}
......@@ -2982,7 +2984,8 @@ int ha_sphinx::index_read ( byte * buf, const byte * key, uint key_len, enum ha_
SPH_RET ( HA_ERR_END_OF_FILE );
}
strncpy ( pTable->m_tStats.m_sLastMessage, sMessage, sizeof(pTable->m_tStats.m_sLastMessage) );
strncpy ( pTable->m_tStats.m_sLastMessage, sMessage, sizeof pTable->m_tStats.m_sLastMessage - 1 );
pTable->m_tStats.m_sLastMessage[sizeof pTable->m_tStats.m_sLastMessage - 1] = '\0';
SafeDeleteArray ( sMessage );
if ( uRespStatus!=SEARCHD_WARNING )
......
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