Re: HOOKS for Synchronous Replication - Mailing list pgsql-hackers

From Alfranio Correia Junior
Subject Re: HOOKS for Synchronous Replication
Date
Msg-id 42B7D17A.9000709@lsd.di.uminho.pt
Whole thread Raw
In response to Re: HOOKS for Synchronous Replication  (Alvaro Herrera <alvherre@surnet.cl>)
List pgsql-hackers
Thank you for the comments.

>First of all your patch does not conform with the project style.  Please
>have a look at how other files are indented, in particular regarding
>brace position and ereport() arguments (any function arguments really,
>but in ereport your problems are more visible).  Also, always use
>ereport() for user messages, elog() for conditions that involve
>can't-happen situations (server bugs, like not finding a tuple in a
>catalog that should be there, etc).
>  
>
OK !!! I am going to correct these problems.

>Also there are some changes that you certainly don't want committed.
>For example why are you removing the TransState from xact.c?
>  
>
I simply moved it to the xact.h...
Basically, it was done to be able to access the current transaction 
state from other files.
Thus, I can avoid to rebuild the structure that stores the global 
triggers in the middle of a transaction.
However, the lack of this functionality it is not critical since the 
superuser is the only
person that can change such triggers.

>Also, consider using the XactCallback mechanism instead of inventing
>your own.
>
>  
>
Unfortunately, the XactCallback is called after "commit" which
means that a transaction cannot be rolled back.
For synchronous replication, it is necessary to have a before commit event.
Moreover,  the addition of a callback function implies modifications to 
the source code, am I wrong ?
These global triggers could be easily adapted to call functions "before" 
and "after commit" without
changing the code.

>On a different front, have you considered talking to the people behind
>Slony-II to see if they'd have some use for your hooks?
>
>  
>
I would like to share the hooks with them and other things that I have 
been done.

Best regards,

Alfranio Junior.


pgsql-hackers by date:

Previous
From: "Dave Page"
Date:
Subject: Re: [PATCHES] default database creation with initdb
Next
From: Oleg Bartunov
Date:
Subject: Re: Schedule for 8.1 feature freeze