Error on Backup into a network filesystem.

62 views
Skip to first unread message

Marco Casavecchia

unread,
Dec 10, 2013, 9:41:27 AM12/10/13
to pg_...@googlegroups.com
Hi all, 
recently I switched from pg_rman 1.2.2 to 1.2.6.
In my company I have a network filesystem dedicated to the backups that is mounted by the linux servers in order to make the backups in a "safe place".
So far, pg_rman executed the backups directly on those remote filesystems without issues, but when I upgraded to the 1.2.6, I got very often this error message: "ERROR: current time may be rewound. Please retry with full backup mode."

After a quick debug session, I realized that the problem was caused by a slight difference  (around 2 seconds) in the timestamps between the linux system and the NAS. Most likely it was because of the activity on the fileserver combined with a slight difference in their clocks.
Anyway, I solved it with a quick modification in the backup.c source that adds 10 seconds of tolerance to the test that checks the timestamp of the files.
( I used the already defined constant TIMEOUT_ARCHIVE for convenience reasons )

--- backup.c (revision 198)
+++ backup.c (working copy)
@@ -1251,8 +1251,10 @@
  pgFile *file = (pgFile *) parray_get(files, i);
 
  /* If current time is rewinded, abort this backup. */
- if(tv.tv_sec < file->mtime){
- elog(ERROR_SYSTEM, _("current time may be rewound. Please retry with full backup mode."));
+ /* MCM: Introduced 10 secodds of approximation that prevents issues on network filesystems */
+ /*      due to possible differences in the hosts timestamps. */
+ if((tv.tv_sec+TIMEOUT_ARCHIVE) < file->mtime){
+ elog(ERROR_SYSTEM, _("current time may be rewound. Please retry with full backup mode. (System Timestamp=%ld < Files Timestamp=%ld)"), (long)tv.tv_sec, (long)file->mtime);
  }
 
  /* check for interrupt */

I hope it can be useful even to other people and that it can become part of the next version of pg_rman.
..or at least that the problem will be fixed in a more elegant way. :)

Regards by MCM.
Reply all
Reply to author
Forward
0 new messages