mirror of
https://github.com/MariaDB/server.git
synced 2025-01-19 13:32:33 +01:00
ea3ae3c470
storage/maria/Makefile.am: copyright storage/maria/ma_pagecache.c: copyright storage/maria/ma_pagecache.h: copyright storage/maria/ma_pagecaches.c: copyright storage/maria/ma_pagecrc.c: copyright storage/maria/unittest/Makefile.am: copyright storage/maria/unittest/lockman-t.c: copyright storage/maria/unittest/lockman1-t.c: copyright storage/maria/unittest/lockman2-t.c: copyright storage/maria/unittest/ma_control_file-t.c: copyright storage/maria/unittest/ma_loghandler_examples.c: copyright storage/maria/unittest/ma_maria_log_cleanup.c: copyright storage/maria/unittest/ma_pagecache_consist.c: copyright storage/maria/unittest/ma_pagecache_rwconsist.c: copyright storage/maria/unittest/ma_pagecache_single.c: copyright storage/maria/unittest/ma_test_loghandler-t.c: copyright storage/maria/unittest/ma_test_loghandler_first_lsn-t.c: copyright storage/maria/unittest/ma_test_loghandler_max_lsn-t.c: copyright storage/maria/unittest/ma_test_loghandler_multigroup-t.c: copyright storage/maria/unittest/ma_test_loghandler_multithread-t.c: copyright storage/maria/unittest/ma_test_loghandler_noflush-t.c: copyright storage/maria/unittest/ma_test_loghandler_nologs-t.c: copyright storage/maria/unittest/ma_test_loghandler_pagecache-t.c: copyright storage/maria/unittest/ma_test_loghandler_purge-t.c: copyright storage/maria/unittest/test_file.c: copyright storage/maria/unittest/test_file.h: copyright storage/maria/unittest/trnman-t.c: copyright
64 lines
2 KiB
C
64 lines
2 KiB
C
/* Copyright (C) 2006-2008 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 "../maria_def.h"
|
|
#include <my_dir.h>
|
|
|
|
my_bool maria_log_remove()
|
|
{
|
|
MY_DIR *dirp;
|
|
uint i;
|
|
MY_STAT stat_buff;
|
|
char file_name[FN_REFLEN];
|
|
|
|
/* Removes control file */
|
|
if (fn_format(file_name, CONTROL_FILE_BASE_NAME,
|
|
maria_data_root, "", MYF(MY_WME)) == NullS)
|
|
return 1;
|
|
if (my_stat(file_name, &stat_buff, MYF(0)) &&
|
|
my_delete(file_name, MYF(MY_WME)) != 0)
|
|
return 1;
|
|
|
|
/* Finds and removes transaction log files */
|
|
if (!(dirp = my_dir(maria_data_root, MYF(MY_DONT_SORT))))
|
|
return 1;
|
|
|
|
for (i= 0; i < dirp->number_off_files; i++)
|
|
{
|
|
char *file= dirp->dir_entry[i].name;
|
|
if (strncmp(file, "maria_log.", 10) == 0 &&
|
|
file[10] >= '0' && file[10] <= '9' &&
|
|
file[11] >= '0' && file[11] <= '9' &&
|
|
file[12] >= '0' && file[12] <= '9' &&
|
|
file[13] >= '0' && file[13] <= '9' &&
|
|
file[14] >= '0' && file[14] <= '9' &&
|
|
file[15] >= '0' && file[15] <= '9' &&
|
|
file[16] >= '0' && file[16] <= '9' &&
|
|
file[17] >= '0' && file[17] <= '9' &&
|
|
file[18] == '\0')
|
|
{
|
|
if (fn_format(file_name, file,
|
|
maria_data_root, "", MYF(MY_WME)) == NullS ||
|
|
my_delete(file_name, MYF(MY_WME)) != 0)
|
|
{
|
|
my_dirend(dirp);
|
|
return 1;
|
|
}
|
|
}
|
|
}
|
|
my_dirend(dirp);
|
|
return 0;
|
|
}
|
|
|