X-Original-To: pgsql-hackers-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 91F4BD1B1EC for ; Mon, 5 Jul 2004 18:47:01 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 43444-03 for ; Mon, 5 Jul 2004 21:46:57 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id 385DCD1B1D2 for ; Mon, 5 Jul 2004 18:46:54 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.11/8.12.11) with ESMTP id i65LkubN004264; Mon, 5 Jul 2004 17:46:56 -0400 (EDT) To: Simon Riggs Cc: pgsql-hackers@postgresql.org Subject: Re: Point in Time Recovery In-reply-to: <1089060299.17493.58.camel@stromboli> References: <1089060299.17493.58.camel@stromboli> Comments: In-reply-to Simon Riggs message dated "Mon, 05 Jul 2004 21:45:00 +0100" Date: Mon, 05 Jul 2004 17:46:56 -0400 Message-ID: <4263.1089064016@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200407/263 X-Sequence-Number: 55824 Simon Riggs writes: > Should we use a different datatype than time_t for the commit timestamp, > one that offers more fine grained differentiation between checkpoints? Pretty much everybody supports gettimeofday() (time_t and separate integer microseconds); you might as well use that. Note that the actual resolution is not necessarily microseconds, and it'd still not be certain that successive commits have distinct timestamps --- so maybe this refinement would be pointless. You'll still have to design a user interface that allows selection without the assumption of distinct timestamps. > - when we stop, keep reading records until EOF, just don't apply them. > When we write a checkpoint at end of recovery, the unapplied > transactions are buried alive, never to return. > - stop where we stop, then force zeros to EOF, so that no possible > record remains of previous transactions. Go with plan B; it's best not to destroy data (what if you chose the wrong restart point the first time)? Actually this now reminds me of a discussion I had with Patrick Macdonald some time ago. The DB2 practice in this connection is that you *never* overwrite existing logfile data when recovering. Instead you start a brand new xlog segment file, which is given a new "branch number" so it can be distinguished from the future-time xlog segments that you chose not to apply. I don't recall what the DB2 terminology was exactly --- not "branch number" I don't think --- but anyway the idea is that when you restart the database after an incomplete recovery, you are now in a sort of parallel universe that has its own history after the branch point (PITR stop point). You need to be able to distinguish archived log segments of this parallel universe from those of previous and subsequent incarnations. I'm not sure whether Vadim intended our StartUpID to serve this purpose, but it could perhaps be used that way, if we reflected it in the WAL file names. regards, tom lane