Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WDjyS-0003f1-6H for pgsql-docs@arkaria.postgresql.org; Thu, 13 Feb 2014 00:16:16 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1WDjyR-0002Ji-6e for pgsql-docs@arkaria.postgresql.org; Thu, 13 Feb 2014 00:16:15 +0000 Received: from makus.postgresql.org ([2001:4800:7903:4::125]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WDjyQ-0002Jb-69 for pgsql-docs@postgresql.org; Thu, 13 Feb 2014 00:16:14 +0000 Received: from moutng.kundenserver.de ([212.227.17.9]) by makus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WDjyJ-0008SI-8m for pgsql-docs@postgresql.org; Thu, 13 Feb 2014 00:16:13 +0000 Received: from ayaki.localdomain (106-68-40-189.dyn.iinet.net.au [106.68.40.189]) by mrelayeu.kundenserver.de (node=mreue103) with ESMTP (Nemesis) id 0MKLPq-1WDBTO2VJ0-001fCc; Thu, 13 Feb 2014 01:16:06 +0100 Message-ID: <52FC0EBF.7020300@2ndquadrant.com> Date: Thu, 13 Feb 2014 08:15:59 +0800 From: Craig Ringer Organization: 2nd Quadrant User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.0 MIME-Version: 1.0 To: Ian Lawrence Barwick , PostgreSQL Developers Subject: Re: PATCH: Warn users about tablespace abuse data loss risk References: <52FAEFEA.4060609@2ndquadrant.com> <1392181593539-5791542.post@n5.nabble.com> In-Reply-To: X-Enigmail-Version: 1.6 Content-Type: multipart/mixed; boundary="------------040706050607030106070408" X-Provags-ID: V02:K0:yF5JEF0HokUNhf3JhApnQs3CqQT4xNXx76cdyuBMqx4 QKxWGhnGvUo7Sl9iKZIuQZlTo/1VmpjtoRU6DoufIa2zE0HlYH ChpPB/BlQIsnMLzY4S5tqIUgHIMwB8DkyvDXhMv1bDqZTnTi4n rfHPcQJxlAvz+LkUZaSpI/dn4AHBYPUzPmmN75Kh3bHnZvDL8Z lwMiIOAuJboHv9hh6dLzqpN8ssrbogBBxeJd1lsRJ/BcdlqLL5 ngl+X3sBN9aws95Dc+/96RsFs4B/xwWoEFduOgXa36+fdzrzSN x5GTa70LJYb5fwQvfvb3PRBqBMHiQQN4mOslUQJPhcSvoaZ+bK KRoejishhRmudMpmgsbOD9jGDagM0QEwZqAP0TSYl X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-docs Precedence: bulk Sender: pgsql-docs-owner@postgresql.org This is a multi-part message in MIME format. --------------040706050607030106070408 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 02/12/2014 02:35 PM, Ian Lawrence Barwick wrote: > And taking a look at the page in question I see this prominent example: > > CREATE TABLESPACE fastspace LOCATION '/mnt/sda1/postgresql/data'; Here's an updated patch, adopting your wording for the first par and tweaking the example. -- Craig Ringer http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Training & Services --------------040706050607030106070408 Content-Type: text/x-patch; name="0001-Warn-about-risks-of-tablespace-misuse.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="0001-Warn-about-risks-of-tablespace-misuse.patch" From a754f61f5228e0d066edc10ae903282b36f9a256 Mon Sep 17 00:00:00 2001 From: Craig Ringer Date: Wed, 12 Feb 2014 11:48:23 +0800 Subject: [PATCH] Warn about risks of tablespace misuse With rewording by Ian Barwick --- doc/src/sgml/manage-ag.sgml | 28 +++++++++++++++++++++++++++- doc/src/sgml/ref/create_tablespace.sgml | 10 ++++++++++ 2 files changed, 37 insertions(+), 1 deletion(-) diff --git a/doc/src/sgml/manage-ag.sgml b/doc/src/sgml/manage-ag.sgml index b44d521..efd080f 100644 --- a/doc/src/sgml/manage-ag.sgml +++ b/doc/src/sgml/manage-ag.sgml @@ -379,12 +379,33 @@ dropdb dbname expensive, slower disk system. + + + Even if they are located outside the main PostgreSQL data directory, + tablespaces are an integral part of the database cluster and + cannot be treated as an autonomous collection of data + files. They rely on metadata contained in the main data directory, without + which they are useless. In particular, tablespaces cannot be reattached to + a different database cluster, and backing up individual tablespaces makes + no sense as a backup/redundancy method. Similarly, if you lose a + tablespace (file deletion, disk failure, etc) the main database may become + unreadable or fail to start. + + + + Do not attempt to use tablespaces to transfer tables between database + clusters, for backup and restore, or to partition your data based on + the reliability of the storage it is on. Never put a tablespace + on a ramdisk or temporary file system. + + + To define a tablespace, use the command, for example:CREATE TABLESPACE: -CREATE TABLESPACE fastspace LOCATION '/mnt/sda1/postgresql/data'; +CREATE TABLESPACE fastspace LOCATION '/ssd1/postgresql/data'; The location must be an existing, empty directory that is owned by the PostgreSQL operating system user. All objects subsequently @@ -392,6 +413,11 @@ CREATE TABLESPACE fastspace LOCATION '/mnt/sda1/postgresql/data'; directory. + + The location must not be on removable or transient storage, as the database + will not work if the tablespace is missing or lost. + + There is usually not much point in making more than one diff --git a/doc/src/sgml/ref/create_tablespace.sgml b/doc/src/sgml/ref/create_tablespace.sgml index 04c5fb8..83edd88 100644 --- a/doc/src/sgml/ref/create_tablespace.sgml +++ b/doc/src/sgml/ref/create_tablespace.sgml @@ -50,6 +50,16 @@ CREATE TABLESPACE tablespace_name CREATE INDEX or ADD CONSTRAINT to have the data files for these objects stored within the specified tablespace. + + + + You can't use the contents of a tablespace without the database it's part of, + nor can you use the main database if a tablespace is missing. Don't try to + use tablespaces for backup or redundancy. + See . + + + -- 1.8.3.1 --------------040706050607030106070408 Content-Type: text/plain Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 -- Sent via pgsql-docs mailing list (pgsql-docs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-docs --------------040706050607030106070408--