Bug 34 - slonik crash if spoolnode = true
Summary: slonik crash if spoolnode = true
Status: RESOLVED FIXED
Alias: None
Product: Slony-I
Classification: Unclassified
Component: slonik (show other bugs)
Version: 1.2
Hardware: PC Linux
: medium normal
Assignee: Christopher Browne
URL:
Depends on:
Blocks:
 
Reported: 2008-02-07 02:52 UTC by prouxel.pacte
Modified: 2008-02-14 14:24 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description prouxel.pacte 2008-02-07 02:52:33 UTC
I want to use a node with no database replication and that i use for generate logshipping.

node 1 admin conninfo='host=127.0.0.1 dbname=fb7 user=pgslony port=5433';
node 2 admin conninfo='host=127.0.0.1 dbname=fb7 user=pgslony port=5435'';

init cluster (id = 1, comment = 'Node 1 - fb7@127.0.0.1');

# STORE NODE
store node (id = 2, spoolnode = true, comment = 'Node 2 ');

in slonik.c:store_node()
 if (!stmt->no_spool)
        {
                adminfo1 = get_active_adminfo((SlonikStmt *) stmt, stmt->no_id);
                if (adminfo1 == NULL)
                        return -1;
        }
  
  adminfo2 = get_checked_adminfo((SlonikStmt *) stmt, stmt->ev_origin);
  if (adminfo2 == NULL)
       return -1;
    
  if (db_begin_xact((SlonikStmt *) stmt, adminfo2) < 0) 
       return -1;
  
stmt=0 when spoolnode = true so it crash.
Comment 1 prouxel.pacte 2008-02-07 03:01:15 UTC
(In reply to comment #0)
> I want to use a node with no database replication and that i use for generate
> logshipping.
> 
> node 1 admin conninfo='host=127.0.0.1 dbname=fb7 user=pgslony port=5433';
> node 2 admin conninfo='host=127.0.0.1 dbname=fb7 user=pgslony port=5435'';
> 
> init cluster (id = 1, comment = 'Node 1 - fb7@127.0.0.1');
> 
> # STORE NODE
> store node (id = 2, spoolnode = true, comment = 'Node 2 ');
> 
> in slonik.c:store_node()
>  if (!stmt->no_spool)
>         {
>                 adminfo1 = get_active_adminfo((SlonikStmt *) stmt,
> stmt->no_id);
>                 if (adminfo1 == NULL)
>                         return -1;
>         }
> 
>   adminfo2 = get_checked_adminfo((SlonikStmt *) stmt, stmt->ev_origin);
>   if (adminfo2 == NULL)
>        return -1;
> 
>   if (db_begin_xact((SlonikStmt *) stmt, adminfo2) < 0) 
>        return -1;
> 
> stmt=0 when spoolnode = true so it crash.
> 
it's adminfo1=0 when spoolnode = true
Comment 2 Christopher Browne 2008-02-14 12:49:36 UTC
The way that log shipping functions has changed from the time when we anticipated that this "SPOOLNODE" slonik parameter would be used to control initializing log shipping nodes.

When I try to replicate this, I find that the slonik script that tries to set SPOOLNODE=TRUE falls over with a segfault...

I'll point out three things:

1.  SPOOLNODE=true has never actually been usable in any Slony-I release.  There was a plan to have "log shipping nodes" visible in the configuration, but the way they were eventually implemented, this is no longer necessary.

There isn't yet a really good tutorial on using logshipping, but see the following:

http://slony.info/documentation/logshipping.html - has a lot of relevant notes, (none of which suggest setting SPOOLNODE=true).

There is a logshipping test; see the sources in CVS:
http://main.slony.info/viewcvs/viewvc.cgi/slony1-engine/tests/testlogship/?pathrev=REL_1_2_STABLE

This is a functioning test; reviewing the code, particularly in "generate_dml.sh", should be helpful in seeing what steps are needed to set up a log shipping node.

2.  I'm patching 1_2_STABLE to indicate an error message, if SPOOLNODE=true, as follows:

cbbrowne@dba2:CMD/slony1-1.2/src/slonik> cvs diff -u 
cvs diff: Diffing .
Index: slonik.c
===================================================================
RCS file: /home/cvsd/slony1/slony1-engine/src/slonik/slonik.c,v
retrieving revision 1.67.2.13
diff -c -u -r1.67.2.13 slonik.c
cvs diff: conflicting specifications of output style
--- slonik.c	8 Jan 2008 20:42:41 -0000	1.67.2.13
+++ slonik.c	14 Feb 2008 20:44:42 -0000
@@ -327,6 +327,10 @@
 
 					if (!stmt->no_spool)
 					{
+						printf("Slonik command STORE NODE does not "
+						       "support the SPOOLNODE argument being set "
+						       "to TRUE.\n  See logshipping.html for "
+						       "documentation on setting up log shipping.\n");
 						if (script_check_adminfo(hdr, stmt->no_id) < 0)
 							errors++;
 					}

3.  SPOOLNODE-related code should get cleaned out altogether in CVS HEAD.
Comment 3 Christopher Browne 2008-02-14 12:50:44 UTC
Changing priority - broken "vestigal" behaviour should not be considered "critical."
Comment 4 Christopher Browne 2008-02-14 14:24:23 UTC
Have committed changes to CVS HEAD (for 2.0) to expunge SPOOLNODE:

http://lists.slony.info/pipermail/slony1-commit/2008-February/002179.html
http://lists.slony.info/pipermail/slony1-commit/2008-February/002180.html
http://lists.slony.info/pipermail/slony1-commit/2008-February/002181.html

Note that this is sufficiently intrusive that I decline to backpatch this to 1.2...