Thu Nov 4 00:22:24 PST 2004
- Previous message: [Slony1-general] Slonik 'EXIT' command not closing database connection properly
- Next message: [Slony1-general] problem upgrading to 1.0.5
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Wed, 2004-11-03 at 10:04 -0500, Jan Wieck wrote:
> On 11/2/2004 11:52 PM, Justin Clift wrote:
>
> > Hi all,
> >
> > Trying out the Slonik EXIT command now to indicate various successes and
> > failures.
> >
> > PostgreSQL is always giving this error message when Slonik uses the EXIT
> > command instead of just finishing the input script naturally:
> >
> > *******
> >
> > LOG: unexpected EOF on client connection
>
> Right ... the exit command simply does exit(2), which causes the kernel
> to close all sockets the hard way and the backend misses the X message.
Ok.
Is the plan to (at some point) add code for doing full backend cleanup
before exiting with EXIT, or leave it as-is? Perhaps was can add an
additional option so that it's optional or something?
The reason I'm asking is because I'm writing Slonik scripting that
checks the success failure of each command then passes unique return
values back to the caller. This is so it can hook into a larger
framework of tools as needed and is also more user-friendly.
This is an example:
***********
# Create the set of tables and sequences for propagating from XYZ to the
ABC server
echo 'Creating the set for replicating from XYZ to the ABC';
try
{
create set (id = 2, origin = 2, comment = 'Tables replicating from XYZ
to the ABC');
} on error
{
# The create set command failed
echo 'Creating the set for propagating data from XYZ to the ABC
failed';
exit 1;
}
try
{
set add table (set id=2, origin=2, id=4, fully qualified name =
'public.third', comment='third table');
} on error
{
# Adding this table to the set failed
echo 'Adding the public.third table to the set failed';
exit 2;
}
try
{
set add table (set id=2, origin=2, id=5, fully qualified name =
'public.fourth', comment='fourth table');
} on error
{
# Adding this table to the set failed
echo 'Adding the public.fourth table to the set failed';
exit 3;
}
# Wait for slony to propagate the new set information to the node that
will become the subscriber
try
{
echo 'Waiting for node information to syncronise. (60 second
timeout)';
wait for event (origin = 2, confirmed = 1);
} on error
{
# The wait for event command failed.
drop set (id = 2, origin = 2);
echo 'Waiting for the new set to be created on the ABC server failed.
Are the slon daemons running?';
exit 4;
} on success
{
# Subscribe the ABC node to this set
subscribe set ( id = 2, provider = 2, receiver = 1, forward = no);
}
# Let the caller know the script completed successfully
echo 'Creating the set for replicating from XYZ to the ABC completed
successfully';
exit 0;
***********
It seems like the present behaviour of EXIT works for when something
goes badly wrong and Slonik needs to drop out straight away "in an
emergency", whereas the kind of approach I'm wanting to use it for is
for general status passing. Full cleanup would be preferred. :)
Should I crank up a C editor and see if I can work out what's required
or something?
Regards and best wishes,
Justin Clift
> Jan
- Previous message: [Slony1-general] Slonik 'EXIT' command not closing database connection properly
- Next message: [Slony1-general] problem upgrading to 1.0.5
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Slony1-general mailing list