Chris Browne cbbrowne
Fri Dec 2 19:21:14 PST 2005
Back in the early plans to do log shipping, we introduced a column on
sl_node, namely no_spool.

The plan was that there would be some awareness by the node of whether
or not it was configured/intended to do log shipping.

The eventual implementation used the "-a" option for this, which makes
the no_spool column seem fairly much irrelevant.

"Fairly much irrelevant" is suggestive that we perhaps should expunge
code having to do with no_spool from the source tree.

Looking at the source tree (a grep for storenode/no_spool at the
bottom of this email shows something of the scope of how many parts of
the code need to be touched to change this), it looks as though
changing this would be quite intrusive.  Furthermore, it's worth
noting something from the documentation:

      <varlistentry><term><literal> SPOOLNODE = boolean </literal></term>
       
       <listitem><para>Specifies that the new node is a virtual spool
       node for file archiving of replication log.  If true,
       <application>slonik</application> will not attempt to
       initialize a database with the replication
       schema.</para></listitem>
       
      </varlistentry>

The above documentation oughtn't be right, or to the degree it is, it
indicates that setting "SPOOLNODE = true" is a downright *terrible*
thing to try to do.  (The code in slonik.c does seem to agree with the
above documentation.)

I'm of two minds on this, and would covet others' comments.

1.  Perhaps it would be wise to drop the no_spool column altogether,
which leads to rather a lot of moderately intrusive changes.

If the functionality is, well, as counterproductive as it seems, there
is wisdom in expunging all of this for 1.2 as cleaning it out later
would doubtless become more painful.

2.  Perhaps we should change it to actually make a *proper* use of
no_spool.

I'm more or less certain we want to expunge the functionality to the
effect that "If true, slonik will not attempt to initialize a database
with the replication schema..."

But it seems to me that it *is* a useful thing to mark a node as being
used for log shipping.  Right now, there is a risk that if you restart
slon, and [by some error] neglect to include the "-a" option, you will
immediately 'corrupt' log shipping by virtue of losing logs for a
period of time.

If no_spool tracks the status that "We want to use this node for log
shipping!", then we could have slon verify, if the value of no_spool
is 't', that the variable archive_dir (used liberally in
remote_worker.c) is TRUE.  If archive_dir = FALSE, then we could have
the slon terminate itself before it potentially drops log shipping on
the floor.

Thoughts???

==========================================================
cbbrowne at dba2:~/Slony-I/slony1-HEAD-pristine> egrep -i '(storenode|no_spool)' src/*/*[a-np-z]                                         Friday 11:31:23
src/backend/README.events:	ev_data3		no_spool
src/backend/README.events:	storeNode (no_id, no_comment, no_spool)
src/backend/README.events:	storeNode_int (no_id, no_comment, no_spool)
src/backend/README.events:	exists, the no_comment and no_spool fields are updated.
src/backend/slony1_base.sql:	no_spool			boolean,
src/backend/slony1_base.sql:comment on column @NAMESPACE at .sl_node.no_spool is 'Is the node being used for log shipping?';  
src/backend/slony1_funcs.sql:	perform @NAMESPACE at .storeNode_int (p_local_node_id, p_comment, false);
src/backend/slony1_funcs.sql:-- FUNCTION storeNode (no_id, no_comment, no_spool)
src/backend/slony1_funcs.sql:create or replace function @NAMESPACE at .storeNode (int4, text, boolean)
src/backend/slony1_funcs.sql:	p_no_spool		alias for $3;
src/backend/slony1_funcs.sql:	v_no_spool_txt	text;
src/backend/slony1_funcs.sql:	if p_no_spool then
src/backend/slony1_funcs.sql:		v_no_spool_txt = ''t'';
src/backend/slony1_funcs.sql:		v_no_spool_txt = ''f'';
src/backend/slony1_funcs.sql:	perform @NAMESPACE at .storeNode_int (p_no_id, p_no_comment, p_no_spool);
src/backend/slony1_funcs.sql:									p_no_id, p_no_comment, v_no_spool_txt);
src/backend/slony1_funcs.sql:comment on function @NAMESPACE at .storeNode(int4, text, boolean) is
src/backend/slony1_funcs.sql:no_spool - Flag for virtual spool nodes
src/backend/slony1_funcs.sql:-- FUNCTION storeNode_int (no_id, no_comment, no_spool)
src/backend/slony1_funcs.sql:create or replace function @NAMESPACE at .storeNode_int (int4, text, boolean)
src/backend/slony1_funcs.sql:	p_no_spool		alias for $3;
src/backend/slony1_funcs.sql:				no_spool = p_no_spool
src/backend/slony1_funcs.sql:				(no_id, no_active, no_comment, no_spool) values
src/backend/slony1_funcs.sql:				(p_no_id, ''f'', p_no_comment, p_no_spool);
src/backend/slony1_funcs.sql:comment on function @NAMESPACE at .storeNode_int(int4, text, boolean) is
src/backend/slony1_funcs.sql:no_spool - Flag for virtual spool nodes
src/backend/slony1_funcs.sql:			perform @NAMESPACE at .storeNode_int (p_pa_server, ''<event pending>'', ''f'');
src/backend/slony1_funcs.sql:			perform @NAMESPACE at .storeNode_int (p_pa_client, ''<event pending>'', ''f'');
src/backend/slony1_funcs.sql:			perform @NAMESPACE at .storeNode_int (p_li_origin, ''<event pending>'', ''f'');
src/backend/slony1_funcs.sql:			perform @NAMESPACE at .storeNode_int (p_li_provider, ''<event pending>'', ''f'');
src/backend/slony1_funcs.sql:			perform @NAMESPACE at .storeNode_int (p_li_receiver, ''<event pending>'', ''f'');
src/backend/slony1_funcs.sql:			perform @NAMESPACE at .storeNode_int (p_set_origin, ''<event pending>'', ''f'');
src/backend/slony1_funcs.sql:		-- Add new column sl_node.no_spool for virtual spool nodes
src/backend/slony1_funcs.sql:		execute ''alter table @NAMESPACE at .sl_node add column no_spool boolean'';
src/backend/slony1_funcs.sql:		update @NAMESPACE at .sl_node set no_spool = false;
src/slon/local_listen.c:					rtcfg_storeNode(no_id, no_comment);
src/slon/remote_worker.c:				char	   *no_spool = event->ev_data3;
src/slon/remote_worker.c:					rtcfg_storeNode(no_id, no_comment);
src/slon/remote_worker.c:								 "select %s.storeNode_int(%d, '%q', '%s'); ",
src/slon/remote_worker.c:								 no_id, no_comment, no_spool);
src/slon/runtime_config.c: * rtcfg_storeNode 
src/slon/runtime_config.c:rtcfg_storeNode(int no_id, char *no_comment)
src/slon/runtime_config.c:				 "storeNode: no_id=%d no_comment='%s' - update node\n",
src/slon/runtime_config.c:			 "storeNode: no_id=%d no_comment='%s'\n",
src/slon/runtime_config.c:		perror("rtcfg_storeNode: malloc()");
src/slon/runtime_config.c:		rtcfg_storeNode(pa_server, "<event pending>");
src/slon/slon.c:			rtcfg_storeNode(no_id, no_comment);
src/slon/slon.h:extern void rtcfg_storeNode(int no_id, char *no_comment);
src/slonik/parser.y:							new->no_spool		= opt[2].ival;
src/slonik/slonik.c:					if (!stmt->no_spool)
src/slonik/slonik.c:	if (!stmt->no_spool)
src/slonik/slonik.c:	if (!stmt->no_spool)
src/slonik/slonik.c:					 "select no_id, no_active, no_comment, no_spool "
src/slonik/slonik.c:			char	   *no_spool = PQgetvalue(res, tupno, 3);
src/slonik/slonik.c:						 "select \"_%s\".storeNode_int(%s, '%q', '%s'); ",
src/slonik/slonik.c:				 stmt->hdr.script->clustername, no_id, no_comment, no_spool);
src/slonik/slonik.c:	/* On the existing node, call storeNode() and enableNode() */
src/slonik/slonik.c:				 "select \"_%s\".storeNode(%d, '%q', '%s'); "
src/slonik/slonik.c:				 (stmt->no_spool != 0) ? "t" : "f",
src/slonik/slonik.c:	if (stmt->no_spool)
src/slonik/slonik.h:	int			no_spool;
cbbrowne at dba2:~/Slony-I/slony1-HEAD-pristine> 
==========================================================
-- 
"cbbrowne","@","acm.org"
http://cbbrowne.com/info/rdbms.html
Rules of the Evil Overlord #200. "During times of peace, my Legions of
Terror will  not be permitted to  lie around drinking  mead and eating
roast boar. Instead they will be  required to obey my dietician and my
aerobics instructor." <http://www.eviloverlord.com/>


More information about the Slony1-general mailing list