Rev 308: in http://samba.org/~tridge/ctdb

tridge at samba.org tridge at samba.org
Wed May 16 08:10:28 GMT 2007


------------------------------------------------------------
revno: 308
revision-id: tridge at samba.org-20070516081026-l0m82yuabzu91dlr
parent: tridge at samba.org-20070515084056-6333fevxsd6cnlzz
parent: sahlberg at ronnie-20070516023430-nle4lyaap7006te6
committer: Andrew Tridgell <tridge at samba.org>
branch nick: tridge
timestamp: Wed 2007-05-16 18:10:26 +1000
message:
  
  - merge from ronnie
  - fixed a memory leak found by dmitry
modified:
  common/ctdb_call.c             ctdb_call.c-20061128065342-to93h6eejj5kon81-1
  common/ctdb_client.c           ctdb_client.c-20070411010216-3kd8v37k61steeya-1
  common/ctdb_control.c          ctdb_control.c-20070426122724-j6gkpiofhbwdin63-1
  common/ctdb_recover.c          ctdb_recover.c-20070503002147-admmfgt1oj6gexfo-1
  common/ctdb_recoverd.c         recoverd.c-20070503213540-bvxuyd9jm1f7ig90-1
  include/ctdb.h                 ctdb.h-20061117234101-o3qt14umlg9en8z0-11
  include/ctdb_private.h         ctdb_private.h-20061117234101-o3qt14umlg9en8z0-13
    ------------------------------------------------------------
    revno: 197.1.112
    merged: sahlberg at ronnie-20070516023430-nle4lyaap7006te6
    parent: sahlberg at ronnie-20070516011228-cap2v4f7lj3p2epm
    committer: Ronnie Sahlberg <sahlberg at ronnie>
    branch nick: ctdb
    timestamp: Wed 2007-05-16 12:34:30 +1000
    message:
      if a caller specifies a timeout when calling a control, it makes no 
      sense to have the daemon requeue the packets if they timeout or fail to 
      deliver to the remote node
    ------------------------------------------------------------
    revno: 197.1.111
    merged: sahlberg at ronnie-20070516011228-cap2v4f7lj3p2epm
    parent: sahlberg at ronnie-20070515003414-d6txjr8vr0ce1ypt
    parent: tridge at samba.org-20070515084056-6333fevxsd6cnlzz
    committer: Ronnie Sahlberg <sahlberg at ronnie>
    branch nick: ctdb
    timestamp: Wed 2007-05-16 11:12:28 +1000
    message:
      merge from tridge
    ------------------------------------------------------------
    revno: 197.1.110
    merged: sahlberg at ronnie-20070515003414-d6txjr8vr0ce1ypt
    parent: sahlberg at ronnie-20070515002841-1obirc98ubq0e4de
    parent: tridge at samba.org-20070515003328-ogsyrb3gnoyicfud
    committer: Ronnie Sahlberg <sahlberg at ronnie>
    branch nick: ctdb
    timestamp: Tue 2007-05-15 10:34:14 +1000
    message:
      merge from tridge
    ------------------------------------------------------------
    revno: 197.1.109
    merged: sahlberg at ronnie-20070515002841-1obirc98ubq0e4de
    parent: sahlberg at ronnie-20070514040719-j0wnxcbbcezb1vy3
    parent: tridge at samba.org-20070515001716-tndy0z6bafkvdc3v
    committer: Ronnie Sahlberg <sahlberg at ronnie>
    branch nick: ctdb
    timestamp: Tue 2007-05-15 10:28:41 +1000
    message:
      merge from tridge
    ------------------------------------------------------------
    revno: 197.1.108
    merged: sahlberg at ronnie-20070514040719-j0wnxcbbcezb1vy3
    parent: sahlberg at ronnie-20070514040549-7fvs0gm0tvcjw1yu
    parent: tridge at samba.org-20070514040133-2ktprtc6t6161yy5
    committer: Ronnie Sahlberg <sahlberg at ronnie>
    branch nick: ctdb
    timestamp: Mon 2007-05-14 14:07:19 +1000
    message:
      merge from tridge
    ------------------------------------------------------------
    revno: 197.1.107
    merged: sahlberg at ronnie-20070514040549-7fvs0gm0tvcjw1yu
    parent: sahlberg at ronnie-20070513220348-r6ejgh94ki3cwqib
    parent: tridge at samba.org-20070514034901-vpwg24spu188ab97
    committer: Ronnie Sahlberg <sahlberg at ronnie>
    branch nick: ctdb
    timestamp: Mon 2007-05-14 14:05:49 +1000
    message:
      merge from tridge
    ------------------------------------------------------------
    revno: 197.1.106
    merged: sahlberg at ronnie-20070513220348-r6ejgh94ki3cwqib
    parent: sahlberg at ronnie-20070513205024-60p5pk9tju8ollgg
    committer: Ronnie Sahlberg <sahlberg at ronnie>
    branch nick: ctdb
    timestamp: Mon 2007-05-14 08:03:48 +1000
    message:
      remove the control to bump the rsn since we dont need it anymore
    ------------------------------------------------------------
    revno: 197.1.105
    merged: sahlberg at ronnie-20070513205024-60p5pk9tju8ollgg
    parent: sahlberg at ronnie-20070513202515-nxib2dfr0t23gzii
    committer: Ronnie Sahlberg <sahlberg at ronnie>
    branch nick: ctdb
    timestamp: Mon 2007-05-14 06:50:24 +1000
    message:
      add a mising parameter to the new signature for ctdb_control
    ------------------------------------------------------------
    revno: 197.1.104
    merged: sahlberg at ronnie-20070513202515-nxib2dfr0t23gzii
    parent: sahlberg at ronnie-20070511020319-631dcfd6ff1f1120
    parent: tridge at samba.org-20070512232016-fdj2opy995c536bs
    committer: Ronnie Sahlberg <sahlberg at ronnie>
    branch nick: ctdb
    timestamp: Mon 2007-05-14 06:25:15 +1000
    message:
      merge from tridge
    ------------------------------------------------------------
    revno: 197.1.103
    merged: sahlberg at ronnie-20070511020319-631dcfd6ff1f1120
    parent: sahlberg at ronnie-20070511003742-32b5e6c3644d8ade
    committer: Ronnie Sahlberg <sahlberg at ronnie>
    branch nick: ctdb
    timestamp: Fri 2007-05-11 12:03:19 +1000
    message:
      we have to get a NEW generation id after completing recovery
      to solve a race condition with the logic to retransmit in
      ctdb_call.c/ctdb_call_timeout()
    ------------------------------------------------------------
    revno: 197.1.102
    merged: sahlberg at ronnie-20070511003742-32b5e6c3644d8ade
    parent: sahlberg at ronnie-20070511003647-00a5926a49a06b53
    parent: tridge at samba.org-20070511003343-mdcfsv1todutp5mz
    committer: Ronnie Sahlberg <sahlberg at ronnie>
    branch nick: ctdb
    timestamp: Fri 2007-05-11 10:37:42 +1000
    message:
      merge from tridge
    ------------------------------------------------------------
    revno: 197.1.101
    merged: sahlberg at ronnie-20070511003647-00a5926a49a06b53
    parent: sahlberg at ronnie-20070510200817-cd0cc3a541930600
    committer: Ronnie Sahlberg <sahlberg at ronnie>
    branch nick: ctdb
    timestamp: Fri 2007-05-11 10:36:47 +1000
    message:
      add a control to bump the rsn number for all records in a database
      
      use this control from the recovery daemon to ensure that the recmaster 
      always have a higher rsn than andy other node for the records after 
      recovery completes
=== modified file 'common/ctdb_call.c'
--- a/common/ctdb_call.c	2007-05-15 00:16:59 +0000
+++ b/common/ctdb_call.c	2007-05-16 08:10:26 +0000
@@ -48,8 +48,8 @@
   local version of ctdb_call
 */
 int ctdb_call_local(struct ctdb_db_context *ctdb_db, struct ctdb_call *call,
-		    struct ctdb_ltdb_header *header, TDB_DATA *data,
-		    uint32_t caller)
+		    struct ctdb_ltdb_header *header, TALLOC_CTX *mem_ctx,
+		    TDB_DATA *data, uint32_t caller)
 {
 	struct ctdb_call_info *c;
 	struct ctdb_registered_call *fn;
@@ -322,12 +322,10 @@
 		return;
 	}
 
-	ctdb_call_local(ctdb_db, &state->call, &header, &data, ctdb->vnn);
+	ctdb_call_local(ctdb_db, &state->call, &header, state, &data, ctdb->vnn);
 
 	ctdb_ltdb_unlock(ctdb_db, state->call.key);
 
-	talloc_steal(state, state->call.reply_data.dptr);
-
 	state->state = CTDB_CALL_DONE;
 	if (state->async.fn) {
 		state->async.fn(state);
@@ -477,7 +475,7 @@
 		return;
 	}
 
-	ctdb_call_local(ctdb_db, &call, &header, &data, c->hdr.srcnode);
+	ctdb_call_local(ctdb_db, &call, &header, hdr, &data, c->hdr.srcnode);
 
 	ctdb_ltdb_unlock(ctdb_db, call.key);
 
@@ -491,7 +489,6 @@
 	r->datalen       = call.reply_data.dsize;
 	if (call.reply_data.dsize) {
 		memcpy(&r->data[0], call.reply_data.dptr, call.reply_data.dsize);
-		talloc_free(call.reply_data.dptr);
 	}
 
 	ctdb_queue_packet(ctdb, &r->hdr);
@@ -694,8 +691,7 @@
 	state->call = *call;
 	state->ctdb_db = ctdb_db;
 
-	ret = ctdb_call_local(ctdb_db, &state->call, header, data, ctdb->vnn);
-	talloc_steal(state, state->call.reply_data.dptr);
+	ret = ctdb_call_local(ctdb_db, &state->call, header, state, data, ctdb->vnn);
 
 	event_add_timed(ctdb->ev, state, timeval_zero(), call_local_trigger, state);
 

=== modified file 'common/ctdb_client.c'
--- a/common/ctdb_client.c	2007-05-12 11:25:26 +0000
+++ b/common/ctdb_client.c	2007-05-16 08:10:26 +0000
@@ -264,8 +264,7 @@
 	state->call = *call;
 	state->ctdb_db = ctdb_db;
 
-	ret = ctdb_call_local(ctdb_db, &state->call, header, data, ctdb->vnn);
-	talloc_steal(state, state->call.reply_data.dptr);
+	ret = ctdb_call_local(ctdb_db, &state->call, header, state, data, ctdb->vnn);
 
 	return state;
 }
@@ -706,6 +705,13 @@
 		ctdb_socket_connect(ctdb);
 	}
 
+	/* if the caller specified a timeout it makes no sense for the
+	   daemon to requeue the packet if the destination is unavailable
+	 */
+	if (timeout) {
+		flags |= CTDB_CTRL_FLAG_NOREQUEUE;
+	}
+
 	state = talloc_zero(ctdb, struct ctdb_client_control_state);
 	CTDB_NO_MEMORY(ctdb, state);
 

=== modified file 'common/ctdb_control.c'
--- a/common/ctdb_control.c	2007-05-15 00:17:16 +0000
+++ b/common/ctdb_control.c	2007-05-16 02:34:30 +0000
@@ -359,14 +359,19 @@
 		       struct timeval t, void *private_data)
 {
 	struct ctdb_control_state *state = talloc_get_type(private_data, struct ctdb_control_state);
+	struct ctdb_req_control *c = (struct ctdb_req_control *)state->private_data;
 	TALLOC_CTX *tmp_ctx = talloc_new(ev);
 
 	state->ctdb->status.timeouts.control++;
 
 	talloc_steal(tmp_ctx, state);
 
-	state->callback(state->ctdb, -1, tdb_null, "ctdb_control timed out", 
-			state->private_data);
+	/* Dont retry the control if the caller asked for NOREQUEUE */
+	if (!(c->flags & CTDB_CTRL_FLAG_NOREQUEUE)) {
+		state->callback(state->ctdb, -1, tdb_null,
+				"ctdb_control timed out", 
+				state->private_data);
+	}
 	talloc_free(tmp_ctx);
 }
 

=== modified file 'common/ctdb_recover.c'
--- a/common/ctdb_recover.c	2007-05-14 03:48:40 +0000
+++ b/common/ctdb_recover.c	2007-05-14 04:05:49 +0000
@@ -449,3 +449,4 @@
 	ctdb->recovery_mode = recmode;
 	return 0;
 }
+

=== modified file 'common/ctdb_recoverd.c'
--- a/common/ctdb_recoverd.c	2007-05-15 05:13:36 +0000
+++ b/common/ctdb_recoverd.c	2007-05-16 01:12:28 +0000
@@ -400,6 +400,7 @@
 
 
 	/* build a new vnn map with all the currently active nodes */
+	generation = random();
 	vnnmap = talloc(mem_ctx, struct ctdb_vnn_map);
 	CTDB_NO_MEMORY(ctdb, vnnmap);
 	vnnmap->generation = generation;
@@ -439,7 +440,6 @@
 	}
 
 
-
 	/* disable recovery mode */
 	ret = set_recovery_mode(ctdb, nodemap, CTDB_RECOVERY_NORMAL);
 	if (ret!=0) {

=== modified file 'include/ctdb.h'
--- a/include/ctdb.h	2007-05-15 05:13:36 +0000
+++ b/include/ctdb.h	2007-05-16 01:12:28 +0000
@@ -277,6 +277,11 @@
 int ctdb_ctrl_cleardb(struct ctdb_context *ctdb, uint32_t destnode, TALLOC_CTX *mem_ctx, uint32_t dbid);
 
 /*
+  bump the rsn number for al records
+ */
+int ctdb_ctrl_bumprsn(struct ctdb_context *ctdb, struct timeval timeout, uint32_t destnode, TALLOC_CTX *mem_ctx, uint32_t dbid);
+
+/*
   write a record on a specific db (this implicitely updates dmaster of the record to locally be the vnn of the node where the control is executed on)
  */
 int ctdb_ctrl_write_record(struct ctdb_context *ctdb, uint32_t destnode, TALLOC_CTX *mem_ctx, uint32_t dbid, TDB_DATA key, TDB_DATA data);

=== modified file 'include/ctdb_private.h'
--- a/include/ctdb_private.h	2007-05-15 05:13:36 +0000
+++ b/include/ctdb_private.h	2007-05-16 08:10:26 +0000
@@ -518,7 +518,8 @@
 	uint32_t opcode;
 	uint64_t srvid;
 	uint32_t client_id;
-#define CTDB_CTRL_FLAG_NOREPLY 1
+#define CTDB_CTRL_FLAG_NOREPLY   1
+#define CTDB_CTRL_FLAG_NOREQUEUE 2
 	uint32_t flags;
 	uint32_t datalen;
 	uint8_t data[1];
@@ -680,7 +681,7 @@
 void ctdb_request_finished(struct ctdb_context *ctdb, struct ctdb_req_header *hdr);
 
 int ctdb_call_local(struct ctdb_db_context *ctdb_db, struct ctdb_call *call,
-		    struct ctdb_ltdb_header *header, TDB_DATA *data,
+		    struct ctdb_ltdb_header *header, TALLOC_CTX *mem_ctx, TDB_DATA *data,
 		    uint32_t caller);
 
 #define ctdb_reqid_find(ctdb, reqid, type)	(type *)_ctdb_reqid_find(ctdb, reqid, #type, __location__)



More information about the samba-cvs mailing list