X-Original-To: pgsql-hackers-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 6C83654C4C for ; Sat, 5 Mar 2005 08:59:59 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 83033-07 for ; Sat, 5 Mar 2005 08:59:57 +0000 (GMT) Received: from mailbox.samurai.com (mailbox.samurai.com [205.207.28.82]) by svr1.postgresql.org (Postfix) with ESMTP id 153B355F20 for ; Sat, 5 Mar 2005 08:59:55 +0000 (GMT) Received: from localhost (mailbox.samurai.com [205.207.28.82]) by mailbox.samurai.com (Postfix) with ESMTP id 9AD7218D020; Sat, 5 Mar 2005 03:59:56 -0500 (EST) Received: from mailbox.samurai.com ([205.207.28.82]) by localhost (mailbox.samurai.com [205.207.28.82]) (amavisd-new, port 10024) with LMTP id 34078-01-3; Sat, 5 Mar 2005 03:59:55 -0500 (EST) Received: from [220.101.4.182] (r220-101-4-182.cpe.unwired.net.au [220.101.4.182]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mailbox.samurai.com (Postfix) with ESMTP id 9175F18CED6; Sat, 5 Mar 2005 03:59:53 -0500 (EST) Message-ID: <42297503.20604@samurai.com> Date: Sat, 05 Mar 2005 19:59:47 +1100 From: Neil Conway User-Agent: Mozilla Thunderbird 1.0 (Macintosh/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Magnus Hagander Cc: pgsql-hackers Subject: Re: refactoring fork() and EXEC_BACKEND References: <6BCB9D8A16AC4241919521715F4D8BCE476A3C@algol.sollentuna.se> In-Reply-To: <6BCB9D8A16AC4241919521715F4D8BCE476A3C@algol.sollentuna.se> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at mailbox.samurai.com X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.003 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200503/142 X-Sequence-Number: 64944 Magnus Hagander wrote: > This is a lot like what I was planning to work towards with the > refactoring of the forkexec code I promised to do for 8.1. Cool. BTW, have we accepted that EXEC_BACKEND is the way we're going to workaround the lack of fork() on Win32 for the foreseeable future? I mean, it _works_, but it's slow, ugly, and complicates the code. If it's the only workable option for Win32 support, then fair enough -- I just don't know enough of the Win32 API to know if there's a better alternative out there (short of using threads, which is of course not really plausible). > I was actually thinking of not passing these on the commandline at all, > in order to avoid possible quoting issues etc (recall all the problems > with the stupid commandline processing on win32). Instead moving it into > a struct that is appended to the end of the backend variable file/shared > memory. Sounds good to me. Finding a cleaner way to pass data to the child process than writing it out to a file would also be nice, if possible. Again, I'm not sure what options there are on Win32... > That was also what I was thinking. Let me know if you want to split the > load somewhere :-) Given that you're planning to work on this, I've scaled back my ambitions. I'll send a patch to -patches that just cleans up fork() and doesn't change the EXEC_BACKEND case. So fork_process() will: - flush stderr/stdout - save and restore the profiling timer if LINUX_PROFILE is defined - handle BeOS which means it should not be very invasive. Of course, there is plenty of room for improvement -- if you're interested in taking a look, please do... -Neil