Christian Kruse
bbb67c55f6
simple past of set is set
2014-01-23 10:50:37 +01:00
Christian Kruse
c2c48a9fe6
removed already finished TODO tasks
2014-01-23 10:48:04 +01:00
Christian Kruse
9d6ac2ebf9
fixed documentation and line endings
2014-01-23 10:39:21 +01:00
Christian Kruse
680f23fb1d
copyright push
2014-01-23 10:37:49 +01:00
Christian Kruse
1159113c58
ignore the dynamic shared memory directory, too
2014-01-23 10:02:32 +01:00
Christian Kruse
f25a709454
added an explicit type cast to avoid compiler warnings
2014-01-22 15:17:47 +01:00
Christian Kruse
897daddcc7
removed not needed arguments to avoid compiler warnings
2014-01-22 15:17:28 +01:00
Christian Kruse
0fdcce0477
use if instead of switch and avoid a warning
2014-01-22 15:12:29 +01:00
Christian Kruse
de58eff7c1
added a chdir() for proper daemonizing
2014-01-22 14:30:38 +01:00
Christian Kruse
f2a0b31a20
more log format fixes
2014-01-22 14:30:24 +01:00
Christian Kruse
e007a55967
fix: do not use fsync()
...
We do not need fsync(), the fflush() is enough to avoid concurrent
logs.
2014-01-22 11:47:50 +01:00
Christian Kruse
d235c696af
fix: do not newline at the start of a log line
...
This breaks the log file format since it will have a line break directly
after the timestamp
2014-01-22 11:47:02 +01:00
Christian Kruse
4ef6fbb5fe
do not close stderr but reopen it to /dev/null
...
We want stderr to be always a valid file descriptor
2014-01-21 16:25:57 +01:00
Christian Kruse
2e61d7b156
refactoring: daemonizing is now a function
2014-01-21 16:19:49 +01:00
Christian Kruse
4496a0761e
we now use a function and are more sophisticated
...
Refactoring part: we now use a function to generate the PID
file. Sophistication: we now check if the PID contained in the file is a
valid PID. We ignore the file if it doesn't.
2014-01-21 16:18:15 +01:00
Christian Kruse
3978ead184
use a second fork to avoid a terminal
...
after the setsid() we are the process leader. And as a process leader we
are able to open a new terminal, even if we currently don't own one. So
we do another fork and do not call setsid() and not become a process
leader to avoid that.
2014-01-21 15:51:33 +01:00
Christian Kruse
b36dbf61fe
reopening stdin and stdout to /dev/null now
...
stdin, stdout and stderr should always be valid file handles. Thus we
don't close them but reopen them to /dev/null
2014-01-21 15:31:38 +01:00
Christian Kruse
84466ecca5
log_crit() is more appropriate
2014-01-21 15:23:20 +01:00
Christian Kruse
649086e5e4
use unlink() instead of remove()
...
`remove()` will do a rmdir if necessary - we don't want that. So we use `unlink()`
2014-01-21 15:22:31 +01:00
Christian Kruse
7cf2eb440d
renamed config options to a much more descriptive name
2014-01-21 15:19:50 +01:00
Christian Kruse
388bbfb773
split install target into install_prog and install_ext
...
Patch by Marco Nenciarini <mnencia@debian.org >
2014-01-21 14:23:33 +01:00
Christian Kruse
a89aa02c68
fix: make pg_config be settable from outside the makefile
...
Patch by Marco Nenciarini <mnencia@debian.org >
2014-01-21 14:22:59 +01:00
Christian Kruse
c81793b63f
fix: added forgotten options.priority value
...
Patch by Marco Nenciarini <mnencia@debian.org >
2014-01-21 14:18:12 +01:00
Christian Kruse
b4e83cf188
Add format attribute checking for printf() like functions
...
Patch by Marco Nenciarini <mnencia@debian.org >
2014-01-21 14:14:36 +01:00
Christian Kruse
1db61ce277
fix: fail when repmgr_funcs is not pre-loaded
...
when repmgr_funcs is not pre-loaded `repmgr_update_standby_location()`
will return false and `repmgr_get_last_standby_location()` will return
an empty string. Thus we may end in an endless loop. To avoid that we fail.
2014-01-21 13:54:10 +01:00
Christian Kruse
41abf9a7ef
fix: flushing and fsync()ing the log file
...
When not flushing and fsync()ing it the output may be garbled due to
concurrent writes to the file (system() spawns a child process with
stdin/stdout/stderr inherited from it's parent)
2014-01-21 13:52:27 +01:00
Christian Kruse
abebc53ddc
fix: sscanf() does not set variables to 0 on error
2014-01-21 13:48:41 +01:00
Christian Kruse
5fc4a0382f
added config options sleep_delay and sleep_monitor
...
sleep_monitor replaces the old SLEEP_MONITOR define and makes it
configurable; this is the interval in which we monitor
sleep_delay replaces the old sleep(300) when waiting for the master to
recover.
2014-01-17 14:35:50 +01:00
Christian Kruse
a7d3c9b93a
fix: also close stderr when using syslog logging
2014-01-17 12:14:26 +01:00
Christian Kruse
ee9dc9e247
do not use exit()
...
We avoid using exit() to be able to clean up when we have to
terminate. This includes removal of the PID file as well as closing
database connections.
2014-01-17 11:28:55 +01:00
Christian Kruse
94cb5b94e7
fix: reopen log file on SIGHUP
2014-01-16 17:16:45 +01:00
Christian Kruse
a08aa50f92
fix: close stdin and stdout only in repmgrd
...
closing stdin and stdout might cause problems when using system(), so we
avoid it.
2014-01-16 16:01:58 +01:00
Christian Kruse
9563877fbb
new config option, stdout/stdin closed
...
Now stdin and stdout get closed. Additionally stderr gets closed and
reopened to the new config option „logfile“ if specified
2014-01-16 15:22:34 +01:00
Christian Kruse
4f3bd6612c
do not exit in getMasterConnection()
2014-01-16 15:07:15 +01:00
Christian Kruse
192ee3cdb0
do not exit in get_cluster_size
2014-01-16 15:07:06 +01:00
Christian Kruse
6f149ead8f
do not exit in guc_setted and guc_setted_typed
2014-01-16 14:48:46 +01:00
Christian Kruse
77aa6aa326
do not exit in pg_version
2014-01-16 14:48:42 +01:00
Christian Kruse
18206b3a64
do not exit() in is_witness
2014-01-16 14:28:56 +01:00
Christian Kruse
91446bcf93
fix: do not try to reconnect infinitely
2014-01-10 17:26:02 +01:00
Christian Kruse
dcdf8788ae
fix: handle connection loss to standby
...
We do basically the same as we do for the master since connections drop
from time to time
2014-01-10 17:12:03 +01:00
Christian Kruse
4fabfbbbd0
fix: do not exit in is_standby()
...
Instead we now return an int with 0 meaning „not a standby,“ 1 meaning
„is a standby“ and -1 meaning „connection dropped“
2014-01-10 17:11:16 +01:00
Christian Kruse
c41030b40e
Merge branch 'REL2_0_STABLE'
...
Conflicts:
HISTORY
dbutils.h
repmgr.c
repmgrd.c
version.h
2014-01-10 16:07:33 +01:00
Christian Kruse
a0fdadd5d2
this way it is much cleaner
2014-01-09 15:35:44 +01:00
Christian Kruse
4c3d7f80ed
now code compiles with -ansi -pedantic and has less warnings
2014-01-09 14:45:07 +01:00
Christian Kruse
6e3fe059d8
added config options pg_bindir and pg_ctl_options
2014-01-09 14:44:34 +01:00
Christian Kruse
9f26254ac3
fix: added some missing initializers to avoid compiler warning
2014-01-09 13:33:22 +01:00
Christian Kruse
0e8ff1730e
added handling of a PID file
2014-01-09 13:04:40 +01:00
Christian Kruse
634fdff303
fix: do not call setup_event_handlers() on WIN32
...
If we put setup_event_handlers() in #ifdef WIN32, we have to do it for
the call and the declaration, too
2014-01-09 12:57:16 +01:00
Christian Kruse
cbce29f009
fixed typos
2014-01-08 11:55:03 +01:00
Christian Kruse
920f925e4b
added a new cli option --daemonize
...
This option forks the process and generates a new session. This
effectively detaches it from the shell. Don't forget to redirect stderr
or use syslog for logging!
2014-01-08 11:53:15 +01:00