X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id 8A347310DBF for ; Tue, 1 Jul 2003 20:03:16 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 16113-07 for ; Tue, 1 Jul 2003 17:03:06 -0300 (ADT) Received: from www.postgresql.com (www.postgresql.com [64.117.225.209]) by svr1.postgresql.org (Postfix) with ESMTP id 442C7310D1A for ; Tue, 1 Jul 2003 17:02:47 -0300 (ADT) Received: from irko.smoothcorp.com (unknown [208.49.241.41]) by www.postgresql.com (Postfix) with ESMTP id 58BDCCF7343 for ; Tue, 1 Jul 2003 12:25:50 -0300 (ADT) Received: from jgardner.ifloor.com ([10.0.1.63]) by irko.smoothcorp.com with esmtp (Exim 4.12) id 19XMxr-0003uz-00; Tue, 01 Jul 2003 08:22:39 -0700 Received: from jgardner.ifloor.com (localhost.localdomain [127.0.0.1]) by jgardner.ifloor.com (8.12.8/8.12.8) with ESMTP id h61FMeHK032651; Tue, 1 Jul 2003 08:22:40 -0700 Received: from localhost (localhost [[UNIX: localhost]]) by jgardner.ifloor.com (8.12.8/8.12.8/Submit) id h61FMd3t032649; Tue, 1 Jul 2003 08:22:39 -0700 From: Jonathan Gardner To: weigelt@metux.de, pgsql-admin@postgresql.org Subject: Re: replication/redundancy Date: Tue, 1 Jul 2003 08:22:37 -0700 User-Agent: KMail/1.5 References: <200306300831.10498.jgardner@jonathangardner.net> <20030630161704.GG6956@metux.de> In-Reply-To: <20030630161704.GG6956@metux.de> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Content-Description: clearsigned data Content-Disposition: inline Message-Id: <200307010822.39288.jgardner@jonathangardner.net> X-SA-Exim-Rcpt-To: weigelt@metux.de, pgsql-admin@postgresql.org X-SA-Exim-Scanned: No; SAEximRunCond expanded to false X-Archive-Number: 200307/25 X-Sequence-Number: 9366 -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Monday 30 June 2003 09:17, weigelt@metux.de wrote: > On Mon, Jun 30, 2003 at 08:31:09AM -0700, Jonathan Gardner wrote: > > * currently only an explicit sync-out is supported - from time to time > evry table has to be scanned for new records So you are using "lazy" rather than "eager" replication. I am sure you know= =20 the limitations for lazy replication. Let me enumerate them here for those = of=20 you who aren't familiar with this: 1) The data is not consistent. This means if you run the same select quer= y=20 at the same time on the two databases, you may get different results. For= =20 some situations, that is okay (like Usenet). For others, it is not. (like= =20 registrations -- you'll sign up on one database, but you won't appear on th= e=20 other.) 2) The "other" process that does the synchronization is serial in nature.= =20 The processes that change the database are parallel in nature. It is very= =20 possible to have changes happening to the database faster than you can=20 replicate them. This was a real problem at a web company I recently worked= =20 for that used lazy replication. Their backup database fell weeks behind the= =20 live database. It almost got to the point where recreating the entire=20 database would've been faster than waiting for the replication process to= =20 catch up. 3) These two factors above make using the second database as a hot-swappa= ble=20 backup risky at best. You will lose some data when you switch to the backup= ,=20 unless changes to the database are so rare that the backup is usually up to= =20 date. If that were the case, you probably don't need the backup in the firs= t=20 place, because databases that don't do much tend not to be very important. > > * currently no real conflict handling > What he is talking about here is what happens when two seperate processes a= re=20 working on the same rows. PostgreSQL uses transactions and locking right no= w,=20 so two processes on the same system cannot do this. However, his system=20 cannot handle this at all when the two processes are on seperate machines. The most obvious problem with this comes from incrementing a column. If bot= h=20 processes try to increment the same column, then they will end up with the= =20 column incremented by one or the other, but not both. This would be bad for= =20 things like paypal, where your account would only increase by one or the=20 other account transfers, rather than both, if two occured at the same time. > > perhaps we can improve this a little bit. > I would hope you spend some time researching what others have done. Relatio= nal=20 databases are an area that a tremendous amount of solid research has alread= y=20 occured. Applying yourself to understand the research and projects that hav= e=20 gone before you will save yourself a lot of time replicating their work. In= =20 other words, "If I have seen farther, it is because I have stood on the=20 shoulders of giants" to (mis?)quote Newton. Again, to re-emphasize why pgreplication is so cool and why everyone should= be=20 excited about this: 1) Database theory says that scaleable, eager replication is impossible.= =20 This is true in practice. 2) The Postgres-R team discovered a way to make scaleable, eager replicat= ion=20 work. The restriction is that locks, once granted, may be aborted or revoke= d. 3) This means you will one day be able to setup a beowulf-type cluster of= =20 postgres databases that will rival the most powerful databases on earth=20 today. - --=20 Jonathan Gardner (was jgardn@alumni.washington.edu) Live Free, Use Linux! -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.1 (GNU/Linux) iD8DBQE/Aac+WgwF3QvpWNwRAgFxAJ9Mxesnc6Q3wLrUcL1Zz62AGLLjGACcCYJp zcV9rFm8TiqH90N6eSpRQnY=3D =3D/bFm -----END PGP SIGNATURE-----