Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1V02MS-00041i-Pq for pgsql-odbc@arkaria.postgresql.org; Fri, 19 Jul 2013 04:32:08 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1V02MR-0004TW-M9 for pgsql-odbc@arkaria.postgresql.org; Fri, 19 Jul 2013 04:32:07 +0000 Received: from makus.postgresql.org ([2001:4800:7903:4::125]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1V02MP-0004T7-6O for pgsql-odbc@postgresql.org; Fri, 19 Jul 2013 04:32:05 +0000 Received: from mail-qe0-f42.google.com ([209.85.128.42]) by makus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1V02MK-0002Y8-VU for pgsql-odbc@postgresql.org; Fri, 19 Jul 2013 04:32:03 +0000 Received: by mail-qe0-f42.google.com with SMTP id s14so2221751qeb.29 for ; Thu, 18 Jul 2013 21:32:00 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent :x-gm-message-state; bh=cCDHEmhmm+bEPyrZIbFmAKCjsTflzr8cuWguqfUhIFU=; b=lRgn0yVFMM6Tb668KRhqEtg0XevaxWpCuPUEHIIMm1K2wGRtLKHLPYrK37n35crzfd 582bCBNpdZ5gp/1vincdvwfB1idc3xGlv3Xy6IeTe5x5q+wr1lYLlsqLs4W9CD4Bf8EM 31gduSbGH2HrDqikKuikN8KnyDGtBp2dSPIlS8hocAtuI3Dk94A1liLjnjpz7UL3syCc 9SIsbhQVVB3eCDNxAJvGrr07lFirC7Bt6M8pPR6/z8oP/N/h0W6CSS+kdG+wIFx+k3Pg 1T5vkCqNm6+clSrvc6iZJLXuT7lQJQDuU2jrlylU/pHTB7WTHwvZ7WyiYMMkPte77AYP v5Qg== X-Received: by 10.224.92.70 with SMTP id q6mr16888170qam.43.1374208320269; Thu, 18 Jul 2013 21:32:00 -0700 (PDT) Received: from tornado.leadboat.com (ip68-105-236-221.hr.hr.cox.net. [68.105.236.221]) by mx.google.com with ESMTPSA id r10sm17687299qeu.4.2013.07.18.21.31.57 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 18 Jul 2013 21:31:59 -0700 (PDT) Date: Fri, 19 Jul 2013 00:31:56 -0400 From: Noah Misch To: Robert Haas Cc: pgsql-hackers@postgresql.org, pgsql-odbc@postgresql.org Subject: Re: getting rid of SnapshotNow Message-ID: <20130719043156.GA103442@tornado.leadboat.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.18 (2008-05-17) X-Gm-Message-State: ALoCoQnXRt4o7jCsa3zv6jACB/n/BkRiwpTTmKU0BBxdzS8EHuWvzE9sxtKjIfDP7jk3kdG6j9Ym X-Pg-Spam-Score: -1.2 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-odbc Precedence: bulk Sender: pgsql-odbc-owner@postgresql.org On Thu, Jul 18, 2013 at 08:46:48AM -0400, Robert Haas wrote: > 1. snapshot-error-v1.patch introduces a new special snapshot, called > SnapshotError. In the cases where we set SnapshotNow as a sort of > default snapshot, this patch changes the code to use SnapshotError > instead. This affects scan->xs_snapshot in genam.c and > estate->es_snapshot in execUtils.c. This passes make check-world, so > apparently there is no code in the core distribution that does this. > However, this is safer for third-party code, which will ERROR instead > of seg faulting. The alternative approach would be to use > InvalidSnapshot, which I think would be OK too if people dislike this > approach. I don't have a strong opinion. Anything it diagnoses is a code bug, probably one that makes the affected extension useless until it's fixed. But the patch is small and self-contained. I think the benefit, more than making things safer in production, would be reducing the amount of time the developer needs to zero in on the problem. It wouldn't be the first time we've done that; compare AtEOXact_Buffers(). Does this particular class of bug deserve that aid? I don't know. > 2. snapshot-self-not-now-v1.patch changes several uses of SnapshotNow > to use SnapshotSelf instead. These include pgrowlocks(), > pgstat_heap(), and get_actual_variable_range(). In all of those > cases, only an approximately-correct answer is needed, so the change > should be fine. I'd also generally expect that it's very unlikely for > any of these things to get called in a context where the table being > scanned has been updated by the current transaction after the most > recent command-counter increment, so in practice the change in > semantics will probably not be noticeable at all. SnapshotSelf is awfully special; currently, you can grep for all uses of it and find a collection of callers with highly-technical needs. Diluting that with a handful of callers that legitimately preferred SnapshotNow but don't care enough to mind SnapshotSelf in its place brings a minor loss of clarity.