pgpool2.git / summary / log / commit / refs

commit    550ffd6adace6cc2c1fc232af3739ee229059bdd
Author:   Tatsuo Ishii <ishii at sraoss.co.jp>
Date:     Thu Aug 12 00:27:19 2010 +0000

    Add info about white_function_list and black_function_list.
    Add default value for black_function_list(i.e. nextval and setval) for
    backward compatibilty for those who do not update pgpool.conf.


pool_config.c | 37 +++++++++++++++++++------------------ pool_config.l | 5 +++-- pool_process_reporting.c | 31 ++++++++++++++++++++++++++++++- 3 files changed, 52 insertions(+), 21 deletions(-) diff --git a/pool_config.c b/pool_config.c index 3f1e2938c..b566493b5 100644 --- a/pool_config.c +++ b/pool_config.c @@ -524,6 +524,7 @@ POOL_CONFIG *pool_config; /* configuration values */ POOL_SYSTEMDB_CONNECTION_POOL *system_db_info; static unsigned Lineno; static char *default_reset_query_list[] = {"ABORT", "DISCARD ALL"}; +static char *default_black_function_list[] = {"nextval", "setval"}; typedef enum { POOL_KEY = 1, @@ -540,7 +541,7 @@ static char *extract_string(char *value, POOL_TOKEN token); static char **extract_string_tokens(char *str, char *delim, int *n); static void clear_host_entry(int slot); -#line 544 "pool_config.c" +#line 545 "pool_config.c" #define INITIAL 0 @@ -720,10 +721,10 @@ YY_DECL register char *yy_cp, *yy_bp; register int yy_act; -#line 84 "pool_config.l" +#line 85 "pool_config.l" -#line 727 "pool_config.c" +#line 728 "pool_config.c" if ( !(yy_init) ) { @@ -805,12 +806,12 @@ do_action: /* This label is used only to access EOF actions. */ case 1: /* rule 1 can match eol */ YY_RULE_SETUP -#line 86 "pool_config.l" +#line 87 "pool_config.l" Lineno++; return POOL_EOL; YY_BREAK case 2: YY_RULE_SETUP -#line 87 "pool_config.l" +#line 88 "pool_config.l" /* eat whitespace */ YY_BREAK case 3: @@ -818,50 +819,50 @@ case 3: (yy_c_buf_p) = yy_cp -= 1; YY_DO_BEFORE_ACTION; /* set up yytext again */ YY_RULE_SETUP -#line 88 "pool_config.l" +#line 89 "pool_config.l" /* eat comment */ YY_BREAK case 4: YY_RULE_SETUP -#line 90 "pool_config.l" +#line 91 "pool_config.l" return POOL_KEY; YY_BREAK case 5: YY_RULE_SETUP -#line 91 "pool_config.l" +#line 92 "pool_config.l" return POOL_STRING; YY_BREAK case 6: YY_RULE_SETUP -#line 92 "pool_config.l" +#line 93 "pool_config.l" return POOL_UNQUOTED_STRING; YY_BREAK case 7: YY_RULE_SETUP -#line 93 "pool_config.l" +#line 94 "pool_config.l" return POOL_INTEGER; YY_BREAK case 8: YY_RULE_SETUP -#line 94 "pool_config.l" +#line 95 "pool_config.l" return POOL_REAL; YY_BREAK case 9: YY_RULE_SETUP -#line 95 "pool_config.l" +#line 96 "pool_config.l" return POOL_EQUALS; YY_BREAK case 10: YY_RULE_SETUP -#line 97 "pool_config.l" +#line 98 "pool_config.l" return POOL_PARSE_ERROR; YY_BREAK case 11: YY_RULE_SETUP -#line 99 "pool_config.l" +#line 100 "pool_config.l" ECHO; YY_BREAK -#line 865 "pool_config.c" +#line 866 "pool_config.c" case YY_STATE_EOF(INITIAL): yyterminate(); @@ -1819,7 +1820,7 @@ void yyfree (void * ptr ) #define YYTABLES_NAME "yytables" -#line 99 "pool_config.l" +#line 100 "pool_config.l" @@ -1887,8 +1888,8 @@ int pool_init_config(void) pool_config->num_reset_queries = sizeof(default_reset_query_list)/sizeof(char *); pool_config->white_function_list = NULL; pool_config->num_white_function_list = 0; - pool_config->black_function_list = NULL; - pool_config->num_black_function_list = 0; + pool_config->black_function_list = default_black_function_list; + pool_config->num_black_function_list = sizeof(default_black_function_list)/sizeof(char *); pool_config->print_timestamp = 1; pool_config->master_slave_mode = 0; pool_config->master_slave_sub_mode = "slony"; diff --git a/pool_config.l b/pool_config.l index 537abb253..bf0ecf497 100644 --- a/pool_config.l +++ b/pool_config.l @@ -41,6 +41,7 @@ POOL_CONFIG *pool_config; /* configuration values */ POOL_SYSTEMDB_CONNECTION_POOL *system_db_info; static unsigned Lineno; static char *default_reset_query_list[] = {"ABORT", "DISCARD ALL"}; +static char *default_black_function_list[] = {"nextval", "setval"}; typedef enum { POOL_KEY = 1, @@ -162,8 +163,8 @@ int pool_init_config(void) pool_config->num_reset_queries = sizeof(default_reset_query_list)/sizeof(char *); pool_config->white_function_list = NULL; pool_config->num_white_function_list = 0; - pool_config->black_function_list = NULL; - pool_config->num_black_function_list = 0; + pool_config->black_function_list = default_black_function_list; + pool_config->num_black_function_list = sizeof(default_black_function_list)/sizeof(char *); pool_config->print_timestamp = 1; pool_config->master_slave_mode = 0; pool_config->master_slave_sub_mode = "slony"; diff --git a/pool_process_reporting.c b/pool_process_reporting.c index 41fb68974..c5b8ee824 100644 --- a/pool_process_reporting.c +++ b/pool_process_reporting.c @@ -212,11 +212,40 @@ void config_reporting(POOL_CONNECTION *frontend, POOL_CONNECTION_POOL *backend) len = POOLCONFIG_MAXVALLEN - strlen(status[i].value); strncat(status[i].value, pool_config->reset_query_list[j], len); len = POOLCONFIG_MAXVALLEN - strlen(status[i].value); - strncat(status[i].value, ";", len); + if (j != pool_config->num_reset_queries-1) + strncat(status[i].value, ";", len); } strncpy(status[i].desc, "queries issued at the end of session", POOLCONFIG_MAXDESCLEN); i++; + strncpy(status[i].name, "white_function_list", POOLCONFIG_MAXNAMELEN); + *(status[i].value) = '\0'; + for (j=0;j<pool_config->num_white_function_list;j++) + { + int len; + len = POOLCONFIG_MAXVALLEN - strlen(status[i].value); + strncat(status[i].value, pool_config->white_function_list[j], len); + len = POOLCONFIG_MAXVALLEN - strlen(status[i].value); + if (j != pool_config->num_white_function_list-1) + strncat(status[i].value, ",", len); + } + strncpy(status[i].desc, "functions those do not write to database", POOLCONFIG_MAXDESCLEN); + i++; + + strncpy(status[i].name, "black_function_list", POOLCONFIG_MAXNAMELEN); + *(status[i].value) = '\0'; + for (j=0;j<pool_config->num_black_function_list;j++) + { + int len; + len = POOLCONFIG_MAXVALLEN - strlen(status[i].value); + strncat(status[i].value, pool_config->black_function_list[j], len); + len = POOLCONFIG_MAXVALLEN - strlen(status[i].value); + if (j != pool_config->num_black_function_list-1) + strncat(status[i].value, ",", len); + } + strncpy(status[i].desc, "functions those write to database", POOLCONFIG_MAXDESCLEN); + i++; + strncpy(status[i].name, "print_timestamp", POOLCONFIG_MAXNAMELEN); snprintf(status[i].value, POOLCONFIG_MAXVALLEN, "%d", pool_config->print_timestamp); strncpy(status[i].desc, "if true print time stamp to each log line", POOLCONFIG_MAXDESCLEN); [parent: 4f52b4d07ed2]