BUILD/compile-pentium-debug

    make -j 2
mysys/my_open.c
    my_umask is better than 0 - we do not want 0000 files when my_open() is called with O_CREAT
sql/log.cc
    fixed up IO_CACHE to make replication work, not fully yet
sql/log_event.cc
    fixed up IO_CACHE
parent eb0a423e
...@@ -174,3 +174,5 @@ mysql-test/var/lib/test/elt_ck2.MYD ...@@ -174,3 +174,5 @@ mysql-test/var/lib/test/elt_ck2.MYD
mysql-test/var/lib/test/elt_ck2.MYI mysql-test/var/lib/test/elt_ck2.MYI
repl-tests/test-repl-ts/repl-timestamp.master.reject repl-tests/test-repl-ts/repl-timestamp.master.reject
client/.mysqladmin.c.swp client/.mysqladmin.c.swp
repl-tests/test-repl/sum-wlen-slave.master.reje
support-files/mysql-3.23.28-gamma.spec
...@@ -17,4 +17,4 @@ CFLAGS="-DEXTRA_DEBUG -DFORCE_INIT_OF_VARS -O2 -mpentiumpro $C_WARNINGS" CXX=gc ...@@ -17,4 +17,4 @@ CFLAGS="-DEXTRA_DEBUG -DFORCE_INIT_OF_VARS -O2 -mpentiumpro $C_WARNINGS" CXX=gc
CXXFLAGS="-DEXTRA_DEBUG -DFORCE_INIT_OF_VARS -O2 -mpentiumpro -felide-constructors -fno-exceptions -fno-rtti $CC_WARNINGS" \ CXXFLAGS="-DEXTRA_DEBUG -DFORCE_INIT_OF_VARS -O2 -mpentiumpro -felide-constructors -fno-exceptions -fno-rtti $CC_WARNINGS" \
./configure --prefix=/usr/local/mysql --enable-assembler --with-mysqld-ldflags=-all-static --disable-shared --with-extra-charsets=complex --with-debug=full \ ./configure --prefix=/usr/local/mysql --enable-assembler --with-mysqld-ldflags=-all-static --disable-shared --with-extra-charsets=complex --with-debug=full \
--with-berkeley-db=/usr/local/BerkeleyDB --with-berkeley-db=/usr/local/BerkeleyDB
make make -j 2
...@@ -40,7 +40,7 @@ File my_open(const char *FileName, int Flags, myf MyFlags) ...@@ -40,7 +40,7 @@ File my_open(const char *FileName, int Flags, myf MyFlags)
else else
fd = open((my_string) FileName, Flags | O_BINARY); fd = open((my_string) FileName, Flags | O_BINARY);
#elif !defined(NO_OPEN_3) #elif !defined(NO_OPEN_3)
fd = open(FileName, Flags, 0); /* Normal unix */ fd = open(FileName, Flags, my_umask); /* Normal unix */
#else #else
fd = open((my_string) FileName, Flags); fd = open((my_string) FileName, Flags);
#endif #endif
......
...@@ -73,7 +73,7 @@ static int find_uniq_filename(char *name) ...@@ -73,7 +73,7 @@ static int find_uniq_filename(char *name)
DBUG_RETURN(0); DBUG_RETURN(0);
} }
MYSQL_LOG::MYSQL_LOG(): last_time(0), query_start(0), MYSQL_LOG::MYSQL_LOG(): last_time(0), query_start(0),index_file(-1),
name(0), log_type(LOG_CLOSED),write_error(0), name(0), log_type(LOG_CLOSED),write_error(0),
inited(0), opened(0), no_rotate(0) inited(0), opened(0), no_rotate(0)
{ {
...@@ -156,7 +156,7 @@ void MYSQL_LOG::open(const char *log_name, enum_log_type log_type_arg, ...@@ -156,7 +156,7 @@ void MYSQL_LOG::open(const char *log_name, enum_log_type log_type_arg,
do_magic = ((log_type == LOG_BIN) && !my_stat(log_file_name, do_magic = ((log_type == LOG_BIN) && !my_stat(log_file_name,
&tmp_stat, MYF(0))); &tmp_stat, MYF(0)));
if ((file=my_open(log_file_name,O_APPEND | O_WRONLY | O_BINARY, if ((file=my_open(log_file_name,O_APPEND | O_WRONLY | O_BINARY|O_CREAT,
MYF(MY_WME | ME_WAITTANG))) < 0 || MYF(MY_WME | ME_WAITTANG))) < 0 ||
init_io_cache(&log_file, file, IO_SIZE, WRITE_CACHE, init_io_cache(&log_file, file, IO_SIZE, WRITE_CACHE,
my_tell(file,MYF(MY_WME)), 0, MYF(MY_WME | MY_NABP))) my_tell(file,MYF(MY_WME)), 0, MYF(MY_WME | MY_NABP)))
...@@ -203,11 +203,13 @@ void MYSQL_LOG::open(const char *log_name, enum_log_type log_type_arg, ...@@ -203,11 +203,13 @@ void MYSQL_LOG::open(const char *log_name, enum_log_type log_type_arg,
if ((do_magic && my_b_write(&log_file, (byte*) BINLOG_MAGIC, 4)) || if ((do_magic && my_b_write(&log_file, (byte*) BINLOG_MAGIC, 4)) ||
(index_file < 0 && (index_file < 0 &&
(index_file = my_open(index_file_name,O_APPEND | O_BINARY | O_RDWR, (index_file = my_open(index_file_name,
O_APPEND | O_BINARY | O_RDWR |O_CREAT,
MYF(MY_WME))) < 0)) MYF(MY_WME))) < 0))
goto err; goto err;
Start_log_event s; Start_log_event s;
s.write(&log_file); s.write(&log_file);
flush_io_cache(&log_file);
pthread_mutex_lock(&LOCK_index); pthread_mutex_lock(&LOCK_index);
my_write(index_file, log_file_name,strlen(log_file_name), MYF(0)); my_write(index_file, log_file_name,strlen(log_file_name), MYF(0));
my_write(index_file, "\n",1, MYF(0)); my_write(index_file, "\n",1, MYF(0));
...@@ -242,7 +244,7 @@ int MYSQL_LOG::find_first_log(LOG_INFO* linfo, const char* log_name) ...@@ -242,7 +244,7 @@ int MYSQL_LOG::find_first_log(LOG_INFO* linfo, const char* log_name)
return LOG_INFO_INVALID; return LOG_INFO_INVALID;
int error = 0; int error = 0;
char* fname = linfo->log_file_name; char* fname = linfo->log_file_name;
int log_name_len = (uint) strlen(log_name); uint log_name_len = (uint) strlen(log_name);
IO_CACHE io_cache; IO_CACHE io_cache;
// mutex needed because we need to make sure the file pointer does not move // mutex needed because we need to make sure the file pointer does not move
...@@ -287,7 +289,7 @@ int MYSQL_LOG::find_next_log(LOG_INFO* linfo) ...@@ -287,7 +289,7 @@ int MYSQL_LOG::find_next_log(LOG_INFO* linfo)
{ {
// mutex needed because we need to make sure the file pointer does not move // mutex needed because we need to make sure the file pointer does not move
// from under our feet // from under our feet
if (!index_file) return LOG_INFO_INVALID; if (index_file < 0) return LOG_INFO_INVALID;
int error = 0; int error = 0;
char* fname = linfo->log_file_name; char* fname = linfo->log_file_name;
IO_CACHE io_cache; IO_CACHE io_cache;
...@@ -323,7 +325,7 @@ int MYSQL_LOG::purge_logs(THD* thd, const char* to_log) ...@@ -323,7 +325,7 @@ int MYSQL_LOG::purge_logs(THD* thd, const char* to_log)
if (no_rotate) return LOG_INFO_PURGE_NO_ROTATE; if (no_rotate) return LOG_INFO_PURGE_NO_ROTATE;
int error; int error;
char fname[FN_REFLEN]; char fname[FN_REFLEN];
char* fname_end, *p; char *p;
uint fname_len, i; uint fname_len, i;
bool logs_to_purge_inited = 0, logs_to_keep_inited = 0, found_log = 0; bool logs_to_purge_inited = 0, logs_to_keep_inited = 0, found_log = 0;
DYNAMIC_ARRAY logs_to_purge, logs_to_keep; DYNAMIC_ARRAY logs_to_purge, logs_to_keep;
...@@ -379,7 +381,7 @@ int MYSQL_LOG::purge_logs(THD* thd, const char* to_log) ...@@ -379,7 +381,7 @@ int MYSQL_LOG::purge_logs(THD* thd, const char* to_log)
goto err; goto err;
} }
if (!(p = sql_memdup(fname, (uint)(fname_end - fname) + 1)) || if (!(p = sql_memdup(fname, fname_len+1)) ||
insert_dynamic(found_log ? &logs_to_keep : &logs_to_purge, insert_dynamic(found_log ? &logs_to_keep : &logs_to_purge,
(gptr) &p)) (gptr) &p))
{ {
...@@ -418,7 +420,8 @@ during log purge for write"); ...@@ -418,7 +420,8 @@ during log purge for write");
#else #else
my_close(index_file, MYF(MY_WME)); my_close(index_file, MYF(MY_WME));
my_delete(index_file_name, MYF(MY_WME)); my_delete(index_file_name, MYF(MY_WME));
if(!(index_file = my_open(index_file_name, O_BINARY | O_RDWR | O_APPEND, if(!(index_file = my_open(index_file_name,
O_BINARY | O_RDWR | O_APPEND |O_CREAT,
MYF(MY_WME)))) MYF(MY_WME))))
{ {
sql_print_error("Ouch! Could not re-open the binlog index file \ sql_print_error("Ouch! Could not re-open the binlog index file \
...@@ -432,8 +435,8 @@ during log purge for write"); ...@@ -432,8 +435,8 @@ during log purge for write");
{ {
char* l; char* l;
get_dynamic(&logs_to_keep, (gptr)&l, i); get_dynamic(&logs_to_keep, (gptr)&l, i);
if (my_write(index_file, l, strlen(l), MYF(MY_WME)) || if (my_write(index_file, l, strlen(l), MYF(MY_WME|MY_NABP)) ||
my_write(index_file, "\n", 1, MYF(MY_WME))) my_write(index_file, "\n", 1, MYF(MY_WME|MY_NABP)))
{ {
error = LOG_INFO_FATAL; error = LOG_INFO_FATAL;
goto err; goto err;
...@@ -819,7 +822,6 @@ void MYSQL_LOG::close(bool exiting) ...@@ -819,7 +822,6 @@ void MYSQL_LOG::close(bool exiting)
write_error=1; write_error=1;
sql_print_error(ER(ER_ERROR_ON_WRITE),name,errno); sql_print_error(ER(ER_ERROR_ON_WRITE),name,errno);
} }
log_type=LOG_CLOSED;
} }
if (exiting && index_file >= 0) if (exiting && index_file >= 0)
{ {
...@@ -828,7 +830,8 @@ void MYSQL_LOG::close(bool exiting) ...@@ -828,7 +830,8 @@ void MYSQL_LOG::close(bool exiting)
write_error=1; write_error=1;
sql_print_error(ER(ER_ERROR_ON_WRITE),name,errno); sql_print_error(ER(ER_ERROR_ON_WRITE),name,errno);
} }
index_file=0; index_file=-1;
log_type=LOG_CLOSED;
} }
safeFree(name); safeFree(name);
} }
......
...@@ -78,7 +78,10 @@ int Log_event::read_log_event(IO_CACHE* file, String* packet, ...@@ -78,7 +78,10 @@ int Log_event::read_log_event(IO_CACHE* file, String* packet,
if (my_b_read(file, (byte*) buf, sizeof(buf))) if (my_b_read(file, (byte*) buf, sizeof(buf)))
{ {
if (log_lock) pthread_mutex_unlock(log_lock); if (log_lock) pthread_mutex_unlock(log_lock);
return file->error >= 0 ? LOG_READ_TRUNC: LOG_READ_IO; // if the read hits eof, we must report it as eof
// so the caller will know it can go into cond_wait to be woken up
// on the next update to the log
return file->error >= 0 ? LOG_READ_EOF: LOG_READ_IO;
} }
data_len = uint4korr(buf + EVENT_LEN_OFFSET); data_len = uint4korr(buf + EVENT_LEN_OFFSET);
if (data_len < LOG_EVENT_HEADER_LEN || data_len > MAX_EVENT_LEN) if (data_len < LOG_EVENT_HEADER_LEN || data_len > MAX_EVENT_LEN)
...@@ -94,6 +97,9 @@ int Log_event::read_log_event(IO_CACHE* file, String* packet, ...@@ -94,6 +97,9 @@ int Log_event::read_log_event(IO_CACHE* file, String* packet,
{ {
if(log_lock) if(log_lock)
pthread_mutex_unlock(log_lock); pthread_mutex_unlock(log_lock);
// here we should never hit eof in a non-error condtion
// eof means we are reading the event partially, which should
// never happen
return file->error >= 0 ? LOG_READ_TRUNC: LOG_READ_IO; return file->error >= 0 ? LOG_READ_TRUNC: LOG_READ_IO;
} }
} }
......
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