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 1jLiPQ-0001gt-RR for pgsql-general@arkaria.postgresql.org; Tue, 07 Apr 2020 07:12:32 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jLiPP-00035u-Oa for pgsql-general@arkaria.postgresql.org; Tue, 07 Apr 2020 07:12:31 +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 1jLiPP-00035n-Gg for pgsql-general@lists.postgresql.org; Tue, 07 Apr 2020 07:12:31 +0000 Received: from mail-wm1-x342.google.com ([2a00:1450:4864:20::342]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1jLiPM-0002Pq-6y for pgsql-general@postgresql.org; Tue, 07 Apr 2020 07:12:30 +0000 Received: by mail-wm1-x342.google.com with SMTP id c195so79552wme.1 for ; Tue, 07 Apr 2020 00:12:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cybertec-at.20150623.gappssmtp.com; s=20150623; h=message-id:subject:from:to:date:in-reply-to:references:user-agent :mime-version:content-transfer-encoding; bh=av84y6p/9fb6FBGuhGq6OW20zu25FmAY6wV0r3W9AKQ=; b=aZ/e4UMeBIRlLu+hW6dzKiq3T2mbqMs15jP1rVYB8awELg9H89CPjzdxqI1i+TwdBT ohWZbTOgOXArKByaid7uUIXBq/zMGlMN0STvtBP38Qvpld7oppbUB5BQHRLw540px+RP zz9ucj705UXQMaeKIjawD+GUPEXKyRHVFBDrvBAlKVsi3+sNZmvJ4v2FB69OIv9JLqs0 uUXnj4hUqzdyDF/cXrMEe8hgcE5zgM2ZcmZSfHObqVIZZmtkOzvWJbBFQmXZLVtctIno dJGPVKmAKa/hyV4qJvlUpN1qCPF6bS0cJUqdZJlYN8yYAbiSNoiuNxUCNajQp13Af7PQ 0flg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:subject:from:to:date:in-reply-to :references:user-agent:mime-version:content-transfer-encoding; bh=av84y6p/9fb6FBGuhGq6OW20zu25FmAY6wV0r3W9AKQ=; b=NZuxZTGdipUkwzvzFqXn3udVPAgMrl8jMZJpawJoNLrRJCHya8ajBuQCawX1X6GHe7 26f0l0Vs5VwlcpYKbKBkoHVNaesFS19olhL8RiobSUBx7RqQH9XE0lKcIpNGCK5hpmWd fSeBMBb9BE7p4YxICo8jJ7yHMLrx/ygSTvpT8mmKXbyLLZCMU8kKn2CL0EeOuLq+Kj3d Z11pQ8BbRE0VYmm1BX7SWq9+LIs1ZAxJJAupS/ks03PPzNLiFZf+wOchTGJ1jVTQI10D utCbdIzSm/CDpJOjpXV4FtCOP2fLyXXUoozjyBxCzlgr9cGIY3HcodLIKCgU0rmXUm8g TzQA== X-Gm-Message-State: AGi0PuZWQA6/Y/f8Zg6fC0FfwWHpxJAbSe7grPIh/6Q/HMLWqQUvPrqx 4CWRbyv24IRbFsEOsYZUaf/VlA== X-Google-Smtp-Source: APiQypKmRUsgKJAPMy+w/RknDJ51SdqQslMA1FSLP/RinUcNCdOqL4Ua2CAmmbJ/4cA2dpApgI0haQ== X-Received: by 2002:a1c:1fca:: with SMTP id f193mr841887wmf.5.1586243547163; Tue, 07 Apr 2020 00:12:27 -0700 (PDT) Received: from dynamic-eo9lc8043u2qr9u6l-pd01.res.v6.highway.a1.net (dynamic-eo9lc8043u2qr9u6l-pd01.res.v6.highway.a1.net. [2001:871:60:9a62:6597:76d3:1e4c:440d]) by smtp.gmail.com with ESMTPSA id b82sm1200929wme.25.2020.04.07.00.12.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Apr 2020 00:12:26 -0700 (PDT) Message-ID: Subject: Re: How to prevent master server crash if hot standby stops From: Laurenz Albe To: Andrus , pgsql-general Date: Tue, 07 Apr 2020 09:12:25 +0200 In-Reply-To: <0E181F52FD6449568F620E9C84427D10@dell2> References: <5E2C91B46CEF42078CC7BEE1EDC10F0E@dell2> <0A8FE679886142EBABB0AC8102477904@dell2> <0E181F52FD6449568F620E9C84427D10@dell2> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.32.5 (3.32.5-1.fc30) MIME-Version: 1.0 Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Tue, 2020-04-07 at 00:50 +0300, Andrus wrote: > > If you prefer replication to fail silently, don't use replication > > slots. Use "wal_keep_segments" instead. > > I desided to give 1 GB to wal. So I added > > wal_keep_segments=60 > > After some time Postgres created 80 files with total size 1.3GB. > > How to fix this so that no more than 1 GB of disk space is used ? > How to get information how may wal files are yet not processed by slave ? > How to delete processed wal files so that 1 GB of disk space can used for some other purposes ? "wal_keep_segments" is the number of old WAL segments the server keeps around for the standby. But there are also some segments that are created for future use (the minimum is governed by "min_wal_size"). All these limits are not hard limits, the server will try to keep them more or less. Consider that WAL segments are created as needed, but only removed during checkpoints. So, about your first question, you cannot. Always make sure that there is more disk space available. About your second question, you also cannot do that. The primary server has no idea which standby server needs which WAL information. All you can tell is where the currently connected standby servers are: SELECT pg_walfile_name(flush_lsn) FROM pg_stat_replication; About your third question, you *never* manually mess with the files in pg_wal. The server does that. Yours, Laurenz Albe -- Cybertec | https://www.cybertec-postgresql.com