summaryrefslogtreecommitdiff
path: root/myisam/myisamlog.c
diff options
context:
space:
mode:
authorunknown <monty@mashka.mysql.fi>2004-02-19 19:33:09 +0200
committerunknown <monty@mashka.mysql.fi>2004-02-19 19:33:09 +0200
commitddbb78809dcce02d649eae436c77799d7a76983e (patch)
tree86d1d367349c537e9cbd45f6bf0ba3c2315f1a59 /myisam/myisamlog.c
parent62cc89aad50b00c0ab1ef3e94c5a3467eb78eb70 (diff)
downloadmariadb-git-ddbb78809dcce02d649eae436c77799d7a76983e.tar.gz
Max open files handling moved to my_set_max_open_files()
This ensures that my_file_info takes this the max number of files into account and one can now use --open-files-limit on windows to increase number of used files up to 2048 client/client_priv.h: Added --open-files-limit to mysqlbinlog client/mysqlbinlog.cc: Added --open-files-limit to mysqlbinlog include/config-win.h: Define that you can have up to 2048 files open on windows include/my_global.h: Allow override of OS_FILE_LIMIT include/my_sys.h: Cleanup Added prototypes for my_set_max_open_files() and my_free_open_files() libmysql/Makefile.shared: Added my_file.c myisam/myisamlog.c: Use my_set_max_open_files() mysys/Makefile.am: Use my_file.c (for mysqlbinlog) mysys/my_alloc.c: Remove compiler warning mysys/my_div.c: MY_NFILE -> my_file_limit mysys/my_dup.c: MY_NFILE -> my_file_limit mysys/my_fopen.c: MY_NFILE -> my_file_limit mysys/my_open.c: MY_NFILE -> my_file_limit mysys/my_static.c: Allow changing of open files limit mysys/my_static.h: Allow changing of open files limit sql/mysqld.cc: Max open files handling moved to my_set_max_open_files()
Diffstat (limited to 'myisam/myisamlog.c')
-rw-r--r--myisam/myisamlog.c39
1 files changed, 3 insertions, 36 deletions
diff --git a/myisam/myisamlog.c b/myisam/myisamlog.c
index c9b00be7d9e..82f6277ce25 100644
--- a/myisam/myisamlog.c
+++ b/myisam/myisamlog.c
@@ -60,7 +60,6 @@ static int file_info_compare(void *cmp_arg, void *a,void *b);
static int test_if_open(struct file_info *key,element_count count,
struct test_if_open_param *param);
static void fix_blob_pointers(MI_INFO *isam,byte *record);
-static uint set_maximum_open_files(uint);
static int test_when_accessed(struct file_info *key,element_count count,
struct st_access_param *access_param);
static void file_info_free(struct file_info *info);
@@ -89,9 +88,8 @@ int main(int argc, char **argv)
log_filename=myisam_log_filename;
get_options(&argc,&argv);
- /* Nr of isam-files */
- max_files=(set_maximum_open_files(min(max_files,8))-6)/2;
-
+ /* Number of MyISAM files we can have open at one time */
+ max_files= (my_set_max_open_files(min(max_files,8))-6)/2;
if (update)
printf("Trying to %s MyISAM files according to log '%s'\n",
(recover ? "recover" : "update"),log_filename);
@@ -123,6 +121,7 @@ int main(int argc, char **argv)
printf("Had to do %d re-open because of too few possibly open files\n",
re_open_count);
VOID(mi_panic(HA_PANIC_CLOSE));
+ my_free_open_file_info();
my_end(test_info ? MY_CHECK_ERROR | MY_GIVE_INFO : MY_CHECK_ERROR);
exit(error);
return 0; /* No compiler warning */
@@ -732,38 +731,6 @@ static void fix_blob_pointers(MI_INFO *info, byte *record)
}
}
-static uint set_maximum_open_files(uint maximum_files)
-{
-#if defined(HAVE_GETRUSAGE) && defined(RLIMIT_NOFILE)
- struct rlimit rlimit;
- int old_max;
-
- if (maximum_files > MY_NFILE)
- maximum_files=MY_NFILE; /* Don't crash my_open */
-
- if (!getrlimit(RLIMIT_NOFILE,&rlimit))
- {
- old_max=rlimit.rlim_max;
- if (maximum_files && (int) maximum_files > old_max)
- rlimit.rlim_max=maximum_files;
- rlimit.rlim_cur=rlimit.rlim_max;
- if (setrlimit(RLIMIT_NOFILE,&rlimit))
- {
- if (old_max != (int) maximum_files)
- { /* Set as much as we can */
- rlimit.rlim_max=rlimit.rlim_cur=old_max;
- setrlimit(RLIMIT_NOFILE,&rlimit);
- }
- }
- getrlimit(RLIMIT_NOFILE,&rlimit); /* Read if broken setrlimit */
- if (maximum_files && maximum_files < rlimit.rlim_cur)
- VOID(fprintf(stderr,"Warning: Error from setrlimit: Max open files is %d\n",old_max));
- return rlimit.rlim_cur;
- }
-#endif
- return min(maximum_files,MY_NFILE);
-}
-
/* close the file with hasn't been accessed for the longest time */
/* ARGSUSED */