pgpool2.git / summary / log / commit / refs

commit    eece8b0201044722a0a8a6f39e0ba86f876c1310
Author:   Tatsuo Ishii <ishii at sraoss.co.jp>
Date:     Mon Jun 07 08:29:44 2010 +0000

    Add master_slave_sub_mode


doc/pgpool-en.html | 9 +++++++-- doc/pgpool-ja.html | 8 ++++++-- pgpool.conf.sample | 3 +++ pgpool.conf.sample-master-slave | 3 +++ pgpool.conf.sample-replication | 3 +++ pool_config.c | 27 +++++++++++++++++++++++++++ pool_config.h | 2 ++ pool_config.l | 27 +++++++++++++++++++++++++++ pool_process_reporting.c | 5 +++++ 9 files changed, 83 insertions(+), 4 deletions(-) diff --git a/doc/pgpool-en.html b/doc/pgpool-en.html index d698223f3..e1876a4d0 100644 --- a/doc/pgpool-en.html +++ b/doc/pgpool-en.html @@ -7,7 +7,7 @@ </head> <!-- hhmts start --> -Last modified: Wed May 12 13:43:25 JST 2010 +Last modified: Mon Jun 7 17:13:27 JST 2010 <!-- hhmts end --> <body bgcolor="#ffffff"> @@ -1146,7 +1146,7 @@ alive.</p> <h3>Master/Slave Mode</h3> <p>This mode is for using pgpool-II with another master/slave -replication software (like Slony-I), so it really does the actual data +replication software (like Slony-I and Streaming replication), so it really does the actual data replication. DB nodes' information must be set as the replication mode. In addtion to that, set <code>master_slave_mode</code> and <code>load_balance_mode</code> to @@ -1159,6 +1159,11 @@ SELECT should be executed on master only as well but for this you need to use co <p>In the master/slave mode, <code>replication_mode</code> must be set to false, and <code>master_slave_mode</code> to true.</p> +<p>master/slave mode has "sub mode". The default is 'slony' which is +suitable for Slony-I. You can also set it to 'stream', which should be +set if you want to work with PostgreSQL's buil-in replication system +(Streaming Replication). + <h3>Parallel Mode</h3> <p>This mode enables parallel execution of queries.The table is divided, and data can be given to each node. Moreover, the replication and the loadbalance function can be used at the same time. In parallel mode, replication_mode and loadbalance_mode are set to true in pgpool.conf, master_slave is set to false, and parallel_mode is set to true. When you change this parameter, please reactivate pgpool-II. diff --git a/doc/pgpool-ja.html b/doc/pgpool-ja.html index 3c0a5c942..2e47902ad 100644 --- a/doc/pgpool-ja.html +++ b/doc/pgpool-ja.html @@ -8,7 +8,7 @@ <body> <!-- hhmts start --> -Last modified: Mon May 24 16:54:23 JST 2010 +Last modified: Mon Jun 7 17:14:56 JST 2010 <!-- hhmts end --> <body bgcolor="#ffffff"> @@ -1172,7 +1172,7 @@ DELETE $B$N99?77o?t$,$9$Y$F$N%N!<%I$,F1$8$G$J$$>l9g!"0U?^E*$K9=J8%(%i!<$r5/$9( <h3>$B%^%9%?!<%9%l!<%V%b!<%I(B</h3> <p> - master/slave$B%b!<%I$O!"(BSlony-I$B$N$h$&$J!"(Bmaster/slave$B<0$N%l%W%j%1!<%7%g(B + master/slave$B%b!<%I$O!"(BSlony-I$B$d(BStreaming Replication$B$N$h$&$J!"(Bmaster/slave$B<0$N%l%W%j%1!<%7%g(B $B%s%=%U%H$K%l%W%j%1!<%7%g%s$r$^$+$;$k%b!<%I$G$9!#$3$N%b!<%I$G;H$&$?$a$K(B $B$O!"%l%W%j%1!<%7%g%s%b!<%I$HF1$8$h$&$K!"(BDB$B%N!<%I$N%[%9%H>pJs(B $B$r%;%C%H$7!"(Bmaster_slave_mode$B$H(Bload_balance_mode$B$r(Btrue$B$K$7$^$9!#$3$N$H(B @@ -1188,6 +1188,10 @@ DELETE $B$N99?77o?t$,$9$Y$F$N%N!<%I$,F1$8$G$J$$>l9g!"0U?^E*$K9=J8%(%i!<$r5/$9( <p> $B%^%9%?!<%9%l!<%V%b!<%I$G$O!"(Bpgpool.conf$B$N(Breplication_mode$B$r(Bfalse$B$K!"(Bmaster_slave_mode $B$r(Btrue$B$K$7$^$9!#(B +$B$^$?!"(B"sub mode"$B$r;XDj$9$k$3$H$,$G$-$^$9!#$3$l$O!"(B'slony'($B%G%U%)%k%H(B)$B$+!"(B'stream'$B$G$9!#(B +'slony'$B$O(BSlony-I$B$rMxMQ$9$k;~$K;XDj$7$^$9!#(B'stream'$B$O!"(BPostgreSQL$BAH$_9~$_$N(BStreaming Replication$B$rMxMQ$9$k$H$-$K;XDj$7$^$9!#(B +</p> +<p> $B$3$N%Q%i%a!<%?$rJQ99$7$?;~$K$O(B pgpool-II $B$r:F5/F0$7$F$/$@$5$$!#(B </p> diff --git a/pgpool.conf.sample b/pgpool.conf.sample index f7fe59d86..4255aaa09 100644 --- a/pgpool.conf.sample +++ b/pgpool.conf.sample @@ -86,6 +86,9 @@ print_timestamp = true # If true, operate in master/slave mode. master_slave_mode = false +# Master/slave sub mode. either 'slony' or 'stream'. Default is 'slony'. +master_slave_sub_mode = 'slony' + # If true, cache connection pool. connection_cache = true diff --git a/pgpool.conf.sample-master-slave b/pgpool.conf.sample-master-slave index fcefa3d75..fb47900fe 100644 --- a/pgpool.conf.sample-master-slave +++ b/pgpool.conf.sample-master-slave @@ -86,6 +86,9 @@ print_timestamp = true # If true, operate in master/slave mode. master_slave_mode = true +# Master/slave sub mode. either 'slony' or 'stream'. Default is 'slony'. +master_slave_sub_mode = 'slony' + # If true, cache connection pool. connection_cache = true diff --git a/pgpool.conf.sample-replication b/pgpool.conf.sample-replication index 373560a38..d181ed8e2 100644 --- a/pgpool.conf.sample-replication +++ b/pgpool.conf.sample-replication @@ -86,6 +86,9 @@ print_timestamp = true # If true, operate in master/slave mode. master_slave_mode = false +# Master/slave sub mode. either 'slony' or 'stream'. Default is 'slony'. +master_slave_sub_mode = 'slony' + # If true, cache connection pool. connection_cache = true diff --git a/pool_config.c b/pool_config.c index b111578fe..30b3a52a5 100644 --- a/pool_config.c +++ b/pool_config.c @@ -1878,6 +1878,7 @@ int pool_init_config(void) pool_config->reset_query_list = default_reset_query_list; pool_config->print_timestamp = 1; pool_config->master_slave_mode = 0; + pool_config->master_slave_sub_mode = "slony"; pool_config->connection_cache = 1; pool_config->health_check_timeout = 20; pool_config->health_check_period = 0; @@ -2384,6 +2385,32 @@ int pool_get_config(char *confpath, POOL_CONFIG_CONTEXT context) } } + else if (!strcmp(key, "master_slave_sub_mode") && CHECK_CONTEXT(INIT_CONFIG, context)) + { + char *str; + + if (token != POOL_STRING && token != POOL_UNQUOTED_STRING && token != POOL_KEY) + { + PARSE_ERROR(); + fclose(fd); + return(-1); + } + str = extract_string(yytext, token); + if (str == NULL) + { + fclose(fd); + return(-1); + } + + if (strcmp(str, "slony") && strcmp(str, "stream")) + { + pool_error("pool_config: %s must be either \"slony\" or \"stream\"", key); + fclose(fd); + return(-1); + } + pool_config->master_slave_sub_mode = str; + } + else if (!strcmp(key, "connection_cache") && CHECK_CONTEXT(INIT_CONFIG, context)) { int v = eval_logical(yytext); diff --git a/pool_config.h b/pool_config.h index 38c5c4690..649e6519a 100644 --- a/pool_config.h +++ b/pool_config.h @@ -63,6 +63,8 @@ typedef struct { int print_timestamp; /* if non 0, print time stamp to each log line */ int master_slave_mode; /* if non 0, operate in master/slave mode */ + char *master_slave_sub_mode; /* either "slony" or "stream" */ + int connection_cache; /* if non 0, cache connection pool */ int health_check_timeout; /* health check timeout */ int health_check_period; /* health check period */ diff --git a/pool_config.l b/pool_config.l index 8ed758070..4fdddc4ec 100644 --- a/pool_config.l +++ b/pool_config.l @@ -153,6 +153,7 @@ int pool_init_config(void) pool_config->reset_query_list = default_reset_query_list; pool_config->print_timestamp = 1; pool_config->master_slave_mode = 0; + pool_config->master_slave_sub_mode = "slony"; pool_config->connection_cache = 1; pool_config->health_check_timeout = 20; pool_config->health_check_period = 0; @@ -659,6 +660,32 @@ int pool_get_config(char *confpath, POOL_CONFIG_CONTEXT context) } } + else if (!strcmp(key, "master_slave_sub_mode") && CHECK_CONTEXT(INIT_CONFIG, context)) + { + char *str; + + if (token != POOL_STRING && token != POOL_UNQUOTED_STRING && token != POOL_KEY) + { + PARSE_ERROR(); + fclose(fd); + return(-1); + } + str = extract_string(yytext, token); + if (str == NULL) + { + fclose(fd); + return(-1); + } + + if (strcmp(str, "slony") && strcmp(str, "stream")) + { + pool_error("pool_config: %s must be either \"slony\" or \"stream\"", key); + fclose(fd); + return(-1); + } + pool_config->master_slave_sub_mode = str; + } + else if (!strcmp(key, "connection_cache") && CHECK_CONTEXT(INIT_CONFIG, context)) { int v = eval_logical(yytext); diff --git a/pool_process_reporting.c b/pool_process_reporting.c index d057ea16e..a34386973 100644 --- a/pool_process_reporting.c +++ b/pool_process_reporting.c @@ -179,6 +179,11 @@ void process_reporting(POOL_CONNECTION *frontend, POOL_CONNECTION_POOL *backend) strncpy(status[i].desc, "if true, operate in master/slave mode", POOLCONFIG_MAXDESCLEN); i++; + strncpy(status[i].name, "master_slave_sub_mode", POOLCONFIG_MAXNAMELEN); + snprintf(status[i].value, POOLCONFIG_MAXVALLEN, "%s", pool_config->master_slave_sub_mode); + strncpy(status[i].desc, "master/slave sub mode", POOLCONFIG_MAXDESCLEN); + i++; + strncpy(status[i].name, "connection_cache", POOLCONFIG_MAXNAMELEN); snprintf(status[i].value, POOLCONFIG_MAXVALLEN, "%d", pool_config->connection_cache); strncpy(status[i].desc, "if true, cache connection pool", POOLCONFIG_MAXDESCLEN); [parent: 5dee760e2d7d]