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 1jLxc1-0001qh-UJ for pgsql-hackers@arkaria.postgresql.org; Tue, 07 Apr 2020 23:26:33 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jLxc0-0000We-KU for pgsql-hackers@arkaria.postgresql.org; Tue, 07 Apr 2020 23:26:32 +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 1jLxc0-0000WX-DO for pgsql-hackers@lists.postgresql.org; Tue, 07 Apr 2020 23:26:32 +0000 Received: from mail-qt1-x841.google.com ([2607:f8b0:4864:20::841]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1jLxbv-0002GP-2T for pgsql-hackers@lists.postgresql.org; Tue, 07 Apr 2020 23:26:29 +0000 Received: by mail-qt1-x841.google.com with SMTP id g7so4154005qtj.13 for ; Tue, 07 Apr 2020 16:26:26 -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=TwGBhWBmJ4jqUdy8mAiuT6VGKw01TIAVV6S3cx8/x04=; b=WrfAC8k6KhuxpHBP3rFabiAENWnK44leLXpGQqvAJoUYdhwxBP+Cj6dT7Qk187nLkI 3kGwZZVdAJDIGF5mZ0ippXbgBrneWHU593WF7oMGhoodAEEna70fzc46oa8ZsoTg4VCs g+mq+xci1rVwIIj0c2K46hyrQr/TwFjme/uvobl+2cv3SOlZqDjplFYRGLUw13jxLdMV ry/pBHIsspEJ/77VtZSZi5AYfpP+xhYs5Ic+Mda7Hdz2q15DBlmRmwHblt+kAmmFU8Py kLHWsYz9z+xXR0kjX5thKs0GNTiaFwKcI7oneGrXiYrJmJ/+8fWiIf0ZCFb91AGJgUEG 7w7g== 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=TwGBhWBmJ4jqUdy8mAiuT6VGKw01TIAVV6S3cx8/x04=; b=NoU+KokKbYShoELoRWyXugxPtVoORv2qb2yT0HaCE73TxVRgBdRFQhey0nKyRlpu8Z 26iP5ulz0W8cAn5p+iSf24YPASIi+DuP7wVtgVHPwHBZwvhQ1f7ZKPs4xu+D4KHgSwgD +cFqWA6vETCxCk4wWd3+0lX+QB9qYGfIV6viehWTB2eEAN2OpH5UNIjLrQrM2BcH4DBs 5w9eQUvS/fCG/C+bA6cr2GgCVQQX3iSWpBVQwQ5PhjCDzgXxhlvVNodkccN1kvlfNbQW quGiRofu+U4OlUt29YpbNaKsLW+g9q8DfimEr/N3mg+xKPOufX5fWhv7BBZTY64idUxh Gg4w== X-Gm-Message-State: AGi0PubclTUdMCvQM4cHCXBfnLp5OjlNzli12a4ZZ/Ojh9a99vYsQ25e LMi2Gpy0CncPuGW+0fK5gFXv4A== X-Google-Smtp-Source: APiQypI4m9sa3cDWD9IqZc1zR3cyt+6UL3lfA1IfQR75YFddv+93ONxkeHDz4sq11qaC/AUpC+nPqA== X-Received: by 2002:aed:2843:: with SMTP id r61mr4854684qtd.262.1586301985478; Tue, 07 Apr 2020 16:26:25 -0700 (PDT) Received: from nimloth.alvh.no-ip.org ([190.95.18.252]) by smtp.gmail.com with ESMTPSA id u65sm17728004qkh.100.2020.04.07.16.26.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Apr 2020 16:26:25 -0700 (PDT) Received: by nimloth.alvh.no-ip.org (Postfix, from userid 1000) id 0654F300A5A; Tue, 7 Apr 2020 19:26:02 -0400 (-04) Date: Tue, 7 Apr 2020 19:26:02 -0400 From: Alvaro Herrera To: pgsql-hackers@lists.postgresql.org Cc: Kyotaro Horiguchi Subject: Re: pgsql: Allow users to limit storage reserved by replication slots Message-ID: <20200407232602.GA21559@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 2020-Apr-07, Alvaro Herrera wrote: > src/test/recovery/t/019_replslot_limit.pl | 217 +++++++++++++++++++++++++ I fixed the perlcritic complaint from buildfarm member crake, but there's a new one in francolin: # Failed test 'check that the slot state changes to "reserved"' # at t/019_replslot_limit.pl line 125. # got: '0/15000D8|reserved|216 bytes' # expected: '0/1500000|reserved|216 bytes' # Failed test 'check that the slot state changes to "lost"' # at t/019_replslot_limit.pl line 135. # got: '0/15000D8|lost|t' # expected: '0/1500000|lost|t' # Looks like you failed 2 tests of 13. [23:07:28] t/019_replslot_limit.pl .............. where the Perl code is: $start_lsn = $node_master->lsn('write'); $node_master->wait_for_catchup($node_standby, 'replay', $start_lsn); $node_standby->stop; # Advance WAL again without checkpoint, reducing remain by 6 MB. advance_wal($node_master, 6); # Slot gets into 'reserved' state $result = $node_master->safe_psql('postgres', "SELECT restart_lsn, wal_status, pg_size_pretty(restart_lsn - min_safe_lsn) as remain FROM pg_replication_slots WHERE slot_name = 'rep1'"); is($result, "$start_lsn|reserved|216 bytes", 'check that the slot state changes to "reserved"'); 0xD8 is 216, so this seems to be saying that the checkpoint record was skipped by the restart_lsn. I'm not clear exactly why that happened ... is this saying that a checkpoint occurred? One easy fix would be to remove the "restart_lsn" output column from the query, but do we lose test specificity? (I think the answer is no.) However, even with that change, we're still testing that a checkpoint is 216 bytes ... in other words, whenever someone changes the definition of struct CheckPoint, this test will fail. That seems unnecessary and unfriendly. I'm not sure how to improve that without also removing that column. -- Álvaro Herrera https://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services