Received: from maia.hub.org (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id BD21F635D29 for ; Tue, 25 Aug 2009 20:10:32 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 73319-06-3 for ; Tue, 25 Aug 2009 23:10:23 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from tremor.opencloud.co.nz (tremor.opencloud.co.nz [131.203.101.230]) by mail.postgresql.org (Postfix) with ESMTP id 230776363B9 for ; Tue, 25 Aug 2009 19:53:53 -0300 (ADT) Received: from 122-57-44-76.jetstream.xtra.co.nz ([122.57.44.76] helo=[192.168.1.3]) by tremor.opencloud.co.nz with esmtpsa (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.63) (envelope-from ) id 1Mg4tg-0004ls-2J; Wed, 26 Aug 2009 10:53:48 +1200 Message-ID: <4A946B7A.60408@opencloud.com> Date: Wed, 26 Aug 2009 10:53:46 +1200 From: Oliver Jowett User-Agent: Thunderbird 2.0.0.23 (X11/20090817) MIME-Version: 1.0 To: Maciek Sakrejda CC: pgsql-jdbc@postgresql.org Subject: Re: PGStream synchronization References: <895e58dd0908241736q3575cdc2v461d879c5b5f9dcb@mail.gmail.com> <4A9334C4.2060503@opencloud.com> <895e58dd0908250815m1a8aada0qc9d3f0bde9c7a303@mail.gmail.com> <895e58dd0908250951m1aa4baabnf1695c9e681aa278@mail.gmail.com> In-Reply-To: <895e58dd0908250951m1aa4baabnf1695c9e681aa278@mail.gmail.com> X-Enigmail-Version: 0.95.7 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-2.599 tagged_above=-10 required=5 tests=BAYES_00=-2.599 X-Spam-Level: X-Archive-Number: 200908/60 X-Sequence-Number: 19909 Maciek Sakrejda wrote: > I'm not that familiar with the FEBE protocol (I'll look into this as > well), but we don't need to cancel regular queries explicitly, right? You can do query cancellation via a separate connection, but that's really about halting long-running queries while preserving your connection which is not really what we're after here. All that really matters is getting the Terminate in at an appropriate point in the stream so that the backend knows it's a deliberate shutdown and doesn't complain about an unexpected-client-EOF. > The Terminate message is always valid, except in COPY mode? If that's > the case, we only need to ensure that the various PGStream messages > are sent atomically (which is currently *not* the case in the case of > Terminate), and handle COPY specially (by issuing CopyFail followed by > Terminate). I'm happy to start work on a patch if we find an approach > we agree on. Right, so long as you get the atomicity correct I think that will work. This will probably require more finegrained synchronization since currently there's effectively one big lock that's held for the entire duration of the query, which doesn't work so well here if you want close() to interrupt any ongoing operation in a timely fashion. -O