1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-11-20 00:21:35 +00:00

- Install example scripts.

- Add $pgpool_flags, $pgpool_looger, $pgpool_logger_pri variables for
  /etc/rc.conf.
- Add a patch (already submitted to upstream) to improve diag messages.
This commit is contained in:
Jun Kuriyama 2008-03-07 01:58:15 +00:00
parent af2645c57a
commit c21b0af0b5
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=208549
16 changed files with 324 additions and 8 deletions

View File

@ -7,6 +7,7 @@
PORTNAME= pgpool-II
PORTVERSION= 2.0.1
PORTREVISION= 1
CATEGORIES= databases
MASTER_SITES= http://pgfoundry.org/frs/download.php/1521/
@ -32,9 +33,13 @@ post-patch:
${WRKSRC}/configure
pre-install:
${MKDIR} ${DATADIR}
${MKDIR} ${DATADIR} ${EXAMPLESDIR}
post-install:
${INSTALL_DATA} ${WRKSRC}/sample/dist_def_pgbench.sql ${DATADIR}
.for f in pgpool_recovery pgpool_recovery_pitr pgpool_remote_start
${INSTALL_SCRIPT} ${WRKSRC}/sample/${f} ${EXAMPLESDIR}
.endfor
.if !defined(NOPORTDOCS)
@${MKDIR} ${DOCSDIR}
.for f in ${PORTDOCS}

View File

@ -0,0 +1,53 @@
--- main.c.orig 2007-11-09 13:37:35.000000000 +0900
+++ main.c 2008-03-03 10:24:27.651654702 +0900
@@ -836,7 +836,13 @@
status = bind(fd, (struct sockaddr *)&addr, len);
if (status == -1)
{
- pool_error("bind() failed. reason: %s", strerror(errno));
+ char *host = "", *serv = "";
+ char hostname[NI_MAXHOST], servname[NI_MAXSERV];
+ if (getnameinfo(&addr, len, hostname, sizeof(hostname), servname, sizeof(servname), 0) == 0) {
+ host = hostname;
+ serv = servname;
+ }
+ pool_error("bind(%s:%s) failed. reason: %s", host, serv, strerror(errno));
myexit(1);
}
@@ -872,7 +878,7 @@
status = bind(fd, (struct sockaddr *)&addr, len);
if (status == -1)
{
- pool_error("bind() failed. reason: %s", strerror(errno));
+ pool_error("bind(%s) failed. reason: %s", addr.sun_path, strerror(errno));
myexit(1);
}
@@ -891,6 +897,12 @@
return fd;
}
+static void myunlink(const char* path)
+{
+ if (unlink(path) == 0) return;
+ pool_error("unlink(%s) failed: %s", path, strerror(errno));
+}
+
static void myexit(int code)
{
char path[POOLMAXPATHLEN];
@@ -917,10 +929,10 @@
POOL_SETMASK(&UnBlockSig);
}
- unlink(un_addr.sun_path);
- unlink(pcp_un_addr.sun_path);
+ myunlink(un_addr.sun_path);
+ myunlink(pcp_un_addr.sun_path);
snprintf(path, sizeof(path), "%s/%s", pool_config->logdir, PID_FILE_NAME);
- unlink(path);
+ myunlink(path);
pool_shmem_exit(code);
exit(code);

View File

@ -13,6 +13,9 @@
# Set it to YES to enable pgpool.
# pgpool_conf (file): Set location of your config.
# Default is "%%PREFIX%%/etc/pgpool.conf"
# pgpool_flags (string): Default is "-f $pgpool_conf"
# pgpool_looger (bool): Use logger for logging.
# pgpool_looger_pri (string): logger priority (default "local0.info").
# pgpool_user (uid): User ID to run as (default nobody)
#
@ -25,12 +28,26 @@ load_rc_config $name
: ${pgpool_enable="NO"}
: ${pgpool_conf="%%PREFIX%%/etc/pgpool.conf"}
: ${pgpool_flags="-f ${pgpool_conf}"}
: ${pgpool_user="nobody"}
: ${pgpool_logger="YES"}
: ${pgpool_logger_pri="local0.info"}
command="%%PREFIX%%/bin/pgpool"
command_args="-f ${pgpool_conf}"
command_args="${pgpool_flags}"
start_cmd="pgpool_start"
stop_cmd="${command} ${command_args} stop"
required_files="${pgpool_conf}"
pgpool_start()
{
if checkyesno pgpool_logger; then
su -m $pgpool_user -c "sh -c \"$command $command_args -n 2>&1 | logger -t $name -p $pgpool_logger_pri &\""
else
unset start_cmd
run_rc_command start
fi
}
run_rc_command "$1"

View File

@ -19,6 +19,10 @@ lib/libpcp.a
lib/libpcp.la
lib/libpcp.so
lib/libpcp.so.0
%%DATADIR%%/dist_def_pgbench.sql
%%DATADIR%%/pgpool.pam
%%DATADIR%%/system_db.sql
%%EXAMPLESDIR%%/pgpool_recovery
%%EXAMPLESDIR%%/pgpool_recovery_pitr
%%EXAMPLESDIR%%/pgpool_remote_start
@dirrm %%DATADIR%%

View File

@ -7,6 +7,7 @@
PORTNAME= pgpool-II
PORTVERSION= 2.0.1
PORTREVISION= 1
CATEGORIES= databases
MASTER_SITES= http://pgfoundry.org/frs/download.php/1521/
@ -32,9 +33,13 @@ post-patch:
${WRKSRC}/configure
pre-install:
${MKDIR} ${DATADIR}
${MKDIR} ${DATADIR} ${EXAMPLESDIR}
post-install:
${INSTALL_DATA} ${WRKSRC}/sample/dist_def_pgbench.sql ${DATADIR}
.for f in pgpool_recovery pgpool_recovery_pitr pgpool_remote_start
${INSTALL_SCRIPT} ${WRKSRC}/sample/${f} ${EXAMPLESDIR}
.endfor
.if !defined(NOPORTDOCS)
@${MKDIR} ${DOCSDIR}
.for f in ${PORTDOCS}

View File

@ -0,0 +1,53 @@
--- main.c.orig 2007-11-09 13:37:35.000000000 +0900
+++ main.c 2008-03-03 10:24:27.651654702 +0900
@@ -836,7 +836,13 @@
status = bind(fd, (struct sockaddr *)&addr, len);
if (status == -1)
{
- pool_error("bind() failed. reason: %s", strerror(errno));
+ char *host = "", *serv = "";
+ char hostname[NI_MAXHOST], servname[NI_MAXSERV];
+ if (getnameinfo(&addr, len, hostname, sizeof(hostname), servname, sizeof(servname), 0) == 0) {
+ host = hostname;
+ serv = servname;
+ }
+ pool_error("bind(%s:%s) failed. reason: %s", host, serv, strerror(errno));
myexit(1);
}
@@ -872,7 +878,7 @@
status = bind(fd, (struct sockaddr *)&addr, len);
if (status == -1)
{
- pool_error("bind() failed. reason: %s", strerror(errno));
+ pool_error("bind(%s) failed. reason: %s", addr.sun_path, strerror(errno));
myexit(1);
}
@@ -891,6 +897,12 @@
return fd;
}
+static void myunlink(const char* path)
+{
+ if (unlink(path) == 0) return;
+ pool_error("unlink(%s) failed: %s", path, strerror(errno));
+}
+
static void myexit(int code)
{
char path[POOLMAXPATHLEN];
@@ -917,10 +929,10 @@
POOL_SETMASK(&UnBlockSig);
}
- unlink(un_addr.sun_path);
- unlink(pcp_un_addr.sun_path);
+ myunlink(un_addr.sun_path);
+ myunlink(pcp_un_addr.sun_path);
snprintf(path, sizeof(path), "%s/%s", pool_config->logdir, PID_FILE_NAME);
- unlink(path);
+ myunlink(path);
pool_shmem_exit(code);
exit(code);

View File

@ -13,6 +13,9 @@
# Set it to YES to enable pgpool.
# pgpool_conf (file): Set location of your config.
# Default is "%%PREFIX%%/etc/pgpool.conf"
# pgpool_flags (string): Default is "-f $pgpool_conf"
# pgpool_looger (bool): Use logger for logging.
# pgpool_looger_pri (string): logger priority (default "local0.info").
# pgpool_user (uid): User ID to run as (default nobody)
#
@ -25,12 +28,26 @@ load_rc_config $name
: ${pgpool_enable="NO"}
: ${pgpool_conf="%%PREFIX%%/etc/pgpool.conf"}
: ${pgpool_flags="-f ${pgpool_conf}"}
: ${pgpool_user="nobody"}
: ${pgpool_logger="YES"}
: ${pgpool_logger_pri="local0.info"}
command="%%PREFIX%%/bin/pgpool"
command_args="-f ${pgpool_conf}"
command_args="${pgpool_flags}"
start_cmd="pgpool_start"
stop_cmd="${command} ${command_args} stop"
required_files="${pgpool_conf}"
pgpool_start()
{
if checkyesno pgpool_logger; then
su -m $pgpool_user -c "sh -c \"$command $command_args -n 2>&1 | logger -t $name -p $pgpool_logger_pri &\""
else
unset start_cmd
run_rc_command start
fi
}
run_rc_command "$1"

View File

@ -19,6 +19,10 @@ lib/libpcp.a
lib/libpcp.la
lib/libpcp.so
lib/libpcp.so.0
%%DATADIR%%/dist_def_pgbench.sql
%%DATADIR%%/pgpool.pam
%%DATADIR%%/system_db.sql
%%EXAMPLESDIR%%/pgpool_recovery
%%EXAMPLESDIR%%/pgpool_recovery_pitr
%%EXAMPLESDIR%%/pgpool_remote_start
@dirrm %%DATADIR%%

View File

@ -7,6 +7,7 @@
PORTNAME= pgpool-II
PORTVERSION= 2.0.1
PORTREVISION= 1
CATEGORIES= databases
MASTER_SITES= http://pgfoundry.org/frs/download.php/1521/
@ -32,9 +33,13 @@ post-patch:
${WRKSRC}/configure
pre-install:
${MKDIR} ${DATADIR}
${MKDIR} ${DATADIR} ${EXAMPLESDIR}
post-install:
${INSTALL_DATA} ${WRKSRC}/sample/dist_def_pgbench.sql ${DATADIR}
.for f in pgpool_recovery pgpool_recovery_pitr pgpool_remote_start
${INSTALL_SCRIPT} ${WRKSRC}/sample/${f} ${EXAMPLESDIR}
.endfor
.if !defined(NOPORTDOCS)
@${MKDIR} ${DOCSDIR}
.for f in ${PORTDOCS}

View File

@ -0,0 +1,53 @@
--- main.c.orig 2007-11-09 13:37:35.000000000 +0900
+++ main.c 2008-03-03 10:24:27.651654702 +0900
@@ -836,7 +836,13 @@
status = bind(fd, (struct sockaddr *)&addr, len);
if (status == -1)
{
- pool_error("bind() failed. reason: %s", strerror(errno));
+ char *host = "", *serv = "";
+ char hostname[NI_MAXHOST], servname[NI_MAXSERV];
+ if (getnameinfo(&addr, len, hostname, sizeof(hostname), servname, sizeof(servname), 0) == 0) {
+ host = hostname;
+ serv = servname;
+ }
+ pool_error("bind(%s:%s) failed. reason: %s", host, serv, strerror(errno));
myexit(1);
}
@@ -872,7 +878,7 @@
status = bind(fd, (struct sockaddr *)&addr, len);
if (status == -1)
{
- pool_error("bind() failed. reason: %s", strerror(errno));
+ pool_error("bind(%s) failed. reason: %s", addr.sun_path, strerror(errno));
myexit(1);
}
@@ -891,6 +897,12 @@
return fd;
}
+static void myunlink(const char* path)
+{
+ if (unlink(path) == 0) return;
+ pool_error("unlink(%s) failed: %s", path, strerror(errno));
+}
+
static void myexit(int code)
{
char path[POOLMAXPATHLEN];
@@ -917,10 +929,10 @@
POOL_SETMASK(&UnBlockSig);
}
- unlink(un_addr.sun_path);
- unlink(pcp_un_addr.sun_path);
+ myunlink(un_addr.sun_path);
+ myunlink(pcp_un_addr.sun_path);
snprintf(path, sizeof(path), "%s/%s", pool_config->logdir, PID_FILE_NAME);
- unlink(path);
+ myunlink(path);
pool_shmem_exit(code);
exit(code);

View File

@ -13,6 +13,9 @@
# Set it to YES to enable pgpool.
# pgpool_conf (file): Set location of your config.
# Default is "%%PREFIX%%/etc/pgpool.conf"
# pgpool_flags (string): Default is "-f $pgpool_conf"
# pgpool_looger (bool): Use logger for logging.
# pgpool_looger_pri (string): logger priority (default "local0.info").
# pgpool_user (uid): User ID to run as (default nobody)
#
@ -25,12 +28,26 @@ load_rc_config $name
: ${pgpool_enable="NO"}
: ${pgpool_conf="%%PREFIX%%/etc/pgpool.conf"}
: ${pgpool_flags="-f ${pgpool_conf}"}
: ${pgpool_user="nobody"}
: ${pgpool_logger="YES"}
: ${pgpool_logger_pri="local0.info"}
command="%%PREFIX%%/bin/pgpool"
command_args="-f ${pgpool_conf}"
command_args="${pgpool_flags}"
start_cmd="pgpool_start"
stop_cmd="${command} ${command_args} stop"
required_files="${pgpool_conf}"
pgpool_start()
{
if checkyesno pgpool_logger; then
su -m $pgpool_user -c "sh -c \"$command $command_args -n 2>&1 | logger -t $name -p $pgpool_logger_pri &\""
else
unset start_cmd
run_rc_command start
fi
}
run_rc_command "$1"

View File

@ -19,6 +19,10 @@ lib/libpcp.a
lib/libpcp.la
lib/libpcp.so
lib/libpcp.so.0
%%DATADIR%%/dist_def_pgbench.sql
%%DATADIR%%/pgpool.pam
%%DATADIR%%/system_db.sql
%%EXAMPLESDIR%%/pgpool_recovery
%%EXAMPLESDIR%%/pgpool_recovery_pitr
%%EXAMPLESDIR%%/pgpool_remote_start
@dirrm %%DATADIR%%

View File

@ -7,6 +7,7 @@
PORTNAME= pgpool-II
PORTVERSION= 2.0.1
PORTREVISION= 1
CATEGORIES= databases
MASTER_SITES= http://pgfoundry.org/frs/download.php/1521/
@ -32,9 +33,13 @@ post-patch:
${WRKSRC}/configure
pre-install:
${MKDIR} ${DATADIR}
${MKDIR} ${DATADIR} ${EXAMPLESDIR}
post-install:
${INSTALL_DATA} ${WRKSRC}/sample/dist_def_pgbench.sql ${DATADIR}
.for f in pgpool_recovery pgpool_recovery_pitr pgpool_remote_start
${INSTALL_SCRIPT} ${WRKSRC}/sample/${f} ${EXAMPLESDIR}
.endfor
.if !defined(NOPORTDOCS)
@${MKDIR} ${DOCSDIR}
.for f in ${PORTDOCS}

View File

@ -0,0 +1,53 @@
--- main.c.orig 2007-11-09 13:37:35.000000000 +0900
+++ main.c 2008-03-03 10:24:27.651654702 +0900
@@ -836,7 +836,13 @@
status = bind(fd, (struct sockaddr *)&addr, len);
if (status == -1)
{
- pool_error("bind() failed. reason: %s", strerror(errno));
+ char *host = "", *serv = "";
+ char hostname[NI_MAXHOST], servname[NI_MAXSERV];
+ if (getnameinfo(&addr, len, hostname, sizeof(hostname), servname, sizeof(servname), 0) == 0) {
+ host = hostname;
+ serv = servname;
+ }
+ pool_error("bind(%s:%s) failed. reason: %s", host, serv, strerror(errno));
myexit(1);
}
@@ -872,7 +878,7 @@
status = bind(fd, (struct sockaddr *)&addr, len);
if (status == -1)
{
- pool_error("bind() failed. reason: %s", strerror(errno));
+ pool_error("bind(%s) failed. reason: %s", addr.sun_path, strerror(errno));
myexit(1);
}
@@ -891,6 +897,12 @@
return fd;
}
+static void myunlink(const char* path)
+{
+ if (unlink(path) == 0) return;
+ pool_error("unlink(%s) failed: %s", path, strerror(errno));
+}
+
static void myexit(int code)
{
char path[POOLMAXPATHLEN];
@@ -917,10 +929,10 @@
POOL_SETMASK(&UnBlockSig);
}
- unlink(un_addr.sun_path);
- unlink(pcp_un_addr.sun_path);
+ myunlink(un_addr.sun_path);
+ myunlink(pcp_un_addr.sun_path);
snprintf(path, sizeof(path), "%s/%s", pool_config->logdir, PID_FILE_NAME);
- unlink(path);
+ myunlink(path);
pool_shmem_exit(code);
exit(code);

View File

@ -13,6 +13,9 @@
# Set it to YES to enable pgpool.
# pgpool_conf (file): Set location of your config.
# Default is "%%PREFIX%%/etc/pgpool.conf"
# pgpool_flags (string): Default is "-f $pgpool_conf"
# pgpool_looger (bool): Use logger for logging.
# pgpool_looger_pri (string): logger priority (default "local0.info").
# pgpool_user (uid): User ID to run as (default nobody)
#
@ -25,12 +28,26 @@ load_rc_config $name
: ${pgpool_enable="NO"}
: ${pgpool_conf="%%PREFIX%%/etc/pgpool.conf"}
: ${pgpool_flags="-f ${pgpool_conf}"}
: ${pgpool_user="nobody"}
: ${pgpool_logger="YES"}
: ${pgpool_logger_pri="local0.info"}
command="%%PREFIX%%/bin/pgpool"
command_args="-f ${pgpool_conf}"
command_args="${pgpool_flags}"
start_cmd="pgpool_start"
stop_cmd="${command} ${command_args} stop"
required_files="${pgpool_conf}"
pgpool_start()
{
if checkyesno pgpool_logger; then
su -m $pgpool_user -c "sh -c \"$command $command_args -n 2>&1 | logger -t $name -p $pgpool_logger_pri &\""
else
unset start_cmd
run_rc_command start
fi
}
run_rc_command "$1"

View File

@ -19,6 +19,10 @@ lib/libpcp.a
lib/libpcp.la
lib/libpcp.so
lib/libpcp.so.0
%%DATADIR%%/dist_def_pgbench.sql
%%DATADIR%%/pgpool.pam
%%DATADIR%%/system_db.sql
%%EXAMPLESDIR%%/pgpool_recovery
%%EXAMPLESDIR%%/pgpool_recovery_pitr
%%EXAMPLESDIR%%/pgpool_remote_start
@dirrm %%DATADIR%%