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 1mmeo1-00064Y-D7 for pgsql-hackers@arkaria.postgresql.org; Mon, 15 Nov 2021 16:26:05 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mmenz-0007Sn-U2 for pgsql-hackers@arkaria.postgresql.org; Mon, 15 Nov 2021 16:26:03 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from <9erthalion6@gmail.com>) id 1mmenz-0007Se-Id for pgsql-hackers@lists.postgresql.org; Mon, 15 Nov 2021 16:26:03 +0000 Received: from mail-wm1-x329.google.com ([2a00:1450:4864:20::329]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from <9erthalion6@gmail.com>) id 1mmenu-0003oW-6h for pgsql-hackers@postgresql.org; Mon, 15 Nov 2021 16:26:02 +0000 Received: by mail-wm1-x329.google.com with SMTP id 77-20020a1c0450000000b0033123de3425so16354017wme.0 for ; Mon, 15 Nov 2021 08:25:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=py7uanqIfTixv5TwxyAIf+rUuNRw5p9YvR9gtTMGW1I=; b=R86EDGf3ULg/tGyLu8LAx5sUD1uHV6O80Jj2zVkfUVTYu/1B1R82SaVDW6ns+fvuW4 DJ5QFS67Kd/xAx56gdulPm/+llMwhWx2sw+T4VxRPGbq/pjY0NzZFixZnJYdzbJexUJc 928i6CByXDJSqm7JdI+SjwYc8RuYdbjaX4jQN1BR61J0mRQbBVcdFA4vHAjMRskn+oLc VEDzvoxrnJg+5UQmgGwevjbDB4jRFh8WDVzP0hT0MrmoVW3QC35jONfGyffzR/BO0zqA mS+0peJGm/omE1crU1eyuQRBBCRjtKdzIqGeczCWX8NHP5CfhMniAaVKg6zxMAPoWsqi 13rw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=py7uanqIfTixv5TwxyAIf+rUuNRw5p9YvR9gtTMGW1I=; b=QMv2QgADrScAgFYe4CisIF/DGZwvRvz2h3YJe2w4K/EVpAUilERboljBP9Ky6GL0Ox CcdWx4Ni1yC0qzrf+q7iwSYDMY38rXIF5CXVmp6vLOEn6z+wECFAUpPXmV6pk39Iu/Xl eWlDdv+EtmOcciOg9H8gVfO1n8E3aUsB/NgEbz01gn0nNxk99uQstk67KOoEzOWA9rML k5IvQRDoNeh0rSD+CEJ5beHTWqmV8HHSEH99maemN4IJJybWuqBsxOLaI98Rp09qeVTq UZhB5hw6i0piVDPuKWLLy0/0ZAjnNx/ZHgtdpUUk6YtZqS2PYyhuqBd2BabVpf3MUYp6 Q3eg== X-Gm-Message-State: AOAM531asdydyNNm8YBwjsvVYnylt1pmKEs919H0gQxcQXQQKvJg6DbT y81dAXBqU1yEa3HTe6voIgA= X-Google-Smtp-Source: ABdhPJzRalfXtZdrStToMpx2P1DmGe53+JbTOOoosDNwEDshZKakJIqUN1vGtu9/nrgtj8w0y5ms1Q== X-Received: by 2002:a05:600c:b43:: with SMTP id k3mr43286171wmr.159.1636993555978; Mon, 15 Nov 2021 08:25:55 -0800 (PST) Received: from localhost (dslb-178-012-041-031.178.012.pools.vodafone-ip.de. [178.12.41.31]) by smtp.gmail.com with ESMTPSA id l18sm15165569wrt.81.2021.11.15.08.25.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 15 Nov 2021 08:25:55 -0800 (PST) Date: Mon, 15 Nov 2021 17:26:41 +0100 From: Dmitry Dolgov <9erthalion6@gmail.com> To: Robert Haas Cc: Jeevan Ladhe , Mark Dilger , "pgsql-hackers@postgresql.org" , tushar Subject: Re: refactoring basebackup.c Message-ID: <20211115162641.dmo6l32fklh64gnw@localhost> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk > On Fri, Nov 05, 2021 at 11:50:01AM -0400, Robert Haas wrote: > On Tue, Nov 2, 2021 at 10:32 AM Robert Haas wrote: > > Meanwhile, I think it's probably OK for me to go ahead and commit > > 0001-0003 from my patches at this point, since it seems we have pretty > > good evidence that the abstraction basically works, and there doesn't > > seem to be any value in holding off and maybe having to do a bunch > > more rebasing. > > I went ahead and committed 0001 and 0002, but got nervous about > proceeding with 0003. Hi, I'm observing a strange issue which I can only relate to bef47ff85d where bbsink abstraction was introduced. The problem is about failing assertion when doing: DETAIL: Failed process was running: BASE_BACKUP ( LABEL 'pg_basebackup base backup', PROGRESS, WAIT 0, MAX_RATE 102400, MANIFEST 'yes') Walsender tries to send a backup manifest, but crashes on the trottling sink: #2 0x0000560857b551af in ExceptionalCondition (conditionName=0x560857d15d27 "sink->bbs_next != NULL", errorType=0x560857d15c23 "FailedAssertion", fileName=0x560857d15d15 "basebackup_sink.c", lineNumber=91) at assert.c:69 #3 0x0000560857918a94 in bbsink_forward_manifest_contents (sink=0x5608593f73f8, len=32768) at basebackup_sink.c:91 #4 0x0000560857918d68 in bbsink_throttle_manifest_contents (sink=0x5608593f7450, len=32768) at basebackup_throttle.c:125 #5 0x00005608579186d0 in bbsink_manifest_contents (sink=0x5608593f7450, len=32768) at ../../../src/include/replication/basebackup_sink.h:240 #6 0x0000560857918b1b in bbsink_forward_manifest_contents (sink=0x5608593f74e8, len=32768) at basebackup_sink.c:94 #7 0x0000560857911edc in bbsink_manifest_contents (sink=0x5608593f74e8, len=32768) at ../../../src/include/replication/basebackup_sink.h:240 #8 0x00005608579129f6 in SendBackupManifest (manifest=0x7ffdaea9d120, sink=0x5608593f74e8) at backup_manifest.c:373 Looking at the similar bbsink_throttle_archive_contents it's not clear why comments for both functions (archive and manifest throttling) say "pass archive contents to next sink", but only bbsink_throttle_manifest_contents does pass bbs_next into the bbsink_forward_manifest_contents. Is it supposed to be like that? Passing the same sink object instead the next one into bbsink_forward_manifest_contents seems to solve the problem in this case.