Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eSNtG-0001FM-On for pgsql-general@arkaria.postgresql.org; Fri, 22 Dec 2017 14:01:35 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eSNtG-00036s-BK for pgsql-general@arkaria.postgresql.org; Fri, 22 Dec 2017 14:01:34 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1eSNtF-00036h-Ty for pgsql-general@lists.postgresql.org; Fri, 22 Dec 2017 14:01:34 +0000 Received: from forward102p.mail.yandex.net ([2a02:6b8:0:1472:2741:0:8b7:102]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1eSNtC-0004v8-0A for pgsql-general@postgresql.org; Fri, 22 Dec 2017 14:01:32 +0000 Received: from mxback10o.mail.yandex.net (mxback10o.mail.yandex.net [IPv6:2a02:6b8:0:1a2d::24]) by forward102p.mail.yandex.net (Yandex) with ESMTP id 29BC943037F0; Fri, 22 Dec 2017 17:01:25 +0300 (MSK) Received: from web8j.yandex.ru (web8j.yandex.ru [2a02:6b8:0:1619::308]) by mxback10o.mail.yandex.net (nwsmtp/Yandex) with ESMTP id dW6mlfSRS4-1OS4oLwT; Fri, 22 Dec 2017 17:01:24 +0300 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1513951284; bh=a6bZUt7MBgnGNROgZFpSObdfpHKePBjTCZ9zwYggS0Q=; h=From:To:Subject:Message-Id:Date; b=h6Zy572inx2tHCnCgVzF2vJ6y52VpMJBS11cRpy9sNALDA5QlGdMxvz3VQNuboGJa MwP+SrWxsUf81eJ8nZeA8Oc1OusoqsL1S7K9Y4DgRLDeAnQJofP5dPponS4O1BW76i jCebi3JpJBNidqfbljoqLMmdXaKqRfU+NypgxsAw= Authentication-Results: mxback10o.mail.yandex.net; dkim=pass header.i=@yandex.ru Received: by web8j.yandex.ru with HTTP; Fri, 22 Dec 2017 17:01:24 +0300 From: Victor To: pgsql-general@postgresql.org, eshkinkot@gmail.com Subject: Why standby restores some WALs many times from archive? MIME-Version: 1.0 Message-Id: <1173421513951284@web8j.yandex.ru> X-Mailer: Yamail [ http://yandex.ru ] 5.0 Date: Fri, 22 Dec 2017 17:01:24 +0300 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=utf-8 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Hi, I have postgres 9.4 standby with archive-based replication (via restore_command). PostgreSQL 9.4.12 on x86_64-unknown-linux-gnu, compiled by gcc (Debian 4.9.2-10) 4.9.2, 64-bit One day I noticed strange behavior in postgres logs: the same WAL has been restored many times: "restored log file ""0000000200064AA80000005D"" from archive",,,,,,,,,"" "unexpected pageaddr 64A81/F9000000 in log segment 0000000200064AA80000005E, offset 0",,,,,,,,,"" "restored log file ""0000000200064AA80000005D"" from archive",,,,,,,,,"" "restored log file ""0000000200064AA80000005D"" from archive",,,,,,,,,"" "restored log file ""0000000200064AA80000005D"" from archive",,,,,,,,,"" "restored log file ""0000000200064AA80000005D"" from archive",,,,,,,,,"" "restored log file ""0000000200064AA80000005D"" from archive",,,,,,,,,"" "restored log file ""0000000200064AA80000005D"" from archive",,,,,,,,,"" "restored log file ""0000000200064AA80000005D"" from archive",,,,,,,,,"" "restored log file ""0000000200064AA80000005D"" from archive",,,,,,,,,"" "restored log file ""0000000200064AA80000005E"" from archive",,,,,,,,,"" "restored log file ""0000000200064AA80000005F"" from archive",,,,,,,,,"" "restored log file ""0000000200064AA800000060"" from archive",,,,,,,,,"" I enabled logging of successful execution in 'restore_command' script and realized that it's really happens: some WALs are recovering again and again. And this is always connected with 'unexpected pageaddr' log message. Some statistics of how many 'same WALs' have been restored in 3 minutes: [vyagofarov@myserver:~] $ cut -f 2 -d '-' wals_restored.log | uniq -c -d | sort -r 9 0000000200064AA9000000A4 9 0000000200064AA80000005D 8 0000000200064AAA00000044 7 0000000200064AAA000000AB 6 0000000200064AAA000000ED 3 0000000200064AA7000000E8 2 0000000200064AA80000003D 2 0000000200064AA800000033 2 0000000200064AA800000028 2 0000000200064AA800000018 2 0000000200064AA800000004 2 0000000200064AA7000000FD Is this a bug? --  Best regards, Victor Yagofarov