Skip to content

Commit

Permalink
[JGRP-1282] - Race condition in FLUSH when master leaves cluster
Browse files Browse the repository at this point in the history
  • Loading branch information
Vladimir Blagojevic committed Feb 8, 2011
1 parent c2832c5 commit e319bb5
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions src/org/jgroups/protocols/pbcast/FLUSH.java
Original file line number Diff line number Diff line change
Expand Up @@ -646,6 +646,9 @@ private void onSuspend(List<Address> members) {
} else {
participantsInFlush = new ArrayList<Address>(currentView.getMembers());
}
flushMembers.clear();
flushMembers.addAll(participantsInFlush);
flushMembers.removeAll(suspected);
msg = new Message(null, localAddress, null);
msg.putHeader(getName(), new FlushHeader(FlushHeader.START_FLUSH, currentViewId(),
participantsInFlush));
Expand Down Expand Up @@ -691,14 +694,18 @@ private void onStartFlush(Address flushStarter, FlushHeader fh) {
numberOfFlushes += 1;
}
boolean proceed = false;
boolean amIFlushStarter = false;
synchronized (sharedLock) {
flushCoordinator = flushStarter;
flushMembers.clear();
if (fh.flushParticipants != null) {
flushMembers.addAll(fh.flushParticipants);
amIFlushStarter = flushStarter.equals(localAddress);
if(!amIFlushStarter){
flushCoordinator = flushStarter;
flushMembers.clear();
if (fh.flushParticipants != null) {
flushMembers.addAll(fh.flushParticipants);
}
flushMembers.removeAll(suspected);
}
proceed = flushMembers.contains(localAddress);
flushMembers.removeAll(suspected);
proceed = flushMembers.contains(localAddress);
}

if (proceed) {
Expand Down

0 comments on commit e319bb5

Please sign in to comment.