[Csync2] Younger/older test tied

Lars Ellenberg lars.ellenberg at linbit.com
Mon Nov 2 19:49:56 CET 2015


On Tue, Oct 27, 2015 at 02:25:20PM +0000, Marcus Downing wrote:
> When synchronising between two masters and one slave (client sensitive
> information sanitised, of course):
> 
> group cluster {
>         host server1 server2 (backup);
>         key /etc/csync2.key;
>         include /var/www/htdocs;
>         auto younger;
> }
> 
> 
> I've been seeing a great many errors like this on both sides:
> 
> While syncing file
> /var/www/htdocs/wp-content/themes/wireframe/widgets/search_widget.php:
> ERROR from peer server1: File is also marked dirty here!
> Do not auto-resolve conflict: Lost 'younger/older' test.

So why is that file generated simultaneously on both nodes?

> I understand that csync2 is push only, and this error is expect whenever
> the other server has more recent changes than we do. However, I'm seeing it
> on both sides, and I'm seeing it for files that haven't changed recently. I
> believe the cause is that the files' timestamps one one server have been
> updated by an external rsync, but the contents weren't changed at all.
> 
> I suggest two changes to fix this. First, csync2 needs to recognise that
> the content, timestamp and other attributes of a file are identical, ie
> that there's nothing to sync, and clear the dirty flag for that file in its
> local database.

If the stat information (as recorded by csync2) is identical,
*and* the content is identical, even if both sides are "marked dirty",
You will get "File is already up to date on peer.",
and the dirty flag is cleared (on both sides, for this host pair).

At least that is how it *should* be, and how it works for me.
So if that does not work for you, you may need to upgrade,
or come back with a test case to show how to reproduce the misbehaviour.

> 
> Second, I suggest the following line be changed:
> http://git.linbit.com/csync2.git/blob/HEAD:/update.c#l553
> 
> from
> 
> if ((localdata > remotedata) ==
> 
> 
> to:
> 
> if ((localdata >= remotedata) ==
> 
> 
> which is to say, if the timestamps on the two sides are the same it
> considers itself to have won the conflict and proceeds to sync successfully.

younger or older is exactly *not* "... or same timestamp"

IIUC, semantically you are proposing that "younger" would be changed to
"younger", but if same time stamp, "first"
  (the guy who first called csync2 --update wins)

maybe that should be made explicit, though, rather than implicitly by
only changing less-than to less-than-or-equal.  At least it deserves
some change in the documentation and a code comment.


-- 
: Lars Ellenberg
: http://www.LINBIT.com | Your Way to High Availability
: DRBD, Linux-HA  and  Pacemaker support and consulting

DRBD® and LINBIT® are registered trademarks of LINBIT, Austria.


More information about the Csync2 mailing list