summaryrefslogtreecommitdiff
path: root/lib/ldb
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2017-09-11 13:16:31 +1200
committerAndrew Bartlett <abartlet@samba.org>2017-09-22 21:20:24 +0200
commit61b66b8d0a2a29496ad96774011e158e5f089bf0 (patch)
tree0a6a4ab221e501debd2c69ab2a8d13ec41197b5c /lib/ldb
parentc71ddab974eae65a8b1120de0a62d67bc62223c9 (diff)
downloadsamba-61b66b8d0a2a29496ad96774011e158e5f089bf0.tar.gz
ldb_tdb: Print progress messages on re-index
A re-index of 10,000 entries is slow enough and rare enought that we can justify the message being at LDB_DEBUG_WARNING as otherwise the administrator will be sure the "lockup" was one. The default for ldb is to print LDB_DEBUG_WARNING in comand-line tools and the default for Samba is to log it at level 2. Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Garming Sam <garming@catalyst.net.nz>
Diffstat (limited to 'lib/ldb')
-rw-r--r--lib/ldb/ldb_tdb/ldb_index.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/lib/ldb/ldb_tdb/ldb_index.c b/lib/ldb/ldb_tdb/ldb_index.c
index fb31ba509e0..621d819ae8e 100644
--- a/lib/ldb/ldb_tdb/ldb_index.c
+++ b/lib/ldb/ldb_tdb/ldb_index.c
@@ -2264,6 +2264,7 @@ static int delete_index(struct tdb_context *tdb, TDB_DATA key, TDB_DATA data, vo
struct ltdb_reindex_context {
struct ldb_module *module;
int error;
+ uint32_t count;
};
/*
@@ -2368,6 +2369,13 @@ static int re_key(struct tdb_context *tdb, TDB_DATA key, TDB_DATA data, void *st
talloc_free(msg);
+ ctx->count++;
+ if (ctx->count % 10000 == 0) {
+ ldb_debug(ldb, LDB_DEBUG_WARNING,
+ "Reindexing: re-keyed %u records so far",
+ ctx->count);
+ }
+
return 0;
}
@@ -2449,6 +2457,13 @@ static int re_index(struct tdb_context *tdb, TDB_DATA key, TDB_DATA data, void *
talloc_free(msg);
+ ctx->count++;
+ if (ctx->count % 10000 == 0) {
+ ldb_debug(ldb, LDB_DEBUG_WARNING,
+ "Reindexing: re-indexed %u records so far",
+ ctx->count);
+ }
+
return 0;
}
@@ -2498,6 +2513,7 @@ int ltdb_reindex(struct ldb_module *module)
ctx.module = module;
ctx.error = 0;
+ ctx.count = 0;
/* now traverse adding any indexes for normal LDB records */
ret = tdb_traverse(ltdb->tdb, re_key, &ctx);
@@ -2515,6 +2531,7 @@ int ltdb_reindex(struct ldb_module *module)
}
ctx.error = 0;
+ ctx.count = 0;
/* now traverse adding any indexes for normal LDB records */
ret = tdb_traverse(ltdb->tdb, re_index, &ctx);
@@ -2531,5 +2548,11 @@ int ltdb_reindex(struct ldb_module *module)
return ctx.error;
}
+ if (ctx.count > 10000) {
+ ldb_debug(ldb_module_get_ctx(module),
+ LDB_DEBUG_WARNING, "Reindexing: re_index successful on %s, "
+ "final index write-out will be in transaction commit",
+ tdb_name(ltdb->tdb));
+ }
return LDB_SUCCESS;
}