Those per se are not that annoying, but the random messages generated
by the backend while pg_arman is waiting for segments to be archived
are annoying. This commit gets rid of them by using client_min_messages
set to warning on the connection used.
Report by Yury Zhuravlev.
If the target path is too long, an error needs to be emitted as well.
The buffer is correctly null-terminated, this will just avoid running
into weird problems should the target have a too long name.
IsDir was somewhat optimized on systems where DT_DIR (dirent.d_type
being not part of the POSIX spec) is present on some systems leading
to more complex logic depending on the file system used, particularly
on XFS this routine was actually broken. Having a call to stat()
should not be that expensive to check if a path is a directory or
not and this is proving to be far more stable coding, so just rely
on that, that's more portable anyway and will avoid future surprises.
Report by Yury Zhuravlev, though I did not use his patch.
This restriction has been inherited from the upstream project pg_rman, however
the new differential facility is proving to be able to address that need quite
nicely after more testing regarding that.
Mentioned by Thomas Reiss.
All the ERROR_* fields are removed in favor of a more simple layer
made of ERROR, FATAL, PANIC. The two last ones are not actually used
yet, thought there should be some code paths that would need more
polishing on this matter.
The error message emitted before leaving should be fine to let the
user know what is happening.
During the execution of the "delete" command, the oldest start LSN is saved
and used to determine what is the oldest WAL segment that needs to be kept
for the existing backups. Like pg_archivecleanup, the implemented logic
ignores the timeline part of the WAL segment name, ensuring that a segment
from a parent timeline will not be removed prematurely. This logic could
be made more complicated regarding this matter, but in order to take backups
from a node on a given timeline this is far enough.
This commit improves the performance of page-level, or differential
backup, by not having to scan anymore all the pages of a relation file,
something that can be very long on large data sets, but by scanning the
list of blocks changed by WAL records since the last full or differential
backup.
As a restriction and to avoid potential data corruption should hint-bit
updates occur on a page, backups can only be taken from a server that has
wal_log_hints or data checksums enabled.
Base patch by Yury Zhuravlev, heavily modified by me.
The tests now rely on --verbose to print out useful information in the
logs that can be used for debugging purposes. In case of a failure in
some of the tests an overall cleanup is not done, this is particularly
useful for PGDATA which could still be used for extra failure analysis.
--debug and --verbose had actually the same meaning as they were aimed
at giving to the user information regarding how the process is running,
hence both options are merged into --verbose and use elog(LOG) to decide
if a given message should be printed out depending on the verbosity of
the call. This makes a couple of routines more readable as they do not
depend on any boolean checks.
The "_()" have been removed from the code, those are aimed at being used
for translation but having them mandatorily in each log message is just
useless noise. If needed, pgut.c should be updated in consequence to
have a more portable facility.
At the same time this commit takes care of putting into correct shape
some code paths more in-line with PostgreSQL policy. There are surely
more of this kind of ugly stuff but at this stage things are more simple
and more manageable.
Performance of compression is quite questionable on many objects like
that and makes the routines aimed at managing file copy, backup and restore
more complicated than they should be.
This commit results in a largely simplified code in data.c, which will
be helpful when integrating differential backup using WAL file lookup.
-DFRONTEND should be overridden as part of CPPFLAGS and it is not really
necessary to have the source list. The definition of pg_arman.h was rather
obscure as well.
This new facility has the advantage on not relying on static data when
generating the tests making the whole facility more robust. This is
basically taken from the upstream project pg_rman and adapted for the
sake of this pet project, so most of the credit go to Kyotaro Horiguchi
and Amit Langote regarding this facility. However I have adapted a bunch
of things and fixed a lot of redundancy and code duplication.