Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WDTPf-0000zu-TU for pgsql-docs@arkaria.postgresql.org; Wed, 12 Feb 2014 06:35:16 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1WDTPf-00075s-Dk for pgsql-docs@arkaria.postgresql.org; Wed, 12 Feb 2014 06:35:15 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WDTPe-00075g-Pa for pgsql-docs@postgresql.org; Wed, 12 Feb 2014 06:35:14 +0000 Received: from mail-ie0-x22d.google.com ([2607:f8b0:4001:c03::22d]) by magus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WDTPc-0001sQ-0m for pgsql-docs@postgresql.org; Wed, 12 Feb 2014 06:35:14 +0000 Received: by mail-ie0-f173.google.com with SMTP id y20so2616010ier.18 for ; Tue, 11 Feb 2014 22:35:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=h73Of73eKZhf0+kH4kXJM2pxXTb2Dc3zYRZY5nwUR/0=; b=L2cIrI5nDYvvo8XBxNetVahNa7g4bpct4Jefe8iZP9GIDvtK/Y6eyr+beC/Yq5uevq Afb4Wm9LG/yeXICdGObn394Vw1xnT3kh0y340eywEB6tuGa4/AEcadTC6tlxwqOjVEpS nnPsFkX9uc7sT7bF+zabDqHm+NF6YFUoonJsMbtoSP2zqIVic1bIE4cru/iOAOOA2G3L TNELeHxiH3nbm7dtAsB6tGaNOECJQP68/lYIuLULPZ441aMcEdttCUM8vh6hP5A2d82Y XXHGavG/hTEby8D9J20rN5XM8Vmy9KBJjb/VN0+koEC+rG5KLeTShF53DajClSNMPhTM JcgQ== MIME-Version: 1.0 X-Received: by 10.50.203.101 with SMTP id kp5mr2153310igc.49.1392186909827; Tue, 11 Feb 2014 22:35:09 -0800 (PST) Received: by 10.50.87.194 with HTTP; Tue, 11 Feb 2014 22:35:09 -0800 (PST) In-Reply-To: References: <52FAEFEA.4060609@2ndquadrant.com> <1392181593539-5791542.post@n5.nabble.com> Date: Wed, 12 Feb 2014 15:35:09 +0900 Message-ID: Subject: Re: PATCH: Warn users about tablespace abuse data loss risk From: Ian Lawrence Barwick To: David Johnston Cc: pgsql-docs , Craig Ringer Content-Type: text/plain; charset=UTF-8 X-Pg-Spam-Score: -2.0 (--) 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 2014-02-12 15:16 GMT+09:00 Ian Lawrence Barwick : > 2014-02-12 14:06 GMT+09:00 David Johnston : >> Ian Lawrence Barwick wrote >>> 2014-02-12 12:52 GMT+09:00 Craig Ringer < >> >>> craig@ >> >>> >: >>>> Hi all >>>> >>>> I've just seen another case of data loss due to misuse of / >>>> misunderstanding of tablespaces: >>>> >>>> http://dba.stackexchange.com/questions/58704/how-do-i-access-a-old-saved-tablespace-after-reinstalling-postgres >>>> >>>> and it's prompted me to write some docs amendments to make it more >>>> obvious that *you shouldn't do that*. >>>> >>>> Not that it'll stop people, but it'll at least mean they can't say we >>>> didn't warn them. >>>> >>>> This is actually quite important, because many users are used to MySQL's >>>> MyISAM, where each table contains its own metadata and is readable by >>>> simply copying the table into a different MySQL install's data >>>> directory. It doesn't even have to be the same version! Users are >>>> clearly surprised that PostgreSQL tablespaces don't have the same >>>> properties. >>>> >>>> Thoughts? >>> >>> People still use MyISAM!? >>> >>> I had a similar issue pop up at work a while back, having something >>> explicit to point to is definitely a good idea. >>> >>> Suggestion for the first paragraph of the patch (sorry I can't provide it >>> in >>> patch form right now): >>> >>> 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. >>> > >> While providing additional warnings is good and necessary it may also help >> to be more descriptive as to in what situations tablespaces are appropriate >> and/or necessary so that people leave with a better understanding of why the >> feature exists and not just trying to know what not to use it for. It goes >> against the more prescriptive tone of the documentation generally but both >> approaches work well together to tackle the knowledge/understanding gap some >> users seem to have. > > The warning would appear on this page: > > http://www.postgresql.org/docs/current/static/manage-ag-tablespaces.html > > which describes what tablespaces *can* do, but unless you're familiar with the > structure of the PostgreSQL data directories, it's not obvious what you *can't* > do. I recall reading a blog post a while back about tablespaces being "archived" > to the cloud with disastrous results, and a quick search pulls up > stuff like this: > > http://stackoverflow.com/questions/3534415/moving-postgres-tablespaces-and-tables-across-ec2-instance > > so it's definitely not a niche issue. Something "official" to link to > would be very useful in this kind of situation. That doesn't preclude the general > documentation being improved of course. And taking a look at the page in question I see this prominent example: CREATE TABLESPACE fastspace LOCATION '/mnt/sda1/postgresql/data'; As '/mnt' is usually a temporary mount point for detachable media and all that [*] maybe it's not the best impression to give for a suitable tablespace location. [*] http://www.pathname.com/fhs/pub/fhs-2.3.html#MNTMOUNTPOINTFORATEMPORARILYMOUNT "This directory is provided so that the system administrator may temporarily mount a filesystem as needed. " Ian Barwick -- Sent via pgsql-docs mailing list (pgsql-docs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-docs