Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rQhvG-0034IW-JK for pgsql-hackers@arkaria.postgresql.org; Fri, 19 Jan 2024 06:00:11 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1rQhvF-007PDx-LC for pgsql-hackers@arkaria.postgresql.org; Fri, 19 Jan 2024 06:00:09 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rQhvF-007PDp-C2 for pgsql-hackers@lists.postgresql.org; Fri, 19 Jan 2024 06:00:09 +0000 Received: from mail-lf1-x133.google.com ([2a00:1450:4864:20::133]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1rQhvB-002aZ2-T9 for pgsql-hackers@lists.postgresql.org; Fri, 19 Jan 2024 06:00:08 +0000 Received: by mail-lf1-x133.google.com with SMTP id 2adb3069b0e04-50e80d14404so1333928e87.1 for ; Thu, 18 Jan 2024 22:00:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1705644004; x=1706248804; darn=lists.postgresql.org; h=content-transfer-encoding:in-reply-to:references:cc:to:from :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=zd5bJm0YkZ+Ch26Vu5lHSxu0Iz4QAG80CnFZ6EUhm6k=; b=PqqmT5+ko3zIdADr/gP4p3NKJ/nl0MHLevOYNfOfVndGj71QdkI4QB3IEu3XXhpflS liAQ87RO/RbXLqx4IPIU/HIeZqEiqzh6QG1CrWMPENf2xxu1Hw/xO5UCmg3BiPjOpMNF MO1s8p/ERD6tfFVc4ZDUVyQNXRvSMqSI9Sa3/7OKeKJnCEKcjjjh5Wyrpd0LRkyUtWH+ MKsfNDboKpT9ut9Uz/EuFKLQ9IAKqglwbXkCtiI9v4IyVGJGvxvGuxrXolSKHl18VOPU Jf20tzab5ZxwYFBCumrZa2KhH2F3K6+xqnh54sxSB5I+IHSXvAXyBSMT/IzO3A/AN23f psOA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705644004; x=1706248804; h=content-transfer-encoding:in-reply-to:references:cc:to:from :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=zd5bJm0YkZ+Ch26Vu5lHSxu0Iz4QAG80CnFZ6EUhm6k=; b=PC5ZPhqcjoPFbihvGMu5IiJRvv+x/dYmRvBaf8yO3IWNZTpG8V0QxUiRdnXMdF478y tDrcvQxqi4mGhQXG88U78hTuE5MXmD6CnnDg5GtyY4au2VcUQ703mr56oSckKQVTbQvY gUarVnomOW/XyHPNdOnEXPS+iMWlWmkiQFh1i4HoKPnWtjSEvyKwg44ji18QGBykYsp/ KovzqD6JNMYCOjjVD16Dr0VyUtXRsLQZTBeVPluQi/AnqzlCbYv50vMYbUdYEYCbSV6H pIXs88HzJuBB9Tiw5H9/EsDM9aBOSdZoyjOSnzYWaV7TImbE2FQr6eUSZSECPrmxF2Vj XzSw== X-Gm-Message-State: AOJu0YxOiVx5jVZw/s9iKdeA6pMd49cLR95+nPy65MgO4ChzbLl2t+jr kKgz2TZCpgWzi7w3DpInPKONv747LA5uwLP4BaNiiWy+hNMw0WD6 X-Google-Smtp-Source: AGHT+IG0Xp08sXOkFqXkMq18TApbced4EZ+swK5LPGB/FhUyIMUokHzsrOLsrNC9hnXYxQY/24lllQ== X-Received: by 2002:a19:5e1d:0:b0:50f:184e:26f5 with SMTP id s29-20020a195e1d000000b0050f184e26f5mr242575lfb.5.1705644004019; Thu, 18 Jan 2024 22:00:04 -0800 (PST) Received: from [1.0.0.7] ([91.185.77.50]) by smtp.gmail.com with ESMTPSA id z15-20020a056512308f00b0050ee46236b3sm863078lfd.232.2024.01.18.22.00.02 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 18 Jan 2024 22:00:03 -0800 (PST) Message-ID: Date: Fri, 19 Jan 2024 09:00:01 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2 Subject: Re: Test slots invalidations in 035_standby_logical_decoding.pl only if dead rows are removed Content-Language: en-US From: Alexander Lakhin To: Michael Paquier , Bertrand Drouvot Cc: "Yu Shi (Fujitsu)" , Tom Lane , Robert Haas , Andres Freund , Thomas Munro , PostgreSQL Hackers References: <7c025095-5763-17a6-8c80-899b35bd0459@gmail.com> <5d0e5bec-67f9-9164-36cb-c4ff5f95d1ed@gmail.com> <6f85667e-5754-5d35-dbf1-c83fe08c1e48@gmail.com> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hello, 15.01.2024 12:00, Alexander Lakhin wrote: > If this approach looks promising to you, maybe we could add a submodule to > perl/PostgreSQL/Test/ and use this functionality in other tests (e.g., in > 019_replslot_limit) as well. > > Personally I think that having such a functionality for using in tests > might be useful not only to avoid some "problematic" behaviour but also to > test the opposite cases. After spending a few days on it, I've discovered two more issues: https://www.postgresql.org/message-id/16d6d9cc-f97d-0b34-be65-425183ed3721%40gmail.com https://www.postgresql.org/message-id/b0102688-6d6c-c86a-db79-e0e91d245b1a%40gmail.com (The latter is not related to bgwriter directly, but it was discovered thanks to the RUNNING_XACTS record flew in WAL in a lucky moment.) So it becomes clear that the 035 test is not the only one, which might suffer from bgwriter's activity, and inventing a way to stop bgwriter/ control it is a different subject, getting out of scope of the current issue. 15.01.2024 11:49, Bertrand Drouvot wrote: > We did a few things in this thread, so to sum up what we've discovered: > > - a race condition in InvalidatePossiblyObsoleteSlot() (see [1]) > - we need to launch the vacuum(s) only if we are sure we got a newer XID horizon > ( proposal in in v6 attached) > - we need a way to control how frequent xl_running_xacts are emmitted (to ensure > they are not triggered in a middle of an active slot invalidation test). > > I'm not sure it's possible to address Tom's concern and keep the test "predictable". > > So, I think I'd vote for Michael's proposal to implement a superuser-settable > developer GUC (as sending a SIGSTOP on the bgwriter (and bypass $windows_os) would > still not address Tom's concern anyway). > > Another option would be to "sacrifice" the full predictablity of the test (in > favor of real-world behavior testing)? > > [1]: https://www.postgresql.org/message-id/ZaTjW2Xh%2BTQUCOH0%40ip-10-97-1-34.eu-west-3.compute.internal So, now we have the test 035 failing due to nondeterministic vacuum activity in the first place, and due to bgwriter's activity in the second. Maybe it would be a right move to commit the fix, and then think about more rare failures. Though I have a couple of question regarding the fix left, if you don't mind: 1) The test has minor defects in the comments, that I noted before [1]; would you like to fix them in passing? > BTW, it looks like the comment: > # One way to produce recovery conflict is to create/drop a relation and > # launch a vacuum on pg_class with hot_standby_feedback turned off on the standby. > in scenario 3 is a copy-paste error. > Also, there are two "Scenario 4" in this test. > 2) Shall we align the 035_standby_logical_decoding with 031_recovery_conflict in regard to improving stability of vacuum? I see the following options for this: a) use wait_until_vacuum_can_remove() and autovacuum = off in both tests; b) use FREEZE and autovacuum = off in both tests; c) use wait_until_vacuum_can_remove() in 035, FREEZE in 031, and  autovacuum = off in both. I've re-tested the v6 patch today and confirmed that it makes the test more stable. I ran (with bgwriter_delay = 10000 in temp.config) 20 tests in parallel and got failures ('inactiveslot slot invalidation is logged with vacuum on pg_authid') on iterations 2, 6, 6 with no patch applied. (With unlimited CPU, when average test duration is around 70 seconds.) But with v6 applied, 60 iterations succeeded. [1] https://www.postgresql.org/message-id/b2a1f7d0-7629-72c0-2da7-e9c4e336b010@gmail.com Best regards, Alexander