Hi Jake, all,
please note that the following remarks are about communicating via named
pipes in general, not specific for MySQL.
I do _not_ comment whether the idea is good or bad, will work,
alternatives, ...
Jake Peavy wrote:
Hey, I sent this a while ago, but never received a response.
This still seems to exist under 5.0.15-standard (at least under
mysql-standard-5.0.15-linux-i686-glibc23)
Can anyone from MySQL comment on this or should I open it as a bug?
Thanks,
JP
On 6/11/05, Jake Peavy <[EMAIL PROTECTED]> wrote:
Has anyone been able to use a named pipe for their general query log
(or any of the other logfiles for that matter)?
I tried the following as user mysql:
rm /var/lib/mysql/myhost.log
mkfifo -m 0660 /var/lib/mysql/myhost.log
but the mysql server would not start.
Sure: "Works as designed".
"man 2 open" will tell you that an "open()" call on a named pipe
synchronizes: Any such call will block until there is a corresponding
call at the other end of the pipe.
So the general technique is:
mkfifo the_pipe
reader_command < the_pipe &
writer_command > the_pipe
Note that the pipe has a limited buffer capacity, so the writer cannot
produce more info than the reader has processed: If your reader is slow
(say, "more" and a human watching), the writer has to wait.
Also, writing to the pipe fails if there is no reader attached. So if
your reader terminates (crash, "q" input to "more", ...), your writer
cannot write any more, this may be fatal (depends on error handling).
I think it would be very useful to be able to use a FIFO for this so I
can use the log for debugging/info without having to create a log
rotation script.
For any log of a MySQL server, this is IMHO useful _only_ in a test
environment, because of the speed and stability restrictions described
above.
I am running 5.0.2-alpha-standard on linux on i386.
These pipe semantics hold for any Unix since pipes were introduced:
For anonymous pipes ("open()" implicit in "pipe()"), since the early
1970s; for named pipes (aka "FIFOs"), since AT&T Unix System V in the
late 1980s (AFAIR).
HTH,
Joerg
--
Joerg Bruehe, Senior Production Engineer
MySQL AB, www.mysql.com
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]