Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hSpSI-0005Yh-HG for pgsql-performance@arkaria.postgresql.org; Mon, 20 May 2019 21:04:22 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hSpSG-00026k-Ni for pgsql-performance@arkaria.postgresql.org; Mon, 20 May 2019 21:04:20 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hSpSG-00025A-8b for pgsql-performance@lists.postgresql.org; Mon, 20 May 2019 21:04:20 +0000 Received: from mail-wm1-x343.google.com ([2a00:1450:4864:20::343]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hSpS8-00044i-KK for pgsql-performance@postgresql.org; Mon, 20 May 2019 21:04:18 +0000 Received: by mail-wm1-x343.google.com with SMTP id c77so745264wmd.1 for ; Mon, 20 May 2019 14:04:12 -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:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=+eMJamTE3XdsIF9j6om+A7vTdRZc0PrtW2HWFllkQpY=; b=lW4A2E/Olm6a/X5YJPLZP73fiqtipODaeCyeGrhoaPn2TTpkPY4Fd2S4S6FZZyGfB3 QeZqYGBTqRUjSB4qwhQnve/YPu/4IspOvfILfGxxmpl2mn7ZcJvn2GQzqb2smlcpZWw5 Sc9FCv8nDfcFbo8XPq1xqOXwiiqnYuMwl+YvAees/yVqK9ij0EvhlF3336R9qzPScxM7 li5F4Dm9m8y2F5JQsKgtGYNyf5b5K4C8KuWAytMdVfwrWkm7RnpOCfJ5x9WaWfeJ40rS aiB1YOIdbUV8eDvDX2j+Fw+JH45ucEJCfpSlmVXRPacXOkeMp63OcyCvQDqgegPZy+3b gAUA== 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:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=+eMJamTE3XdsIF9j6om+A7vTdRZc0PrtW2HWFllkQpY=; b=BgcDgW6xekixntVdXJkT6oxP1RGXymsqV/fZ39GdWmfUxryoq/pfak2VUOvswogihR XyZ1JinsIS1WsExRpd4UVbla95EGXXPQ3wAvTMyrKVMJBlV9IoeEZH0Wi9bkUP8VQgHk Wm1hfJGZ1CXAivpZ9IYJ5GCg6Nlz4Pc3OAq8W2tKYRQfbifedjdjBe/Nom5wZwsX2I4E ltO09TH0IoVlzSQlaZAUhhTVJeqVKU+GYennkw+hGn/4tU1zblcMi/k29MKyK0OYc/TC YHFl/wUpk1NeRcgCPLisPpGoVLi4hz1Yan+8uPsqjGZ4x9iFB84+Xa4DPo+IicdaR2O2 Z7cA== X-Gm-Message-State: APjAAAV+fkVsp3OK7H8SChtTIMtJv4COo+AfQItjVxQl2zzdTw4MvPl0 TzrmO0KqlnWYFphEMTP3YFqdqw== X-Google-Smtp-Source: APXvYqxqmTJIU7iJFdRQTm8QNoBoIdI6HhFZNPCTDFPbwyhXi1ttLjqIRFUJm91yFWQtjZhYVi7LtQ== X-Received: by 2002:a1c:c108:: with SMTP id r8mr745915wmf.78.1558386251164; Mon, 20 May 2019 14:04:11 -0700 (PDT) Received: from localhost (ip-86-49-243-43.net.upcbroadband.cz. [86.49.243.43]) by smtp.gmail.com with ESMTPSA id 8sm473130wmf.18.2019.05.20.14.04.07 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Mon, 20 May 2019 14:04:07 -0700 (PDT) Date: Mon, 20 May 2019 23:04:06 +0200 From: Tomas Vondra To: Mariel Cherkassky Cc: Bimal , Greg Clough , PostgreSQL mailing lists Subject: Re: Trying to handle db corruption 9.6 Message-ID: <20190520210406.5paaijqd5no6imez@development> References: <1909968146.4951657.1558369245203@mail.yahoo.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1; format=flowed Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: NeoMutt/20180716-1444-295967 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Mon, May 20, 2019 at 08:20:33PM +0300, Mariel Cherkassky wrote: > Hey Greg, > Basically my backup was made after the first pg_resetxlog so I was wrong. Bummer. > However, the customer had a secondary machine that wasn't synced for a > month. I have all the walls since the moment the secondary went out of > sync. Once I started it I hoped that it will start recover the wals and > fill the gap. However I got an error in the secondary :          >  2019-05-20 10:11:28 PDT  19021  LOG:  entering standby mode > 2019-05-20 10:11:28 PDT  19021  LOG:  invalid primary checkpoint record > 2019-05-20 10:11:28 PDT  19021  LOG:  invalid secondary checkpoint link in > control file > 2019-05-20 10:11:28 PDT  19021  PANIC:  could not locate a valid > checkpoint record > 2019-05-20 10:11:28 PDT  19018  LOG:  startup process (PID 19021) was > terminated by signal 6: Aborted > 2019-05-20 10:11:28 PDT  19018  LOG:  aborting startup due to startup > process failure > 2019-05-20 10:11:28 PDT  19018  LOG:  database system is shut down.        >                     I checked my secondary archive dir and pg_xlog dir and > it seems that the restore command doesnt work. My restore_command:       > restore_command = 'rsync -avzhe ssh > postgres@x.x.x.x:/var/lib/pgsql/archive/%f /var/lib/pgsql/archive/%f ; > gunzip < /var/lib/pgsql/archive/%f > %p' > archive_cleanup_command = '/usr/pgsql-9.6/bin/pg_archivecleanup > /var/lib/pgsql/archive %r' Well, when you say it does not work, why do you think so? Does it print some error, or what? Does it even get executed? It does not seem to be the case, judging by the log (there's no archive_command message). How was the "secondary machine" created? You said you have all the WAL since then - how do you know that? regards -- Tomas Vondra http://www.2ndQuadrant.com PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services