[SCM] Samba Shared Repository - branch master updated

Stefan Metzmacher metze at samba.org
Fri Jul 9 08:48:30 MDT 2010


The branch, master has been updated
       via  1caa8b0... s4:drepl_notify: hide some bugs from the make test output
       via  02a627e... s4:drsuapi: don't return all linked attributes at the same time
      from  5b5ee73... s3-build: Add a gdbtestenv environment for Samba3.

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 1caa8b06f781758943e31c367e70014de1d04380
Author: Stefan Metzmacher <metze at samba.org>
Date:   Fri Jul 9 16:27:34 2010 +0200

    s4:drepl_notify: hide some bugs from the make test output
    
    It's useless to get messages like this every few seconds:
    
    dreplsrv_notify: Failed to send DsReplicaSync to
    edbf4745-2966-49a7-8653-99200f1c9430._msdcs.samba2003.example.com for
    CN=Configuration,DC=samba2003,DC=example,DC=com -
    NT_STATUS_OBJECT_NAME_NOT_FOUND : WERR_BADFILE
    
    We have a non bug regarding non-linked DN attributes
    and changes of the target DN.
    
    metze

commit 02a627e71995dc1b0d75165b0772da332b67ba7e
Author: Stefan Metzmacher <metze at samba.org>
Date:   Fri Jul 9 12:52:11 2010 +0200

    s4:drsuapi: don't return all linked attributes at the same time
    
    Windows gives them in chunks, but I don't know the correct
    rule to calculate the chunk size.
    
    For now I'll use 1500 as the max size.
    
    Windows isn't happy when it gets ~ 100000 linked attributes in one
    response. It corrupts its directory index and later moves some objects
    to the LostAndFound folder.
    
    metze

-----------------------------------------------------------------------

Summary of changes:
 source4/dsdb/repl/drepl_notify.c          |   13 ++++++-
 source4/rpc_server/drsuapi/getncchanges.c |   59 +++++++++++++++++++++++++----
 2 files changed, 63 insertions(+), 9 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source4/dsdb/repl/drepl_notify.c b/source4/dsdb/repl/drepl_notify.c
index 8a39745..6b81901 100644
--- a/source4/dsdb/repl/drepl_notify.c
+++ b/source4/dsdb/repl/drepl_notify.c
@@ -197,7 +197,18 @@ static void dreplsrv_notify_op_callback(struct tevent_req *subreq)
 		unsigned int msg_debug_level = 0;
 		werr = ntstatus_to_werror(status);
 		if (W_ERROR_EQUAL(werr, WERR_BADFILE)) {
-			msg_debug_level = 1;
+			/*
+			 * TODO:
+			 *
+			 * we should better fix the bug regarding
+			 * non-linked attribute handling, instead
+			 * of just hiding the failures.
+			 *
+			 * we should also remove the dc from our repsTo
+			 * if it failed to often, instead of retrying
+			 * every few seconds
+			 */
+			msg_debug_level = 2;
 		}
 
 		DEBUG(msg_debug_level,
diff --git a/source4/rpc_server/drsuapi/getncchanges.c b/source4/rpc_server/drsuapi/getncchanges.c
index a9bb1c0..5d4a44b 100644
--- a/source4/rpc_server/drsuapi/getncchanges.c
+++ b/source4/rpc_server/drsuapi/getncchanges.c
@@ -665,6 +665,8 @@ struct drsuapi_getncchanges_state {
 	struct ldb_dn *last_dn;
 	struct drsuapi_DsReplicaLinkedAttribute *la_list;
 	uint32_t la_count;
+	bool la_sorted;
+	uint32_t la_idx;
 	struct drsuapi_DsReplicaCursorCtrEx *uptodateness_vector;
 };
 
@@ -701,6 +703,10 @@ WERROR dcesrv_drsuapi_DsGetNCChanges(struct dcesrv_call_state *dce_call, TALLOC_
 	struct drsuapi_DsGetNCChangesRequest8 *req8;
 	uint32_t options;
 	uint32_t max_objects;
+	uint32_t max_links;
+	uint32_t link_count = 0;
+	uint32_t link_total = 0;
+	uint32_t link_given = 0;
 	struct ldb_dn *search_dn = NULL;
 	bool am_rodc;
 	enum security_user_level security_level;
@@ -939,6 +945,10 @@ WERROR dcesrv_drsuapi_DsGetNCChanges(struct dcesrv_call_state *dce_call, TALLOC_
 	if (req8->max_object_count < max_objects) {
 		max_objects = req8->max_object_count;
 	}
+	/*
+	 * TODO: work out how the maximum should be calculated
+	 */
+	max_links = lp_parm_int(dce_call->conn->dce_ctx->lp_ctx, NULL, "drs", "max link sync", 1500);
 
 	for(i=getnc_state->num_sent; 
 	    i<getnc_state->site_res->count && 
@@ -1026,14 +1036,46 @@ WERROR dcesrv_drsuapi_DsGetNCChanges(struct dcesrv_call_state *dce_call, TALLOC_
 		}
 	}
 
+	/*
+	 * TODO:
+	 * This is just a guess, how to calculate the
+	 * number of linked attributes to send, we need to
+	 * find out how to do this right.
+	 */
+	if (r->out.ctr->ctr6.object_count >= max_links) {
+		max_links = 0;
+	} else {
+		max_links -= r->out.ctr->ctr6.object_count;
+	}
+
+	link_total = getnc_state->la_count;
+
 	if (i < getnc_state->site_res->count) {
 		r->out.ctr->ctr6.more_data = true;
 	} else {
-		r->out.ctr->ctr6.linked_attributes_count = getnc_state->la_count;
-		r->out.ctr->ctr6.linked_attributes = talloc_steal(mem_ctx, getnc_state->la_list);
+		/* sort the whole array the first time */
+		if (!getnc_state->la_sorted) {
+			LDB_TYPESAFE_QSORT(getnc_state->la_list, getnc_state->la_count,
+					   b_state->sam_ctx, linked_attribute_compare);
+			getnc_state->la_sorted = true;
+		}
+
+		link_count = getnc_state->la_count - getnc_state->la_idx;
+		link_count = MIN(max_links, link_count);
+
+		r->out.ctr->ctr6.linked_attributes_count = link_count;
+		r->out.ctr->ctr6.linked_attributes = getnc_state->la_list + getnc_state->la_idx;
+
+		getnc_state->la_idx += link_count;
+		link_given = getnc_state->la_idx;
 
-		LDB_TYPESAFE_QSORT(r->out.ctr->ctr6.linked_attributes, r->out.ctr->ctr6.linked_attributes_count,
-				   b_state->sam_ctx, linked_attribute_compare);
+		if (getnc_state->la_idx < getnc_state->la_count) {
+			r->out.ctr->ctr6.more_data = true;
+		}
+	}
+
+	if (!r->out.ctr->ctr6.more_data) {
+		talloc_steal(mem_ctx, getnc_state->la_list);
 
 		r->out.ctr->ctr6.uptodateness_vector = talloc(mem_ctx, struct drsuapi_DsReplicaCursor2CtrEx);
 		r->out.ctr->ctr6.new_highwatermark.highest_usn = r->out.ctr->ctr6.new_highwatermark.tmp_highest_usn;
@@ -1055,12 +1097,13 @@ WERROR dcesrv_drsuapi_DsGetNCChanges(struct dcesrv_call_state *dce_call, TALLOC_
 	}
 
 	DEBUG(r->out.ctr->ctr6.more_data?2:1,
-	      ("DsGetNCChanges with uSNChanged >= %llu flags 0x%08x on %s gave %u objects (done %d/%d la=%d)\n",
+	      ("DsGetNCChanges with uSNChanged >= %llu flags 0x%08x on %s gave %u objects (done %u/%u) %u links (done %u/%u)\n",
 	       (unsigned long long)(req8->highwatermark.highest_usn+1),
-	       req8->replica_flags,
-	       ncRoot->dn, r->out.ctr->ctr6.object_count,
+	       req8->replica_flags, ncRoot->dn,
+	       r->out.ctr->ctr6.object_count,
 	       i, r->out.ctr->ctr6.more_data?getnc_state->site_res->count:i,
-	       r->out.ctr->ctr6.linked_attributes_count));
+	       r->out.ctr->ctr6.linked_attributes_count,
+	       link_given, link_total));
 
 #if 0
 	if (!r->out.ctr->ctr6.more_data) {


-- 
Samba Shared Repository


More information about the samba-cvs mailing list