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 1t0cpO-00COBZ-PV for pgsql-hackers@arkaria.postgresql.org; Tue, 15 Oct 2024 08:22:50 +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 1t0cpN-004jvK-30 for pgsql-hackers@arkaria.postgresql.org; Tue, 15 Oct 2024 08:22:49 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1t0cpM-004jvC-Op for pgsql-hackers@lists.postgresql.org; Tue, 15 Oct 2024 08:22:49 +0000 Received: from mail-ed1-x534.google.com ([2a00:1450:4864:20::534]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1t0cpK-000yOy-Hl for pgsql-hackers@lists.postgresql.org; Tue, 15 Oct 2024 08:22:47 +0000 Received: by mail-ed1-x534.google.com with SMTP id 4fb4d7f45d1cf-5c94861ee25so3118865a12.0 for ; Tue, 15 Oct 2024 01:22:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1728980565; x=1729585365; darn=lists.postgresql.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=uwpdLZrSVSEZx/ozIJZa2W8P5cLLqCoDLK2wFFYLE3I=; b=esb1gOwrARTwuKV2yo6ywTc0nkCzecGUp9s2t0nYs33sXVmbNPmOI4tLwWORwEOzfM 6VeNCp36iZQjKExnbsSirF8SbMADP2v8bgEyM3rUBTsJJT/gUlSvi2Z89uqyvga7GM11 O/G7PdunkawMrc9J/uvfsBX+qSx3ZRixuaAXfhFW25fMjbkIK5fv+wbZW8QOk+1g/fYu 4ZnLFcnjsscU/aMEM+GqNpc0fndIWslzedwbBzYsh22LVnR3cu+jvxnhkd2Zplz3zzRL WSp7xK455jVBeWUIy3jk0bguiO+8aQ3WKA6lrs99PSSU20n3U6fFsM6D2f86dYl7uz3Z rXNQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728980565; x=1729585365; h=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=uwpdLZrSVSEZx/ozIJZa2W8P5cLLqCoDLK2wFFYLE3I=; b=ZPBK+a/GyqbqG6dIt8iHEZR4nASlnLqdGjoQ6zvInvAk8ZSE+eZhUnvsNm6DxZ2OIQ dMc5t1i1xdZDe10oWGkWkA9qgG5dRnGgyqxwH0wXhhO8KT+1gbsFvBzWwQboqs/448lW 0i88fFamURNE/4bVFtcFtBhOjP0VZ8tPwVftA43jrMPjRiPPGfF4GwCG4oBhl43YaHRz WlGc6wwo9iCoLTlSQfecsmUbJqNF38HCNFysR/BpF/cXaX3gSW9L9DwBSLab4khA30Bu eemkcd0LJN2d4lC2QbnLGPHbeOU+E8Gkj00vv0JXcoDY4Se8708xciiSIbpnQkR+j2qf Bf+Q== X-Forwarded-Encrypted: i=1; AJvYcCWwxwfIMA63ZMEqEY2HaGbre5U3qtalfYBGu/d1tQIBbbqYEM/AF0rge8IQ+OvnjMGJZRqy1BUQQESERFrH@lists.postgresql.org X-Gm-Message-State: AOJu0YyCpNTLbwOKHg1wD8TBWXzuZ9BwqkcwfYNqy7pkcJW6HBNiF4jx dI5j1sJGradQlHS50pVadhr7557xn+bjwsvYkAxk6TTHog5dvR9QLy50b/NXCWu0P9Ll6uFDl92 QmZXOE6uWI+/sCjZlMmRD4FWOPFg= X-Google-Smtp-Source: AGHT+IGn02bbM1HoD4zbYdd+bvpzeyDtByy1mAvO14rH8EUfyWN6h0q7JWBVJtGDtUJSH1Ddwuk8x1r/lR5jt5CYAzM= X-Received: by 2002:a05:6402:4016:b0:5c9:45b5:6077 with SMTP id 4fb4d7f45d1cf-5c95ac4f578mr14074815a12.23.1728980564534; Tue, 15 Oct 2024 01:22:44 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Jingtang Zhang Date: Tue, 15 Oct 2024 16:22:32 +0800 Message-ID: Subject: Re: Use WALReadFromBuffers in more places To: Bharath Rupireddy , pgsql-hackers@lists.postgresql.org Cc: Nitin Jadhav Content-Type: multipart/alternative; boundary="0000000000005f716c06247fa853" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --0000000000005f716c06247fa853 Content-Type: text/plain; charset="UTF-8" Hi all. I've been back to this patch for a while recently. I witness that if a WAL writer works fast, the already flushed WAL buffers will be zeroed out and re-initialized for future use by AdvanceXLInsertBuffer in XLogBackgroundFlush, so that WALReadFromBuffers will miss even though the space of WAL buffer is enough. It is much more unfriendly for logical walsenders than physical walsenders, because logical ones consume WAL slower than physical ones due to the extra decoding phase. Seems that the aim of AdvanceXLInsertBuffer in WAL writer contradicts with our reading from WAL buffer. Any thoughts? --0000000000005f716c06247fa853 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi all.

I&#= 39;ve been back to this patch for a while recently. I witness that if a WAL=
writer works fast, the already flushed WAL buffers will be zeroe= d out and
re-initialized for future use by AdvanceXLInsertBuffer = in
XLogBackgroundFlush, so that WALReadFromBuffers will miss even= though the
space of WAL buffer is enough. It is much more unfrie= ndly for logical
walsenders than physical walsenders, because log= ical ones consume=C2=A0WAL
slower than physical ones due to the e= xtra decoding phase. Seems that the aim
of AdvanceXLInsertBuffer = in WAL writer contradicts with our reading from
WAL buffer. Any t= houghts?
--0000000000005f716c06247fa853--