[DRBD-cvs] svn commit by phil - r2601 - in trunk: . drbd drbd/linux
user - Implemented a new after-slit-brain-0pri policy: "discar
drbd-cvs at lists.linbit.com
drbd-cvs at lists.linbit.com
Sat Nov 18 11:46:57 CET 2006
Author: phil
Date: 2006-11-18 11:46:55 +0100 (Sat, 18 Nov 2006)
New Revision: 2601
Modified:
trunk/ROADMAP
trunk/drbd/drbd_receiver.c
trunk/drbd/linux/drbd.h
trunk/user/drbdsetup.c
Log:
Implemented a new after-slit-brain-0pri policy:
"discard-zero-changes"
Auto sync from the node that modified
blocks during the split brain situation, but only
if the target not did not touched a single block.
If both nodes touched their data, this policy
falls back to disconnect.
And a new after-sb-1pri & 2pri policy
"violently-as0p" Alsways take the decission of the "after-sb-0pri"
algorithm. Even if that causes case an erratic change
of the primarie's view of the data.
This is only usefull if you use an 1node FS (i.e.
not OCFS2 or GFS) with the allow-two-primaries
flag, _AND_ you really know what you are doing.
This is DANGEROUS and MAY CRASH YOUR MACHINE if you
have a FS mounted on the primary node.
To allow Simon and Ernest to run DRBD in this setup:
When running Primary/Primary if the Heartbeat connection goes down when
we recover we always split brain. Simon had an idea which I have
implemented. He is on vacation so this may not reflect his exact idea.
Essentially with this change, we do not create a new current UUID on the
node unless I/O is seen. This prevent Split-Brain mitigation when both
nodes are primary but only one node is originating I/O and never the
other. He is only stand-by in that case.
Modified: trunk/ROADMAP
===================================================================
--- trunk/ROADMAP 2006-11-16 11:47:42 UTC (rev 2600)
+++ trunk/ROADMAP 2006-11-18 10:46:55 UTC (rev 2601)
@@ -44,6 +44,15 @@
"discard-older-primary"
Auto sync from the node that became primary
as second during the split brain situation.
+ If discard-younger-primary and discard-older-primary
+ can not find a decissions, they fall back to
+ discard-least-changes.
+ "discard-zero-changes"
+ Auto sync from the node that modified
+ blocks during the split brain situation, but only
+ if the target not did not touched a single block.
+ If both nodes touched their data, this policy
+ falls back to disconnect.
"discard-least-changes"
Auto sync from the node that touched more
blocks during the split brain situation.
@@ -56,6 +65,14 @@
"consensus" ... discard the version of the secondary if the outcome
of the "after-sb-0pri" algorithm would also destroy
the current secondary's data. Otherwise disconnect.
+ "violently-as0p" Alsways take the decission of the "after-sb-0pri"
+ algorithm. Even if that causes case an erratic change
+ of the primarie's view of the data.
+ This is only usefull if you use an 1node FS (i.e.
+ not OCFS2 or GFS) with the allow-two-primaries
+ flag, _AND_ you really know what you are doing.
+ This is DANGEROUS and MAY CRASH YOUR MACHINE if you
+ have a FS mounted on the primary node.
"discard-secondary"
discard the version of the secondary.
"call-pri-lost-after-sb"
@@ -70,6 +87,14 @@
In case both nodes are primary you control DRBD's strategy by
the "after-sb-2pri" option.
"disconnect" ... Go to StandAlone mode on both sides.
+ "violently-as0p" Alsways take the decission of the "after-sb-0pri"
+ algorithm. Even if that causes case an erratic change
+ of the primarie's view of the data.
+ This is only usefull if you use an 1node FS (i.e.
+ not OCFS2 or GFS) with the allow-two-primaries
+ flag, _AND_ you really know what you are doing.
+ This is DANGEROUS and MAY CRASH YOUR MACHINE if you
+ have a FS mounted on the primary node.
"call-pri-lost-after-sb"
Honor the outcome of the "after-sb-0pri" algorithm
and calls the "pri-lost-after-sb" program on the
Modified: trunk/drbd/drbd_receiver.c
===================================================================
--- trunk/drbd/drbd_receiver.c 2006-11-16 11:47:42 UTC (rev 2600)
+++ trunk/drbd/drbd_receiver.c 2006-11-18 10:46:55 UTC (rev 2601)
@@ -1667,6 +1667,9 @@
self = mdev->bc->md.uuid[Bitmap] & 1;
peer = mdev->p_uuid[Bitmap] & 1;
+ ch_peer = mdev->p_uuid[UUID_SIZE];
+ ch_self = drbd_bm_total_weight(mdev);
+
switch ( mdev->net_conf->after_sb_0p ) {
case Consensus:
case DiscardSecondary:
@@ -1685,22 +1688,21 @@
/* Else fall through to one of the other strategies... */
WARN("Discard younger/older primary did not found a decision\n"
"Using discard-least-changes instead\n");
+ case DiscardZeroChg:
+ if( ch_peer == 0 && ch_self == 0) {
+ rv=test_bit(DISCARD_CONCURRENT,&mdev->flags) ? -1 : 1;
+ break;
+ } else {
+ if ( ch_peer == 0 ) { rv = 1; break; }
+ if ( ch_self == 0 ) { rv = -1; break; }
+ }
+ if( mdev->net_conf->after_sb_0p == DiscardZeroChg ) break;
case DiscardLeastChg:
- ch_peer = mdev->p_uuid[UUID_SIZE];
- ch_self = drbd_bm_total_weight(mdev);
if ( ch_self < ch_peer ) rv = -1;
else if ( ch_self > ch_peer ) rv = 1;
else /* ( ch_self == ch_peer ) */ {
- // Well, then use the order of the IP addresses...
- ch_self = (unsigned long)
- (((struct sockaddr_in *)mdev->net_conf->my_addr)
- ->sin_addr.s_addr);
- ch_peer = (unsigned long)
- (((struct sockaddr_in *)mdev->net_conf->peer_addr)
- ->sin_addr.s_addr);
- if ( ch_self < ch_peer ) rv = -1;
- else if ( ch_self > ch_peer ) rv = 1;
- else ERR("Everything equal!?!\n");
+ // Well, then use something else.
+ rv=test_bit(DISCARD_CONCURRENT,&mdev->flags) ? -1 : 1;
}
break;
case DiscardLocal:
@@ -1735,6 +1737,9 @@
if( hg == -1 && mdev->state.role==Secondary) rv=hg;
if( hg == 1 && mdev->state.role==Primary) rv=hg;
break;
+ case ViolentlyAS0Pri:
+ rv = drbd_asb_recover_0p(mdev);
+ break;
case DiscardSecondary:
return mdev->state.role==Primary ? 1 : -1;
case CallHelper:
@@ -1749,6 +1754,7 @@
}
} else rv = hg;
}
+
return rv;
}
@@ -1769,6 +1775,9 @@
case DiscardSecondary:
ERR("Configuration error.\n");
break;
+ case ViolentlyAS0Pri:
+ rv = drbd_asb_recover_0p(mdev);
+ break;
case Disconnect:
break;
case CallHelper:
@@ -1783,6 +1792,7 @@
}
} else rv = hg;
}
+
return rv;
}
Modified: trunk/drbd/linux/drbd.h
===================================================================
--- trunk/drbd/linux/drbd.h 2006-11-16 11:47:42 UTC (rev 2600)
+++ trunk/drbd/linux/drbd.h 2006-11-18 10:46:55 UTC (rev 2601)
@@ -55,12 +55,14 @@
Disconnect,
DiscardYoungerPri,
DiscardOlderPri,
+ DiscardZeroChg,
DiscardLeastChg,
DiscardLocal,
DiscardRemote,
Consensus,
DiscardSecondary,
- CallHelper
+ CallHelper,
+ ViolentlyAS0Pri
};
/* KEEP the order, do not delete or insert!
Modified: trunk/user/drbdsetup.c
===================================================================
--- trunk/user/drbdsetup.c 2006-11-16 11:47:42 UTC (rev 2600)
+++ trunk/user/drbdsetup.c 2006-11-18 10:46:55 UTC (rev 2601)
@@ -197,6 +197,7 @@
[Disconnect] = "disconnect",
[DiscardYoungerPri] = "discard-younger-primary",
[DiscardOlderPri] = "discard-older-primary",
+ [DiscardZeroChg] = "discard-zero-changes",
[DiscardLeastChg] = "discard-least-changes",
[DiscardLocal] = "discard-local",
[DiscardRemote] = "discard-remote"
@@ -205,12 +206,14 @@
const char *asb1p_n[] = {
[Disconnect] = "disconnect",
[Consensus] = "consensus",
+ [ViolentlyAS0Pri] = "violently-as0p",
[DiscardSecondary] = "discard-secondary",
[CallHelper] = "call-pri-lost-after-sb"
};
const char *asb2p_n[] = {
[Disconnect] = "disconnect",
+ [ViolentlyAS0Pri] = "violently-as0p",
[CallHelper] = "call-pri-lost-after-sb"
};
More information about the drbd-cvs
mailing list