Commit 74cac792 authored by Vladislav Vaintroub's avatar Vladislav Vaintroub

- Fix rpl_checksum test. Use basename of file in error messages, not the o

nes prefixed with .\ or ./
- Add my_basename() to mysys.
- Do not compile files that are not needed on Windows (my_addr_resolve, an
d safemalloc related stuff it it is not used)
Avoids linker warnings about compilation of essentially empty files.
parent 139bf5ce
...@@ -639,6 +639,7 @@ extern int my_fclose(FILE *fd,myf MyFlags); ...@@ -639,6 +639,7 @@ extern int my_fclose(FILE *fd,myf MyFlags);
extern File my_fileno(FILE *fd); extern File my_fileno(FILE *fd);
extern int my_chsize(File fd,my_off_t newlength, int filler, myf MyFlags); extern int my_chsize(File fd,my_off_t newlength, int filler, myf MyFlags);
extern int my_chmod(const char *name, mode_t mode, myf my_flags); extern int my_chmod(const char *name, mode_t mode, myf my_flags);
extern const char *my_basename(const char *filename);
extern void thr_set_sync_wait_callback(void (*before_sync)(void), extern void thr_set_sync_wait_callback(void (*before_sync)(void),
void (*after_sync)(void)); void (*after_sync)(void));
extern int my_sync(File fd, myf my_flags); extern int my_sync(File fd, myf my_flags);
......
...@@ -71,7 +71,7 @@ insert into t1 values (1) /* will not be applied on slave due to simulation */; ...@@ -71,7 +71,7 @@ insert into t1 values (1) /* will not be applied on slave due to simulation */;
set @@global.debug_dbug='d,simulate_slave_unaware_checksum'; set @@global.debug_dbug='d,simulate_slave_unaware_checksum';
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: 'Slave can not handle replication events with the checksum that master is configured to log; the last event was read from './master-bin.000010' at 245, the last byte read was read from './master-bin.000010' at 245.'' Last_IO_Error = 'Got fatal error 1236 from master when reading data from binary log: 'Slave can not handle replication events with the checksum that master is configured to log; the last event was read from 'master-bin.000010' at 245, the last byte read was read from 'master-bin.000010' at 245.''
select count(*) as zero from t1; select count(*) as zero from t1;
zero zero
0 0
......
...@@ -29,11 +29,11 @@ SET(MYSYS_SOURCES array.c charset-def.c charset.c checksum.c default.c ...@@ -29,11 +29,11 @@ SET(MYSYS_SOURCES array.c charset-def.c charset.c checksum.c default.c
my_mkdir.c my_mmap.c my_once.c my_open.c my_pread.c my_pthread.c my_mkdir.c my_mmap.c my_once.c my_open.c my_pread.c my_pthread.c
my_quick.c my_read.c my_redel.c my_rename.c my_seek.c my_sleep.c my_quick.c my_read.c my_redel.c my_rename.c my_seek.c my_sleep.c
my_static.c my_symlink.c my_symlink2.c my_sync.c my_thr_init.c my_static.c my_symlink.c my_symlink2.c my_sync.c my_thr_init.c
my_basename.c
my_write.c ptr_cmp.c queues.c stacktrace.c my_write.c ptr_cmp.c queues.c stacktrace.c
rijndael.c sha1.c string.c thr_alarm.c thr_lock.c thr_mutex.c rijndael.c sha1.c string.c thr_alarm.c thr_lock.c thr_mutex.c
thr_rwlock.c tree.c typelib.c base64.c my_memmem.c my_getpagesize.c thr_rwlock.c tree.c typelib.c base64.c my_memmem.c my_getpagesize.c
lf_alloc-pin.c lf_dynarray.c lf_hash.c lf_alloc-pin.c lf_dynarray.c lf_hash.c
my_addr_resolve.c safemalloc.c my_new.cc
my_atomic.c my_getncpus.c my_safehash.c my_chmod.c my_rnd.c my_atomic.c my_getncpus.c my_safehash.c my_chmod.c my_rnd.c
my_uuid.c wqueue.c waiting_threads.c ma_dyncol.c my_uuid.c wqueue.c waiting_threads.c ma_dyncol.c
my_rdtsc.c) my_rdtsc.c)
...@@ -42,8 +42,17 @@ IF (WIN32) ...@@ -42,8 +42,17 @@ IF (WIN32)
SET (MYSYS_SOURCES ${MYSYS_SOURCES} my_winthread.c my_wincond.c my_winerr.c my_winfile.c my_windac.c my_conio.c) SET (MYSYS_SOURCES ${MYSYS_SOURCES} my_winthread.c my_wincond.c my_winerr.c my_winfile.c my_windac.c my_conio.c)
ENDIF() ENDIF()
IF(NOT HAVE_CXX_NEW) IF(UNIX)
SET (MYSYS_SOURCES ${MYSYS_SOURCES} my_addr_resolve.c)
ENDIF()
IF(WITH_SAFEMALLOC OR NOT HAVE_CXX_NEW)
ADD_DEFINITIONS( -DUSE_MYSYS_NEW) ADD_DEFINITIONS( -DUSE_MYSYS_NEW)
SET (MYSYS_SOURCES ${MYSYS_SOURCES} my_new.cc)
ENDIF()
IF(WITH_SAFEMALLOC)
SET (MYSYS_SOURCES ${MYSYS_SOURCES} safemalloc.c)
ENDIF() ENDIF()
IF(HAVE_ALARM) IF(HAVE_ALARM)
......
/* Copyright (C) 2011 Monty Program Ab
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
#include <my_sys.h>
/**
@brief retrieve last component of the filename.
Loosely based on Single Unix Spec definition.
@fn my_basename()
@param filename Filename
*/
const char *my_basename(const char *filename)
{
const char *last;
const char *s=filename;
/* Handle basename()'s special cases, as per single unix spec */
if (!filename || !filename[0])
return ".";
if(filename[0] == '/' && filename[1]== '\0')
return filename;
for(last= s; *s; s++)
{
if (*s == '/' || *s == '\\')
last= s + 1;
}
return last;
}
...@@ -465,6 +465,7 @@ void my_write_core(int sig) ...@@ -465,6 +465,7 @@ void my_write_core(int sig)
#include <dbghelp.h> #include <dbghelp.h>
#include <tlhelp32.h> #include <tlhelp32.h>
#include <my_sys.h>
#if _MSC_VER #if _MSC_VER
#pragma comment(lib, "dbghelp") #pragma comment(lib, "dbghelp")
#endif #endif
...@@ -652,14 +653,10 @@ void my_print_stacktrace(uchar* unused1, ulong unused2) ...@@ -652,14 +653,10 @@ void my_print_stacktrace(uchar* unused1, ulong unused2)
&(package.sym)); &(package.sym));
have_source= SymGetLineFromAddr64(hProcess, addr, &line_offset, &line); have_source= SymGetLineFromAddr64(hProcess, addr, &line_offset, &line);
my_safe_printf_stderr("%p ", addr); my_safe_printf_stderr("%p ", (uintptr_t)addr);
if(have_module) if(have_module)
{ {
char *base_image_name= strrchr(module.ImageName, '\\'); const char *base_image_name= my_basename(module.ImageName);
if(base_image_name)
base_image_name++;
else
base_image_name= module.ImageName;
my_safe_printf_stderr("%s!", base_image_name); my_safe_printf_stderr("%s!", base_image_name);
} }
if(have_symbol) if(have_symbol)
...@@ -670,11 +667,7 @@ void my_print_stacktrace(uchar* unused1, ulong unused2) ...@@ -670,11 +667,7 @@ void my_print_stacktrace(uchar* unused1, ulong unused2)
if(have_source) if(have_source)
{ {
char *base_file_name= strrchr(line.FileName, '\\'); const char *base_file_name= my_basename(line.FileName);
if(base_file_name)
base_file_name++;
else
base_file_name= line.FileName;
my_safe_printf_stderr("[%s:%u]", my_safe_printf_stderr("[%s:%u]",
base_file_name, line.LineNumber); base_file_name, line.LineNumber);
} }
......
...@@ -554,6 +554,7 @@ static int send_heartbeat_event(NET* net, String* packet, ...@@ -554,6 +554,7 @@ static int send_heartbeat_event(NET* net, String* packet,
DBUG_RETURN(0); DBUG_RETURN(0);
} }
/* /*
TODO: Clean up loop to only have one call to send_file() TODO: Clean up loop to only have one call to send_file()
*/ */
...@@ -1194,8 +1195,8 @@ err: ...@@ -1194,8 +1195,8 @@ err:
of the last position read. of the last position read.
*/ */
my_snprintf(error_text, sizeof(error_text), fmt, errmsg, my_snprintf(error_text, sizeof(error_text), fmt, errmsg,
coord->file_name, (llstr(coord->pos, llbuff1), llbuff1), my_basename(coord->file_name), (llstr(coord->pos, llbuff1), llbuff1),
log_file_name, (llstr(my_b_tell(&log), llbuff2), llbuff2)); my_basename(log_file_name), (llstr(my_b_tell(&log), llbuff2), llbuff2));
} }
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