Commit b58f2872 authored by Sergei Golubchik's avatar Sergei Golubchik

Merge branch '5.5' into 10.0

parents 9eadef01 32b7d456
...@@ -6577,8 +6577,6 @@ static inline bool is_escape_char(char c, char in_string) ...@@ -6577,8 +6577,6 @@ static inline bool is_escape_char(char c, char in_string)
SYNOPSIS SYNOPSIS
read_line read_line
buf buffer for the read line
size size of the buffer i.e max size to read
DESCRIPTION DESCRIPTION
This function actually reads several lines and adds them to the This function actually reads several lines and adds them to the
...@@ -6596,10 +6594,15 @@ static inline bool is_escape_char(char c, char in_string) ...@@ -6596,10 +6594,15 @@ static inline bool is_escape_char(char c, char in_string)
*/ */
int read_line(char *buf, int size) static char *read_command_buf= NULL;
static size_t read_command_buflen= 0;
static const size_t max_multibyte_length= 6;
int read_line()
{ {
char c, last_quote=0, last_char= 0; char c, last_quote=0, last_char= 0;
char *p= buf, *buf_end= buf + size - 1; char *p= read_command_buf;
char *buf_end= read_command_buf + read_command_buflen - max_multibyte_length;
int skip_char= 0; int skip_char= 0;
my_bool have_slash= FALSE; my_bool have_slash= FALSE;
...@@ -6607,10 +6610,21 @@ int read_line(char *buf, int size) ...@@ -6607,10 +6610,21 @@ int read_line(char *buf, int size)
R_COMMENT, R_LINE_START} state= R_LINE_START; R_COMMENT, R_LINE_START} state= R_LINE_START;
DBUG_ENTER("read_line"); DBUG_ENTER("read_line");
*p= 0;
start_lineno= cur_file->lineno; start_lineno= cur_file->lineno;
DBUG_PRINT("info", ("Starting to read at lineno: %d", start_lineno)); DBUG_PRINT("info", ("Starting to read at lineno: %d", start_lineno));
for (; p < buf_end ;) while (1)
{
if (p >= buf_end)
{ {
my_ptrdiff_t off= p - read_command_buf;
read_command_buf= (char*)my_realloc(read_command_buf,
read_command_buflen*2, MYF(MY_FAE));
p= read_command_buf + off;
read_command_buflen*= 2;
buf_end= read_command_buf + read_command_buflen - max_multibyte_length;
}
skip_char= 0; skip_char= 0;
c= my_getc(cur_file->file); c= my_getc(cur_file->file);
if (feof(cur_file->file)) if (feof(cur_file->file))
...@@ -6646,7 +6660,7 @@ int read_line(char *buf, int size) ...@@ -6646,7 +6660,7 @@ int read_line(char *buf, int size)
cur_file->lineno++; cur_file->lineno++;
/* Convert cr/lf to lf */ /* Convert cr/lf to lf */
if (p != buf && *(p-1) == '\r') if (p != read_command_buf && *(p-1) == '\r')
p--; p--;
} }
...@@ -6661,9 +6675,9 @@ int read_line(char *buf, int size) ...@@ -6661,9 +6675,9 @@ int read_line(char *buf, int size)
} }
else if ((c == '{' && else if ((c == '{' &&
(!my_strnncoll_simple(charset_info, (const uchar*) "while", 5, (!my_strnncoll_simple(charset_info, (const uchar*) "while", 5,
(uchar*) buf, MY_MIN(5, p - buf), 0) || (uchar*) read_command_buf, MY_MIN(5, p - read_command_buf), 0) ||
!my_strnncoll_simple(charset_info, (const uchar*) "if", 2, !my_strnncoll_simple(charset_info, (const uchar*) "if", 2,
(uchar*) buf, MY_MIN(2, p - buf), 0)))) (uchar*) read_command_buf, MY_MIN(2, p - read_command_buf), 0))))
{ {
/* Only if and while commands can be terminated by { */ /* Only if and while commands can be terminated by { */
*p++= c; *p++= c;
...@@ -6797,8 +6811,6 @@ int read_line(char *buf, int size) ...@@ -6797,8 +6811,6 @@ int read_line(char *buf, int size)
*p++= c; *p++= c;
} }
} }
die("The input buffer is too small for this query.x\n" \
"check your query or increase MAX_QUERY and recompile");
DBUG_RETURN(0); DBUG_RETURN(0);
} }
...@@ -6943,12 +6955,8 @@ bool is_delimiter(const char* p) ...@@ -6943,12 +6955,8 @@ bool is_delimiter(const char* p)
terminated by new line '\n' regardless how many "delimiter" it contain. terminated by new line '\n' regardless how many "delimiter" it contain.
*/ */
#define MAX_QUERY (256*1024*2) /* 256K -- a test in sp-big is >128K */
static char read_command_buf[MAX_QUERY];
int read_command(struct st_command** command_ptr) int read_command(struct st_command** command_ptr)
{ {
char *p= read_command_buf;
struct st_command* command; struct st_command* command;
DBUG_ENTER("read_command"); DBUG_ENTER("read_command");
...@@ -6964,8 +6972,7 @@ int read_command(struct st_command** command_ptr) ...@@ -6964,8 +6972,7 @@ int read_command(struct st_command** command_ptr)
die("Out of memory"); die("Out of memory");
command->type= Q_UNKNOWN; command->type= Q_UNKNOWN;
read_command_buf[0]= 0; if (read_line())
if (read_line(read_command_buf, sizeof(read_command_buf)))
{ {
check_eol_junk(read_command_buf); check_eol_junk(read_command_buf);
DBUG_RETURN(1); DBUG_RETURN(1);
...@@ -6974,6 +6981,7 @@ int read_command(struct st_command** command_ptr) ...@@ -6974,6 +6981,7 @@ int read_command(struct st_command** command_ptr)
if (opt_result_format_version == 1) if (opt_result_format_version == 1)
convert_to_format_v1(read_command_buf); convert_to_format_v1(read_command_buf);
char *p= read_command_buf;
DBUG_PRINT("info", ("query: '%s'", read_command_buf)); DBUG_PRINT("info", ("query: '%s'", read_command_buf));
if (*p == '#') if (*p == '#')
{ {
...@@ -9126,6 +9134,8 @@ int main(int argc, char **argv) ...@@ -9126,6 +9134,8 @@ int main(int argc, char **argv)
init_win_path_patterns(); init_win_path_patterns();
#endif #endif
read_command_buf= (char*)my_malloc(read_command_buflen= 65536, MYF(MY_FAE));
init_dynamic_string(&ds_res, "", 2048, 2048); init_dynamic_string(&ds_res, "", 2048, 2048);
init_alloc_root(&require_file_root, 1024, 1024, MYF(0)); init_alloc_root(&require_file_root, 1024, 1024, MYF(0));
......
...@@ -1119,6 +1119,7 @@ sub GetData() ...@@ -1119,6 +1119,7 @@ sub GetData()
} }
} }
print " Replication "; print " Replication ";
print "Master:$data->{Master_Host} ";
print "IO:$data->{Slave_IO_Running} "; print "IO:$data->{Slave_IO_Running} ";
print "SQL:$data->{Slave_SQL_Running} "; print "SQL:$data->{Slave_SQL_Running} ";
print RESET() if ($HAS_COLOR); print RESET() if ($HAS_COLOR);
......
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