r11186: - get rid of some .extra = True cases
authorStefan Metzmacher <metze@samba.org>
Wed, 19 Oct 2005 16:25:58 +0000 (16:25 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 18:44:58 +0000 (13:44 -0500)
- add multihomed vs unique section
- update conflict handling for the above case

metze
(This used to be commit c043e56efd3d72cdd5b17c78512e12285c87f221)

source4/torture/nbt/winsreplication.c
source4/wrepl_server/wrepl_apply_records.c

index 6e47861c6c287feac7ace251a14685449b327b7f..ee8f7e7883c0ae83363e0d0c13250bd568d15769 100644 (file)
@@ -847,7 +847,6 @@ static BOOL test_conflict_different_owner(struct test_wrepl_conflict_conn *ctx)
        {
                .line   = __location__,
                .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
-               .extra  = True,
                .r1     = {
                        .owner          = &ctx->b,
                        .type           = WREPL_TYPE_UNIQUE,
@@ -864,8 +863,8 @@ static BOOL test_conflict_different_owner(struct test_wrepl_conflict_conn *ctx)
                        .state          = WREPL_STATE_TOMBSTONE,
                        .node           = WREPL_NODE_B,
                        .is_static      = False,
-                       .num_ips        = ARRAY_SIZE(addresses_A_1),
-                       .ips            = addresses_A_1,
+                       .num_ips        = ARRAY_SIZE(addresses_B_1),
+                       .ips            = addresses_B_1,
                        .apply_expected = False
                }
        },
@@ -2757,6 +2756,183 @@ static BOOL test_conflict_different_owner(struct test_wrepl_conflict_conn *ctx)
                }
        },
 
+/*
+ * multi homed vs. unique section,
+ */
+       /* 
+        * mhomed,active vs. unique,active
+        * => should be replaced
+        */
+       {
+               .line   = __location__,
+               .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
+               .r1     = {
+                       .owner          = &ctx->a,
+                       .type           = WREPL_TYPE_MHOMED,
+                       .state          = WREPL_STATE_ACTIVE,
+                       .node           = WREPL_NODE_B,
+                       .is_static      = False,
+                       .num_ips        = ARRAY_SIZE(addresses_A_3_4),
+                       .ips            = addresses_A_3_4,
+                       .apply_expected = True
+               },
+               .r2     = {
+                       .owner          = &ctx->b,
+                       .type           = WREPL_TYPE_UNIQUE,
+                       .state          = WREPL_STATE_ACTIVE,
+                       .node           = WREPL_NODE_B,
+                       .is_static      = False,
+                       .num_ips        = ARRAY_SIZE(addresses_B_1),
+                       .ips            = addresses_B_1,
+                       .apply_expected = True
+               }
+       },
+
+       /* 
+        * mhomed,active vs. unique,tombstone
+        * => should NOT be replaced
+        */
+       {
+               .line   = __location__,
+               .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
+               .r1     = {
+                       .owner          = &ctx->b,
+                       .type           = WREPL_TYPE_MHOMED,
+                       .state          = WREPL_STATE_ACTIVE,
+                       .node           = WREPL_NODE_B,
+                       .is_static      = False,
+                       .num_ips        = ARRAY_SIZE(addresses_B_1),
+                       .ips            = addresses_B_1,
+                       .apply_expected = True
+               },
+               .r2     = {
+                       .owner          = &ctx->a,
+                       .type           = WREPL_TYPE_UNIQUE,
+                       .state          = WREPL_STATE_TOMBSTONE,
+                       .node           = WREPL_NODE_B,
+                       .is_static      = False,
+                       .num_ips        = ARRAY_SIZE(addresses_B_1),
+                       .ips            = addresses_B_1,
+                       .apply_expected = False
+               }
+       },
+
+       /* 
+        * mhomed,released vs. unique,active
+        * => should be replaced
+        */
+       {
+               .line   = __location__,
+               .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
+               .r1     = {
+                       .owner          = &ctx->a,
+                       .type           = WREPL_TYPE_MHOMED,
+                       .state          = WREPL_STATE_RELEASED,
+                       .node           = WREPL_NODE_B,
+                       .is_static      = False,
+                       .num_ips        = ARRAY_SIZE(addresses_A_1),
+                       .ips            = addresses_A_1,
+                       .apply_expected = False
+               },
+               .r2     = {
+                       .owner          = &ctx->b,
+                       .type           = WREPL_TYPE_UNIQUE,
+                       .state          = WREPL_STATE_ACTIVE,
+                       .node           = WREPL_NODE_B,
+                       .is_static      = False,
+                       .num_ips        = ARRAY_SIZE(addresses_B_1),
+                       .ips            = addresses_B_1,
+                       .apply_expected = True
+               }
+       },
+
+       /* 
+        * mhomed,released vs. uinique,tombstone
+        * => should be replaced
+        */
+       {
+               .line   = __location__,
+               .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
+               .r1     = {
+                       .owner          = &ctx->b,
+                       .type           = WREPL_TYPE_MHOMED,
+                       .state          = WREPL_STATE_RELEASED,
+                       .node           = WREPL_NODE_B,
+                       .is_static      = False,
+                       .num_ips        = ARRAY_SIZE(addresses_B_1),
+                       .ips            = addresses_B_1,
+                       .apply_expected = False
+               },
+               .r2     = {
+                       .owner          = &ctx->a,
+                       .type           = WREPL_TYPE_UNIQUE,
+                       .state          = WREPL_STATE_TOMBSTONE,
+                       .node           = WREPL_NODE_B,
+                       .is_static      = False,
+                       .num_ips        = ARRAY_SIZE(addresses_A_1),
+                       .ips            = addresses_A_1,
+                       .apply_expected = True
+               }
+       },
+
+       /* 
+        * mhomed,tombstone vs. unique,active
+        * => should be replaced
+        */
+       {
+               .line   = __location__,
+               .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
+               .r1     = {
+                       .owner          = &ctx->a,
+                       .type           = WREPL_TYPE_MHOMED,
+                       .state          = WREPL_STATE_TOMBSTONE,
+                       .node           = WREPL_NODE_B,
+                       .is_static      = False,
+                       .num_ips        = ARRAY_SIZE(addresses_A_1),
+                       .ips            = addresses_A_1,
+                       .apply_expected = True
+               },
+               .r2     = {
+                       .owner          = &ctx->b,
+                       .type           = WREPL_TYPE_UNIQUE,
+                       .state          = WREPL_STATE_ACTIVE,
+                       .node           = WREPL_NODE_B,
+                       .is_static      = False,
+                       .num_ips        = ARRAY_SIZE(addresses_B_1),
+                       .ips            = addresses_B_1,
+                       .apply_expected = True
+               }
+       },
+
+       /* 
+        * mhomed,tombstone vs. uinique,tombstone
+        * => should be replaced
+        */
+       {
+               .line   = __location__,
+               .name   = _NBT_NAME("_DIFF_OWNER", 0x00, NULL),
+               .r1     = {
+                       .owner          = &ctx->b,
+                       .type           = WREPL_TYPE_MHOMED,
+                       .state          = WREPL_STATE_TOMBSTONE,
+                       .node           = WREPL_NODE_B,
+                       .is_static      = False,
+                       .num_ips        = ARRAY_SIZE(addresses_B_1),
+                       .ips            = addresses_B_1,
+                       .apply_expected = True
+               },
+               .r2     = {
+                       .owner          = &ctx->a,
+                       .type           = WREPL_TYPE_UNIQUE,
+                       .state          = WREPL_STATE_TOMBSTONE,
+                       .node           = WREPL_NODE_B,
+                       .is_static      = False,
+                       .num_ips        = ARRAY_SIZE(addresses_A_1),
+                       .ips            = addresses_A_1,
+                       .apply_expected = True
+               }
+       },
+
 /*
  * multi homed vs. normal group section,
  */
@@ -2967,7 +3143,7 @@ static BOOL test_conflict_different_owner(struct test_wrepl_conflict_conn *ctx)
        },
 
        /* 
-        * mhomed,active vs. group,tombstone
+        * mhomed,active vs. sgroup,tombstone
         * => should NOT be replaced
         */
        {
@@ -3025,7 +3201,7 @@ static BOOL test_conflict_different_owner(struct test_wrepl_conflict_conn *ctx)
        },
 
        /* 
-        * mhomed,released vs. group,tombstone
+        * mhomed,released vs. sgroup,tombstone
         * => should be replaced
         */
        {
@@ -3083,7 +3259,7 @@ static BOOL test_conflict_different_owner(struct test_wrepl_conflict_conn *ctx)
        },
 
        /* 
-        * mhomed,tombstone vs. group,tombstone
+        * mhomed,tombstone vs. sgroup,tombstone
         * => should be replaced
         */
        {
index a87f06d28e80062dec45ee1c3a859ef48e1c7ff0..3d9a04369a8b32f77cdf9370089e51668b19f854 100644 (file)
@@ -192,6 +192,12 @@ static enum _R_ACTION replace_replica_replica_sgroup_vs_X(struct winsdb_record *
 }
 
 /*
+MHOMED,ACTIVE vs. UNIQUE,ACTIVE with different ip(s) => REPLACE
+MHOMED,ACTIVE vs. UNIQUE,TOMBSTONE with same ip(s) => NOT REPLACE
+MHOMED,RELEASED vs. UNIQUE,ACTIVE with different ip(s) => REPLACE
+MHOMED,RELEASED vs. UNIQUE,TOMBSTONE with different ip(s) => REPLACE
+MHOMED,TOMBSTONE vs. UNIQUE,ACTIVE with different ip(s) => REPLACE
+MHOMED,TOMBSTONE vs. UNIQUE,TOMBSTONE with different ip(s) => REPLACE
 MHOMED,ACTIVE vs. GROUP,ACTIVE with different ip(s) => REPLACE
 MHOMED,ACTIVE vs. GROUP,TOMBSTONE with same ip(s) => NOT REPLACE
 MHOMED,RELEASED vs. GROUP,ACTIVE with different ip(s) => REPLACE
@@ -207,7 +213,7 @@ MHOMED,TOMBSTONE vs. SGROUP,TOMBSTONE with different ip(s) => REPLACE
 */
 static enum _R_ACTION replace_replica_replica_mhomed_vs_X(struct winsdb_record *r1, struct wrepl_name *r2)
 {
-       if (R_IS_UNIQUE(r2) || R_IS_MHOMED(r2)) {
+       if (R_IS_MHOMED(r2)) {
                /* not handled here: MERGE */
                return R_DO_MERGE;
        }
@@ -217,7 +223,7 @@ static enum _R_ACTION replace_replica_replica_mhomed_vs_X(struct winsdb_record *
                return R_DO_REPLACE;
        }
 
-       if (R_IS_GROUP(r2) && R_IS_ACTIVE(r2)) {
+       if (!R_IS_SGROUP(r2) && R_IS_ACTIVE(r2)) {
                /* REPLACE */
                return R_DO_REPLACE;
        }