summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/my_sys.h1
-rw-r--r--include/mysys_err.h3
-rw-r--r--mysys/Makefile.am2
-rw-r--r--mysys/errors.c4
-rw-r--r--mysys/my_chmod.c48
-rw-r--r--mysys/my_init.c45
-rw-r--r--storage/maria/ma_test1.c4
-rwxr-xr-xstorage/maria/ma_test_recovery28
-rw-r--r--storage/maria/ma_test_recovery.expected6
-rw-r--r--storage/maria/maria_read_log.c6
-rw-r--r--storage/maria/unittest/ma_pagecache_consist.c20
-rw-r--r--storage/maria/unittest/ma_pagecache_single.c22
-rw-r--r--storage/maria/unittest/ma_test_loghandler_first_lsn-t.c7
-rw-r--r--storage/maria/unittest/ma_test_loghandler_multithread-t.c14
-rw-r--r--storage/maria/unittest/ma_test_loghandler_noflush-t.c7
-rw-r--r--storage/maria/unittest/ma_test_loghandler_nologs-t.c3
-rw-r--r--storage/maria/unittest/ma_test_loghandler_pagecache-t.c12
17 files changed, 128 insertions, 104 deletions
diff --git a/include/my_sys.h b/include/my_sys.h
index 7c39e69ad6e..e04c0da3132 100644
--- a/include/my_sys.h
+++ b/include/my_sys.h
@@ -645,6 +645,7 @@ extern FILE *my_fopen(const char *FileName,int Flags,myf MyFlags);
extern FILE *my_fdopen(File Filedes,const char *name, int Flags,myf MyFlags);
extern int my_fclose(FILE *fd,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_sync(File fd, myf my_flags);
extern int my_sync_dir(const char *dir_name, myf my_flags);
extern int my_sync_dir_by_file(const char *file_name, myf my_flags);
diff --git a/include/mysys_err.h b/include/mysys_err.h
index 09e77248c17..7167395f71f 100644
--- a/include/mysys_err.h
+++ b/include/mysys_err.h
@@ -62,7 +62,8 @@ extern const char * NEAR globerrs[]; /* my_error_messages is here */
#define EE_UNKNOWN_COLLATION 28
#define EE_FILENOTFOUND 29
#define EE_FILE_NOT_CLOSED 30
-#define EE_ERROR_LAST 30 /* Copy last error nr */
+#define EE_CANT_CHMOD 31
+#define EE_ERROR_LAST 31 /* Copy last error nr */
/* Add error numbers before EE_ERROR_LAST and change it accordingly. */
/* exit codes for all MySQL programs */
diff --git a/mysys/Makefile.am b/mysys/Makefile.am
index 10200fde8be..27cae5c6363 100644
--- a/mysys/Makefile.am
+++ b/mysys/Makefile.am
@@ -45,7 +45,7 @@ libmysys_a_SOURCES = my_init.c my_getwd.c mf_getdate.c my_mmap.c \
tree.c trie.c list.c hash.c array.c string.c typelib.c \
my_copy.c my_append.c my_lib.c \
my_delete.c my_rename.c my_redel.c \
- my_chsize.c my_clock.c \
+ my_chsize.c my_chmod.c my_clock.c \
my_quick.c my_lockmem.c my_static.c \
my_sync.c my_getopt.c my_mkdir.c \
default_modify.c default.c \
diff --git a/mysys/errors.c b/mysys/errors.c
index 889cf6d7fe3..db63667fb77 100644
--- a/mysys/errors.c
+++ b/mysys/errors.c
@@ -49,7 +49,8 @@ const char * NEAR globerrs[GLOBERRS]=
"Can't sync file '%s' to disk (Errcode: %d)",
"Collation '%s' is not a compiled collation and is not specified in the '%s' file",
"File '%s' not found (Errcode: %d)",
- "File '%s' (fileno: %d) was not closed"
+ "File '%s' (fileno: %d) was not closed",
+ "Can't change mode for file '%s' to 0x%lx (Error: %d)"
};
void init_glob_errs(void)
@@ -90,5 +91,6 @@ void init_glob_errs()
EE(EE_UNKNOWN_COLLATION)= "Collation '%s' is not a compiled collation and is not specified in the %s file";
EE(EE_FILENOTFOUND) = "File '%s' not found (Errcode: %d)";
EE(EE_FILE_NOT_CLOSED) = "File '%s' (fileno: %d) was not closed";
+ EE(EE_CANT_CHMOD) = "Can't change mode for file '%s' to 0x%lx (Error: %d)";
}
#endif
diff --git a/mysys/my_chmod.c b/mysys/my_chmod.c
new file mode 100644
index 00000000000..afdea758833
--- /dev/null
+++ b/mysys/my_chmod.c
@@ -0,0 +1,48 @@
+/* Copyright (C) 2000 MySQL 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+
+#include "mysys_priv.h"
+#include "mysys_err.h"
+
+/**
+ @brief Change mode of file.
+
+ @fn my_chmod()
+ @param name Filename
+ @param mode_t Mode
+ @param my_flags Flags
+
+ @notes
+ The mode of the file given by path or referenced by fildes is changed
+
+ @retval 0 Ok
+ @retval # Error
+*/
+
+int my_chmod(const char *name, mode_t mode, myf my_flags)
+{
+ DBUG_ENTER("my_chmod");
+ DBUG_PRINT("my",("name: %s mode: %lu flags: %d", name, (ulong) mode,
+ my_flags));
+
+ if (chmod(name, mode))
+ {
+ my_errno= errno;
+ if (my_flags & MY_WME)
+ my_error(EE_CANT_CHMOD, MYF(0), name, (ulong) mode, my_errno);
+ DBUG_RETURN(1);
+ }
+ DBUG_RETURN(0);
+}
diff --git a/mysys/my_init.c b/mysys/my_init.c
index 145a435b4b6..a153275f87e 100644
--- a/mysys/my_init.c
+++ b/mysys/my_init.c
@@ -356,6 +356,30 @@ static void my_win_init(void)
_tzset();
+ /* The following is used by time functions */
+#define OFFSET_TO_EPOC ((__int64) 134774 * 24 * 60 * 60 * 1000 * 1000 * 10)
+#define MS 10000000
+ {
+ FILETIME ft;
+ LARGE_INTEGER li, t_cnt;
+ DBUG_ASSERT(sizeof(LARGE_INTEGER) == sizeof(query_performance_frequency));
+ if (QueryPerformanceFrequency((LARGE_INTEGER *)&query_performance_frequency) == 0)
+ query_performance_frequency= 0;
+ else
+ {
+ GetSystemTimeAsFileTime(&ft);
+ li.LowPart= ft.dwLowDateTime;
+ li.HighPart= ft.dwHighDateTime;
+ query_performance_offset= li.QuadPart-OFFSET_TO_EPOC;
+ QueryPerformanceCounter(&t_cnt);
+ query_performance_offset-= (t_cnt.QuadPart /
+ query_performance_frequency * MS +
+ t_cnt.QuadPart %
+ query_performance_frequency * MS /
+ query_performance_frequency);
+ }
+ }
+
/* apre la chiave HKEY_LOCAL_MACHINES\software\MySQL */
if (RegOpenKeyEx(HKEY_LOCAL_MACHINE,(LPCTSTR)targetKey,0,
KEY_READ,&hSoftMysql) != ERROR_SUCCESS)
@@ -393,27 +417,6 @@ static void my_win_init(void)
/* chiude la chiave */
RegCloseKey(hSoftMysql) ;
- /* The following is used by time functions */
-#define OFFSET_TO_EPOC ((__int64) 134774 * 24 * 60 * 60 * 1000 * 1000 * 10)
-#define MS 10000000
- {
- FILETIME ft;
- LARGE_INTEGER li, t_cnt;
- DBUG_ASSERT(sizeof(LARGE_INTEGER) == sizeof(query_performance_frequency));
- if (QueryPerformanceFrequency((LARGE_INTEGER *)&query_performance_frequency))
- query_performance_frequency= 0;
- else
- {
- GetSystemTimeAsFileTime(&ft);
- li.LowPart= ft.dwLowDateTime;
- li.HighPart= ft.dwHighDateTime;
- query_performance_offset= li.QuadPart-OFFSET_TO_EPOC;
- QueryPerformanceCounter(&t_cnt);
- query_performance_offset-= (t_cnt.QuadPart / query_performance_frequency * MS +
- t_cnt.QuadPart % query_performance_frequency * MS /
- query_performance_frequency);
- }
- }
DBUG_VOID_RETURN ;
}
diff --git a/storage/maria/ma_test1.c b/storage/maria/ma_test1.c
index 363bceb7067..a23d37a82af 100644
--- a/storage/maria/ma_test1.c
+++ b/storage/maria/ma_test1.c
@@ -752,9 +752,9 @@ static struct my_option my_long_options[] =
{"silent", 's', "Undocumented",
(uchar**) &silent, (uchar**) &silent, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
0, 0},
- {"skip-delete", 'U', "Don't test deletes", (uchar**) &skip_delete,
+ {"skip-delete", 'D', "Don't test deletes", (uchar**) &skip_delete,
(uchar**) &skip_delete, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
- {"skip-update", 'D', "Don't test updates", (uchar**) &skip_update,
+ {"skip-update", 'U', "Don't test updates", (uchar**) &skip_update,
(uchar**) &skip_update, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"testflag", 't', "Stop test at specified stage", (uchar**) &testflag,
(uchar**) &testflag, 0, GET_INT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
diff --git a/storage/maria/ma_test_recovery b/storage/maria/ma_test_recovery
index 1794f245dfc..f6bc2a8be0a 100755
--- a/storage/maria/ma_test_recovery
+++ b/storage/maria/ma_test_recovery
@@ -20,6 +20,13 @@ fi
echo "MARIA RECOVERY TESTS"
+if $maria_path/maria_read_log --help | grep IDENTICAL_PAGES_AFTER_RECOVERY
+then
+ echo "Recovery tests require compilation with DBUG"
+ echo "Aborting test"
+ exit 0
+fi
+
check_table_is_same()
{
# Computes checksum of new table and compares to checksum of old table
@@ -90,7 +97,7 @@ echo "Testing the REDO PHASE ALONE"
# identical to the saved original.
# Does not test the index file as we don't have logging for it yet.
-set -- "ma_test1 $silent -M -T -c" "ma_test2 $silent -L -K -W -P -M -T -c" "ma_test2 $silent -M -T -c -b65000"
+set -- "ma_test1 $silent -M -T -c" "ma_test2 $silent -L -K -W -P -M -T -c -d500" "ma_test2 $silent -M -T -c -b65000" "ma_test2 $silent -M -T -c -b65000 -d800"
while [ $# != 0 ]
do
prog=$1
@@ -153,8 +160,8 @@ do
rm maria_log.* maria_log_control
echo "TEST WITH $prog $abort_run_args$test_undo (additional aborted work)"
$maria_path/$prog $abort_run_args$test_undo
- cp $table.MAD $tmp/$table.MAD.before_undo
- cp $table.MAI $tmp/$table.MAI.before_undo
+ cp $table.MAD $tmp/$table-before_undo.MAD
+ cp $table.MAI $tmp/$table-before_undo.MAI
# The lines below seem unneeded, will be removed soon
# We have to copy and restore logs, as running maria_read_log will
@@ -169,8 +176,8 @@ do
# probably nothing to undo went to log or data file
apply_log "dontknow"
fi
- cp $table.MAD $tmp/$table.MAD.after_undo
- cp $table.MAI $tmp/$table.MAI.after_undo
+ cp $table.MAD $tmp/$table-after_undo.MAD
+ cp $table.MAI $tmp/$table-after_undo.MAI
# It is impossible to do a "cmp" between .good and .after_undo,
# because the UNDO phase generated log
@@ -184,18 +191,15 @@ do
# We can't do a binary compary as there may have been different number
# of calls to compact_page. We can enable this if we first call
# maria-check to generate identically compacted pages.
-# cmp $table.MAD $tmp/$table.MAD.after_undo
- # can't do this, creation time differs at least; enable it if you
- # have a "cmp" which ignores the header.
- cmp $table.MAI $tmp/$table.MAI.after_undo
+# cmp $table.MAD $tmp/$table-after_undo.MAD
+ cmp $table.MAI $tmp/$table-after_undo.MAI
check_table_is_same
echo "testing applying of CLRs to recreate table"
rm $table.MA?
# cp $tmp/maria_log* $maria_path #unneeded
apply_log "shouldnotchangelog"
-# cmp $table.MAD $tmp/$table.MAD.after_undo
- # can't do this, creation time differs at least
- cmp $table.MAI $tmp/$table.MAI.after_undo
+# cmp $table.MAD $tmp/$table-after_undo.MAD
+ cmp $table.MAI $tmp/$table-after_undo.MAI
check_table_is_same
shift 3
done
diff --git a/storage/maria/ma_test_recovery.expected b/storage/maria/ma_test_recovery.expected
index 46b4fdaa296..7f40bb8bdfd 100644
--- a/storage/maria/ma_test_recovery.expected
+++ b/storage/maria/ma_test_recovery.expected
@@ -3,7 +3,7 @@ TEST WITH ma_test1 -s -M -T -c
applying log
testing idempotency
applying log
-TEST WITH ma_test2 -s -L -K -W -P -M -T -c
+TEST WITH ma_test2 -s -L -K -W -P -M -T -c -d500
applying log
testing idempotency
applying log
@@ -11,6 +11,10 @@ TEST WITH ma_test2 -s -M -T -c -b65000
applying log
testing idempotency
applying log
+TEST WITH ma_test2 -s -M -T -c -b65000 -d800
+applying log
+testing idempotency
+applying log
Testing the REDO AND UNDO PHASE
TEST WITH ma_test1 -s -M -T -c -N --testflag=1 (commit at end)
TEST WITH ma_test1 -s -M -T -c -N --testflag=2 --test-undo=1 (additional aborted work)
diff --git a/storage/maria/maria_read_log.c b/storage/maria/maria_read_log.c
index ff7be5b533b..21de2f07381 100644
--- a/storage/maria/maria_read_log.c
+++ b/storage/maria/maria_read_log.c
@@ -217,6 +217,12 @@ static void usage(void)
puts("Display and apply log records from a MARIA transaction log");
puts("found in the current directory (for now)");
+#ifndef IDENTICAL_PAGES_AFTER_RECOVERY
+ puts("\nNote: Maria is compiled without -DIDENTICAL_PAGES_AFTER_RECOVERY\n"
+ "which means that the table files are not byte-to-byte identical to\n"
+ "files created during normal execution. This should be ok, except for\n"
+ "test scripts that tries to compare files before and after recovery.");
+#endif
VOID(printf("\nUsage: %s OPTIONS\n", my_progname_short));
puts("You need to use one of -o or -a");
my_print_help(my_long_options);
diff --git a/storage/maria/unittest/ma_pagecache_consist.c b/storage/maria/unittest/ma_pagecache_consist.c
index 6da775764fb..e591e53a02e 100644
--- a/storage/maria/unittest/ma_pagecache_consist.c
+++ b/storage/maria/unittest/ma_pagecache_consist.c
@@ -183,7 +183,6 @@ void put_rec(uchar *buff, uint end, uint len, uint tag)
end+= sizeof(uint);
num++;
*((uint *)buff)= num;
- *((uint*)(buff + end))= len;
for (i= end; i < (len + end); i++)
{
buff[i]= (uchar) num % 256;
@@ -348,12 +347,8 @@ int main(int argc __attribute__((unused)),
pagecache_file_init(file1, &dummy_callback, &dummy_callback,
&dummy_fail_callback, &dummy_callback, NULL);
DBUG_PRINT("info", ("file1: %d", file1.file));
- if (chmod(file1_name, S_IRWXU | S_IRWXG | S_IRWXO) != 0)
- {
- fprintf(stderr, "Got error during file1 chmod() (errno: %d)\n",
- errno);
+ if (my_chmod(file1_name, S_IRWXU | S_IRWXG | S_IRWXO, MYF(MY_WME)))
exit(1);
- }
my_pwrite(file1.file, "test file", 9, 0, MYF(0));
if ((error= pthread_cond_init(&COND_thread_count, NULL)))
@@ -411,12 +406,7 @@ int main(int argc __attribute__((unused)),
flush_pagecache_blocks(&pagecache, &file1, FLUSH_FORCE_WRITE);
free(buffr);
}
- if ((error= pthread_mutex_lock(&LOCK_thread_count)))
- {
- fprintf(stderr,"LOCK_thread_count: %d from pthread_mutex_lock (errno: %d)\n",
- error,errno);
- exit(1);
- }
+ pthread_mutex_lock(&LOCK_thread_count);
while (number_of_readers != 0 || number_of_writers != 0)
{
if (number_of_readers != 0)
@@ -454,15 +444,13 @@ int main(int argc __attribute__((unused)),
pthread_attr_destroy(&thr_attr);
/* wait finishing */
- if ((error= pthread_mutex_lock(&LOCK_thread_count)))
- fprintf(stderr,"LOCK_thread_count: %d from pthread_mutex_lock\n",error);
+ pthread_mutex_lock(&LOCK_thread_count);
while (thread_count)
{
if ((error= pthread_cond_wait(&COND_thread_count,&LOCK_thread_count)))
fprintf(stderr,"COND_thread_count: %d from pthread_cond_wait\n",error);
}
- if ((error= pthread_mutex_unlock(&LOCK_thread_count)))
- fprintf(stderr,"LOCK_thread_count: %d from pthread_mutex_unlock\n",error);
+ pthread_mutex_unlock(&LOCK_thread_count);
DBUG_PRINT("info", ("thread ended"));
end_pagecache(&pagecache, 1);
diff --git a/storage/maria/unittest/ma_pagecache_single.c b/storage/maria/unittest/ma_pagecache_single.c
index 878cc15211a..359751c3c2a 100644
--- a/storage/maria/unittest/ma_pagecache_single.c
+++ b/storage/maria/unittest/ma_pagecache_single.c
@@ -537,13 +537,9 @@ int main(int argc __attribute__((unused)),
my_delete(file2_name, MYF(0));
DBUG_PRINT("info", ("file1: %d", file1.file));
- if (chmod(file1_name, S_IRWXU | S_IRWXG | S_IRWXO) != 0)
- {
- fprintf(stderr, "Got error during file1 chmod() (errno: %d)\n",
- errno);
+ if (my_chmod(file1_name, S_IRWXU | S_IRWXG | S_IRWXO, MYF(MY_WME)))
exit(1);
- }
- my_pwrite(file1.file, "test file", 9, 0, MYF(0));
+ my_pwrite(file1.file, "test file", 9, 0, MYF(MY_WME));
if ((error= pthread_cond_init(&COND_thread_count, NULL)))
{
@@ -587,12 +583,7 @@ int main(int argc __attribute__((unused)),
}
DBUG_PRINT("info", ("Page cache %d pages", pagen));
- if ((error=pthread_mutex_lock(&LOCK_thread_count)))
- {
- fprintf(stderr,"Got error: %d from pthread_mutex_lock (errno: %d)\n",
- error,errno);
- exit(1);
- }
+ pthread_mutex_lock(&LOCK_thread_count);
param=(int*) malloc(sizeof(int));
*param= 1;
if ((error= pthread_create(&tid, &thr_attr, test_thread, (void*) param)))
@@ -607,15 +598,13 @@ int main(int argc __attribute__((unused)),
pthread_attr_destroy(&thr_attr);
- if ((error= pthread_mutex_lock(&LOCK_thread_count)))
- fprintf(stderr,"Got error: %d from pthread_mutex_lock\n",error);
+ pthread_mutex_lock(&LOCK_thread_count);
while (thread_count)
{
if ((error= pthread_cond_wait(&COND_thread_count,&LOCK_thread_count)))
fprintf(stderr,"Got error: %d from pthread_cond_wait\n",error);
}
- if ((error= pthread_mutex_unlock(&LOCK_thread_count)))
- fprintf(stderr,"Got error: %d from pthread_mutex_unlock\n",error);
+ pthread_mutex_unlock(&LOCK_thread_count);
DBUG_PRINT("info", ("thread ended"));
end_pagecache(&pagecache, 1);
@@ -628,7 +617,6 @@ int main(int argc __attribute__((unused)),
my_end(0);
DBUG_PRINT("info", ("file1 (%d) closed", file1.file));
-
DBUG_PRINT("info", ("Program end"));
DBUG_RETURN(exit_status());
diff --git a/storage/maria/unittest/ma_test_loghandler_first_lsn-t.c b/storage/maria/unittest/ma_test_loghandler_first_lsn-t.c
index e07eb8621c0..5b7b43e4775 100644
--- a/storage/maria/unittest/ma_test_loghandler_first_lsn-t.c
+++ b/storage/maria/unittest/ma_test_loghandler_first_lsn-t.c
@@ -24,7 +24,6 @@ int main(int argc __attribute__((unused)), char *argv[])
uchar long_tr_id[6];
PAGECACHE pagecache;
LSN lsn, first_lsn, theor_lsn;
- MY_STAT st;
LEX_STRING parts[TRANSLOG_INTERNAL_PARTS + 1];
MY_INIT(argv[0]);
@@ -36,10 +35,8 @@ int main(int argc __attribute__((unused)), char *argv[])
if (maria_log_remove())
exit(1);
/* be sure that we have no logs in the directory*/
- if (my_stat(CONTROL_FILE_BASE_NAME, &st, MYF(0)))
- my_delete(CONTROL_FILE_BASE_NAME, MYF(0));
- if (my_stat(first_translog_file, &st, MYF(0)))
- my_delete(first_translog_file, MYF(0));
+ my_delete(CONTROL_FILE_BASE_NAME, MYF(0));
+ my_delete(first_translog_file, MYF(0));
bzero(long_tr_id, 6);
#ifndef DBUG_OFF
diff --git a/storage/maria/unittest/ma_test_loghandler_multithread-t.c b/storage/maria/unittest/ma_test_loghandler_multithread-t.c
index e33e5e9b0b3..1fa3da98a38 100644
--- a/storage/maria/unittest/ma_test_loghandler_multithread-t.c
+++ b/storage/maria/unittest/ma_test_loghandler_multithread-t.c
@@ -317,13 +317,7 @@ int main(int argc __attribute__((unused)),
}
- if ((error= pthread_mutex_lock(&LOCK_thread_count)))
- {
- fprintf(stderr, "LOCK_thread_count: %d from pthread_mutex_lock "
- "(errno: %d)\n", error, errno);
- exit(1);
- }
-
+ pthread_mutex_lock(&LOCK_thread_count);
while (number_of_writers != 0)
{
param= (int*) malloc(sizeof(int));
@@ -343,15 +337,13 @@ int main(int argc __attribute__((unused)),
pthread_attr_destroy(&thr_attr);
/* wait finishing */
- if ((error= pthread_mutex_lock(&LOCK_thread_count)))
- fprintf(stderr, "LOCK_thread_count: %d from pthread_mutex_lock\n", error);
+ pthread_mutex_lock(&LOCK_thread_count);
while (thread_count)
{
if ((error= pthread_cond_wait(&COND_thread_count, &LOCK_thread_count)))
fprintf(stderr, "COND_thread_count: %d from pthread_cond_wait\n", error);
}
- if ((error= pthread_mutex_unlock(&LOCK_thread_count)))
- fprintf(stderr, "LOCK_thread_count: %d from pthread_mutex_unlock\n", error);
+ pthread_mutex_unlock(&LOCK_thread_count);
/* Find last LSN and flush up to it (all our log) */
{
diff --git a/storage/maria/unittest/ma_test_loghandler_noflush-t.c b/storage/maria/unittest/ma_test_loghandler_noflush-t.c
index 098841e6288..08a5de57b13 100644
--- a/storage/maria/unittest/ma_test_loghandler_noflush-t.c
+++ b/storage/maria/unittest/ma_test_loghandler_noflush-t.c
@@ -25,7 +25,6 @@ int main(int argc __attribute__((unused)), char *argv[])
uchar long_tr_id[6];
PAGECACHE pagecache;
LSN first_lsn;
- MY_STAT st;
TRANSLOG_HEADER_BUFFER rec;
LEX_STRING parts[TRANSLOG_INTERNAL_PARTS + 1];
@@ -38,10 +37,8 @@ int main(int argc __attribute__((unused)), char *argv[])
if (maria_log_remove())
exit(1);
/* be sure that we have no logs in the directory*/
- if (my_stat(CONTROL_FILE_BASE_NAME, &st, MYF(0)))
- my_delete(CONTROL_FILE_BASE_NAME, MYF(0));
- if (my_stat(first_translog_file, &st, MYF(0)))
- my_delete(first_translog_file, MYF(0));
+ my_delete(CONTROL_FILE_BASE_NAME, MYF(0));
+ my_delete(first_translog_file, MYF(0));
bzero(long_tr_id, 6);
#ifndef DBUG_OFF
diff --git a/storage/maria/unittest/ma_test_loghandler_nologs-t.c b/storage/maria/unittest/ma_test_loghandler_nologs-t.c
index 339d07d0d9d..071b5281b6a 100644
--- a/storage/maria/unittest/ma_test_loghandler_nologs-t.c
+++ b/storage/maria/unittest/ma_test_loghandler_nologs-t.c
@@ -107,12 +107,11 @@ int main(int argc __attribute__((unused)), char *argv[])
ma_control_file_end();
{
- MY_STAT stat_buff;
char file_name[FN_REFLEN];
for (i= 1; i <= 2; i++)
{
translog_filename_by_fileno(i, file_name);
- if (my_stat(file_name, &stat_buff, MY_WME) == NULL)
+ if (my_access(file_name, W_OK))
{
fprintf(stderr, "No file '%s'\n", file_name);
exit(1);
diff --git a/storage/maria/unittest/ma_test_loghandler_pagecache-t.c b/storage/maria/unittest/ma_test_loghandler_pagecache-t.c
index 14732c83971..2b069b8c212 100644
--- a/storage/maria/unittest/ma_test_loghandler_pagecache-t.c
+++ b/storage/maria/unittest/ma_test_loghandler_pagecache-t.c
@@ -63,10 +63,8 @@ int main(int argc __attribute__((unused)), char *argv[])
if (maria_log_remove())
exit(1);
/* be sure that we have no logs in the directory*/
- if (my_stat(CONTROL_FILE_BASE_NAME, &st, MYF(0)))
- my_delete(CONTROL_FILE_BASE_NAME, MYF(0));
- if (my_stat(first_translog_file, &st, MYF(0)))
- my_delete(first_translog_file, MYF(0));
+ my_delete(CONTROL_FILE_BASE_NAME, MYF(0));
+ my_delete(first_translog_file, MYF(0));
bzero(long_tr_id, 6);
#ifndef DBUG_OFF
@@ -139,12 +137,8 @@ int main(int argc __attribute__((unused)), char *argv[])
}
pagecache_file_init(file1, &dummy_callback, &dummy_callback,
&dummy_fail_callback, maria_flush_log_for_page, NULL);
- if (chmod(file1_name, S_IRWXU | S_IRWXG | S_IRWXO) != 0)
- {
- fprintf(stderr, "Got error during file1 chmod() (errno: %d)\n",
- errno);
+ if (my_chmod(file1_name, S_IRWXU | S_IRWXG | S_IRWXO, MYF(MY_WME)))
exit(1);
- }
{
uchar page[PCACHE_PAGE];