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 1kS1hl-00035w-14 for pgsql-hackers@arkaria.postgresql.org; Mon, 12 Oct 2020 17:33:49 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kS1hj-0005Tx-VF for pgsql-hackers@arkaria.postgresql.org; Mon, 12 Oct 2020 17:33:47 +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 1kS1hj-0005To-KB for pgsql-hackers@lists.postgresql.org; Mon, 12 Oct 2020 17:33:47 +0000 Received: from mail-il1-x142.google.com ([2607:f8b0:4864:20::142]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1kS1hh-0004AO-3W for pgsql-hackers@postgresql.org; Mon, 12 Oct 2020 17:33:47 +0000 Received: by mail-il1-x142.google.com with SMTP id j13so12834510ilc.4 for ; Mon, 12 Oct 2020 10:33:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telsasoft-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=HhuKXpuxYTfhJMUQQihJuIN+HmpaqJRFPs5CJO7ZDGY=; b=DMwk0BBUqAbxBSC8zuxTKrnPDSoufV3Wt3U/BBjuv9udB7sYs35hpD+uaqZAmHv67d kaOI5xkkUCfjRwSzRAQs2QQ1Bz1CrJ4TLbA9tNNcbDNfuaffuEpRdySw4hVzCm5RNRpi jO6ykWWudGQnd8+YPmvhcBR0zdefxOT81yEQ2JKXM1D51zS9Bt8Ok3xyV9aLIxujYPOh Jn7xISmCGwQwDdPh3hNFDERucHO1b4lACDRoBH6G6bLnvdSa0DdskS6F0ZbaV1woSYic pT7+ou/uCc1wxaAmkdZ2cMovMVoXCpiw3VSLpoThpzWX2v7FmdiaeeX8nJ24xKmWu3Yu WeSQ== 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:in-reply-to:user-agent; bh=HhuKXpuxYTfhJMUQQihJuIN+HmpaqJRFPs5CJO7ZDGY=; b=lkX8Z+mynHYx5rmSGelG/3Glij8Am5qU6A2gf3J5uqtIjok2Xcy9F/x1vTrXZHFsWj UB3+8XA0aJgmUk0PUTjmXwrM9ySxTn8zOZvJVndtgJdGP02QVR9up9wFgOz3NJa8i/91 LyVHg75NUOVmyWk6ESl1nk2l8++CV5M/yKCI63jcz07iw45bkU0utD893sY6nVtJ2ypu AmvCHOl668dsB0MY2HTvaYuiNIusU+jmVEBpdDnIsRrVLbh/NzOmlbGSz7WSar7zrbb7 f79aMEfuhsmqUBcB/b38Z54y0K4meKk3VVzIMqll0EOyJHN0F21LLLnv8VJxVCiPyYZ0 KilQ== X-Gm-Message-State: AOAM532MHz5Lk1Sz7gyzrmvvxH74XXUQXZMiy4012KdCJ2vaJ59TkC5W a7KB8Nzvl28Z0qUpz/TqlpizTQ== X-Google-Smtp-Source: ABdhPJxvaygsR17GXP8skbocFKtzVkSop3lgoIWwWFiPzj12ygHvZ7g6hfr9WZq6e3+C954SZovKuA== X-Received: by 2002:a92:cc51:: with SMTP id t17mr14454294ilq.67.1602524022333; Mon, 12 Oct 2020 10:33:42 -0700 (PDT) Received: from pryzbyj.telsasoft (charmander.telsasoft.com. [50.244.222.1]) by smtp.gmail.com with ESMTPSA id c28sm9630809ilf.3.2020.10.12.10.33.41 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 12 Oct 2020 10:33:41 -0700 (PDT) Received: by pryzbyj.telsasoft (Postfix, from userid 1000) id E9BBF80071F; Mon, 12 Oct 2020 12:33:39 -0500 (CDT) Date: Mon, 12 Oct 2020 12:33:39 -0500 From: Justin Pryzby To: Bruce Momjian Cc: pgsql-hackers@postgresql.org Subject: Re: pg_upgrade: fail early if a tablespace dir already exists for new cluster version Message-ID: <20201012173339.GG9241@telsasoft.com> References: <20200925005531.GJ23631@telsasoft.com> <20201009185325.GA24870@momjian.us> <20201009192310.GS17626@telsasoft.com> <20201009234251.GA8419@momjian.us> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201009234251.GA8419@momjian.us> User-Agent: Mutt/1.9.4 (2018-02-28) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Fri, Oct 09, 2020 at 07:42:51PM -0400, Bruce Momjian wrote: > On Fri, Oct 9, 2020 at 02:23:10PM -0500, Justin Pryzby wrote: > > In my local branch, I had revised this comment to say: > > > > + * Note, v8.4 has no tablespace_suffix, which is fine so long as the version we > > + * being upgraded *to* has a suffix, since it's not allowed to pg_upgrade from > > + * a version to the same version if tablespaces are in use. > > OK, updated patch attached. Also, from your original patch, I didn't > need to call canonicalize_path() since we are not comparing paths, and I > didn't need to include common/relpath.h. I also renamed a variable. Since I just hit it again, I'll take the opportunity to give an example of how this can happen. Here, I've pg_upgraded from a pg12 to pg13, but the pg12 cluster has postgis-3.0, and pg13 has postgis-3.1. Maybe that's not guaranteed/intended to work, but that's what's been working well so far this year, except that there's two gis functions which no longer exist. So we fail while "Restoring database schemas in the new cluster", leaving behind tablespace dirs, which then cause future pg_upgrades to fail. pg_restore: from TOC entry 13543; 1255 17106 FUNCTION pgis_geometry_union_transfn("internal", "public"."geometry") postgres pg_restore: error: could not execute query: ERROR: could not find function "pgis_geometry_union_transfn" in file "/usr/pgsql-13/lib/postgis-3.so" Command was: CREATE FUNCTION "public"."pgis_geometry_union_transfn"("internal", "public"."geometry") RETURNS "internal" LANGUAGE "c" PARALLEL SAFE AS '$libdir/postgis-3', 'pgis_geometry_union_transfn'; I imagine in previous years I hit that some other way, like maybe I installed postgres RC1 on a customer server, imported their schema (and maybe data), which then caused upgrade failure 1-2 months later when trying to upgrade their production instance. -- Justin