From 2cd316911309e3db4007aa224f7874bfbeb14032 Mon Sep 17 00:00:00 2001 From: Sergey Vojtovich Date: Mon, 18 Dec 2017 17:15:48 +0400 Subject: MDEV-14265 - RPMLint warning: shared-lib-calls-exit find_type_or_exit() client helper did exit(1) on error, exit(1) moved to clients. mysql_read_default_options() did exit(1) on error, error is passed through and handled now. my_str_malloc_default() did exit(1) on error, replaced my_str_ allocator functions with normal my_malloc()/my_realloc()/my_free(). sql_connect.cc did many exit(1) on hash initialisation failure. Removed error check since my_hash_init() never fails. my_malloc() did exit(1) on error. Replaced with abort(). my_load_defaults() did exit(1) on error, replaced with return 2. my_load_defaults() still does exit(0) when invoked with --print-defaults. --- include/m_string.h | 9 --------- include/mysql.h.pp | 2 -- include/typelib.h | 2 -- 3 files changed, 13 deletions(-) (limited to 'include') diff --git a/include/m_string.h b/include/m_string.h index 7437ea8b7cd..d088b510de5 100644 --- a/include/m_string.h +++ b/include/m_string.h @@ -64,15 +64,6 @@ extern "C" { #endif -/* - my_str_malloc(), my_str_realloc() and my_str_free() are assigned to - implementations in strings/alloc.c, but can be overridden in - the calling program. - */ -extern void *(*my_str_malloc)(size_t); -extern void *(*my_str_realloc)(void *, size_t); -extern void (*my_str_free)(void *); - #ifdef DBUG_OFF #if defined(HAVE_STPCPY) && MY_GNUC_PREREQ(3, 4) && !defined(__INTEL_COMPILER) #define strmov(A,B) __builtin_stpcpy((A),(B)) diff --git a/include/mysql.h.pp b/include/mysql.h.pp index 32d87b7391c..8936a716b90 100644 --- a/include/mysql.h.pp +++ b/include/mysql.h.pp @@ -221,8 +221,6 @@ typedef struct st_typelib { extern my_ulonglong find_typeset(char *x, TYPELIB *typelib,int *error_position); extern int find_type_with_warning(const char *x, TYPELIB *typelib, const char *option); -extern int find_type_or_exit(const char *x, TYPELIB *typelib, - const char *option); extern int find_type(const char *x, const TYPELIB *typelib, unsigned int flags); extern void make_type(char *to,unsigned int nr,TYPELIB *typelib); extern const char *get_type(TYPELIB *typelib,unsigned int nr); diff --git a/include/typelib.h b/include/typelib.h index 4504bea4ff7..ab5a0f0d258 100644 --- a/include/typelib.h +++ b/include/typelib.h @@ -29,8 +29,6 @@ typedef struct st_typelib { /* Different types saved here */ extern my_ulonglong find_typeset(char *x, TYPELIB *typelib,int *error_position); extern int find_type_with_warning(const char *x, TYPELIB *typelib, const char *option); -extern int find_type_or_exit(const char *x, TYPELIB *typelib, - const char *option); #define FIND_TYPE_BASIC 0 /** makes @c find_type() require the whole name, no prefix */ #define FIND_TYPE_NO_PREFIX (1 << 0) -- cgit v1.2.1 From e64184134a19579dbe5bf98fc54f0f6236aabbcd Mon Sep 17 00:00:00 2001 From: Monty Date: Sat, 23 Dec 2017 16:59:41 +0200 Subject: 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) --- include/my_sys.h | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'include') diff --git a/include/my_sys.h b/include/my_sys.h index adb7f4826f6..99c1dacfcaa 100644 --- a/include/my_sys.h +++ b/include/my_sys.h @@ -552,12 +552,13 @@ static inline int my_b_get(IO_CACHE *info) return _my_b_get(info); } -/* my_b_write_byte dosn't have any err-check */ -static inline void my_b_write_byte(IO_CACHE *info, uchar chr) +static inline my_bool my_b_write_byte(IO_CACHE *info, uchar chr) { if (info->write_pos >= info->write_end) - my_b_flush_io_cache(info, 1); + if (my_b_flush_io_cache(info, 1)) + return 1; *info->write_pos++= chr; + return 0; } /** @@ -825,9 +826,9 @@ extern int end_io_cache(IO_CACHE *info); extern void my_b_seek(IO_CACHE *info,my_off_t pos); extern size_t my_b_gets(IO_CACHE *info, char *to, size_t max_length); extern my_off_t my_b_filelength(IO_CACHE *info); -extern size_t my_b_write_backtick_quote(IO_CACHE *info, const char *str, - size_t len); -extern size_t my_b_printf(IO_CACHE *info, const char* fmt, ...); +extern my_bool my_b_write_backtick_quote(IO_CACHE *info, const char *str, + size_t len); +extern my_bool my_b_printf(IO_CACHE *info, const char* fmt, ...); extern size_t my_b_vprintf(IO_CACHE *info, const char* fmt, va_list ap); extern my_bool open_cached_file(IO_CACHE *cache,const char *dir, const char *prefix, size_t cache_size, -- cgit v1.2.1