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 1jKawH-0007z7-0s for pgsql-hackers@arkaria.postgresql.org; Sat, 04 Apr 2020 05:01:49 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jKawF-0006zx-Sv for pgsql-hackers@arkaria.postgresql.org; Sat, 04 Apr 2020 05:01:47 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jKawF-0006zp-Gz for pgsql-hackers@lists.postgresql.org; Sat, 04 Apr 2020 05:01:47 +0000 Received: from mail-wr1-x430.google.com ([2a00:1450:4864:20::430]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1jKaw7-0001yM-43 for pgsql-hackers@postgresql.org; Sat, 04 Apr 2020 05:01:46 +0000 Received: by mail-wr1-x430.google.com with SMTP id m17so10871543wrw.11 for ; Fri, 03 Apr 2020 22:01:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=ChlEkPrEiDFnu5xlwnOHztHN+yulSJeMr7ZWpq9Z90I=; b=0tOAGytHN0LA2EeR+tbAjXpxN0iInwp91d9LXgFnkY3dOJo0KhaFNBh3NGNg1ENKBf 1my84zTwmDHGYQOKNGn0x7ZCWOcHRPMSC+Iz9Ffl5ab5bTOcpYxaTQlTkwiCJtSzf/4k vGrD36zVQt8+xVoTieE7gFqLADNwoEXnTybFgvGNEjQgnprqvQGt47xJtGn1BxwrgXs/ Uld4RZ2aLQLiRATlIRO6qtSRo0sFLmGjev15XOXC/xZPaWzfpkVefsMldW5DYJw4uEvA Z61+AcvkEALQLQEEk2NNXD1ffOU+XfbOKM22+f7mjrOn/vl7KYpZmGQLyKmCrtbxR4PZ NnSw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=ChlEkPrEiDFnu5xlwnOHztHN+yulSJeMr7ZWpq9Z90I=; b=SuScuF3jMA6ed8dm+TunxWXss3RMCwcCAxoa9vZCBJHPcCXVfM0mCEiMei+3X1rtO+ hKFN6yD3U6/hZX2Bzzba4Cq4t9Gss8JN74qFG/f7Vi8QhiFfczTvDimqRx0VrHJkUS5s PbmE/VYvUyWi48jJ05sBtc5XGZwyEgjHVw6W0admoIEjoGTSyl77YYLat2zvOwgRJpuh HjTwJoaAulj6XSnOlmTRdyJuRYeRiMhEwfHNDowp3IDwPLYzHeWdVIm/FDjeoG8WCEtk 84UK/HJarDRGBcAhViTt9H8XZ3xfkeTapdoDdgPEA3k375mH/FohYbRwfQN4xUADd4T4 6PRQ== X-Gm-Message-State: AGi0PuYXBjCAF3oNdy66WIt5FESpENiGvbRBuXy5DOsPnQm6dwVlpNi8 2yLx81yRL4n7RLOxPd7zgGcP3A== X-Google-Smtp-Source: APiQypKJShqN3/fhVFDTuICurQQ+0Y7AftF87zsgfrikp5x9RiI1z8V5ePDhgfmV9TYM3YovFAAgMw== X-Received: by 2002:adf:fdc6:: with SMTP id i6mr12797458wrs.252.1585976497822; Fri, 03 Apr 2020 22:01:37 -0700 (PDT) Received: from ?IPv6:2a02:8308:13b:9400:c4bc:d2a3:915a:f059? ([2a02:8308:13b:9400:c4bc:d2a3:915a:f059]) by smtp.gmail.com with ESMTPSA id t126sm14928635wmb.27.2020.04.03.22.01.36 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 03 Apr 2020 22:01:37 -0700 (PDT) Subject: Re: backup manifests and contemporaneous buildfarm failures To: Andres Freund , Robert Haas , Peter Eisentraut Cc: Tom Lane , Fabien COELHO , Alvaro Herrera , David Steele , Noah Misch , Stephen Frost , Amit Kapila , Suraj Kharage , tushar , Rajkumar Raghuwanshi , Rushabh Lathia , Tels , Andrew Dunstan , PostgreSQL Hackers , Jeevan Chalke , vignesh C , Thomas Munro References: <20200403205412.GA8279@alvherre.pgsql> <22394.1585951968@sss.pgh.pa.us> <20200404030628.rlyvz2n76g7g26ea@alap3.anarazel.de> From: Petr Jelinek Message-ID: Date: Sat, 4 Apr 2020 07:01:36 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.4.1 MIME-Version: 1.0 In-Reply-To: <20200404030628.rlyvz2n76g7g26ea@alap3.anarazel.de> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 04/04/2020 05:06, Andres Freund wrote: > Hi, > > Peter, Petr, CCed you because it's probably a bug somewhere around the > initial copy code for logical replication. > > > On 2020-04-03 20:48:09 -0400, Robert Haas wrote: >> 'serinus' is also failing. This is less obviously related: > > Hm. Tests passed once since then. > > >> 2020-04-04 02:08:57.299 CEST [5e87d019.506c1:4] LOG: received >> replication command: CREATE_REPLICATION_SLOT >> "tap_sub_16390_sync_16384" TEMPORARY LOGICAL pgoutput USE_SNAPSHOT >> 2020-04-04 02:08:57.299 CEST [5e87d019.506c1:5] ERROR: replication >> slot "tap_sub_16390_sync_16384" already exists > > That already seems suspicious. I checked the following (successful) run > and I did not see that in the stage's logs. > > Looking at the failing log, it fails because for some reason there's > rounds (once due to a refresh, once due to an intention replication > failure) of copying the relation. Each creates its own temporary slot. > > first time: > 2020-04-04 02:08:57.276 CEST [5e87d019.506bd:1] LOG: connection received: host=[local] > 2020-04-04 02:08:57.278 CEST [5e87d019.506bd:4] LOG: received replication command: CREATE_REPLICATION_SLOT "tap_sub_16390_sync_16384" TEMPORARY LOGICAL pgoutput USE_SNAPSHOT > 2020-04-04 02:08:57.282 CEST [5e87d019.506bd:9] LOG: statement: COPY public.tab_rep TO STDOUT > 2020-04-04 02:08:57.284 CEST [5e87d019.506bd:10] LOG: disconnection: session time: 0:00:00.007 user=bf database=postgres host=[local] > > second time: > 2020-04-04 02:08:57.288 CEST [5e87d019.506bf:1] LOG: connection received: host=[local] > 2020-04-04 02:08:57.289 CEST [5e87d019.506bf:4] LOG: received replication command: CREATE_REPLICATION_SLOT "tap_sub_16390_sync_16384" TEMPORARY LOGICAL pgoutput USE_SNAPSHOT > 2020-04-04 02:08:57.293 CEST [5e87d019.506bf:9] LOG: statement: COPY public.tab_rep TO STDOUT > > third time: > 2020-04-04 02:08:57.297 CEST [5e87d019.506c1:1] LOG: connection received: host=[local] > 2020-04-04 02:08:57.299 CEST [5e87d019.506c1:4] LOG: received replication command: CREATE_REPLICATION_SLOT "tap_sub_16390_sync_16384" TEMPORARY LOGICAL pgoutput USE_SNAPSHOT > 2020-04-04 02:08:57.299 CEST [5e87d019.506c1:5] ERROR: replication slot "tap_sub_16390_sync_16384" already exists > > Note that the connection from the second attempt has not yet > disconnected. Hence the error about the replication slot already > existing - it's a temporary replication slot that'd otherwise already > have been dropped. > > > Seems the logical rep code needs to do something about this race? > The downstream: > 2020-04-04 02:08:57.275 CEST [5e87d019.506bc:1] LOG: logical replication table synchronization worker for subscription "tap_sub", table "tab_rep" has started > 2020-04-04 02:08:57.282 CEST [5e87d019.506bc:2] ERROR: duplicate key value violates unique constraint "tab_rep_pkey" > 2020-04-04 02:08:57.282 CEST [5e87d019.506bc:3] DETAIL: Key (a)=(1) already exists. > 2020-04-04 02:08:57.282 CEST [5e87d019.506bc:4] CONTEXT: COPY tab_rep, line 1 > 2020-04-04 02:08:57.283 CEST [5e87d018.50689:5] LOG: background worker "logical replication worker" (PID 329404) exited with exit code 1 > 2020-04-04 02:08:57.287 CEST [5e87d019.506be:1] LOG: logical replication table synchronization worker for subscription "tap_sub", table "tab_rep" has started > 2020-04-04 02:08:57.293 CEST [5e87d019.506be:2] ERROR: duplicate key value violates unique constraint "tab_rep_pkey" > 2020-04-04 02:08:57.293 CEST [5e87d019.506be:3] DETAIL: Key (a)=(1) already exists. > 2020-04-04 02:08:57.293 CEST [5e87d019.506be:4] CONTEXT: COPY tab_rep, line 1 > 2020-04-04 02:08:57.295 CEST [5e87d018.50689:6] LOG: background worker "logical replication worker" (PID 329406) exited with exit code 1 > 2020-04-04 02:08:57.297 CEST [5e87d019.506c0:1] LOG: logical replication table synchronization worker for subscription "tap_sub", table "tab_rep" has started > 2020-04-04 02:08:57.299 CEST [5e87d019.506c0:2] ERROR: could not create replication slot "tap_sub_16390_sync_16384": ERROR: replication slot "tap_sub_16390_sync_16384" already exists > 2020-04-04 02:08:57.300 CEST [5e87d018.50689:7] LOG: background worker "logical replication worker" (PID 329408) exited with exit code Looks like we are simply retrying so fast that upstream will not have finished cleanup after second try by the time we already run the third one. The last_start_times is supposed to protect against that so I guess there is some issue with how that works. -- Petr Jelinek 2ndQuadrant - PostgreSQL Solutions for the Enterprise https://www.2ndQuadrant.com/