Subject: sysctl mysql netbsd HELP
To: None <netbsd-help@netbsd.org>
From: Heron GALLEGOS <gallegos@csxxi.sepc.edu.mx>
List: netbsd-help
Date: 11/28/2000 11:31:32
Hello

1) The situation

I have problems with mysql-server-3.22.32 running
in a NetBSD-1.5_BETA2/i386 server (PII/350,128eccRAM,9GBscsiIII).

I work with a database of 15+ tables and mysqld shortly ends with
the file descriptors:

/var/mysql/server.err:
001128  9:10:10 Error in access: Too many open files
and sometimes the following message
Error in access: Too many open files in system

In /usr/pkg/etc/rc.d/mysql I have the following lines:

........
$bindir/safe_mysqld --user=$mysql_daemon_user
 --pid-file=$pid_file --datadir=$datadir
 -O max_connections=400 -O table_cache=3200 --log &
# wait 2 seconds to be sure mysqld is up and running
 sleep 2
 if test -f "$pid_file"
    then
        mysqld_pid=`cat $pid_file`
        sysctl -w proc.$mysqld_pid.rlimit.descriptors.soft=unlimited
    fi

At this point I am sure mysqld have a big number for open files:
server# sysctl proc.222.rlimit.descriptors
proc.222.rlimit.descriptors.soft=3400
proc.222.rlimit.descriptors.hard=3400
server#

(proc.222.rlimit.descriptors.soft was 64 before "sysctl -w" command)

2) The problem

When mysqld starts, it runs some init functions, one of them
is in mysql-server/work/mysql-server-3.22.32/mit-pthreads/pthreads/fd.c

In "fd_init" mysqld asks to the machine for the "open files limit"
     dtablesize = machdep_sys_getdtablesize ();
and this function means "return(sysconf(_SC_OPEN_MAX))" for this OS

The problem is that dtablesize gets the number 64.
It occurs while the startup script waits 2 seconds in order
to be sure mysqld is up and running.

When the sysctl command runs, mysqld has been init
with a limit of 64

3) The question

What can I do to solve my problem?
(without hack the fd_init function)

Thanks in advance


Heron Gallegos
Saltillo, Coah., Mexico