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 1rsFna-005qDN-LA for pgsql-hackers@arkaria.postgresql.org; Thu, 04 Apr 2024 05:38:07 +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 1rsFnZ-00FV3d-Np for pgsql-hackers@arkaria.postgresql.org; Thu, 04 Apr 2024 05:38:05 +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 1rsFnZ-00FV1b-Bu for pgsql-hackers@lists.postgresql.org; Thu, 04 Apr 2024 05:38:05 +0000 Received: from mail-oa1-x2d.google.com ([2001:4860:4864:20::2d]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1rsFnW-000XpV-Ng for pgsql-hackers@lists.postgresql.org; Thu, 04 Apr 2024 05:38:04 +0000 Received: by mail-oa1-x2d.google.com with SMTP id 586e51a60fabf-22ea805f3edso281282fac.1 for ; Wed, 03 Apr 2024 22:38:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712209081; x=1712813881; 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=U6ZeThTgjMCzpS/nM7AdhbjwlI3uwvFHZYbfX1L76BU=; b=hPTWcAE2j3W7lNg3oy+jWH8gZadUsqW2D1zI7Fn7MBaQe3IKD2o0yGyIkbp2xWuCPo fhli+Jkeh8N0yEjCsozv4ALJ4WFTZPJDLvJMJOqb+yuJC4oeaRCrhXo7Gtusu44wmOlh xl/ycHrbx0s9QulTCFF6Jfi7UHLBtGGW4iYWo6BCe4xpGCQxrGVBwY5K0rufjA/McRpn 76N5cpkglIklL/++49UN8BkT0RovI0nc1DAlClZ6WgFZmJVzzNzHXQO6prpK5myPAunn EHvaMuT4DcQRJla1V3v6pAqW10r98/imxqhve29cLRTJ1KmPQUil1paNm2pNC7AraVfw MWEA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712209081; x=1712813881; 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=U6ZeThTgjMCzpS/nM7AdhbjwlI3uwvFHZYbfX1L76BU=; b=YyjL5oGk8SRKtOJOCz1KYIkc4n2zmxrsJ0FjEANcX6Ierho/J6TArRVLgLaRbq8wpt pXiYJZpJuwar8VlIm14IvUtDEAPrAJCQ+MAc6IobqTsD17myl87xv5C2cTPABBCRwGmo ITi2/Rt5kDCt8XJdQPkGiq5t+9+uOZmBH5TiS4aY9n6WqhJNajR2TU97tTNY36fnbnvK PEDxzex54plFUrwmhgXw++L/aP3G8diiUPfqQzftvf2hi6iFNDJ482B24QPuQuPo5/cU sbM1fgAZ2ZXJradkOyiOOrA16dt/HTYtxzTMmejRjk6Qa9qNmJ7PI7SfO6j53l+zBFUq JJsw== X-Forwarded-Encrypted: i=1; AJvYcCXfeyGLXF3tRmOyEKZes+Y2P1vW8Tps3qLiIgFk1miFVBZOsgObBs1OL8I7+Csz3UNUpuG4adQp60j/xSJ/a55z0f4AO74oXtsUAVgoNJ+X6ydP X-Gm-Message-State: AOJu0Yx1DfNNng3+V027AyYhpsv+mUExFlAwIbA3nlY9k7aC2eURcxtD mJBS96X189o2BHKwHSB1p15hQREIK/iyv7aauuLpW3Tqkuwq2qUvXf4zAqB7mh3wv/ZjFdchs7e TP/LXOGzNPvAGAgl2m+xJhy5Wh3s= X-Google-Smtp-Source: AGHT+IG7lbk1dV525hI2jbK/mVP9jxVgpIiEHw6ppy+JI5bP7lXitZlfuxEwx85UIyjsE0cxTnyGhNGAFY5s96jh2eQ= X-Received: by 2002:a05:6870:328a:b0:22a:2876:833f with SMTP id q10-20020a056870328a00b0022a2876833fmr1258889oac.53.1712209080903; Wed, 03 Apr 2024 22:38:00 -0700 (PDT) MIME-Version: 1.0 References: <8fab8-65d74c80-1-2f28e880@39088166> <99df2-65d8d200-1-63c26880@172687752> In-Reply-To: From: Amit Kapila Date: Thu, 4 Apr 2024 11:07:49 +0530 Message-ID: Subject: Re: Slow catchup of 2PC (twophase) transactions on replica in LR To: Ajin Cherian Cc: =?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 Thu, Apr 4, 2024 at 10:53=E2=80=AFAM Ajin Cherian wr= ote: > > On Wed, Mar 6, 2024 at 1:29=E2=80=AFAM =D0=94=D0=B0=D0=B2=D1=8B=D0=B4=D0= =BE=D0=B2 =D0=92=D0=B8=D1=82=D0=B0=D0=BB=D0=B8=D0=B9 wrote: >> >> In usual work, the subscription has two_phase =3D on. I have to change t= his option at catchup stage only, but this parameter can not be altered. Th= ere was a patch proposal in past to implement altering of two_phase option,= but it was rejected. I think, the recreation of the subscription with two_= phase =3D off will not work. >> >> > > The altering of two_phase was restricted because if there was a previousl= y prepared transaction on the subscriber when the two_phase was on, and the= n it was turned off, the apply worker on the subscriber would re-apply the = transaction a second time and this might result in an inconsistent replica. > Here's a patch that allows toggling two_phase option provided that there = are no pending uncommitted prepared transactions on the subscriber for that= subscription. > I think this would probably be better than the current situation but can we think of a solution to allow toggling the value of two_phase even when prepared transactions are present? Can you please summarize the reason for the problems in doing that and the solutions, if any? --=20 With Regards, Amit Kapila.