View Issue Details

IDProjectCategoryView StatusLast Update
0000548Pgpool-IIBugpublic2019-12-24 09:08
ReporterharukatAssigned Tohoshiai 
PrioritylowSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
Product Version4.1 beta1 
Target Version4.1 RC1Fixed in Version4.1 RC1 
Summary0000548: syslog_facility couldn't be changed by reload
DescriptionThe parameter "syslog_facility" couldn't be changed by Pgpool-II reload, even though
the document say "this parameter can be changed by reloading the Pgpool-II configurations."
TagsNo tags attached.

Activities

harukat

2019-09-27 16:25

developer   ~0002889

When I set the C preprocessor variables HAVE_SYSLOG for build like the following,
log messages flowed as new syslog facility after pgpool reloading.

  $ CFLAGS="-g -DHAVE_SYSLOG=1" ./configure --prefix /home/postgres/tmp/pgpool2_41 \
     --with-openssl --with-memcached=/usr --with-pgsql=/home/postgres/pgsql/11.3

But even if it was a build with HAVE_SYSLOG, the command "SHOW syslog_facility"
answered the old syslog_facility value after reloding.

test environment:
 CentOS6.x, x86_64, glibc-2.12-1.209.el6_9.2, rsyslog-5.8.10-8.el6

harukat

2019-09-27 16:43

developer   ~0002891

At least, I think we need to fix configure.ac like this.

  - AC_CHECK_FUNCS([strlcat, strlcpy])
  + AC_CHECK_FUNCS([strlcat, strlcpy, syslog])

harukat

2019-09-29 09:50

developer   ~0002894

This is a patch to fix this bug.

pgpool2_41_syslog_reloadable.patch (806 bytes)
diff --git a/configure.ac b/configure.ac
index d146388..a7e715a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -85,7 +85,7 @@ AC_CHECK_LIB(PW,       main)
 AC_CHECK_LIB(resolv,   main)
 AC_CHECK_LIB(crypt,   main)
 
-AC_CHECK_FUNCS([strlcat, strlcpy])
+AC_CHECK_FUNCS([strlcat, strlcpy, syslog])
 
 dnl Checks for header files.
 AC_HEADER_STDC
diff --git a/src/include/config.h.in b/src/include/config.h.in
index 76e52c2..3aa46b5 100644
--- a/src/include/config.h.in
+++ b/src/include/config.h.in
@@ -197,6 +197,9 @@
 /* Define to 1 if `__ss_len' is a member of `struct sockaddr_storage'. */
 #undef HAVE_STRUCT_SOCKADDR_STORAGE___SS_LEN
 
+/* Define to 1 if you have the `syslog' function. */
+#undef HAVE_SYSLOG
+
 /* Define to 1 if you have the <sys/param.h> header file. */
 #undef HAVE_SYS_PARAM_H
 

hoshiai

2019-10-01 20:03

developer   ~0002897

Thank you your report and patch.
You are right, 'HAVE_SYSLOG' was not defined properly.
I fixed your patch a little. This change vsyslog to syslog because vsyslog is not used.

bug548_pgpool_4_1.patch (3,242 bytes)
diff --git a/configure b/configure
index ef182fe..04569a2 100755
--- a/configure
+++ b/configure
@@ -14594,7 +14594,7 @@ cat >>confdefs.h <<_ACEOF
 _ACEOF
 
 
-for ac_func in setsid select socket sigprocmask strdup strerror strftime strtok asprintf vasprintf gai_strerror hstrerror pstat setproctitle vsyslog
+for ac_func in setsid select socket sigprocmask strdup strerror strftime strtok asprintf vasprintf gai_strerror hstrerror pstat setproctitle syslog
 do :
   as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
 ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
diff --git a/configure.ac b/configure.ac
index e8ffcb3..3802000 100644
--- a/configure.ac
+++ b/configure.ac
@@ -266,7 +266,7 @@ AC_TYPE_SIGNAL
 AC_FUNC_VPRINTF
 AC_FUNC_WAIT3
 AC_FUNC_ACCEPT_ARGTYPES
-AC_CHECK_FUNCS(setsid select socket sigprocmask strdup strerror strftime strtok asprintf vasprintf gai_strerror hstrerror pstat setproctitle vsyslog)
+AC_CHECK_FUNCS(setsid select socket sigprocmask strdup strerror strftime strtok asprintf vasprintf gai_strerror hstrerror pstat setproctitle syslog)
 
 PGAC_C_TYPES_COMPATIBLE
 
diff --git a/src/include/config.h.in b/src/include/config.h.in
index 76e52c2..39e2661 100644
--- a/src/include/config.h.in
+++ b/src/include/config.h.in
@@ -249,7 +249,7 @@
 #undef HAVE_VSNPRINTF
 
 /* Define to 1 if you have the `vsyslog' function. */
-#undef HAVE_VSYSLOG
+#undef HAVE_SYSLOG
 
 /* Define to 1 if you have the `wait3' system call. Deprecated, you should no
    longer depend upon `wait3'. */
diff --git a/src/include/utils/elog.h b/src/include/utils/elog.h
index 4acec99..31d8038 100644
--- a/src/include/utils/elog.h
+++ b/src/include/utils/elog.h
@@ -502,7 +502,7 @@ typedef enum
 
 extern bool in_error_recursion_trouble(void);
 
-#ifdef HAVE_VSYSLOG
+#ifdef HAVE_SYSLOG
 extern void set_syslog_parameters(const char *ident, int facility);
 #endif
 
diff --git a/src/utils/error/elog.c b/src/utils/error/elog.c
index 74928e3..89d3a04 100644
--- a/src/utils/error/elog.c
+++ b/src/utils/error/elog.c
@@ -62,7 +62,7 @@
 #include <unistd.h>
 #include <signal.h>
 #include <ctype.h>
-#ifdef HAVE_VSYSLOG
+#ifdef HAVE_SYSLOG
 #include <syslog.h>
 #endif
 #include <string.h>
@@ -126,7 +126,7 @@ extern bool redirection_done;
  */
 emit_log_hook_type emit_log_hook = NULL;
 
-#ifdef HAVE_VSYSLOG
+#ifdef HAVE_SYSLOG
 
 /*
  * Max string length to send to syslog().  Note that this doesn't count the
@@ -1442,7 +1442,7 @@ GetErrorContextStack(void)
 }
 
 
-#ifdef HAVE_VSYSLOG
+#ifdef HAVE_SYSLOG
 
 /*
  * Set or update the parameters for syslog logging
@@ -1575,7 +1575,7 @@ write_syslog(int level, const char *line)
 		syslog(level, "[%lu] %s", seq, line);
 	}
 }
-#endif							/* HAVE_VSYSLOG */
+#endif							/* HAVE_SYSLOG */
 
 #ifdef WIN32
 /*
@@ -2179,7 +2179,7 @@ send_message_to_server_log(ErrorData *edata)
 		}
 	}
 
-#ifdef HAVE_VSYSLOG
+#ifdef HAVE_SYSLOG
 	/* Write to syslog, if enabled */
 	if (pool_config->log_destination & LOG_DESTINATION_SYSLOG)
 	{
@@ -2217,7 +2217,7 @@ send_message_to_server_log(ErrorData *edata)
 		}
 		write_syslog(syslog_level, buf.data);
 	}
-#endif							/* HAVE_VSYSLOG */
+#endif							/* HAVE_SYSLOG */
 
 	if (pool_config->log_destination & LOG_DESTINATION_STDERR)
 	{
bug548_pgpool_4_1.patch (3,242 bytes)

hoshiai

2019-10-08 13:17

developer   ~0002911

I commited this fix.

https://git.postgresql.org/gitweb/?p=pgpool2.git;a=commit;h=934d78132cfd2202058f0abd99e97be02244285a

hoshiai

2019-12-24 09:08

developer   ~0003027

This fix has already been fixed, so i change status of ticket to resolved

Issue History

Date Modified Username Field Change
2019-09-27 14:14 harukat New Issue
2019-09-27 14:27 hoshiai Assigned To => hoshiai
2019-09-27 14:27 hoshiai Status new => assigned
2019-09-27 16:25 harukat Note Added: 0002889
2019-09-27 16:43 harukat Note Added: 0002891
2019-09-29 09:50 harukat File Added: pgpool2_41_syslog_reloadable.patch
2019-09-29 09:50 harukat Note Added: 0002894
2019-10-01 20:03 hoshiai File Added: bug548_pgpool_4_1.patch
2019-10-01 20:03 hoshiai Note Added: 0002897
2019-10-08 13:17 hoshiai Note Added: 0002911
2019-10-16 12:43 administrator Target Version => 4.1 RC1
2019-10-16 17:39 administrator Fixed in Version => 4.1 RC1
2019-12-24 09:08 hoshiai Status assigned => resolved
2019-12-24 09:08 hoshiai Resolution open => fixed
2019-12-24 09:08 hoshiai Note Added: 0003027