Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 22 Mar 2011 20:27:26 +0000 (UTC)
From:      Mikolaj Golub <trociny@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r219882 - head/sbin/hastd
Message-ID:  <201103222027.p2MKRQ8R070214@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: trociny
Date: Tue Mar 22 20:27:26 2011
New Revision: 219882
URL: http://svn.freebsd.org/changeset/base/219882

Log:
  After synchronization is complete we should make primary counters be
  equal to secondary counters:
  
    primary_localcnt = secondary_remotecnt
    primary_remotecnt = secondary_localcnt
  
  Previously it was done wrong and split-brain was observed after
  primary had synchronized up-to-date data from secondary.
  
  Approved by:	pjd (mentor)
  MFC after:	1 week

Modified:
  head/sbin/hastd/primary.c

Modified: head/sbin/hastd/primary.c
==============================================================================
--- head/sbin/hastd/primary.c	Tue Mar 22 20:00:27 2011	(r219881)
+++ head/sbin/hastd/primary.c	Tue Mar 22 20:27:26 2011	(r219882)
@@ -1757,13 +1757,13 @@ sync_thread(void *arg __unused)
 				mtx_lock(&metadata_lock);
 				res->hr_syncsrc = HAST_SYNCSRC_UNDEF;
 				res->hr_primary_localcnt =
-				    res->hr_secondary_localcnt;
-				res->hr_primary_remotecnt =
 				    res->hr_secondary_remotecnt;
+				res->hr_primary_remotecnt =
+				    res->hr_secondary_localcnt;
 				pjdlog_debug(1,
 				    "Setting localcnt to %ju and remotecnt to %ju.",
 				    (uintmax_t)res->hr_primary_localcnt,
-				    (uintmax_t)res->hr_secondary_localcnt);
+				    (uintmax_t)res->hr_primary_remotecnt);
 				(void)metadata_write(res);
 				mtx_unlock(&metadata_lock);
 			}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201103222027.p2MKRQ8R070214>