From 539daefaf3f7edb6a630f3d57fb590f57a6ab688 Mon Sep 17 00:00:00 2001 From: Tim Beale Date: Fri, 12 Oct 2018 13:29:32 +1300 Subject: [PATCH] libnet/drs: Update replication debug to report link progress Update the replication debug (for joins/backups) so that it's easier to see how far through syncing the links we are. E.g. with 150,000 links, you just get screeds of debug like this, with no real idea how far through the replication is. Partition[DC=addom,DC=samba,DC=example,DC=com] objects[11816/11720] linked_values[1500/150024] Partition[DC=addom,DC=samba,DC=example,DC=com] objects[11816/11720] linked_values[1500/150024] Partition[DC=addom,DC=samba,DC=example,DC=com] objects[11816/11720] linked_values[1500/150024] This patch now applies to links the same debug logic we use for objects, and changes it to look like: Partition[DC=addom,DC=samba,DC=example,DC=com] objects[11816/11720] linked_values[57024/150024] Partition[DC=addom,DC=samba,DC=example,DC=com] objects[11816/11720] linked_values[58524/150024] Partition[DC=addom,DC=samba,DC=example,DC=com] objects[11816/11720] linked_values[60024/150024] Signed-off-by: Tim Beale Reviewed-by: Garming Sam Reviewed-by: Andrew Bartlett --- source4/libnet/libnet_vampire.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/source4/libnet/libnet_vampire.c b/source4/libnet/libnet_vampire.c index c4ef6086331..5bd8df13a26 100644 --- a/source4/libnet/libnet_vampire.c +++ b/source4/libnet/libnet_vampire.c @@ -88,6 +88,7 @@ struct libnet_vampire_cb_state { struct loadparm_context *lp_ctx; struct tevent_context *event_ctx; unsigned total_objects; + unsigned total_links; char *last_partition; const char *server_dn_str; }; @@ -689,10 +690,12 @@ WERROR libnet_vampire_cb_store_chunk(void *private_data, /* 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; + s->total_links = 0; talloc_free(s->last_partition); s->last_partition = talloc_strdup(s, c->partition->nc.dn); } s->total_objects += object_count; + s->total_links += linked_attributes_count; partition_dn = ldb_dn_new(s_dsa, s->ldb, c->partition->nc.dn); if (partition_dn == NULL) { @@ -705,7 +708,7 @@ WERROR libnet_vampire_cb_store_chunk(void *private_data, if (nc_object_count) { DEBUG(0,("Exop on[%s] objects[%u/%u] linked_values[%u/%u]\n", c->partition->nc.dn, s->total_objects, nc_object_count, - linked_attributes_count, nc_linked_attributes_count)); + s->total_links, nc_linked_attributes_count)); } else { DEBUG(0,("Exop on[%s] objects[%u] linked_values[%u]\n", c->partition->nc.dn, s->total_objects, linked_attributes_count)); @@ -721,10 +724,10 @@ WERROR libnet_vampire_cb_store_chunk(void *private_data, if (nc_object_count) { DEBUG(0,("Partition[%s] objects[%u/%u] linked_values[%u/%u]\n", c->partition->nc.dn, s->total_objects, nc_object_count, - linked_attributes_count, nc_linked_attributes_count)); + s->total_links, nc_linked_attributes_count)); } else { DEBUG(0,("Partition[%s] objects[%u] linked_values[%u]\n", - c->partition->nc.dn, s->total_objects, linked_attributes_count)); + c->partition->nc.dn, s->total_objects, s->total_links)); } nc_root = partition_dn; }