Christopher Browne cbbrowne at ca.afilias.info
Fri Dec 3 12:24:51 PST 2010
Christopher Browne <cbbrowne at ca.afilias.info> writes:
> [Discussion of bug #169 - http://www.slony.info/bugzilla/show_bug.cgi?id=169]
>
> There appears to be some value in trying to have a common representation
> of administrative connection data.  This was brought up in recent
> brainstorming.[1]
>
> 1.  When running Slonik scripts, you need ADMIN CONNINFO[2] statements in
> the preamble to indicate how to connect to all the nodes.

There seem to be three plausible directions to go:

1.  Ignore the issue, so tools do their own thing.

People aren't really complaining a lot about this today, so this isn't
totally ridiculous...

2.  Treat the Slonik format as "authoritative", and add some tooling to
allow extracting connection info from slonik scripts for reuse by the
other tools.

  2a) One might do the "quick shell script" thing where we detect lines
  looking like "NODE [integer] ADMIN CONNINFO = '[DSN]';" and remap this
  into an array or something for convenient access.

  2b) Write a full scale parser using Bison/Flex.
  That seems like overkill to me!

3.  Come up with a new format that is intended to be widely easy to
use/remap.

Let's say, a fixed format thing like the following
[node],"[DSN]"

Thus...
1,"port=5432 host=db1.example.info dbname=test user=slony"
2,"port=5432 host=db2.example.info dbname=test user=slony"
3,"port=5432 host=db3.example.info dbname=test user=slony"

 3a) Extend slonik with a command to draw conninfo from files in this
     form

 3b) It's no large task to write a script that cuts this up and turns it
     into:

  node 1 admin conninfo='port=5432 host=db1.example.info dbname=test user=slony';
  node 2 admin conninfo='port=5432 host=db2.example.info dbname=test user=slony';
  node 3 admin conninfo='port=5432 host=db3.example.info dbname=test user=slony';

  (It took me a few seconds to write an Emacs macro to do so, so a
  script shouldn't be too troublesome!)

  3c) Java has a notion of "property files" that would likely make this
  look something like:

    admin.conninfo.node.1="port=5432 host=db1.example.info dbname=test user=slony"
    admin.conninfo.node.2="port=5432 host=db2.example.info dbname=test user=slony"
    admin.conninfo.node.3="port=5432 host=db3.example.info dbname=test user=slony"

  It's pretty trivial to transform this into "node [id] admin
  conninfo='[DSN]';" lines for use by today's Slonik.

I don't want to vastly overengineer this - I kind of like 2a).
-- 
"cbbrowne","@","ca.afilias.info"
Christopher Browne
"Bother,"  said Pooh,  "Eeyore, ready  two photon  torpedoes  and lock
phasers on the Heffalump, Piglet, meet me in transporter room three"


More information about the Slony1-hackers mailing list