Thread: pg_xlog question

pg_xlog question

From
Mario Weilguni
Date:
Does anybody know if pg_xlog are essential for postgres to start? What would
happen if those files are lost, is the whole database corrupted or simply
some transactions lost?

I want to know if the following cluster setup would work:
* /dbase - contains the database itself, is on a DRBD mirror device and spread
across  2 machines.
* /dbase/pg_xlog is a symlink to /pg_log and is a local partition, not a DRBD
device
* what would happen if a failover happens, and the pg_xlog on the other
machine is empty. will postgres simply recreate those files (maybe some tx
are lost) or cant this setup work correctly?

Best regards,
    Mario Weilguni


Re: pg_xlog question

From
"Shridhar Daithankar"
Date:
On 6 Aug 2003 at 8:36, Mario Weilguni wrote:

> Does anybody know if pg_xlog are essential for postgres to start? What would
> happen if those files are lost, is the whole database corrupted or simply
> some transactions lost?
>
> I want to know if the following cluster setup would work:
> * /dbase - contains the database itself, is on a DRBD mirror device and spread
> across  2 machines.
> * /dbase/pg_xlog is a symlink to /pg_log and is a local partition, not a DRBD
> device
> * what would happen if a failover happens, and the pg_xlog on the other
> machine is empty. will postgres simply recreate those files (maybe some tx
> are lost) or cant this setup work correctly?

I doubt. It might end up with some transaction uncommittied in files.

If you could replicate/rsync  pg_xlog to another machine, you could get it
correctly in case of failover.

Testing the proper failover under load is recommended and you need to have a
journallig file system to make sure that the transaction logs are in sane
state. PG can not recover from corrupted transaction logs..

HTH

Bye
 Shridhar

--
We Klingons believe as you do -- the sick should die.  Only the strongshould
live.        -- Kras, "Friday's Child", stardate 3497.2


Re: pg_xlog question

From
"Shridhar Daithankar"
Date:
On 6 Aug 2003 at 12:52, Shridhar Daithankar wrote:

> On 6 Aug 2003 at 8:36, Mario Weilguni wrote:
>
> > Does anybody know if pg_xlog are essential for postgres to start? What would
> > happen if those files are lost, is the whole database corrupted or simply
> > some transactions lost?
> >
> > I want to know if the following cluster setup would work:
> > * /dbase - contains the database itself, is on a DRBD mirror device and spread
> > across  2 machines.
> > * /dbase/pg_xlog is a symlink to /pg_log and is a local partition, not a DRBD
> > device
> > * what would happen if a failover happens, and the pg_xlog on the other
> > machine is empty. will postgres simply recreate those files (maybe some tx
> > are lost) or cant this setup work correctly?
>
> I doubt. It might end up with some transaction uncommittied in files.
>
> If you could replicate/rsync  pg_xlog to another machine, you could get it
> correctly in case of failover.

Argh.. I forgot.. Simple option is to sync the pg_xlog while doing failover. It
might add some 10 odd sec to failover process but should be bullet proof..

I don't know if PG is nose poking about permissions of those files. otheriwse
it might refuse to start.. Check out..

Worth adding to failover HOWTO. I doubt if one exists for postgresql.

Bye
 Shridhar

--
Do you know about being with somebody?  Wanting to be?  If I had thewhole
universe, I'd give it to you, Janice.  When I see you, I feellike I'm hungry
all over.  Do you know how that feels?        -- Charlie Evans, "Charlie X", stardate
1535.8


Re: pg_xlog question

From
"Mario Weilguni"
Date:
> > If you could replicate/rsync  pg_xlog to another machine, you could get
it
> > correctly in case of failover.
>
> Argh.. I forgot.. Simple option is to sync the pg_xlog while doing
failover. It
> might add some 10 odd sec to failover process but should be bullet proof..
>
> I don't know if PG is nose poking about permissions of those files.
otheriwse
> it might refuse to start.. Check out..
>
> Worth adding to failover HOWTO. I doubt if one exists for postgresql.

Thanks for the response, but syncing pg_xlog separatly (without DRBD device)
is useless, because a failover will take place when there's an error, so the
extra sync of pg_xlog is very likely to fail.

Regards,
    Mario Weilguni



Re: pg_xlog question

From
"Shridhar Daithankar"
Date:
On 6 Aug 2003 at 9:56, Mario Weilguni wrote:
> Thanks for the response, but syncing pg_xlog separatly (without DRBD device)
> is useless, because a failover will take place when there's an error, so the
> extra sync of pg_xlog is very likely to fail.

Well, I googled for DRBD device. I was unfamiliar with the device.

I would say it should work if data and transaction logs both of them are
mirrored. But of course you need to test.

If you could write a HOWTO, that would be real great..


Bye
 Shridhar

--
    "We have the right to survive!"    "Not by killing others."        -- Deela and Kirk,
"Wink of An Eye", stardate 5710.5


Re: pg_xlog question

From
DeJuan Jackson
Date:
Why not
  DRDB the whole Postgres file system (possibly multiple disks) and let WAL recovery take care, of uncommitted transactions at db startup time.

Shridhar Daithankar wrote:
On 6 Aug 2003 at 9:56, Mario Weilguni wrote: 
Thanks for the response, but syncing pg_xlog separatly (without DRBD device)
is useless, because a failover will take place when there's an error, so the
extra sync of pg_xlog is very likely to fail.   
Well, I googled for DRBD device. I was unfamiliar with the device.

I would say it should work if data and transaction logs both of them are 
mirrored. But of course you need to test.

If you could write a HOWTO, that would be real great..


ByeShridhar

--"We have the right to survive!"	"Not by killing others."		-- Deela and Kirk, 
"Wink of An Eye", stardate 5710.5


---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings