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 1sRx9N-002PnI-6I for pgsql-hackers@arkaria.postgresql.org; Thu, 11 Jul 2024 17:00:09 +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 1sRx9L-00GQCz-AZ for pgsql-hackers@arkaria.postgresql.org; Thu, 11 Jul 2024 17:00:07 +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 1sRx9K-00GQCr-Vq for pgsql-hackers@lists.postgresql.org; Thu, 11 Jul 2024 17:00:07 +0000 Received: from mail-lf1-x12b.google.com ([2a00:1450:4864:20::12b]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1sRx9H-001agU-Oj for pgsql-hackers@lists.postgresql.org; Thu, 11 Jul 2024 17:00:06 +0000 Received: by mail-lf1-x12b.google.com with SMTP id 2adb3069b0e04-52ea1a69624so1201253e87.1 for ; Thu, 11 Jul 2024 10:00:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1720717203; x=1721322003; darn=lists.postgresql.org; h=content-transfer-encoding:in-reply-to:content-language:references :cc:to:subject:from:user-agent:mime-version:date:message-id:from:to :cc:subject:date:message-id:reply-to; bh=PHualfo3al/KKpDDvay/EonGfIR+oN9Gl/TeEfkXqP0=; b=cgTDN7Ka55V9i5/jDfWabkR7mF0t1ImhE5Y00/EVrc3EJI6p0baBuKhpqtQQqnhndJ abqzJgpJmFAiYsd4WOcwDPfVNfEr7CUrw3JP10tvpyJupyX+Zvvi3OqAYupOkX0VOmQx GquWI9sVBQwGOp5ZqzVnDKnHih9jTpLRCbVGb7eAKf0i8fuRLipAuHzhPkpsG8cqohhg 3bVJMRCyzLqtmMGDqIP/BnZiHzuYM6B+O0l+BHixfh1y89eKnmr8AvkV5UJp2ACt70Da 3hooO9pwGFP8JT7qUOB1Ya72xNE9o6NJlTH5/5ZruAokgPBr1nHx9eZZ1VspW/OVRTrI qvgw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720717203; x=1721322003; h=content-transfer-encoding:in-reply-to:content-language:references :cc:to:subject:from:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=PHualfo3al/KKpDDvay/EonGfIR+oN9Gl/TeEfkXqP0=; b=PvaV2DtIP+ZmHbIFaIggP60S5gxUWMEHD2TO4rcH32wIom4cVCaegFd2NUGrbwKjCX KoUsJzmbbJa8OVwTySLN0vl20BvJ3++fvVH/b4y5S4cSILqGa2unfPuIfHDd/5MAvHuY /f+jULWEDY2/X3h56z5oJwcUoxi0sByFXEbF5tJbc1rTWziY5NFIJwc8VLWChB+hiVXb /7z1ujTzWCWNM0Tmijp8Kcj/LMIJn0ElgaZqzs6FoYddxi2RTPnBqFD2PR0D+Jd3Uu7+ zwgsiWTSqFyuOgJbWYD/P1sHxFcY1EgQU1K40+d5GzZcYNUgE4hmAbbl3GoG1J7hzvmK FDQQ== X-Forwarded-Encrypted: i=1; AJvYcCXH+h+ImSkWOA+7zNuRlDDNjeDDs/fLGeJXZ3f1EGDb1ldUYxJH3whY0X3ziCbzWgl/tuxxtmM/IzUndnN3g68ghRl9+E3RUdbRaG/kU/Venpen X-Gm-Message-State: AOJu0YwR6E0Wh7YD1VaGwdxThAzqzo7GbHMBV9rNWqD0V5Pr0T4+dBsx kkb0J30Voh7x5QL38msrLdH4mdWju8JBDopU2/mX9Q7jX/Q1ZcKT X-Google-Smtp-Source: AGHT+IHXQiBYcUWEcRl5k64rNMi4wVxH3m21QvFYw6K2bt+hxtNpbF3ZAvFS6h2//Hup2cZYPYfmKg== X-Received: by 2002:a05:6512:1396:b0:52c:d626:77aa with SMTP id 2adb3069b0e04-52eb99d3dd2mr5637751e87.58.1720717202499; Thu, 11 Jul 2024 10:00:02 -0700 (PDT) Received: from [1.0.0.7] ([178.155.22.46]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-52eb8e48f6fsm1043643e87.71.2024.07.11.10.00.01 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 11 Jul 2024 10:00:02 -0700 (PDT) Message-ID: <68de6498-0449-a113-dd03-e198dded0bac@gmail.com> Date: Thu, 11 Jul 2024 20:00:00 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2 From: Alexander Lakhin Subject: Re: speed up a logical replica setup To: Amit Kapila , =?UTF-8?B?SG91LCBaaGlqaWUv5L6vIOW/l+adsA==?= Cc: "Hayato Kuroda (Fujitsu)" , "pgsql-hackers@lists.postgresql.org" References: <9a9c7e65-c47b-4400-a63e-ac6169c0860e@app.fastmail.com> <5da4b286-e570-4341-8262-92d763f6b1a4@app.fastmail.com> <776c5cac-5ef5-4001-b1bc-5b698bc0c62a@app.fastmail.com> <3c024250-3f13-4f4d-b8e9-55f176db4abf@eisentraut.org> <0dffca12-bf17-4a7a-334d-225569de5e6e@gmail.com> Content-Language: en-US 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 Amit and Hou-San, 11.07.2024 13:21, Amit Kapila wrote: > > We don't wait for the xmin to catch up corresponding to this insert > and I don't know if there is a way to do that. So, we should move this > Insert to after the call to pg_sync_replication_slots(). It won't > impact the general test of pg_createsubscriber. > > Thanks to Hou-San for helping me in the analysis of this BF failure. Thank you for investigating that issue! May I ask you to look at another failure of the test occurred today [1]? The failure log contains: recovery_target_lsn = '0/30098D0' pg_createsubscriber: starting the subscriber ... pg_createsubscriber: server was started pg_createsubscriber: waiting for the target server to reach the consistent state ... 2024-07-11 07:40:10.837 UTC [2948531][postmaster][:0] LOG:  received fast shutdown request Though what I'm seeing after a successful run is: recovery_target_lsn = '0/3009860' pg_createsubscriber: starting the subscriber ... pg_createsubscriber: server was started pg_createsubscriber: waiting for the target server to reach the consistent state ... 2024-07-11 15:19:40.733 UTC [207517] 040_pg_createsubscriber.pl LOG:  statement: SELECT pg_catalog.pg_is_in_recovery() 2024-07-11 15:19:41.635 UTC [207514] LOG:  recovery stopping after WAL location (LSN) "0/3009860" 2024-07-11 15:19:41.635 UTC [207514] LOG:  redo done at 0/3009860 system usage: CPU: user: 0.00 s, system: 0.00 s, elapsed: 21.00 s I've managed to reproduce the failure locally. With the bgwriter mod: -#define LOG_SNAPSHOT_INTERVAL_MS 15000 +#define LOG_SNAPSHOT_INTERVAL_MS 150 and wal_debug=on, when running 5 test instances with parallel, I get the failure with the following log: recovery_target_lsn = '0/3009A20' pg_createsubscriber: starting the subscriber 2024-07-11 14:40:04.551 UTC [205589:72][startup][33/0:0] LOG:  REDO @ 0/30099E8; LSN 0/3009A20: prev 0/30099B0; xid 0; len 24 - Standby/RUNNING_XACTS: nextXid 747 latestCompletedXid 746 oldestRunningXid 747 # ^^^ the last REDO record in the log ... pg_createsubscriber: server was started pg_createsubscriber: waiting for the target server to reach the consistent state ... pg_createsubscriber: server was stopped pg_createsubscriber: error: recovery timed out ... [14:43:06.011](181.800s) not ok 30 - run pg_createsubscriber on node S [14:43:06.012](0.000s) [14:43:06.012](0.000s) #   Failed test 'run pg_createsubscriber on node S' #   at t/040_pg_createsubscriber.pl line 356. $ pg_waldump -p src/bin/pg_basebackup_1/tmp_check/t_040_pg_createsubscriber_node_s_data/pgdata/pg_wal/ 000000010000000000000003 000000010000000000000003 | tail -2 rmgr: Standby     len (rec/tot):     50/    50, tx:          0, lsn: 0/030099B0, prev 0/03009948, desc: RUNNING_XACTS nextXid 747 latestCompletedXid 746 oldestRunningXid 747 rmgr: Standby     len (rec/tot):     50/    50, tx:          0, lsn: 0/030099E8, prev 0/030099B0, desc: RUNNING_XACTS nextXid 747 latestCompletedXid 746 oldestRunningXid 747 Whilst $ pg_waldump -p src/bin/pg_basebackup_1/tmp_check/t_040_pg_createsubscriber_node_p_data/pgdata/pg_wal/ 000000010000000000000003 000000010000000000000003 | tail rmgr: Standby     len (rec/tot):     50/    50, tx:          0, lsn: 0/030099B0, prev 0/03009948, desc: RUNNING_XACTS nextXid 747 latestCompletedXid 746 oldestRunningXid 747 rmgr: Standby     len (rec/tot):     50/    50, tx:          0, lsn: 0/030099E8, prev 0/030099B0, desc: RUNNING_XACTS nextXid 747 latestCompletedXid 746 oldestRunningXid 747 rmgr: Heap2       len (rec/tot):     60/    60, tx:        747, lsn: 0/03009A20, prev 0/030099E8, desc: NEW_CID rel: 1663/16384/6104, tid: 0/1, cmin: 4294967295, cmax: 0, combo: 4294967295 rmgr: Heap        len (rec/tot):     54/    54, tx:        747, lsn: 0/03009A60, prev 0/03009A20, desc: DELETE xmax: 747, off: 1, infobits: [KEYS_UPDATED], flags: 0x00, blkref #0: rel 1663/16384/6104 blk 0 rmgr: Transaction len (rec/tot):     78/    78, tx:        747, lsn: 0/03009A98, prev 0/03009A60, desc: INVALIDATION ; inval msgs: catcache 49 catcache 46 relcache 0 rmgr: Transaction len (rec/tot):     98/    98, tx:        747, lsn: 0/03009AE8, prev 0/03009A98, desc: COMMIT 2024-07-11 14:43:05.994561 UTC; relcache init file inval dbid 16384 tsid 1663; inval msgs: catcache 49 catcache 46 relcache 0 rmgr: Heap2       len (rec/tot):     60/    60, tx:        748, lsn: 0/03009B50, prev 0/03009AE8, desc: NEW_CID rel: 1663/16385/6104, tid: 0/1, cmin: 4294967295, cmax: 0, combo: 4294967295 rmgr: Heap        len (rec/tot):     54/    54, tx:        748, lsn: 0/03009B90, prev 0/03009B50, desc: DELETE xmax: 748, off: 1, infobits: [KEYS_UPDATED], flags: 0x00, blkref #0: rel 1663/16385/6104 blk 0 rmgr: Transaction len (rec/tot):     78/    78, tx:        748, lsn: 0/03009BC8, prev 0/03009B90, desc: INVALIDATION ; inval msgs: catcache 49 catcache 46 relcache 0 rmgr: Transaction len (rec/tot):     98/    98, tx:        748, lsn: 0/03009C18, prev 0/03009BC8, desc: COMMIT 2024-07-11 14:43:06.008619 UTC; relcache init file inval dbid 16385 tsid 1663; inval msgs: catcache 49 catcache 46 relcache 0 [1] https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=olingo&dt=2024-07-11%2007%3A25%3A12 Best regards, Alexander