libnet/drs: Update replication debug to report link progress
authorTim Beale <timbeale@catalyst.net.nz>
Fri, 12 Oct 2018 00:29:32 +0000 (13:29 +1300)
committerAndrew Bartlett <abartlet@samba.org>
Wed, 17 Oct 2018 03:40:07 +0000 (05:40 +0200)
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 <timbeale@catalyst.net.nz>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
source4/libnet/libnet_vampire.c

index c4ef60863312240ed11ab6b612b27baa42d74476..5bd8df13a2620dfa5bd95d5ecd0fcceff52acbee 100644 (file)
@@ -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;
        }