summaryrefslogtreecommitdiff
path: root/mysys/mf_iocache2.c
diff options
context:
space:
mode:
authorMonty <monty@mariadb.org>2017-12-23 16:59:41 +0200
committerMonty <monty@mariadb.org>2017-12-29 13:35:41 +0200
commite64184134a19579dbe5bf98fc54f0f6236aabbcd (patch)
treef6fc13cef5a68539bc6554de30f01add4fc7ff94 /mysys/mf_iocache2.c
parent40f4525f43aba5d579cf55bae2df504001cd04f4 (diff)
downloadmariadb-git-e64184134a19579dbe5bf98fc54f0f6236aabbcd.tar.gz
mysqlbinlog now prints "# Number of rows" and stops on errors
Main problem was that no log-event print function checked for disk full error on the IO_CACHE. All changes in this patch only affects mysqlbinlog, not the server! - Changed all log-event print functions to return 1 on error - Fixed memory usage when not using --flashback. - Added printing of number of rows in row events. Can be disabled with --print-row-count=0 - Print annotated rows when using mysqlbinlog --short-form - Fixed that mysqlbinlog --debug works - Fixed create_drop_binlog.test test failure - Reorganized fields in PRINT_EVENT_INFO to be according to size to optimize storage - Don't change print_row_event_position or print_row_counts if set by user - Remove some testing of argument to my_free is 0 - base64-output=never is now supported and works in all context - Updated help information for --base64-output and --short-form - print_row_count is now on by default. Reset automatically if --short-form is used - Removed obsolote warning for mysql 5.6.0 - More DBUG_PRINT for mysqltest.cc - my_b_write_byte() now checks for flush failures. This fixed a memory overrun on disk full - my_b_printf() now returns 1 on failure, 0 on ok. This simplifies code and no old code was using the old return value of my_b_printf(). - my_b_Write_backtick_quote() now returns 1 on failure and 0 on ok - Fixed some error conditions in log printing that was not previously handled. - Slave_rows_error_report() can now handle longlong positions - Write_on_release_cache() rewritten so that we can detect errors on flush. Not depending on automatic release anymore. - Changed types for Pos and End_log_pos to 64 bit in SHOW BINLOG EVENTS - Fixed that copy_event_cache_to_string_and_reinit() works with strings longer than 4G (Changed to use LEX_STRING instead of String) - Restricted binlog_rows_event_max_size to UINT32_MAX-1 as String's are anyway restricted to UINT32_MAX - Fixed bug in rpl_binlog_state::write_to_iocache() which hide write failures (duplicate variable name) - Fixed bug in String::append if original string was not allocated - Stop mysqlbinlog output at once if there is an error. - Before printing error message, flush result file. This ensures that the error message is printed last. (Easier to find)
Diffstat (limited to 'mysys/mf_iocache2.c')
-rw-r--r--mysys/mf_iocache2.c23
1 files changed, 9 insertions, 14 deletions
diff --git a/mysys/mf_iocache2.c b/mysys/mf_iocache2.c
index 2499094037d..5c888d840e2 100644
--- a/mysys/mf_iocache2.c
+++ b/mysys/mf_iocache2.c
@@ -249,18 +249,16 @@ my_off_t my_b_filelength(IO_CACHE *info)
}
-size_t
+my_bool
my_b_write_backtick_quote(IO_CACHE *info, const char *str, size_t len)
{
const uchar *start;
const uchar *p= (const uchar *)str;
const uchar *end= p + len;
size_t count;
- size_t total= 0;
if (my_b_write(info, (uchar *)"`", 1))
- return (size_t)-1;
- ++total;
+ return 1;
for (;;)
{
start= p;
@@ -269,34 +267,31 @@ my_b_write_backtick_quote(IO_CACHE *info, const char *str, size_t len)
count= p - start;
if (count && my_b_write(info, start, count))
return (size_t)-1;
- total+= count;
if (p >= end)
break;
if (my_b_write(info, (uchar *)"``", 2))
return (size_t)-1;
- total+= 2;
++p;
}
- if (my_b_write(info, (uchar *)"`", 1))
- return (size_t)-1;
- ++total;
- return total;
+ return (my_b_write(info, (uchar *)"`", 1));
}
/*
Simple printf version. Supports '%s', '%d', '%u', "%ld" and "%lu"
- Used for logging in MySQL
- returns number of written character, or (size_t) -1 on error
+ Used for logging in MariaDB
+
+ @return 0 ok
+ 1 error
*/
-size_t my_b_printf(IO_CACHE *info, const char* fmt, ...)
+my_bool my_b_printf(IO_CACHE *info, const char* fmt, ...)
{
size_t result;
va_list args;
va_start(args,fmt);
result=my_b_vprintf(info, fmt, args);
va_end(args);
- return result;
+ return result == (size_t) -1;
}