Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1YHF76-0001WK-1k for pgsql-hackers@arkaria.postgresql.org; Fri, 30 Jan 2015 17:12:12 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1YHF75-0002W2-Ic for pgsql-hackers@arkaria.postgresql.org; Fri, 30 Jan 2015 17:12:11 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1YHF73-0002Uk-LQ for pgsql-hackers@postgresql.org; Fri, 30 Jan 2015 17:12:09 +0000 Received: from linode.thelabyrinth.net ([198.58.117.137] helo=mail.thelabyrinth.net) by makus.postgresql.org with esmtps (TLS1.1:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.80) (envelope-from ) id 1YHF70-0000ha-Lr for pgsql-hackers@postgresql.org; Fri, 30 Jan 2015 17:12:07 +0000 Received: from theseus.local (c-50-186-230-40.hsd1.fl.comcast.net [50.186.230.40]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: dsteele) by mail.thelabyrinth.net (Postfix) with ESMTPSA id E40F7138AC for ; Fri, 30 Jan 2015 17:12:02 +0000 (UTC) Message-ID: <54CBBB61.1090207@pgmasters.net> Date: Fri, 30 Jan 2015 12:12:01 -0500 From: David Steele User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 MIME-Version: 1.0 To: pgsql-hackers@postgresql.org Subject: Re: tablespaces inside $PGDATA considered harmful References: <20150130161928.GB20744@momjian.us> <54CBB4AB.1090805@commandprompt.com> In-Reply-To: <54CBB4AB.1090805@commandprompt.com> OpenPGP: id=A2739CF3 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="hUW4nfaegs2u0IP8cB2oPkWA8DdK5Sb84" X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --hUW4nfaegs2u0IP8cB2oPkWA8DdK5Sb84 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable On 1/30/15 11:43 AM, Joshua D. Drake wrote: > On 01/30/2015 08:19 AM, Bruce Momjian wrote: >> >> On Fri, Jan 30, 2015 at 11:12:43AM -0500, Robert Haas wrote: >>> I think everyone who has read this mailing list for a while is >>> probably already aware of this problem. When you create a tablespace= >>> somewhere inside the data directory, weird things happen. If you >>> pg_upgrade and then incautiously run the delete_old_cluster.sh script= >>> thus created, you will blow away large chunks of your data.[1] If yo= u >> >> pg_upgrade doesn't create the deletion script in this case, and warns >> the user: >> >> Could not create a script to delete the old cluster's data >> files because user-defined tablespaces exist in the old clust= er >> directory. The old cluster's contents must be deleted >> manually. >> >>> In the short term, I favor just adding a warning, so that people get >>> some clue that they are doing something that might be a bad idea. In= >>> the long term, we might want to do more. Thoughts? >> >> Yes, good idea. > > Uhm, wouldn't it be a rather simple patch to say: > > if tablespace_create() in $PGDATA: > ERROR! > > ? > > I mean yes a warning is good but it is after the fact, the tablespace > is already created. We know that tablespaces in $PGDATA are a bad > idea, why not protect the user? I would be in favor of an error. It would then be OK for basebackup, pg_upgrade, and friends to error when a tablespace lives in $PGDATA, rather than trying to deal with the situation in strange ways. If the user really wants tablespaces in $PGDATA they can always change the links manually in the filesystem and deal with any consequences on their own.=20 --=20 - David Steele david@pgmasters.net --hUW4nfaegs2u0IP8cB2oPkWA8DdK5Sb84 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJUy7tiAAoJEIA2uIJQ5SFAIFcQAKmt3kxF6Z2hKxidrDR3Z+yg 4QKAePTnPeKYoRWiR1kqYEnJiaLzXt5zvWqxikwwloO8FoHlWv9mH3/TisY8KtzT IpV2DOwyKBTEu8GxPcWs6RdDfqh+Yyl90IwrKecNvlg5zNoc5WW+If0M2Y5+TwFm BEiwInGMXb/fckFweWlmNLYv1wnsqEFlqLBs2x3mBPmi3muMHcgbJeETeGedMsV8 ZM1N2aXxmR8YvDCJhKDGEBz9gs3/SZxg3rlBd97M+1/LEIzJ4Rk2y1n3AGHGefgw 0/Qm95PhEzqYhXpdf/BFDLoBblcTwIMiyrfL2YzgruHuc7OYrwl/yNp4YL6dXE6T ejdbFIhzGH4KftucYfuF6K4bJ3k5HQb1kMKZ5p0MVxXz0zQTF3knOQSlumOP8h0e BV6Oza8AFlILabcNBsR79oC3g/CjeXRZmdtGn4aMngHn+sm08deUkHstvkDKrS5d qnU35M0UjPuoa3TpJZKpjhbFNtVrhcq/udJXdVOtZTm3/YX5DMu9scp4/fKPWUJn yqzRyzOyD0yzzAx6UJWAIGdpkMgMxInP6amK/xGpwuczvMeXYEVjJJNBbry/iGb4 Qp4MfEhhOjzov2LBO3YKCrPoqZ1TdaSXrA4CaV2XNJFOZ5gg67ZffOB2aWtML2tq 3j7y5IYPBXqRCExQOpDE =AeQn -----END PGP SIGNATURE----- --hUW4nfaegs2u0IP8cB2oPkWA8DdK5Sb84--