Bug 337 - Want slon configuration to be available in a table to enable remote access
Summary: Want slon configuration to be available in a table to enable remote access
Status: ASSIGNED
Alias: None
Product: Slony-I
Classification: Unclassified
Component: slon (show other bugs)
Version: devel
Hardware: All All
: low enhancement
Assignee: Christopher Browne
URL:
Depends on:
Blocks:
 
Reported: 2014-03-20 12:19 UTC by Christopher Browne
Modified: 2014-07-30 12:37 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 Christopher Browne 2014-03-20 12:19:22 UTC
It would be desirable to be able to access the configuration parameters remotely.

At present, parameters may exist in the command line or in a slon.conf file loaded using the -f parameter.  This does not lend itself to analysis (e.g. - to be able to query nodes in a cluster to figure out how it is configured); the "general method" involves:

- Logging onto the machine where the slon is running

- Checking "ps" command to get the parameters passed to slon

- Consulting a config file indicated by -f parameter, but note that if someone has modified the file since the slon was started, the file may not indicate the present configuration.

Note that in confoptions.c, the function set_config_option() includes code to log, at SLON_CONFIG level, all the options that are passed to it; this is used to capture parameters into the Slony log file.

This points to a *slightly* better method for looking at slon configuration than was described above; one might instead look in the slon log for the CONFIG entries.

The desired enhancement is to add a new table, let's call it sl_slonconf, for now, and to write all the configuration options into that table, at the time a slon starts up.

If the table is defined via:

create table sl_slonconf (
    conf_option text primary key,
    conf_value text,
    conf_set_on timestamptz not null default now()
);

At slon startup, confoptions.c (or somewhere similar) should prepare a series of SQL statements amounting to...

   delete from sl_slonconf;
   insert into sl_slonconf (conf_option, conf_value) values ('vac_frequency', '3');
   insert into sl_slonconf (conf_option, conf_value) values ('log_level', '0');
   insert into sl_slonconf (conf_option, conf_value) values ('sql_on_connection', '');

... and so forth...
Comment 1 Christopher Browne 2014-07-17 11:12:50 UTC
Efforts ongoing on GitHub on the "bug337" branch, thus:

https://github.com/cbbrowne/slony1-engine/tree/bug337
Comment 2 Christopher Browne 2014-07-17 14:17:09 UTC
Implementation completed...

https://github.com/cbbrowne/slony1-engine/commits/bug337

Someone should review this...
Comment 3 Steve Singer 2014-07-30 12:37:54 UTC
I'm not very happy with how this patch behaves when we start up a slon that can't connect to a valid slony database.

Start up slon against a database that doesn't yet have slony installed or with a dbname that doesn't exist.

This patch prints an error message for everyconfig value.

It should instead print an error about not being able to connect to the DB or that slony is not installed, but not keep complaining about each individual config parameter.

For example

-------------
 src/slon/slon disorder 'host=localhost dbname=tesssst'
2014-07-30 15:26:29 EDT CONFIG main: slon version 2.3.0 starting up
2014-07-30 15:26:29 EDT INFO   slon: watchdog process started
2014-07-30 15:26:29 EDT CONFIG slon: watchdog ready - pid = 30388
2014-07-30 15:26:29 EDT CONFIG slon: worker process created - pid = 30389
2014-07-30 15:26:29 EDT ERROR  dump_configuration - unable to empty sl_slonconf - 
2014-07-30 15:26:29 EDT CONFIG main: Integer option vac_frequency = 3
2014-07-30 15:26:29 EDT ERROR  dump_configuration - unable to write sl_slonconf entry for ('vac_frequency', '3') - 
2014-07-30 15:26:29 EDT CONFIG main: Integer option log_level = 0
2014-07-30 15:26:29 EDT ERROR  dump_configuration - unable to write sl_slonconf entry for ('log_level', '0') - 
2014-07-30 15:26:29 EDT CONFIG main: Integer option sync_interval = 2000

.
.
.
.
2014-07-30 15:26:29 EDT FATAL  main: Cannot connect to local database - no connection to the server
 - sleep 10s


I want to see that FATAL message first, because that is the message that describes my problem.  (I would be inclined to do the database config writing after , db_checkSchemaVersion in slon.c



Also maybe we want the release notes to just provide a sentence or two description of the change and reference the documentation for the example of the table output.

Other than those issues it looks fine.