Received: from localhost (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id 2595763497E for ; Wed, 26 Aug 2009 21:37:43 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.208.211]) (amavisd-maia, port 10024) with ESMTP id 43028-02 for ; Thu, 27 Aug 2009 00:37:21 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from mail-ew0-f216.google.com (mail-ew0-f216.google.com [209.85.219.216]) by mail.postgresql.org (Postfix) with ESMTP id 4A34C634EFF for ; Wed, 26 Aug 2009 21:37:29 -0300 (ADT) Received: by ewy12 with SMTP id 12so844654ewy.24 for ; Wed, 26 Aug 2009 17:37:27 -0700 (PDT) MIME-Version: 1.0 Received: by 10.211.195.14 with SMTP id x14mr7940325ebp.3.1251333446734; Wed, 26 Aug 2009 17:37:26 -0700 (PDT) In-Reply-To: <4A95CE4B.5050107@opencloud.com> References: <895e58dd0908241736q3575cdc2v461d879c5b5f9dcb@mail.gmail.com> <4A9334C4.2060503@opencloud.com> <895e58dd0908250815m1a8aada0qc9d3f0bde9c7a303@mail.gmail.com> <895e58dd0908250951m1aa4baabnf1695c9e681aa278@mail.gmail.com> <4A946B7A.60408@opencloud.com> <895e58dd0908260201g59762012ka2349eada052ab6d@mail.gmail.com> <4A95CE4B.5050107@opencloud.com> Date: Wed, 26 Aug 2009 17:37:26 -0700 Message-ID: <895e58dd0908261737t20f5b7dbsd9ae546a34264a7@mail.gmail.com> Subject: Re: PGStream synchronization From: Maciek Sakrejda To: Oliver Jowett Cc: pgsql-jdbc@postgresql.org Content-Type: text/plain; charset=ISO-8859-1 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-2.227 tagged_above=-10 required=5 tests=AWL=0.372, BAYES_00=-2.599 X-Spam-Level: X-Archive-Number: 200908/72 X-Sequence-Number: 19921 Right. I did say I wasn't happy with it... Would introducing message-level synchronization be the way to go, then? As I see it, there are four possible approaches: 1. Cancel before close--what I just protoyped in the previous patch. Pros: straighforward Cons: overkill for most applications; semantics are ugly (queries should not be canceled) 2. Status quo: Pros: status quo, works in single-threaded case Cons: protocol violations, possibly swallowed Terminate messages *and* bad data in multi-threaded COPY 3. Introduce protocol-message-level synchronization Pros: cleanest solution conceptually Cons: may incur significant additional synchronization overhead, significant changes in core code 4. Synchronize close() like other QueryExecutorImpl like other connection activities Pros: also straightforward Cons: may block indefinitely on long-running queries or open copy (although could additionally be made to trigger a CopyFail if a copy operation is in progress) I tend to agree that (1) is unworkable as a general-purpose solution. I'm not sure how you guys feel about (2), but protocol violations seem like a really, really ugly problem, even if they are only on closing the connection. (3) is probably ideal, barring performance problems. (4) may also be workable, but having close() block on currently running queries is probably not what we want to do. Any thoughts? -- Maciek Sakrejda | Software Engineer | Truviso (650) 242-3500 Main (650) 242-3501 F msakrejda@truviso.com www.truviso.com