Rev 36: added logic for keeping track of the lacount in http://samba.org/~tridge/ctdb

tridge at samba.org tridge at samba.org
Mon Dec 18 03:58:40 GMT 2006


------------------------------------------------------------
revno: 36
revision-id: tridge at samba.org-20061218035840-o1fzlyy8memm0vjz
parent: tridge at samba.org-20061218034932-dsxmx8dj8rx5bfn2
committer: Andrew Tridgell <tridge at samba.org>
branch nick: tridge
timestamp: Mon 2006-12-18 14:58:40 +1100
message:
  added logic for keeping track of the lacount
modified:
  common/ctdb_call.c             ctdb_call.c-20061128065342-to93h6eejj5kon81-1
=== modified file 'common/ctdb_call.c'
--- a/common/ctdb_call.c	2006-12-18 03:49:32 +0000
+++ b/common/ctdb_call.c	2006-12-18 03:58:40 +0000
@@ -30,7 +30,8 @@
 */
 static int ctdb_call_local(struct ctdb_context *ctdb, TDB_DATA key, 
 			   struct ctdb_ltdb_header *header, TDB_DATA *data,
-			   int call_id, TDB_DATA *call_data, TDB_DATA *reply_data)
+			   int call_id, TDB_DATA *call_data, TDB_DATA *reply_data,
+			   uint32_t caller)
 {
 	struct ctdb_call *c;
 	struct ctdb_registered_call *fn;
@@ -59,6 +60,18 @@
 		return -1;
 	}
 
+	if (header->laccessor != caller) {
+		header->lacount = 0;
+	}
+	header->laccessor = caller;
+	header->lacount++;
+
+	/* we need to force the record to be written out if this was a remote access,
+	   so that the lacount is updated */
+	if (c->new_data == NULL && header->laccessor != ctdb->vnn) {
+		c->new_data = &c->record_data;
+	}
+
 	if (c->new_data) {
 		if (ctdb_ltdb_store(ctdb, key, header, *c->new_data) != 0) {
 			ctdb_set_error(ctdb, "ctdb_call tdb_store failed\n");
@@ -185,7 +198,7 @@
 
 	ctdb_call_local(ctdb, key, &header, &data, c->callid, 
 			call_data.dsize?&call_data:NULL,
-			&reply_data);
+			&reply_data, c->hdr.srcnode);
 
 	r = talloc_size(ctdb, sizeof(*r) + reply_data.dsize);
 	r->hdr.length = sizeof(*r) + reply_data.dsize;
@@ -336,7 +349,8 @@
 	state->node = ctdb->nodes[ctdb->vnn];
 
 	ret = ctdb_call_local(ctdb, key, header, data, 
-			      call_id, call_data, &state->reply_data);
+			      call_id, call_data, &state->reply_data, 
+			      ctdb->vnn);
 	return state;
 }
 



More information about the samba-cvs mailing list