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 1mCUfn-0004xP-I0 for pgsql-bugs@arkaria.postgresql.org; Sat, 07 Aug 2021 22:20:07 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mCUfm-0000On-Hj for pgsql-bugs@arkaria.postgresql.org; Sat, 07 Aug 2021 22:20:06 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mCUfm-0000Of-3b for pgsql-bugs@lists.postgresql.org; Sat, 07 Aug 2021 22:20:06 +0000 Received: from mail-pj1-x1032.google.com ([2607:f8b0:4864:20::1032]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1mCUfj-0003gH-2V for pgsql-bugs@lists.postgresql.org; Sat, 07 Aug 2021 22:20:05 +0000 Received: by mail-pj1-x1032.google.com with SMTP id mq2-20020a17090b3802b0290178911d298bso487736pjb.1 for ; Sat, 07 Aug 2021 15:20:02 -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:in-reply-to:user-agent; bh=x9OxayJKT0hq0GYi4OVk72opRIhbmhr8RM/ZIL6anYQ=; b=WbO6phDufMywDV/pFwjdhqKGU7/+rYoOSn1sMY4tZAgzoDqA0SFlhoF+8VpqLgV4UI vMyNtAK3NsIeOPtY4eufizeWrqC6NJBXh9ru64ALxDgatma4KMVV9BztaM9UtHKbaYXz KIzK09mOq7mMiTjrJyKoGJM1PkRBiZ10sX/Rc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=x9OxayJKT0hq0GYi4OVk72opRIhbmhr8RM/ZIL6anYQ=; b=uCuS4+Cqwpr6AfD/oyxcaY7mM2MomypvnBqhekBjmcjpWunmRvipJIro8KP3BWejyc 7eUGAeqTgVs9ZiyqJIyNWMZK26RWcG05obeMDCzHB4yzeg9zD9rctIGOglWo7Cn4uBst o4w5ST66Y/zz7OpnTiENiJ77xlyln8tA4JT3B8NkM5cL7xb6wscTs31vSAHaMUgEI1Za bjdqLwdMyDE/SrfOELl8V6om5X7UQmb/qWMr32nShk4enQE3ylp2jeqTrgkbI2tZFqKL +1m+D3RgeGMLHqETozIiY/FvW93ZpZEk1Q31lAppeWL0BS2e9+s+1BBApu6UWwY7a2Yx Hx5w== X-Gm-Message-State: AOAM533IafLqsa1t3/wchFr+0ILnT8vIry5UsBHPNqzvfgBv3PgC+gIW M+MWJR0saJ84xf5GWr1pVbNg9g== X-Google-Smtp-Source: ABdhPJwPnraF50HxpPnvm8qRVDjLRVZd2XkN6wCqk3R8RLGUkA6YApHLZvCSjEk9G/fQi4an2G2I9A== X-Received: by 2002:a17:902:8f90:b029:12d:1b48:efd8 with SMTP id z16-20020a1709028f90b029012d1b48efd8mr450376plo.23.1628374800993; Sat, 07 Aug 2021 15:20:00 -0700 (PDT) Received: from rfd.leadboat.com ([2600:1702:a20:5750::46]) by smtp.gmail.com with ESMTPSA id y12sm18268806pgk.7.2021.08.07.15.19.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 07 Aug 2021 15:20:00 -0700 (PDT) Date: Sat, 7 Aug 2021 15:19:57 -0700 From: Noah Misch To: Andrey Borodin Cc: PostgreSQL mailing lists , Michael Paquier , Tom Lane , Peter Geoghegan Subject: Re: CREATE INDEX CONCURRENTLY does not index prepared xact's data Message-ID: <20210807221957.GA169359@rfd.leadboat.com> References: <20210730022548.GA1940096@gust.leadboat.com> <20210730184126.GA2018234@gust.leadboat.com> <85D32B53-FB25-4F2F-A253-0D7B26F72881@yandex-team.ru> <341252AE-B633-471E-9FF4-B09FC5D036E2@yandex-team.ru> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <341252AE-B633-471E-9FF4-B09FC5D036E2@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 Sun, Aug 08, 2021 at 12:00:55AM +0500, Andrey Borodin wrote: > Changes: > 1. Added assert in step 2 (fix for missed invalidation message). I wonder how deep possibly could be RelationBuildDesc() inside RelationBuildDesc() inside RelationBuildDesc() ... ? If the depth is unlimited we, probably, need a better data structure. I don't know either, hence that quick data structure to delay the question. debug_discard_caches=3 may help answer the question. RelationBuildDesc() reads pg_constraint, which is !rd_isnailed. Hence, I expect one can at least get RelationBuildDesc("pg_constraint") inside RelationBuildDesc("user_table"). > Tomorrow I'll try to cleanup step 1 (tap tests). For the final commits, I would like to have two commits. The first will fix the non-2PC bug and add the test for that fix. The second will fix the 2PC bug and add the additional test. Feel free to structure your changes into more patch files, so long as it's straightforward to squash them into two commits that way. A few things I noticed earlier: > --- a/contrib/amcheck/Makefile > +++ b/contrib/amcheck/Makefile > @@ -12,7 +12,7 @@ PGFILEDESC = "amcheck - function for verifying relation integrity" > > REGRESS = check check_btree check_heap > > -TAP_TESTS = 1 > +TAP_TESTS = 2 TAP_TESTS is a Boolean flag, not a count. Leave it set to 1. > --- /dev/null > +++ b/contrib/amcheck/t/002_cic_2pc.pl > +$node->append_conf('postgresql.conf', 'lock_timeout = 5000'); > +my $main_timer = IPC::Run::timeout(5); > +my $reindex_timer = IPC::Run::timeout(5); Values this short cause spurious buildfarm failures. Generally, use 180s for timeouts that do not expire in a successful run. > +# Run background pgbench with CIC. We cannot mix-in this script into single pgbench: > +# CIC will deadlock with itself occasionally. Consider fixing that by taking an advisory lock before running CIC. However, if use of separate pgbench executions works better, feel free to keep that. > +pgbench( > + '--no-vacuum --client=5 --time=1', Consider using a transaction count instead of --time. That way, slow machines still catch the bug, and fast machines waste less time. For the "concurrent OID generation" test, I tuned the transaction count so the test failed about half the time[1] on a buggy build. > + \set txid random(1, 1000000000) > + BEGIN; > + INSERT INTO tbl VALUES(0); > + PREPARE TRANSACTION 'tx:txid'; Try "PREPARE TRANSACTION 'c:client_id'" (or c:client_id:txid) to eliminate the chance of collision. [1] https://postgr.es/m/20160215171129.GA347322@tornado.leadboat.com