From 7dbe0797b1c98fc63af20af03c2b36cc04a7386e Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Thu, 3 Sep 2009 18:31:45 +1000 Subject: show more reasonable object counts during a vampire We now show the total number of objects we have processed, which gives the user a better idea of how much has been done. A vampire on a large domain can take an hour or more (which needs to be fixed btw, it is a problem with the lack of scalability of the ltdb index code). Watching the same msg for an hour makes you wonder if any progress is being made! --- source4/libnet/libnet_vampire.c | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/source4/libnet/libnet_vampire.c b/source4/libnet/libnet_vampire.c index d8b890e5b4..ec1545e6a4 100644 --- a/source4/libnet/libnet_vampire.c +++ b/source4/libnet/libnet_vampire.c @@ -71,6 +71,8 @@ struct vampire_state { struct loadparm_context *lp_ctx; struct tevent_context *event_ctx; + unsigned total_objects; + char *last_partition; }; static NTSTATUS vampire_prepare_db(void *private_data, @@ -190,8 +192,8 @@ static NTSTATUS vampire_apply_schema(struct vampire_state *s, mapping_ctr = &c->ctr6->mapping_ctr; object_count = s->schema_part.object_count; first_object = s->schema_part.first_object; - linked_attributes_count = 0; /* TODO: ! */ - linked_attributes = NULL; /* TODO: ! */; + linked_attributes_count = c->ctr6->linked_attributes_count; + linked_attributes = c->ctr6->linked_attributes; s_dsa->highwatermark = c->ctr6->new_highwatermark; s_dsa->source_dsa_obj_guid = c->ctr6->source_dsa_guid; s_dsa->source_dsa_invocation_id = c->ctr6->source_dsa_invocation_id; @@ -376,6 +378,7 @@ static NTSTATUS vampire_schema_chunk(void *private_data, struct drsuapi_DsReplicaObjectListItemEx *cur; uint32_t nc_linked_attributes_count; uint32_t linked_attributes_count; + struct drsuapi_DsReplicaLinkedAttribute *linked_attributes; switch (c->ctr_level) { case 1: @@ -385,6 +388,7 @@ static NTSTATUS vampire_schema_chunk(void *private_data, first_object = c->ctr1->first_object; nc_linked_attributes_count = 0; linked_attributes_count = 0; + linked_attributes = NULL; break; case 6: mapping_ctr = &c->ctr6->mapping_ctr; @@ -393,6 +397,7 @@ static NTSTATUS vampire_schema_chunk(void *private_data, first_object = c->ctr6->first_object; nc_linked_attributes_count = c->ctr6->nc_linked_attributes_count; linked_attributes_count = c->ctr6->linked_attributes_count; + linked_attributes = c->ctr6->linked_attributes; break; default: return NT_STATUS_INVALID_PARAMETER; @@ -508,15 +513,24 @@ static NTSTATUS vampire_store_chunk(void *private_data, NT_STATUS_HAVE_NO_MEMORY(tmp_dns_name); s_dsa->other_info->dns_name = tmp_dns_name; + /* we want to show a count per partition */ + if (!s->last_partition || strcmp(s->last_partition, c->partition->nc.dn) != 0) { + s->total_objects = 0; + talloc_free(s->last_partition); + s->last_partition = talloc_strdup(s, c->partition->nc.dn); + } + s->total_objects += object_count; + if (nc_object_count) { DEBUG(0,("Partition[%s] objects[%u/%u] linked_values[%u/%u]\n", - c->partition->nc.dn, object_count, nc_object_count, + c->partition->nc.dn, s->total_objects, nc_object_count, linked_attributes_count, nc_linked_attributes_count)); } else { DEBUG(0,("Partition[%s] objects[%u] linked_values[%u\n", - c->partition->nc.dn, object_count, linked_attributes_count)); + c->partition->nc.dn, s->total_objects, linked_attributes_count)); } + status = dsdb_extended_replicated_objects_commit(s->ldb, c->partition->nc.dn, mapping_ctr, -- cgit