Skip to content

Commit 6dbc50a

Browse files
committed
Merge 10.3 into 10.4
2 parents 4752a03 + f6e16bd commit 6dbc50a

31 files changed

+511
-820
lines changed

client/mysqltest.cc

Lines changed: 26 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6581,8 +6581,6 @@ static inline bool is_escape_char(char c, char in_string)
65816581
65826582
SYNOPSIS
65836583
read_line
6584-
buf buffer for the read line
6585-
size size of the buffer i.e max size to read
65866584
65876585
DESCRIPTION
65886586
This function actually reads several lines and adds them to the
@@ -6600,21 +6598,37 @@ static inline bool is_escape_char(char c, char in_string)
66006598
66016599
*/
66026600

6603-
int read_line(char *buf, int size)
6601+
static char *read_command_buf= NULL;
6602+
static size_t read_command_buflen= 0;
6603+
static const size_t max_multibyte_length= 6;
6604+
6605+
int read_line()
66046606
{
66056607
char c, last_quote=0, last_char= 0;
6606-
char *p= buf, *buf_end= buf + size - 1;
6608+
char *p= read_command_buf;
6609+
char *buf_end= read_command_buf + read_command_buflen - max_multibyte_length;
66076610
int skip_char= 0;
66086611
my_bool have_slash= FALSE;
66096612

66106613
enum {R_NORMAL, R_Q, R_SLASH_IN_Q,
66116614
R_COMMENT, R_LINE_START} state= R_LINE_START;
66126615
DBUG_ENTER("read_line");
66136616

6617+
*p= 0;
66146618
start_lineno= cur_file->lineno;
66156619
DBUG_PRINT("info", ("Starting to read at lineno: %d", start_lineno));
6616-
for (; p < buf_end ;)
6620+
while (1)
66176621
{
6622+
if (p >= buf_end)
6623+
{
6624+
my_ptrdiff_t off= p - read_command_buf;
6625+
read_command_buf= (char*)my_realloc(read_command_buf,
6626+
read_command_buflen*2, MYF(MY_FAE));
6627+
p= read_command_buf + off;
6628+
read_command_buflen*= 2;
6629+
buf_end= read_command_buf + read_command_buflen - max_multibyte_length;
6630+
}
6631+
66186632
skip_char= 0;
66196633
c= my_getc(cur_file->file);
66206634
if (feof(cur_file->file))
@@ -6650,7 +6664,7 @@ int read_line(char *buf, int size)
66506664
cur_file->lineno++;
66516665

66526666
/* Convert cr/lf to lf */
6653-
if (p != buf && *(p-1) == '\r')
6667+
if (p != read_command_buf && *(p-1) == '\r')
66546668
p--;
66556669
}
66566670

@@ -6665,9 +6679,9 @@ int read_line(char *buf, int size)
66656679
}
66666680
else if ((c == '{' &&
66676681
(!my_strnncoll_simple(charset_info, (const uchar*) "while", 5,
6668-
(uchar*) buf, MY_MIN(5, p - buf), 0) ||
6682+
(uchar*) read_command_buf, MY_MIN(5, p - read_command_buf), 0) ||
66696683
!my_strnncoll_simple(charset_info, (const uchar*) "if", 2,
6670-
(uchar*) buf, MY_MIN(2, p - buf), 0))))
6684+
(uchar*) read_command_buf, MY_MIN(2, p - read_command_buf), 0))))
66716685
{
66726686
/* Only if and while commands can be terminated by { */
66736687
*p++= c;
@@ -6799,8 +6813,6 @@ int read_line(char *buf, int size)
67996813
}
68006814
}
68016815
}
6802-
die("The input buffer is too small for this query.\n"
6803-
"check your query or increase MAX_QUERY and recompile");
68046816
DBUG_RETURN(0);
68056817
}
68066818

@@ -6945,12 +6957,8 @@ bool is_delimiter(const char* p)
69456957
terminated by new line '\n' regardless how many "delimiter" it contain.
69466958
*/
69476959

6948-
#define MAX_QUERY (256*1024*2) /* 256K -- a test in sp-big is >128K */
6949-
static char read_command_buf[MAX_QUERY];
6950-
69516960
int read_command(struct st_command** command_ptr)
69526961
{
6953-
char *p= read_command_buf;
69546962
struct st_command* command;
69556963
DBUG_ENTER("read_command");
69566964

@@ -6967,8 +6975,7 @@ int read_command(struct st_command** command_ptr)
69676975
die("Out of memory");
69686976
command->type= Q_UNKNOWN;
69696977

6970-
read_command_buf[0]= 0;
6971-
if (read_line(read_command_buf, sizeof(read_command_buf)))
6978+
if (read_line())
69726979
{
69736980
check_eol_junk(read_command_buf);
69746981
DBUG_RETURN(1);
@@ -6977,6 +6984,7 @@ int read_command(struct st_command** command_ptr)
69776984
if (opt_result_format_version == 1)
69786985
convert_to_format_v1(read_command_buf);
69796986

6987+
char *p= read_command_buf;
69806988
DBUG_PRINT("info", ("query: '%s'", read_command_buf));
69816989
if (*p == '#')
69826990
{
@@ -9204,6 +9212,8 @@ int main(int argc, char **argv)
92049212
init_win_path_patterns();
92059213
#endif
92069214

9215+
read_command_buf= (char*)my_malloc(read_command_buflen= 65536, MYF(MY_FAE));
9216+
92079217
init_dynamic_string(&ds_res, "", 2048, 2048);
92089218
init_alloc_root(&require_file_root, "require_file", 1024, 1024, MYF(0));
92099219

debian/additions/debian-start

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ fi
1515

1616
MYSQL="/usr/bin/mysql --defaults-file=/etc/mysql/debian.cnf"
1717
MYADMIN="/usr/bin/mysqladmin --defaults-file=/etc/mysql/debian.cnf"
18-
MYUPGRADE="/usr/bin/mysql_upgrade --defaults-extra-file=/etc/mysql/debian.cnf"
18+
MYUPGRADE="/usr/bin/mysql_upgrade --defaults-extra-file=/etc/mysql/debian.cnf --version-check"
1919
MYCHECK="/usr/bin/mysqlcheck --defaults-file=/etc/mysql/debian.cnf"
2020
MYCHECK_SUBJECT="WARNING: mysqlcheck has found corrupt tables"
2121
MYCHECK_PARAMS="--all-databases --fast --silent"

debian/mariadb-server-10.4.postinst

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,16 @@
22

33
. /usr/share/debconf/confmodule
44

5+
# assume the filename is /path/to/mariadb-server-##.#.postinst
6+
VER=${0: -13:4}
7+
58
if [ -n "$DEBIAN_SCRIPT_DEBUG" ]; then set -v -x; DEBIAN_SCRIPT_TRACE=1; fi
69
${DEBIAN_SCRIPT_TRACE:+ echo "#42#DEBUG# RUNNING $0 $*" 1>&2 }
710

811
export PATH=$PATH:/sbin:/usr/sbin:/bin:/usr/bin
912

1013
# This command can be used as pipe to syslog. With "-s" it also logs to stderr.
11-
ERR_LOGGER="logger -p daemon.err -t mysqld_safe -i"
14+
ERR_LOGGER="logger -p daemon.err -t mariadb-server-$VER.postinst -i"
1215
# This will make an error in a logged command immediately apparent by aborting
1316
# the install, rather than failing silently and leaving a broken install.
1417
set -o pipefail
@@ -162,6 +165,9 @@ EOF
162165
have_global_priv_table=yes
163166
fi
164167

168+
# To avoid downgrades.
169+
touch $mysql_statedir/debian-$VER.flag
170+
165171
## On every reconfiguration the maintenance user is recreated.
166172
#
167173
# - It is easier to regenerate the password every time but as people

0 commit comments

Comments
 (0)