Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mcfOO-0005MF-Im for pgsql-bugs@arkaria.postgresql.org; Tue, 19 Oct 2021 03:02:20 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mcfON-0006BS-3W for pgsql-bugs@arkaria.postgresql.org; Tue, 19 Oct 2021 03:02:19 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mcfOM-00068T-SI for pgsql-bugs@lists.postgresql.org; Tue, 19 Oct 2021 03:02:18 +0000 Received: from mail-qt1-x82c.google.com ([2607:f8b0:4864:20::82c]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1mcfOK-0002yP-Ma for pgsql-bugs@lists.postgresql.org; Tue, 19 Oct 2021 03:02:17 +0000 Received: by mail-qt1-x82c.google.com with SMTP id y11so17064801qtn.13 for ; Mon, 18 Oct 2021 20:02:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=leadboat.com; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=u5V2oLJDOUspu+Wm9affG9TsHFvJKoGwwAdnvsN5vjM=; b=GneJ6TeEVww1eaT6BUNcWoRwWmJqr8i5rFB2XL886tgDFIxaz58Zo944G5YiQG1vRN s+DefbCwQyzHK3U86hK2HEbS7cybv/3NQ9+mFptWo65+wLnCPEsOxJ6zFVJ4gACvI6s5 LspywI6vieNMGwmNyOTHdMtMSlzR8XDfE1d5Y= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=u5V2oLJDOUspu+Wm9affG9TsHFvJKoGwwAdnvsN5vjM=; b=k/sTjN18kcD+C7UVBb6rh2mCTwO6XG4E9uUzgC/5AN1G4ZeQBCKm2JAdze5BBQSjmA JC7MutJqrv6V/OYaLWUQmGe+xJETen9dy8AisB4WTpYxiFFrWCKEqX9MHGKp7LwnY0xK iOvnAc7EoxzLhKk4PMChK2WvDMOugzJ3GEqbSVT5AXA3gQb7lLUw/FYi0av71S7/G7UK GNZf/YoF7vDlzE38baLyqT8TmoCqbCPVOzf9jS9wwzzgs+YZfxK/fHSERetGDUDBCrLJ 28t0mYhYG1y149RkfmLS5kogsLqNNkwCQRXNeftBflNXwU6D512IlvFO4CwqZ1VVb2x6 4QHA== X-Gm-Message-State: AOAM5313fTfkM5Xa2WM5Dzceg5RVo6+GXIuHgNvbI8lsAGmXadJVZtoE 3Sa+I1xS9r+iO8gyqWAuR+V/Ehp3H9C9hER8 X-Google-Smtp-Source: ABdhPJwKCXVtiQrriLiWtPws59mOYBsIbEDVr39FMVVh+/j/t8w/AD9jDxNxGPPEop8f95F2j5oRJQ== X-Received: by 2002:a05:622a:1794:: with SMTP id s20mr22562104qtk.278.1634612535589; Mon, 18 Oct 2021 20:02:15 -0700 (PDT) Received: from rfd.leadboat.com ([2600:1702:a20:5750::46]) by smtp.gmail.com with ESMTPSA id b19sm7039479qto.46.2021.10.18.20.02.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 18 Oct 2021 20:02:15 -0700 (PDT) Date: Mon, 18 Oct 2021 20:02:12 -0700 From: Noah Misch To: Andrey Borodin Cc: PostgreSQL mailing lists , Michael Paquier , Tom Lane , Peter Geoghegan , Andres Freund Subject: Re: CREATE INDEX CONCURRENTLY does not index prepared xact's data Message-ID: <20211019030212.GB3403374@rfd.leadboat.com> References: <20210815134547.3okuz6ktvu4qf7ig@alap3.anarazel.de> <15936F8A-0436-40C8-9D1A-4A4623681554@yandex-team.ru> <20210829180913.ghojzzsgkqgm7vki@alap3.anarazel.de> <364BAA98-1A3F-4C39-B0D9-ED8C40EA902D@yandex-team.ru> <20210908064515.GA2496820@rfd.leadboat.com> <20210920044143.GA3414844@rfd.leadboat.com> <593C6C66-F19E-412A-9896-F1F5B272424A@yandex-team.ru> <20210925201012.GC4134968@rfd.leadboat.com> <20211017151205.GA2384251@rfd.leadboat.com> <9BA43784-E4A7-4638-900C-FC9868C388FA@yandex-team.ru> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <9BA43784-E4A7-4638-900C-FC9868C388FA@yandex-team.ru> User-Agent: Mutt/1.5.24 (2015-08-30) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Mon, Oct 18, 2021 at 06:23:05PM +0500, Andrey Borodin wrote: > > 17 окт. 2021 г., в 20:12, Noah Misch написал(а): > > I think the attached version is ready for commit. Notable differences > > vs. v14: > Few notes: > > 1. Maybe an Assert(in_progress_list_maxlen) when in_progress_list_maxlen is used? RelationCacheInitialize() initializes both in_progress_list_maxlen and the RelationIdCache hash table, and any ERROR there is promoted to FATAL. Without the hash table, nothing good can happen in relcache. Hence, I think such an assert is excessive. > 2. > -#define VirtualTransactionIdIsPreparedXact(vxid) \ > +#define VirtualTransactionIdIsRecoveredPreparedXact(vxid) \ > > This is a very neat transition. Yes, the function argument will always be a xid only for recovered transactions. Maybe add a comment here that this function is expected to be used only for results of GetLockConflicts()? One can use it on any VirtualTransactionId, though some sources only return values for which this returns false. It can return true for the result of GET_VXID_FROM_PGPROC(). I think it can return true for the result of GetCurrentVirtualXIDs(limitXmin = InvalidTransactionId), but core code doesn't make such a call. > > One thing not done here is to change the tests to use CREATE INDEX > > CONCURRENTLY instead of REINDEX CONCURRENTLY, so they're back-patchable to v11 > > and earlier. I may do that before pushing, or I may just omit the tests from > > older branches. > > The tests refactors PostgresNode.pm and some tests. Back-patching this would be quite invasive. That's fine with me. Back-patching a fix without its tests is riskier than back-patching test infrastructure changes. > But swapping every "REINDEX INDEX CONCURRENTLY idx;" with > DROP INDEX CONCURRENTLY idx; > CREATE INDEX CONCURRENTLY idx on tbl(i); > works. > > > > I've checked that this patches work for some time on my machines. I do not observe failures. Good. Thanks for checking.