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 1rwcG2-002yAt-As for pgsql-hackers@arkaria.postgresql.org; Tue, 16 Apr 2024 06:25:30 +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 1rwcFz-001HVX-3Y for pgsql-hackers@arkaria.postgresql.org; Tue, 16 Apr 2024 06:25:27 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rwcFy-001HVO-Nd for pgsql-hackers@lists.postgresql.org; Tue, 16 Apr 2024 06:25:26 +0000 Received: from mail-oo1-xc31.google.com ([2607:f8b0:4864:20::c31]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1rwcFw-0035WY-4B for pgsql-hackers@lists.postgresql.org; Tue, 16 Apr 2024 06:25:25 +0000 Received: by mail-oo1-xc31.google.com with SMTP id 006d021491bc7-5ac8c73cf88so2016962eaf.2 for ; Mon, 15 Apr 2024 23:25:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1713248723; x=1713853523; darn=lists.postgresql.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=wKTcJwx98iHS3p7GQh56sjBy9wuLzv7FtI0Xu9/jiIQ=; b=EoipXfnMHOmDdAsjCnqget8krhfAbigNwnKcCBLMQG6mGzsOkHlc17s+DsjZkSP7Rm w2iy4c6bvW+X6m02pohX41n9i7G6eez9FE9BUV5QiVBaU+B2vPRUcZw54dYJdfehMZ9k kszX06RcMzMU44gZdd4uLXjnJ8bb2/xXF/CnuzwpxTDWZv7HTahYfH00UvtKJdLmRWsq ftXg46YVJly7OLt2o5bU5jQSsN8b9b9TtDgegvp47yFJr9X9buEuPHOeuNkrMZxGpcg0 YEb1TKB8vjpro5m6/UCdtDH59ygUFWXWD6LDLYs3ym1yQJz59eOm2lut4IV0f9y+1JLC WRJA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713248723; x=1713853523; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=wKTcJwx98iHS3p7GQh56sjBy9wuLzv7FtI0Xu9/jiIQ=; b=gXKBUtng2pF1udY3v6PYinYqrof5EX8Rp2Sx3LgDaQClg6UbSySu1e8egyvBNlIz1P fn0wkJ8e9DO+uPdOUDtrf01ql3v/pLQIiqw4Qce7g64rIdpSf6iJcX908GR446dW1dhe 9l5+vz3+FMDib2KsIsf2UMeZgXeZ1jo5AVPQWsxwNMJ71C4u6owUAgwjFibE5lqoNuap EuZATTEW2ZtvU0j2tVCGw3tuQcG9jIGMW9SWqKSnle5JuD9kcpMXiZb+Qp0YPiXqtutT sfHBLZtt9AJV5LFZ3ADXbw9mOXAFPAFgi7vGYjzqGJ9jyW/hiluNlTI1Y+lHrmxIngdV ewog== X-Forwarded-Encrypted: i=1; AJvYcCUIsie/OuMMhw5B0lXWUsdr0s4uYOhde4JSkbrGD4/Iqn9VojElIkzv+yImekuxdEx8CNkciSZlKvijPmY7cP+bm6vHRGXkwHw5DiTAbrZ3PKAI X-Gm-Message-State: AOJu0YyS9Vg7PJBJhdhRUs7JgwLvpcboXNpX1rbep2TkvvPNc0aj8OwU 23vPF8n1qMcjgPFFZPkbd9SB0qr/fp9PeQajRFEKOxd4XIGExJP/UnDDTD4k/QIUiY1hb7qIb2d jiIYUWed8MLOhZVfnXrrRbRgsM0Y= X-Google-Smtp-Source: AGHT+IHT0iYNOWU4t3bavmsisy4UvB9qXDdK797SuWvhcB3W0Ikoe2sfz70raga5QxqZosop/BfJSdstzB3NZKONVq8= X-Received: by 2002:a05:6870:b015:b0:22e:c48a:bfda with SMTP id y21-20020a056870b01500b0022ec48abfdamr15152484oae.28.1713248723300; Mon, 15 Apr 2024 23:25:23 -0700 (PDT) MIME-Version: 1.0 References: <8fab8-65d74c80-1-2f28e880@39088166> <99df2-65d8d200-1-63c26880@172687752> In-Reply-To: From: Amit Kapila Date: Tue, 16 Apr 2024 11:55:11 +0530 Message-ID: Subject: Re: Slow catchup of 2PC (twophase) transactions on replica in LR To: "Hayato Kuroda (Fujitsu)" Cc: Ajin Cherian , =?UTF-8?B?0JTQsNCy0YvQtNC+0LIg0JLQuNGC0LDQu9C40Lk=?= , Heikki Linnakangas , "pgsql-hackers@lists.postgresql.org" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Tue, Apr 16, 2024 at 7:48=E2=80=AFAM Hayato Kuroda (Fujitsu) wrote: > > > > FYI - We also considered the idea which walsender waits until all pre= pared > > transactions > > > are resolved before decoding and sending changes, but it did not work= well > > > - the restarted walsender sent only COMMIT PREPARED record for > > transactions which > > > have been prepared before disabling the subscription. This happened b= ecause > > > 1) if the two_phase option of slots is false, the confirmed_flush can= be ahead of > > > PREPARE record, and > > > 2) after the altering and restarting, start_decoding_at becomes same = as > > > confirmed_flush and records behind this won't be decoded. > > > > > > > I don't understand the exact problem you are facing. IIUC, if the > > commit is after start_decoding_at point and prepare was before it, we > > expect to send the entire transaction followed by a commit record. The > > restart_lsn should be before the start of such a transaction and we > > should have recorded the changes in the reorder buffer. > > This behavior is right for two_phase =3D false case. But if the parameter= is > altered between PREPARE and COMMIT PREPARED, there is a possibility that = only > COMMIT PREPARED is sent. > Can you please once consider the idea shared by me at [1] (One naive idea is that on the publisher .....) to solve this problem? [1] - https://www.postgresql.org/message-id/CAA4eK1K1fSkeK%3Dkc26G5cq87vQG4= %3D1qs_b%2Bno4%2Bep654SeBy1w%40mail.gmail.com --=20 With Regards, Amit Kapila.