Author: kfujino
Date: Wed Jun 17 08:27:05 2015
New Revision: 1685937
URL: http://svn.apache.org/r1685937
Log:
When failed to replication, rather than all member is handled as a failed
member, exclude the failure members from backup members.
Modified:
tomcat/tc8.0.x/trunk/java/org/apache/catalina/tribes/tipis/LocalStrings.properties
tomcat/tc8.0.x/trunk/java/org/apache/catalina/tribes/tipis/ReplicatedMap.java
tomcat/tc8.0.x/trunk/webapps/docs/changelog.xml
Modified:
tomcat/tc8.0.x/trunk/java/org/apache/catalina/tribes/tipis/LocalStrings.properties
URL:
http://svn.apache.org/viewvc/tomcat/tc8.0.x/trunk/java/org/apache/catalina/tribes/tipis/LocalStrings.properties?rev=1685937&r1=1685936&r2=1685937&view=diff
==============================================================================
---
tomcat/tc8.0.x/trunk/java/org/apache/catalina/tribes/tipis/LocalStrings.properties
(original)
+++
tomcat/tc8.0.x/trunk/java/org/apache/catalina/tribes/tipis/LocalStrings.properties
Wed Jun 17 08:27:05 2015
@@ -40,4 +40,5 @@ lazyReplicatedMap.unableReplicate.backup
lazyReplicatedMap.unableReplicate.proxy=Unable to replicate proxy key:{0} to
backup:{1}. Reason:{2}
replicatedMap.member.disappeared=Member[{0}] disappeared. Related map entries
will be relocated to the new node.
replicatedMap.unable.relocate=Unable to relocate[{0}] to a new backup node
-replicatedMap.relocate.complete=Relocation of map entries was complete in {0}
ms.
\ No newline at end of file
+replicatedMap.relocate.complete=Relocation of map entries was complete in {0}
ms.
+replicatedMap.unableReplicate.completely=Unable to replicate backup key:{0}.
Success nodes:{1}. Failed nodes:{2}.
\ No newline at end of file
Modified:
tomcat/tc8.0.x/trunk/java/org/apache/catalina/tribes/tipis/ReplicatedMap.java
URL:
http://svn.apache.org/viewvc/tomcat/tc8.0.x/trunk/java/org/apache/catalina/tribes/tipis/ReplicatedMap.java?rev=1685937&r1=1685936&r2=1685937&view=diff
==============================================================================
---
tomcat/tc8.0.x/trunk/java/org/apache/catalina/tribes/tipis/ReplicatedMap.java
(original)
+++
tomcat/tc8.0.x/trunk/java/org/apache/catalina/tribes/tipis/ReplicatedMap.java
Wed Jun 17 08:27:05 2015
@@ -17,12 +17,16 @@
package org.apache.catalina.tribes.tipis;
import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Iterator;
import java.util.Map;
import org.apache.catalina.tribes.Channel;
import org.apache.catalina.tribes.ChannelException;
+import org.apache.catalina.tribes.ChannelException.FaultyMember;
import org.apache.catalina.tribes.Member;
+import org.apache.catalina.tribes.RemoteProcessException;
import org.apache.juli.logging.Log;
import org.apache.juli.logging.LogFactory;
@@ -131,12 +135,35 @@ public class ReplicatedMap<K,V> extends
if (backup == null || backup.length == 0) return null;
- //publish the data out to all nodes
- MapMessage msg = new MapMessage(getMapContextName(),
MapMessage.MSG_COPY, false,
- (Serializable) key, (Serializable)
value, null,channel.getLocalMember(false), backup);
-
- getChannel().send(getMapMembers(), msg, getChannelSendOptions());
-
+ try {
+
+ //publish the data out to all nodes
+ MapMessage msg = new MapMessage(getMapContextName(),
MapMessage.MSG_COPY, false,
+ (Serializable) key, (Serializable) value,
null,channel.getLocalMember(false), backup);
+
+ getChannel().send(getMapMembers(), msg, getChannelSendOptions());
+ } catch (ChannelException e) {
+ FaultyMember[] faultyMembers = e.getFaultyMembers();
+ if (faultyMembers.length == 0) throw e;
+ ArrayList<Member> faulty = new ArrayList<>();
+ for (FaultyMember faultyMember : faultyMembers) {
+ if (!(faultyMember.getCause() instanceof
RemoteProcessException)) {
+ faulty.add(faultyMember.getMember());
+ }
+ }
+ Member[] realFaultyMembers = faulty.toArray(new
Member[faulty.size()]);
+ if (realFaultyMembers.length != 0) {
+ backup = excludeFromSet(realFaultyMembers, backup);
+ if (backup.length == 0) {
+ throw e;
+ } else {
+ if (log.isWarnEnabled()) {
+
log.warn(sm.getString("replicatedMap.unableReplicate.completely", key,
+ Arrays.toString(backup),
Arrays.toString(realFaultyMembers)), e);
+ }
+ }
+ }
+ }
return backup;
}
Modified: tomcat/tc8.0.x/trunk/webapps/docs/changelog.xml
URL:
http://svn.apache.org/viewvc/tomcat/tc8.0.x/trunk/webapps/docs/changelog.xml?rev=1685937&r1=1685936&r2=1685937&view=diff
==============================================================================
--- tomcat/tc8.0.x/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/tc8.0.x/trunk/webapps/docs/changelog.xml Wed Jun 17 08:27:05 2015
@@ -172,6 +172,11 @@
Ensure that the nodes that the data has been successfully replicated
are
set to the backup node. (kfujino)
</fix>
+ <fix>
+ When failed to replication, rather than all member is handled as a
+ failed member, exclude the failure members from backup members.
+ (kfujino)
+ </fix>
</changelog>
</subsection>
<subsection name="Other">
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]