Received: from localhost (unknown [200.46.204.191]) by postgresql.org (Postfix) with ESMTP id F0BC22E2E84 for ; Mon, 7 Jan 2008 14:55:19 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.191]) (amavisd-maia, port 10024) with ESMTP id 70473-03 for ; Mon, 7 Jan 2008 14:55:11 -0400 (AST) Received: from smtp166.iad.emailsrvr.com (smtp166.iad.emailsrvr.com [207.97.245.166]) by postgresql.org (Postfix) with ESMTP id A278C2E30AD for ; Mon, 7 Jan 2008 14:55:11 -0400 (AST) Received: from relay6.relay.iad.emailsrvr.com (localhost [127.0.0.1]) by relay6.relay.iad.emailsrvr.com (SMTP Server) with ESMTP id C1A766F54ED; Mon, 7 Jan 2008 13:55:09 -0500 (EST) Received: by relay6.relay.iad.emailsrvr.com (Authenticated sender: erik-AT-myemma.com) with ESMTP id E88936F5522; Mon, 7 Jan 2008 13:55:07 -0500 (EST) In-Reply-To: <478226FB.6030306@fmed.uba.ar> References: <478226FB.6030306@fmed.uba.ar> Mime-Version: 1.0 (Apple Message framework v752.3) Content-Type: text/plain; charset=ISO-8859-1; delsp=yes; format=flowed Message-Id: Cc: pgsql-sql@postgresql.org Content-Transfer-Encoding: quoted-printable From: Erik Jones Subject: Re: reading WAL files in python Date: Mon, 7 Jan 2008 12:53:59 -0600 To: Gerardo Herzig X-Mailer: Apple Mail (2.752.3) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200801/31 X-Sequence-Number: 29884 On Jan 7, 2008, at 7:19 AM, Gerardo Herzig wrote: > Hi all. Im having some fun trying to write my own replication =20 > system using python. I will use the postgres own WAL archiving to =20 > write the files, then my app will read them and do some stuff. As =20 > im not a C programmer, im stuck in the mission of reading the =20 > binary files. > > I guess im needing to know the internals of how wals archives are, =20 > how big the buffer has to be, in order to have a complete sql command. > > Can someone point some advice? > I was trying to understad src/backend/access/transam/xlog.c, but =20 > seems too difficult to me :( The biggest problem with what you're wanting to do here is that the =20 data written to the WALL archives isn't going to be at all easily =20 translatable into SQL statements. AFAIK, the WAL data records on-=20 disk file changes, i.e. it's strictly a binary mode scenario. As =20 someone has already suggested, if you want to learn more about =20 Postgres and Python, look at Skytools. I'm not just saying to use =20 it, read the code and, if you like, offer help with patches. Erik Jones DBA | Emma=AE erik@myemma.com 800.595.4401 or 615.292.5888 615.292.0777 (fax) Emma helps organizations everywhere communicate & market in style. Visit us online at http://www.myemma.com