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 1jTasl-0001fj-Pe for pgsql-hackers@arkaria.postgresql.org; Wed, 29 Apr 2020 00:47:23 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jTasj-000788-Bw for pgsql-hackers@arkaria.postgresql.org; Wed, 29 Apr 2020 00:47:21 +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 ) id 1jTasi-00077O-V0 for pgsql-hackers@lists.postgresql.org; Wed, 29 Apr 2020 00:47:21 +0000 Received: from mail-qt1-x844.google.com ([2607:f8b0:4864:20::844]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1jTasc-0007Zd-5B for pgsql-hackers@lists.postgresql.org; Wed, 29 Apr 2020 00:47:19 +0000 Received: by mail-qt1-x844.google.com with SMTP id h26so515967qtu.8 for ; Tue, 28 Apr 2020 17:47:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:mime-version:content-disposition :content-transfer-encoding:in-reply-to:user-agent; bh=+gVAwrvjDf2Issd93g3p72FaMz5ElfqGkw0PDq5hFzU=; b=ZFkpuiAsqF59bIGLq7hhIEuGqMTIGSVfUtd7wiv/1ORa4ny+un9SNyCe/7NQtF88J3 Zn0BQb3+nBK+Z7DtPXYAz98lwlUaDV6eFvGR+3DrmHEXBP4NjLECS/0mdCnZQgipoppP E1uuKGOFxEaANC8MQc6uC6D+DD9C4H1/q+r/xHorpHj4iUM1VBMntYqR27u8Bt20Jp6Q jh7pZTIMz2BIwqLcNbfkllsDQyXOts+vbjIYtbqhaJ7Pd//rYA8K3GSITL9X7+K77pSl swZhS0Msk5tvm9sFdhJGENXrs5srRVwtRwPS/atk7ZTUoTQPgg0Lw4QLQP/PnO6UQS9k 0Psg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=+gVAwrvjDf2Issd93g3p72FaMz5ElfqGkw0PDq5hFzU=; b=j33cxk8rHy7Sj/awhJ0slle06SxjL6fDSIPXAYBd5f7ZcjOJemcp1nrltzstL7Aaq9 cOIuUoH+174ePPz6AZBewtkAcyXshVNR0l9Q3hC6t8q8nKHDP6AsdM+0uyu7V6Uv28No K0lAId7/KVNbJ/tQHl0VsVTuqyx+XAQoE0IfCy4rdJRMjl5ik/fULpU7AFlywxRcftdf VMu49277tYkVMvwU/O1Da9hvE1DQtncSZMH3F5dreULUmAGmK+v2YKpgb5AQvlnO1Iun ht+lS5Tjx2S7X40MTKENoddvOqzzdeDOnmHF47CgaAiz+oKBKnCFJPbPrwzbbfFgnbeK bRYg== X-Gm-Message-State: AGi0Puad4Mop5t6/85xSe5SmHb0XHGPk1d9Z7d9tKydlfEXLGNto583h IRoYy6xBdKChQmFVcyMO+uaxKQ== X-Google-Smtp-Source: APiQypKQ2ygBDzvmtOcG7LgOonYvoh9eebfC2SazQSYpkVDGuNySTLYD+Ha+W0jXm24lhhwGtz8vLQ== X-Received: by 2002:ac8:3f19:: with SMTP id c25mr29102777qtk.96.1588121233188; Tue, 28 Apr 2020 17:47:13 -0700 (PDT) Received: from nimloth.alvh.no-ip.org ([190.95.18.252]) by smtp.gmail.com with ESMTPSA id a27sm15603014qtb.26.2020.04.28.17.47.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Apr 2020 17:47:12 -0700 (PDT) Received: by nimloth.alvh.no-ip.org (Postfix, from userid 1000) id 245713007E7; Tue, 28 Apr 2020 20:47:10 -0400 (-04) Date: Tue, 28 Apr 2020 20:47:10 -0400 From: Alvaro Herrera To: Kyotaro Horiguchi Cc: jgdr@dalibo.com, andres@anarazel.de, michael@paquier.xyz, sawada.mshk@gmail.com, peter.eisentraut@2ndquadrant.com, pgsql-hackers@lists.postgresql.org, thomas.munro@enterprisedb.com, sk@zsrv.org, michael.paquier@gmail.com Subject: Re: [HACKERS] Restricting maximum keep segments by repslots Message-ID: <20200429004710.GA4742@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20200428162941.GA6196@alvherre.pgsql> User-Agent: Mutt/1.10.1 (2018-07-13) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk I pushed this one. Some closing remarks: On 2020-Apr-28, Alvaro Herrera wrote: > On 2020-Apr-28, Kyotaro Horiguchi wrote: > > Agreed to describe what is failed rather than the cause. However, > > logical replications slots are always "previously reserved" at > > creation. > > Bah, of course. I was thinking in making the equivalent messages all > identical in all callsites, but maybe they should be different when > slots are logical. I'll go over them again. I changed the ones that can only be logical slots so that they no longer say "previously reserved WAL". The one in pg_replication_slot_advance still uses that wording, because I didn't think it was worth creating two separate error paths. > > ERROR: replication slot "repl" is not usable to get changes > > That wording seems okay, but my specific point for this error message is > that we were trying to use a physical slot to get logical changes; so > the fact that the slot has been invalidated is secondary and we should > complain about the *type* of slot rather than the restart_lsn. I moved the check for validity to after CreateDecodingContext, so the other errors are reported preferently. I also chose a different wording: /* * After the sanity checks in CreateDecodingContext, make sure the * restart_lsn is valid. Avoid "cannot get changes" wording in this * errmsg because that'd be confusingly ambiguous about no changes * being available. */ if (XLogRecPtrIsInvalid(MyReplicationSlot->data.restart_lsn)) ereport(ERROR, (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE), errmsg("can no longer get changes from replication slot \"%s\"", NameStr(*name)), errdetail("This slot has never previously reserved WAL, or has been invalidated."))); I hope this is sufficiently clear, but if not, feel free to nudge me and we can discuss it further. -- Álvaro Herrera https://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services