dev@shoal.java.net

About forceDSCSync

From: Bongjae Chang <carryel_at_korea.com>
Date: Wed, 26 Aug 2009 12:19:20 +0900

Hi,

I have two issues.

-- First --

I know that sometimes GroupHandle#isFenced() calls the forceDSCSync() if DSC's first sync is not done.

Then, the forceDSCSync() calls DSC#syncCache( token, true ).

See the following code:

In GroupHandlerImple.java
---
private void forceDSCSync(final DistributedStateCacheImpl dsc) {
   ...
   try {
      final String token = getGMSContext().getGroupCommunicationProvider().getGroupLeader();
      ...
      dsc.syncCache(token, true); ---- (1)
   } catch(...) {
      ...
   }
}
---

In DistributedStateCacheImpl.java
---
void syncCache(final String memberToken, final boolean isCoordinator) throws GMSException {
   ...
   final DSCMessage msg = new DSCMessage(temp, DSCMessage.OPERATION.ADDALLLOCAL.toString(), isCoordinator); ---- (2)
   ...
   if(isCoordinator) { ---- (3)
      indicateFirstSyncDone();
   }
}
---

The forceDSCSync() could be called by any members and the member was not a coordinator(the member was not the group leader).

Of course, I could know why isCoordinator was true at (1) and (2). (I think.. for updating remote cache).

But I think that above (3) is not correct if the member is not a group leader.

I think that indicateFirstSyncDone() should be only called

(a). when the member is a group leader
(b). or the member receives a ADDALLREMOTE message or ADDALLLOCAL with dMsg.isCoordinator().

When the member receives a ADDALLREMOTE message or ADDALLLOCAL with dMsg.isCoordinator(), indicateFirstSyncDone() is already called.(In this case (b), there are no problems)

But, in (a) case, we can meet an unexpected result from DSC if the member is not a group leader and the member calls indicateFirstSyncDone().

Because the member is not synchronized yet though DSC's first sync is true.

So I think that above (3) should be modified like this.

if( isCoordinator && getGMSContext().getGroupCommunicationProvider().isGroupLeader() ) {
   indicateFirstSyncDone();
}

Then, the member which is not a group leader will update DSC's first sync in only (b) case.

(Of course, at most of cases, GroupHandle#isFenced() will not call forceDSCSync() because the group leader will synchronize the DSC in ViewWindow when new member will join, then DSC's first sync is already true)


-- Second --

How about exposing the forceDSCSync API through GroupHandle or DistributedStateCache?

Recently, only GroupHandle#isFenced() API is using the forceDSCSync() before checking the fence from DSC.

Similar to GroupHandle#isFenced(), I think that users would like to use DSC's cache through DistributedStateCache#getFromCache() and DistributedStateCache#getAllCache() after DSC's sync is completed.

Then, users uses the API like this at this case.

---
// ensure that the DSC sync is completed
groupHandle.forceDSCSync(); // or dsc.forceDSCSync();
dsc.getFromCache( ... );
---

What do you think?

--
Bongjae Chang