Commit cd6a090a authored by unknown's avatar unknown

Merge bk-internal.mysql.com:/home/bk/mysql-maria

into  janus.mylan:/usr/home/serg/Abk/mysql-maria

parents 7a0a3223 99b3d018
...@@ -8,7 +8,7 @@ let $counter= 5000; ...@@ -8,7 +8,7 @@ let $counter= 5000;
let $mysql_errno= 1; let $mysql_errno= 1;
while ($mysql_errno) while ($mysql_errno)
{ {
--error 0,2002,2003,2006 --error 0,2002,2003,2006,1053
show status; show status;
dec $counter; dec $counter;
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
# Binary must be compiled with debug for crash to occur # Binary must be compiled with debug for crash to occur
--source include/have_debug.inc --source include/have_debug.inc
--source include/have_maria.inc --source include/have_maria.inc
--source include/big_test.inc
set global maria_log_file_size=4294967295; set global maria_log_file_size=4294967295;
......
...@@ -48,6 +48,9 @@ size_t my_pread(File Filedes, uchar *Buffer, size_t Count, my_off_t offset, ...@@ -48,6 +48,9 @@ size_t my_pread(File Filedes, uchar *Buffer, size_t Count, my_off_t offset,
{ {
size_t readbytes; size_t readbytes;
int error= 0; int error= 0;
#ifndef HAVE_PREAD
int save_errno;
#endif
#ifndef DBUG_OFF #ifndef DBUG_OFF
char llbuf[22]; char llbuf[22];
DBUG_ENTER("my_pread"); DBUG_ENTER("my_pread");
...@@ -57,26 +60,25 @@ size_t my_pread(File Filedes, uchar *Buffer, size_t Count, my_off_t offset, ...@@ -57,26 +60,25 @@ size_t my_pread(File Filedes, uchar *Buffer, size_t Count, my_off_t offset,
#endif #endif
for (;;) for (;;)
{ {
#ifndef __WIN__ errno=0; /* Linux, Windows don't reset this on EOF/success */
errno=0; /* Linux doesn't reset this */
#endif
#ifndef HAVE_PREAD #ifndef HAVE_PREAD
pthread_mutex_lock(&my_file_info[Filedes].mutex); pthread_mutex_lock(&my_file_info[Filedes].mutex);
readbytes= (uint) -1; readbytes= (uint) -1;
error= (lseek(Filedes, offset, MY_SEEK_SET) == (my_off_t) -1 || error= (lseek(Filedes, offset, MY_SEEK_SET) == (my_off_t) -1 ||
(readbytes= read(Filedes, Buffer, Count)) != Count); (readbytes= read(Filedes, Buffer, Count)) != Count);
save_errno= errno;
pthread_mutex_unlock(&my_file_info[Filedes].mutex); pthread_mutex_unlock(&my_file_info[Filedes].mutex);
if (error)
{
errno= save_errno;
#else #else
if ((error= ((readbytes= pread(Filedes, Buffer, Count, offset)) != Count))) if ((error= ((readbytes= pread(Filedes, Buffer, Count, offset)) != Count)))
{ {
#endif
my_errno= errno; my_errno= errno;
if (errno == 0 || (readbytes == (size_t) -1 && if (errno == 0 || (readbytes != (size_t) -1 &&
(MyFlags & (MY_NABP | MY_FNABP)))) (MyFlags & (MY_NABP | MY_FNABP))))
my_errno= HA_ERR_FILE_TOO_SHORT; my_errno= HA_ERR_FILE_TOO_SHORT;
}
#endif
if (error)
{
DBUG_PRINT("warning",("Read only %d bytes off %u from %d, errno: %d", DBUG_PRINT("warning",("Read only %d bytes off %u from %d, errno: %d",
(int) readbytes, (uint) Count,Filedes,my_errno)); (int) readbytes, (uint) Count,Filedes,my_errno));
#ifdef THREAD #ifdef THREAD
......
...@@ -43,11 +43,11 @@ size_t my_read(File Filedes, uchar *Buffer, size_t Count, myf MyFlags) ...@@ -43,11 +43,11 @@ size_t my_read(File Filedes, uchar *Buffer, size_t Count, myf MyFlags)
for (;;) for (;;)
{ {
errno= 0; /* Linux doesn't reset this */ errno= 0; /* Linux, Windows don't reset this on EOF/success */
if ((readbytes= read(Filedes, Buffer, Count)) != Count) if ((readbytes= read(Filedes, Buffer, Count)) != Count)
{ {
my_errno= errno; my_errno= errno;
if (errno == 0 || (readbytes == (size_t) -1 && if (errno == 0 || (readbytes != (size_t) -1 &&
(MyFlags & (MY_NABP | MY_FNABP)))) (MyFlags & (MY_NABP | MY_FNABP))))
my_errno= HA_ERR_FILE_TOO_SHORT; my_errno= HA_ERR_FILE_TOO_SHORT;
DBUG_PRINT("warning",("Read only %d bytes off %lu from %d, errno: %d", DBUG_PRINT("warning",("Read only %d bytes off %lu from %d, errno: %d",
......
...@@ -3246,6 +3246,7 @@ my_bool translog_init_with_table(const char *directory, ...@@ -3246,6 +3246,7 @@ my_bool translog_init_with_table(const char *directory,
DBUG_ENTER("translog_init_with_table"); DBUG_ENTER("translog_init_with_table");
id_to_share= NULL; id_to_share= NULL;
log_descriptor.directory_fd= -1;
(*init_table_func)(); (*init_table_func)();
...@@ -3914,7 +3915,8 @@ void translog_destroy() ...@@ -3914,7 +3915,8 @@ void translog_destroy()
delete_dynamic(&log_descriptor.open_files); delete_dynamic(&log_descriptor.open_files);
delete_dynamic(&log_descriptor.unfinished_files); delete_dynamic(&log_descriptor.unfinished_files);
my_close(log_descriptor.directory_fd, MYF(MY_WME)); if (log_descriptor.directory_fd >= 0)
my_close(log_descriptor.directory_fd, MYF(MY_WME));
my_atomic_rwlock_destroy(&LOCK_id_to_share); my_atomic_rwlock_destroy(&LOCK_id_to_share);
if (id_to_share != NULL) if (id_to_share != NULL)
my_free((uchar*)(id_to_share + 1), MYF(MY_WME)); my_free((uchar*)(id_to_share + 1), MYF(MY_WME));
......
...@@ -326,9 +326,12 @@ my_off_t _ma_new(register MARIA_HA *info, int level, ...@@ -326,9 +326,12 @@ my_off_t _ma_new(register MARIA_HA *info, int level,
Next deleted page's number is in the header of the present page Next deleted page's number is in the header of the present page
(single linked list): (single linked list):
*/ */
#ifndef DBUG_OFF
my_off_t current_key_del;
#endif
share->current_key_del= mi_sizekorr(buff+share->keypage_header); share->current_key_del= mi_sizekorr(buff+share->keypage_header);
#ifndef DBUG_OFF #ifndef DBUG_OFF
my_off_t current_key_del= share->current_key_del; current_key_del= share->current_key_del;
DBUG_ASSERT(current_key_del != share->state.key_del && DBUG_ASSERT(current_key_del != share->state.key_del &&
(current_key_del != 0) && (current_key_del != 0) &&
((current_key_del == HA_OFFSET_ERROR) || ((current_key_del == HA_OFFSET_ERROR) ||
......
...@@ -219,11 +219,11 @@ fi ...@@ -219,11 +219,11 @@ fi
# also note that maria_chk -dvv shows differences for ma_test2 in UNDO phase, # also note that maria_chk -dvv shows differences for ma_test2 in UNDO phase,
# this is normal: removing records does not shrink the data/key file, # this is normal: removing records does not shrink the data/key file,
# does not put back the "analyzed,optimized keys"(etc) index state. # does not put back the "analyzed,optimized keys"(etc) index state.
diff $maria_path/ma_test_recovery.expected $tmp/ma_test_recovery.output > /dev/null || diff_failed=1 diff $maria_path/unittest/ma_test_recovery.expected $tmp/ma_test_recovery.output > /dev/null || diff_failed=1
if [ "$diff_failed" == "1" ] if [ "$diff_failed" == "1" ]
then then
echo "UNEXPECTED OUTPUT OF TESTS, FAILED" echo "UNEXPECTED OUTPUT OF TESTS, FAILED"
echo "For more info, do diff $maria_path/ma_test_recovery.expected $tmp/ma_test_recovery.output" echo "For more info, do diff $maria_path/unittest/ma_test_recovery.expected $tmp/ma_test_recovery.output"
exit 1 exit 1
fi fi
echo "ALL RECOVERY TESTS OK" echo "ALL RECOVERY TESTS OK"
This diff is collapsed.
This diff is collapsed.
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