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 1rAVcz-00705I-3p for pgsql-hackers@arkaria.postgresql.org; Tue, 05 Dec 2023 13:38:21 +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 1rAVcx-004Caz-R8 for pgsql-hackers@arkaria.postgresql.org; Tue, 05 Dec 2023 13:38:19 +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 1rAVcx-004CZ5-Ct for pgsql-hackers@lists.postgresql.org; Tue, 05 Dec 2023 13:38:19 +0000 Received: from mail-wr1-x436.google.com ([2a00:1450:4864:20::436]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1rAVcu-00ADzL-G5 for pgsql-hackers@postgresql.org; Tue, 05 Dec 2023 13:38:18 +0000 Received: by mail-wr1-x436.google.com with SMTP id ffacd0b85a97d-3332fc9b9b2so3774814f8f.1 for ; Tue, 05 Dec 2023 05:38:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1701783494; x=1702388294; darn=postgresql.org; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=JGbKxMVJTaN7x9vuIxc6pWnSxHhRJeviqGzZHpBJ+s4=; b=mAg3A/ddSuoKNjTuTNUzLeRS2gyFHR2jEU99XVZRvU2VoS/Jp43F5lfLqsoeungDRM rnfoN3FG/cCPiLzK1huvlVtG4yZ6GHm307UEzuxnggtWeCvZolklqpvZyhBryTHT+328 GeBOPCuG7rpiAV0nHLsRjBoF5qV4LFqcfis4mdnXpHAFbeH05AbQMQIJjFEHQljphszM UZCc+gv8RMuFoBcHY8YV4UqZy1yfTREkQRk9tSQOF1SKezMSH794dNkhUSsemGf+oPZk xBZGIYmSYFTSe6z0e3ldmJ7KtkyhCY/LJsqNmIgK1gBqKhQVAsPBls+s//odG7ICi7m3 9DmA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701783494; x=1702388294; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=JGbKxMVJTaN7x9vuIxc6pWnSxHhRJeviqGzZHpBJ+s4=; b=htPq2PmNL91fiwU66zJ1FDXod2gr/XkpTPTVTjY2W//SakkCPMu0hAdCkF55g6ZdoG 2Swz5QtLAfi8Qt76qOBgmZ4C/F4pAAgg60vLomGOSpKl0husghyQOa00osY+KhObLTBs DIZ3s/6G7QvulhvTYiPeFzrZ3sDzrVMfkvH8QhFVTWtlTwPWqsJXLooDbwUUNLtFCeAm 1cFuWusixrHUokMH4w38/D+bpTbTnlTUdAKGuSAkzZfWn5r3/G4hyCaoLL7wccs6lNDJ EH92gip7LsGV0GPi3pu1wM4OEZ2X50TVU5d46459MfCq/4x3edPDCmgirI3nPyjnyIYH 5/2Q== X-Gm-Message-State: AOJu0YwSebDR6KqABbxMu1jICFSQlV4m6//4rDAr0JIP9r1e7xNksKy/ vrZfDnSb+6B8slDLdFC0IOg= X-Google-Smtp-Source: AGHT+IGoJhE9xahgBCNa7FgRU+5oAEjmXRtxdVlVvZuW8S2HTmNKuJOyhHtxwRbGqSWwwv1lmlNyOg== X-Received: by 2002:adf:fa8f:0:b0:333:3117:c420 with SMTP id h15-20020adffa8f000000b003333117c420mr1758780wrr.177.1701783494146; Tue, 05 Dec 2023 05:38:14 -0800 (PST) Received: from ?IPV6:2a01:cb11:192:7000:61d0:dfb3:acd8:ee11? ([2a01:cb11:192:7000:61d0:dfb3:acd8:ee11]) by smtp.gmail.com with ESMTPSA id q4-20020a05600000c400b003333fa3d043sm8186927wrx.12.2023.12.05.05.38.13 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 05 Dec 2023 05:38:13 -0800 (PST) Message-ID: <09613643-31e9-49f0-ada6-01ebdfa95fb7@gmail.com> Date: Tue, 5 Dec 2023 14:38:12 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Synchronizing slots from primary to standby Content-Language: en-US To: shveta malik Cc: Nisha Moond , Amit Kapila , "Zhijie Hou (Fujitsu)" , Peter Smith , "Hayato Kuroda (Fujitsu)" , Bharath Rupireddy , Peter Eisentraut , Bruce Momjian , Ashutosh Sharma , Andres Freund , pgsql-hackers , Ajin Cherian , Alvaro Herrera References: <65326908-f1ef-40ce-acc6-414801c30946@gmail.com> <1789e94e-8266-44d1-95e4-7f41abc27d0d@gmail.com> <828dcda4-50c2-4069-bdc3-9e8c90c943d7@gmail.com> <6694284d-c847-42df-8f76-6efa8eeeb0df@gmail.com> <2fdc471d-2eee-4c29-9f26-d7f5dcc8cd53@gmail.com> <40e1d73f-a09d-4608-8efa-750c998c3287@gmail.com> From: "Drouvot, Bertrand" 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 Hi, On 12/5/23 11:29 AM, shveta malik wrote: > On Tue, Dec 5, 2023 at 2:18 PM Drouvot, Bertrand > wrote: >> Wouldn't that make sense to move it once we are sure that >> walrcv_startstreaming() returns true and first_stream is true, here? >> >> " >> if (first_stream) >> + { >> ereport(LOG, >> (errmsg("started streaming WAL from primary at %X/%X on timeline %u", >> LSN_FORMAT_ARGS(startpoint), startpointTLI))); >> + SpinLockAcquire(&walrcv->mutex); >> + walrcv->walRcvState = WALRCV_STREAMING; >> + SpinLockRelease(&walrcv->mutex); >> + } >> " >> > > Yes, it makes sense and is the basis for current slot-sync worker > changes being discussed. I think this change deserves its own dedicated thread and patch, does that make sense? If so, I'll submit one. >> >> 2) and 3) looks good to me but with a check on walrcv->walRcvState >> looking for WALRCV_STREAMING state instead of looking for a non null >> WalRcv->pid. > > yes. But I think, the worker should enter no-op, when walRcvState is > WALRCV_STOPPED and not when walRcvState != WALRCV_STREAMING as it is > okay to have WALRCV_WAITING/STARTING/RESTARTING. But the worker should > exit no-op only when it finds walRcvState switched back to > WALRCV_STREAMING. > Yeah, fully agree. Regards, -- Bertrand Drouvot PostgreSQL Contributors Team RDS Open Source Databases Amazon Web Services: https://aws.amazon.com