Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1aIIvv-0001ne-FJ for pgsql-hackers@arkaria.postgresql.org; Sun, 10 Jan 2016 16:33:35 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1aIIvu-0007K0-He for pgsql-hackers@arkaria.postgresql.org; Sun, 10 Jan 2016 16:33:34 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1aIIuZ-0004Ls-DI for pgsql-hackers@postgresql.org; Sun, 10 Jan 2016 16:32:11 +0000 Received: from mail-lb0-x231.google.com ([2a00:1450:4010:c04::231]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84) (envelope-from ) id 1aIIuW-00025O-70 for pgsql-hackers@postgresql.org; Sun, 10 Jan 2016 16:32:10 +0000 Received: by mail-lb0-x231.google.com with SMTP id oh2so243832790lbb.3 for ; Sun, 10 Jan 2016 08:32:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; bh=srNijsIDV5r6z3TX1PjeHkiCkEkQ/qHQPErVC5qLy8M=; b=i+DtsSh9nMfV9/ORIjGgWz9HEWhnUPSWNTkEFJ1YwtvPCsX8rqGwPMDn1J2ndCs22R +UQfPnRhOu9IsCh4bvBYg90i29m5a2i4jivbRg/XcWZMwFLlGafEsi95o9YV+DBLgkoL w0G6df/+9lHvBX7Zx/WbxRwgF414YeuvDSHMGpsILmn5wxqJJF9wdgk++YiEAV8zWRZI 1wmy2MNm6DW0Rk0V4wvruy29Zuv2l+zL/3LjjgtSmC6achEb2TfTpjOqfN4oE1rxrhQ2 hrBrbRZKY23x4t0shF7WQ5MoiRTB/hWUGtZeGcghqa6paspzRM4lBYTkdgB22X/FcK3R ulSg== MIME-Version: 1.0 X-Received: by 10.112.142.101 with SMTP id rv5mr28819412lbb.101.1452443525806; Sun, 10 Jan 2016 08:32:05 -0800 (PST) Received: by 10.112.73.8 with HTTP; Sun, 10 Jan 2016 08:32:05 -0800 (PST) In-Reply-To: References: Date: Sun, 10 Jan 2016 11:32:05 -0500 Message-ID: Subject: Re: [COMMITTERS] pgsql: Avoid pin scan for replay of XLOG_BTREE_VACUUM From: Robert Haas To: Simon Riggs Cc: "pgsql-hackers@postgresql.org" Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Pg-Spam-Score: -2.7 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org On Sat, Jan 9, 2016 at 5:13 AM, Simon Riggs wrote: > Avoid pin scan for replay of XLOG_BTREE_VACUUM > Replay of XLOG_BTREE_VACUUM during Hot Standby was previously thought to = require > complex interlocking that matched the requirements on the master. This re= quired > an O(N) operation that became a significant problem with large indexes, c= ausing > replication delays of seconds or in some cases minutes while the > XLOG_BTREE_VACUUM was replayed. > > This commit skips the =E2=80=9Cpin scan=E2=80=9D that was previously requ= ired, by observing in > detail when and how it is safe to do so, with full documentation. The pin= scan > is skipped only in replay; the VACUUM code path on master is not touched = here. > > The current commit still performs the pin scan for toast indexes, though = this > can also be avoided if we recheck scans on toast indexes. Later patch will > address this. > > No tests included. Manual tests using an additional patch to view WAL rec= ords > and their timing have shown the change in WAL records and their handling = has > successfully reduced replication delay. I suspect I might be missing something here, but I don't see how a test against rel->rd_rel->relnamespace can work during recovery. Won't the relcache entry we're looking at here be one created by CreateFakeRelcacheEntry(), and thus that field won't be valid? --=20 Robert Haas EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company --=20 Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers