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 1h8fM9-0004X4-Fr for pgsql-admin@arkaria.postgresql.org; Tue, 26 Mar 2019 06:14:41 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1h8fM8-0008PR-5E for pgsql-admin@arkaria.postgresql.org; Tue, 26 Mar 2019 06:14:40 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1h8fM7-0008P4-SW for pgsql-admin@lists.postgresql.org; Tue, 26 Mar 2019 06:14:39 +0000 Received: from mail-ot1-x341.google.com ([2607:f8b0:4864:20::341]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1h8fM5-0005zj-B9 for pgsql-admin@lists.postgresql.org; Tue, 26 Mar 2019 06:14:39 +0000 Received: by mail-ot1-x341.google.com with SMTP id u15so10390634otq.10 for ; Mon, 25 Mar 2019 23:14:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-transfer-encoding:content-language; bh=AxBorxRNHfciZKw9C36JFPOYLpSVsNSbYOdP72IjQx4=; b=N419kmBFwnnh+SFalBpLGZ1xBIsenuTc6WOgfJjV8ykB+bAXHzStDKD4SWRjpVX/0g YxMtKvC5wwy5Tu/vXRsBWHMb5JRlwDvCZMvNOwIpKazq9XfF+88Q/fMlSKglMk7KY2x7 Tyk6HEw9XvLNtRkiulw4rRBW5h1xNwYfOMLFkAL9STD2m1ojzzlATX8yi//QmeH+kBov FisnDPfeauZwrDZOuppQ36pnKV8KIM5lnhegmhadyCJREufcDC77vgkElgiz/CKXZdE8 dM8JrBdOOgNasiBgqTJMOmO++ZYyo/vFK+6VsWA3OPzlitQW3uartjng7kc5ouoIh6hP 3xKA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=AxBorxRNHfciZKw9C36JFPOYLpSVsNSbYOdP72IjQx4=; b=rLSMwa995btqdm/dBzK7f5Ks+/+gjnsnwBWCU0bWms15qLgTLCfK5eBaqBuQOg6M9L ACbI1xkUW5DY5Pe8SbYL/7yimv0+yLOZz6sG5rQZKh1prxtIi4l4xz44V09Q2HAughTV 06zLKVEBp6NshbY2uGevLl4VD+/mdC5OZ0uXaeq751Hy6wotnq4CPse6lXbHkQrRdYYJ bkKlbkxIVw9+VvWy/tPrKEc1lnDWpJxMx2qloLyp/UbqoTRqE1lcoDDCymkDfx+dYnr0 J9zkV0SQmzoX78PXDJhgwxbQItV/DmOJO45DKPHRdVYrCO31G8u1Ot9ybwisbmty1+B/ an1Q== X-Gm-Message-State: APjAAAWptDqgUCr+ghz5JcvpPYX7DUofrDEasf8eN1TKY9ETa3pWjFXF 7/MMbkE63l9SPq5sMjabL7+k0GTU0caneg== X-Google-Smtp-Source: APXvYqx4HczI8XL49TIyaxTiEg4I8/p7yaeozbGiTYh3hE0yWaEGj+UhvcN8Zocnuk0bkCN5kUZcgQ== X-Received: by 2002:a9d:5e8d:: with SMTP id f13mr19392926otl.309.1553580874129; Mon, 25 Mar 2019 23:14:34 -0700 (PDT) Received: from [192.168.1.10] (ip70-171-116-89.no.no.cox.net. [70.171.116.89]) by smtp.googlemail.com with ESMTPSA id h23sm3820597oic.10.2019.03.25.23.14.32 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 25 Mar 2019 23:14:33 -0700 (PDT) Subject: Re: Upgrading from Postgresql 9.3.8 to 9.6.10 To: pgsql-admin@lists.postgresql.org References: From: Ron Message-ID: <0e3636ec-ba56-a765-2a5a-84ef01072604@gmail.com> Date: Tue, 26 Mar 2019 01:14:32 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.4.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 3/26/19 12:51 AM, Yuri Niyazov wrote: > We have an old cluster, running 9.3.8, that we are trying to upgrade to > 9.6.10. > > After running pg_upgrade and starting the server, and testing some common > queries against it, we experienced the following error: > > PG::IndexCorrupted: ERROR: index "table_pkey" contains unexpected zero > page at block 17021871 HINT: Please REINDEX it. > > So, if I am reading this correctly, there is an index that 9.3.8 created, > and it recognizes that index as OK, but 9.6.10 thinks that index is > corrupt. Since this happened on one index, it seems reasonable to assume > that this could happen on any index in that database, Yes, *could*. > and we need to reindex the entire database. That does not seem justified. > Now, this is a live application, and we would like to minimize continuous > downtime (multiple short downtimes are fine), so what we are considering > doing is a manual reindex: for each index, create a new one, and then drop > the old one, and after all that, upgrade. Won't work if you've got lots of FK constraints. But "REINDEX INDEX foo;" works just fine. > However, we are leery of doing this reindexing using 9.3.8, since it's > already demonstrated itself to be unreliable. > > Which version should we use to reindex? Just the latest 9.3.X? Was there a > known bug with older versions missing corrupted pages in indices? > > PS:  Just in case I am glaringly doing something wrong: > > Here's our mechanism of doing the upgrade: we create a streaming replica > from a basebackup, and then at some point turn off writes to the primary, > convert the replica to another primary, and then run pg_upgrade on this > new primary. -- Angular momentum makes the world go 'round.