Commit f91c2d33 authored by Andrei Elkin's avatar Andrei Elkin

bug#3593869-64035

A follow-up patch corrects max sizes of printed strings and changes llstr() to %lld.
Credits go to Davi who provided a great feedback.


sql/share/errmsg-utf8.txt:
  Max size for the whole message is 512 so a part of - like '%-.512s' should be less,
  reduction to 320 is safe and with good chances won't cut off a part of a rather log
  message in Last_IO_Error = 'Got fatal error 1236 ...'
sql/sql_repl.cc:
  llstr() is replaced by %lld.
parent 8c894564
...@@ -179,7 +179,8 @@ DROP TABLE t1; ...@@ -179,7 +179,8 @@ DROP TABLE t1;
sync_slave_with_master; sync_slave_with_master;
# #
# bug#3593869-64035 uninitialized event_coordinates instance crashes server # bug#3593869-64035 attempt to read a member of event_coordinates
# referenced by NULL pointer crashes server.
# Testing how out of valid range position value is handled with an error. # Testing how out of valid range position value is handled with an error.
# #
......
...@@ -11,7 +11,7 @@ reset slave; ...@@ -11,7 +11,7 @@ reset slave;
start slave; start slave;
include/wait_for_slave_param.inc [Last_IO_Errno] include/wait_for_slave_param.inc [Last_IO_Errno]
Last_IO_Errno = '1236' Last_IO_Errno = '1236'
Last_IO_Error = 'Got fatal error 1236 from master when reading data from binary log: 'binlog truncated in the middle of event; consider out of disk space on master; the start event position from '' at XXX, the last event was read from 'master-bin.000001' at XXX, the last byte read was read from 'master-bin.000001' at XXX.'' Last_IO_Error = 'Got fatal error 1236 from master when reading data from binary log: 'binlog truncated in the middle of event; consider out of disk space on master; the first event '' at XXX, the last event read from 'master-bin.000001' at XXX, the last byte read from 'master-bin.000001' at XXX.''
reset master; reset master;
stop slave; stop slave;
reset slave; reset slave;
......
...@@ -9,7 +9,7 @@ change master to master_log_pos=MASTER_LOG_POS; ...@@ -9,7 +9,7 @@ change master to master_log_pos=MASTER_LOG_POS;
Read_Master_Log_Pos = '75' Read_Master_Log_Pos = '75'
start slave; start slave;
include/wait_for_slave_io_error.inc [errno=1236] include/wait_for_slave_io_error.inc [errno=1236]
Last_IO_Error = 'Got fatal error 1236 from master when reading data from binary log: 'log event entry exceeded max_allowed_packet; Increase max_allowed_packet on master; the start event position from 'master-bin.000001' at XXX, the last event was read from 'master-bin.000001' at XXX, the last byte read was read from 'master-bin.000001' at XXX.'' Last_IO_Error = 'Got fatal error 1236 from master when reading data from binary log: 'log event entry exceeded max_allowed_packet; Increase max_allowed_packet on master; the first event 'master-bin.000001' at XXX, the last event read from 'master-bin.000001' at XXX, the last byte read from 'master-bin.000001' at XXX.''
include/stop_slave_sql.inc include/stop_slave_sql.inc
show master status; show master status;
File Position Binlog_Do_DB Binlog_Ignore_DB File Position Binlog_Do_DB Binlog_Ignore_DB
......
...@@ -5,7 +5,7 @@ CREATE TABLE t1(c1 INT); ...@@ -5,7 +5,7 @@ CREATE TABLE t1(c1 INT);
FLUSH LOGS; FLUSH LOGS;
call mtr.add_suppression('Got fatal error 1236 from master when reading data from binary log: .*could not find next log'); call mtr.add_suppression('Got fatal error 1236 from master when reading data from binary log: .*could not find next log');
include/wait_for_slave_io_error.inc [errno=1236] include/wait_for_slave_io_error.inc [errno=1236]
Last_IO_Error = 'Got fatal error 1236 from master when reading data from binary log: 'could not find next log; the start event position from 'master-bin.000001' at XXX, the last event was read from 'master-bin.000002' at XXX, the last byte read was read from 'master-bin.000002' at XXX.'' Last_IO_Error = 'Got fatal error 1236 from master when reading data from binary log: 'could not find next log; the first event 'master-bin.000001' at XXX, the last event read from 'master-bin.000002' at XXX, the last byte read from 'master-bin.000002' at XXX.''
CREATE TABLE t2(c1 INT); CREATE TABLE t2(c1 INT);
FLUSH LOGS; FLUSH LOGS;
CREATE TABLE t3(c1 INT); CREATE TABLE t3(c1 INT);
......
...@@ -37,7 +37,7 @@ DROP TABLE t1; ...@@ -37,7 +37,7 @@ DROP TABLE t1;
CREATE TABLE t1 (f1 int PRIMARY KEY, f2 LONGTEXT, f3 LONGTEXT) ENGINE=MyISAM; CREATE TABLE t1 (f1 int PRIMARY KEY, f2 LONGTEXT, f3 LONGTEXT) ENGINE=MyISAM;
INSERT INTO t1(f1, f2, f3) VALUES(1, REPEAT('a', @@global.max_allowed_packet), REPEAT('b', @@global.max_allowed_packet)); INSERT INTO t1(f1, f2, f3) VALUES(1, REPEAT('a', @@global.max_allowed_packet), REPEAT('b', @@global.max_allowed_packet));
include/wait_for_slave_io_error.inc [errno=1236] include/wait_for_slave_io_error.inc [errno=1236]
Last_IO_Error = 'Got fatal error 1236 from master when reading data from binary log: 'log event entry exceeded max_allowed_packet; Increase max_allowed_packet on master; the start event position from '' at XXX, the last event was read from 'master-bin.000001' at XXX, the last byte read was read from 'master-bin.000001' at XXX.'' Last_IO_Error = 'Got fatal error 1236 from master when reading data from binary log: 'log event entry exceeded max_allowed_packet; Increase max_allowed_packet on master; the first event '' at XXX, the last event read from 'master-bin.000001' at XXX, the last byte read from 'master-bin.000001' at XXX.''
STOP SLAVE; STOP SLAVE;
RESET SLAVE; RESET SLAVE;
RESET MASTER; RESET MASTER;
......
...@@ -75,7 +75,7 @@ CHANGE MASTER TO master_log_pos=MASTER_POS; ...@@ -75,7 +75,7 @@ CHANGE MASTER TO master_log_pos=MASTER_POS;
START SLAVE; START SLAVE;
include/wait_for_slave_param.inc [Last_IO_Errno] include/wait_for_slave_param.inc [Last_IO_Errno]
Last_IO_Errno = '1236' Last_IO_Errno = '1236'
Last_IO_Error = 'Got fatal error 1236 from master when reading data from binary log: 'Client requested master to start replication from impossible position; the start event position from 'master-bin.000001' at XXX, the last event was read from 'master-bin.000001' at XXX, the last byte read was read from 'master-bin.000001' at XXX.'' Last_IO_Error = 'Got fatal error 1236 from master when reading data from binary log: 'Client requested master to start replication from impossible position; the first event 'master-bin.000001' at XXX, the last event read from 'master-bin.000001' at XXX, the last byte read from 'master-bin.000001' at XXX.''
include/stop_slave.inc include/stop_slave.inc
RESET SLAVE; RESET SLAVE;
RESET MASTER; RESET MASTER;
......
...@@ -4701,14 +4701,14 @@ ER_NOT_SUPPORTED_YET 42000 ...@@ -4701,14 +4701,14 @@ ER_NOT_SUPPORTED_YET 42000
spa "Esta versión de MySQL no soporta todavia '%s'" spa "Esta versión de MySQL no soporta todavia '%s'"
swe "Denna version av MySQL kan ännu inte utföra '%s'" swe "Denna version av MySQL kan ännu inte utföra '%s'"
ER_MASTER_FATAL_ERROR_READING_BINLOG ER_MASTER_FATAL_ERROR_READING_BINLOG
nla "Kreeg fatale fout %d: '%-.512s' van master tijdens lezen van data uit binaire log" nla "Kreeg fatale fout %d: '%-.320s' van master tijdens lezen van data uit binaire log"
eng "Got fatal error %d from master when reading data from binary log: '%-.512s'" eng "Got fatal error %d from master when reading data from binary log: '%-.320s'"
ger "Schwerer Fehler %d: '%-.512s vom Master beim Lesen des binären Logs" ger "Schwerer Fehler %d: '%-.320s vom Master beim Lesen des binären Logs"
ita "Errore fatale %d: '%-.512s' dal master leggendo i dati dal log binario" ita "Errore fatale %d: '%-.320s' dal master leggendo i dati dal log binario"
por "Obteve fatal erro %d: '%-.512s' do master quando lendo dados do binary log" por "Obteve fatal erro %d: '%-.320s' do master quando lendo dados do binary log"
rus "Получена неисправимая ошибка %d: '%-.512s' от головного сервера в процессе выборки данных из двоичного журнала" rus "Получена неисправимая ошибка %d: '%-.320s' от головного сервера в процессе выборки данных из двоичного журнала"
spa "Recibió fatal error %d: '%-.512s' del master cuando leyendo datos del binary log" spa "Recibió fatal error %d: '%-.320s' del master cuando leyendo datos del binary log"
swe "Fick fatalt fel %d: '%-.512s' från master vid läsning av binärloggen" swe "Fick fatalt fel %d: '%-.320s' från master vid läsning av binärloggen"
ER_SLAVE_IGNORED_TABLE ER_SLAVE_IGNORED_TABLE
eng "Slave SQL thread ignored the query because of replicate-*-table rules" eng "Slave SQL thread ignored the query because of replicate-*-table rules"
ger "Slave-SQL-Thread hat die Abfrage aufgrund von replicate-*-table-Regeln ignoriert" ger "Slave-SQL-Thread hat die Abfrage aufgrund von replicate-*-table-Regeln ignoriert"
......
...@@ -447,7 +447,6 @@ void mysql_binlog_send(THD* thd, char* log_ident, my_off_t pos, ...@@ -447,7 +447,6 @@ void mysql_binlog_send(THD* thd, char* log_ident, my_off_t pos,
String* packet = &thd->packet; String* packet = &thd->packet;
int error; int error;
const char *errmsg = "Unknown error"; const char *errmsg = "Unknown error";
char llbuff0[22], llbuff1[22], llbuff2[22];
char error_text[MAX_SLAVE_ERRMSG]; // to be send to slave via my_message() char error_text[MAX_SLAVE_ERRMSG]; // to be send to slave via my_message()
NET* net = &thd->net; NET* net = &thd->net;
mysql_mutex_t *log_lock; mysql_mutex_t *log_lock;
...@@ -1034,12 +1033,14 @@ impossible position"; ...@@ -1034,12 +1033,14 @@ impossible position";
detailing the fatal error message with coordinates detailing the fatal error message with coordinates
of the last position read. of the last position read.
*/ */
const char *fmt= "%s; the start event position from '%s' at %s, the last event was read from '%s' at %s, the last byte read was read from '%s' at %s."; my_snprintf(error_text, sizeof(error_text),
my_snprintf(error_text, sizeof(error_text), fmt, errmsg, "%s; the first event '%s' at %lld, "
p_start_coord->file_name, "the last event read from '%s' at %lld, "
(llstr(p_start_coord->pos, llbuff0), llbuff0), "the last byte read from '%s' at %lld.",
p_coord->file_name, (llstr(p_coord->pos, llbuff1), llbuff1), errmsg,
log_file_name, (llstr(my_b_tell(&log), llbuff2), llbuff2)); p_start_coord->file_name, p_start_coord->pos,
p_coord->file_name, p_coord->pos,
log_file_name, my_b_tell(&log));
} }
else else
strcpy(error_text, errmsg); strcpy(error_text, errmsg);
......
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