Deleted Added
full compact
secondary.c (214276) secondary.c (214284)
1/*-
2 * Copyright (c) 2009-2010 The FreeBSD Foundation
3 * Copyright (c) 2010 Pawel Jakub Dawidek <pjd@FreeBSD.org>
4 * All rights reserved.
5 *
6 * This software was developed by Pawel Jakub Dawidek under sponsorship from
7 * the FreeBSD Foundation.
8 *

--- 15 unchanged lines hidden (view full) ---

24 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28 * SUCH DAMAGE.
29 */
30
31#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 2009-2010 The FreeBSD Foundation
3 * Copyright (c) 2010 Pawel Jakub Dawidek <pjd@FreeBSD.org>
4 * All rights reserved.
5 *
6 * This software was developed by Pawel Jakub Dawidek under sponsorship from
7 * the FreeBSD Foundation.
8 *

--- 15 unchanged lines hidden (view full) ---

24 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28 * SUCH DAMAGE.
29 */
30
31#include <sys/cdefs.h>
32__FBSDID("$FreeBSD: head/sbin/hastd/secondary.c 214276 2010-10-24 15:44:23Z pjd $");
32__FBSDID("$FreeBSD: head/sbin/hastd/secondary.c 214284 2010-10-24 17:28:25Z pjd $");
33
34#include <sys/param.h>
35#include <sys/time.h>
36#include <sys/bio.h>
37#include <sys/disk.h>
38#include <sys/stat.h>
39
40#include <assert.h>

--- 197 unchanged lines hidden (view full) ---

238 * local=3 remote=3 local=3 remote=4* ?! Full sync from primary.
239 * local=3 remote=3 local=4 remote=2 Split-brain condition.
240 * local=3 remote=3 local=4 remote=3 Secondary out-of-date,
241 * regular sync from primary.
242 * local=3 remote=3 local=4 remote=4* ?! Full sync from primary.
243 */
244 if (res->hr_resuid == 0) {
245 /*
33
34#include <sys/param.h>
35#include <sys/time.h>
36#include <sys/bio.h>
37#include <sys/disk.h>
38#include <sys/stat.h>
39
40#include <assert.h>

--- 197 unchanged lines hidden (view full) ---

238 * local=3 remote=3 local=3 remote=4* ?! Full sync from primary.
239 * local=3 remote=3 local=4 remote=2 Split-brain condition.
240 * local=3 remote=3 local=4 remote=3 Secondary out-of-date,
241 * regular sync from primary.
242 * local=3 remote=3 local=4 remote=4* ?! Full sync from primary.
243 */
244 if (res->hr_resuid == 0) {
245 /*
246 * Provider is used for the first time. Initialize everything.
246 * Provider is used for the first time. If primary node done no
247 * writes yet as well (we will find "virgin" argument) then
248 * there is no need to synchronize anything. If primary node
249 * done any writes already we have to synchronize everything.
247 */
248 assert(res->hr_secondary_localcnt == 0);
249 res->hr_resuid = resuid;
250 if (metadata_write(res) < 0)
251 exit(EX_NOINPUT);
250 */
251 assert(res->hr_secondary_localcnt == 0);
252 res->hr_resuid = resuid;
253 if (metadata_write(res) < 0)
254 exit(EX_NOINPUT);
252 memset(map, 0xff, mapsize);
255 if (nv_exists(nvin, "virgin")) {
256 free(map);
257 map = NULL;
258 mapsize = 0;
259 } else {
260 memset(map, 0xff, mapsize);
261 }
253 nv_add_uint8(nvout, HAST_SYNCSRC_PRIMARY, "syncsrc");
254 } else if (
255 /* Is primary is out-of-date? */
256 (res->hr_secondary_localcnt > res->hr_primary_remotecnt &&
257 res->hr_secondary_remotecnt == res->hr_primary_localcnt) ||
258 /* Node are more or less in sync? */
259 (res->hr_secondary_localcnt == res->hr_primary_remotecnt &&
260 res->hr_secondary_remotecnt == res->hr_primary_localcnt) ||

--- 490 unchanged lines hidden ---
262 nv_add_uint8(nvout, HAST_SYNCSRC_PRIMARY, "syncsrc");
263 } else if (
264 /* Is primary is out-of-date? */
265 (res->hr_secondary_localcnt > res->hr_primary_remotecnt &&
266 res->hr_secondary_remotecnt == res->hr_primary_localcnt) ||
267 /* Node are more or less in sync? */
268 (res->hr_secondary_localcnt == res->hr_primary_remotecnt &&
269 res->hr_secondary_remotecnt == res->hr_primary_localcnt) ||

--- 490 unchanged lines hidden ---