[prev in list] [next in list] [prev in thread] [next in thread] 

List:       intermezzo-cvs
Subject:    CVS: intermezzo/lento/Lento Fileset.pm,1.23,1.24
From:       Shirish Hemant Phatak <shirish () users ! sourceforge ! net>
Date:       2001-10-27 0:14:52
[Download RAW message or body]

Update of /cvsroot/intermezzo/intermezzo/lento/Lento
In directory usw-pr-cvs1:/tmp/cvs-serv20198

Modified Files:
	Fileset.pm 
Log Message:

 ***Note that this code creates a new RPC***

 Add a new RPC to flush KML to a specific peer. Currently the RPC spawns
 a sendKML session which in turn uses a ReintegrateKML RPC. In future, we
 should be able to avoid this nesting. If Peter approves, this can also
 go into the branch.

 We also modify the fset->sync path on a client by adding an extra step 
 that just flushes KML from the server without actually revoking the permit.
 This is done right after the ReplicatorStatus RPC but before trying to 
 fetch a permit. Thus, the server remains available even as initial
 reintegration of pending KML is taking place on the client. By the time
 the client actually does a GetPermit, most of the KML should already be
 at the client which makes the movememnt of the permit faster and prevents
 a blocked/deadlocked server for long periods of time.

 Note that this code might be prone to livelocks since the client's initial
 getKML request does not revoke permits on the serveri which allows the
 server to continue generating KML even as reintegration proceeds on the 
 client.  In general, just before we do a GetPermit, we can use a GetKML 
 to flush KML without revoking permits. This code does not yet do that 
 because of livelock concerns, however, clearly this is an easy way to
 improve reliability.

 The next step is to prevent the client from requesting permits 
 during sync unless it has pending kml to send.



Index: Fileset.pm
===================================================================
RCS file: /cvsroot/intermezzo/intermezzo/lento/Lento/Fileset.pm,v
retrieving revision 1.23
retrieving revision 1.24
diff -U2 -r1.23 -r1.24
--- Fileset.pm	2001/10/16 17:11:08	1.23
+++ Fileset.pm	2001/10/27 00:14:50	1.24
@@ -14,4 +14,6 @@
 use Lento::Server;
 use Lento::Fsetdb;
+use Lento::RPCS::GetPermit;
+use Lento::RPCS::GetKML;
 use POSIX;
 use Fcntl;
@@ -463,8 +465,26 @@
 	     
          #resynchronize our offsets since these values are authoritative
-	     $replicator->fix_offsets($repinfo);
+	     $_[HEAP]->{replicator}->fix_offsets($repinfo);
 
-	     # Now get the permit. This should get any pending KML.
-	     DEBUG "ReplicatorStatus done...now fetching permit\n"; 
+         # Now get pending KML from the server. This is done 
+         # without revoking permit and hence prevents the server
+         # from blocking
+	     DEBUG "ReplicatorStatus done...now getting kml\n"; 
+	     # Now get the permit. This will get any pending KML.
+	     Lento::RPCS::GetKML::GetKML($_[HEAP]->{replicator}, 
+                                            'got_kml', LVL_RECOVER); 
+     },
+     got_kml => sub {
+	     my $rc= $_[ARG0];
+	     my $fset = $_[HEAP]->{fileset};
+	     
+         # XXX: Too draconian...we should allow registered filesets to continue
+		 die "Server will not send us kml and returns error code $rc!\n"
+	        if ($rc != 0);
+
+	     DEBUG "GetKML done...now fetching permit\n"; 
+	     # Now get the permit. This should get any remaining pending KML.
+         # XXX: this should be made optional. We should get permit only
+         # if we have kml to send or we have a pending write permit request.
 	     Lento::RPCS::GetPermit::GetPermit($fset, 'got_permit', LVL_RECOVER); 
 	 },


_______________________________________________
intermezzo-commit mailing list
intermezzo-commit@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/intermezzo-commit

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic