summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorTim Beale <timbeale@catalyst.net.nz>2019-07-30 15:02:25 +1200
committerKarolin Seeger <kseeger@samba.org>2019-08-26 07:06:18 +0000
commitb99fff86ebb64e31fd3577164f55246705511c3b (patch)
treeaad5e4d4df82a4a0cf712f93eaa0a9fde2ef7f77 /lib
parent70726f2dfba3907ebc11b196aba61fe8358ac989 (diff)
downloadsamba-b99fff86ebb64e31fd3577164f55246705511c3b.tar.gz
ldb: Move where we update the pack format version
Store it on the repack context so that we can log a more informative message "Repacking from format x to format y". While this is not really a big deal currently, it could be worth recording for potential future scenarios (i.e. supporting three or more pack versions), where upgrades could potentially skip an intermediary pack format version. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14059 Signed-off-by: Tim Beale <timbeale@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Garming Sam <garming@catalyst.net.nz> (cherry picked from commit d427bd6c775d8117504e76eed42cd2c383512e34)
Diffstat (limited to 'lib')
-rw-r--r--lib/ldb/ldb_key_value/ldb_kv.c2
-rw-r--r--lib/ldb/ldb_key_value/ldb_kv.h1
-rw-r--r--lib/ldb/ldb_key_value/ldb_kv_index.c3
3 files changed, 4 insertions, 2 deletions
diff --git a/lib/ldb/ldb_key_value/ldb_kv.c b/lib/ldb/ldb_key_value/ldb_kv.c
index f768fb5e1e4..4e7b8a116b3 100644
--- a/lib/ldb/ldb_key_value/ldb_kv.c
+++ b/lib/ldb/ldb_key_value/ldb_kv.c
@@ -315,8 +315,6 @@ static int ldb_kv_maybe_repack(struct ldb_kv_private *ldb_kv) {
ldb_kv->target_pack_format_version) {
int r;
struct ldb_context *ldb = ldb_module_get_ctx(ldb_kv->module);
- ldb_kv->pack_format_version =
- ldb_kv->target_pack_format_version;
r = ldb_kv_repack(ldb_kv->module);
if (r != LDB_SUCCESS) {
ldb_debug(ldb, LDB_DEBUG_ERROR,
diff --git a/lib/ldb/ldb_key_value/ldb_kv.h b/lib/ldb/ldb_key_value/ldb_kv.h
index e627644ba34..f9dffae2dcf 100644
--- a/lib/ldb/ldb_key_value/ldb_kv.h
+++ b/lib/ldb/ldb_key_value/ldb_kv.h
@@ -175,6 +175,7 @@ struct ldb_kv_repack_context {
int error;
uint32_t count;
bool normal_record_seen;
+ uint32_t old_version;
};
diff --git a/lib/ldb/ldb_key_value/ldb_kv_index.c b/lib/ldb/ldb_key_value/ldb_kv_index.c
index 5de316579d7..eb84a790e00 100644
--- a/lib/ldb/ldb_key_value/ldb_kv_index.c
+++ b/lib/ldb/ldb_key_value/ldb_kv_index.c
@@ -3595,10 +3595,13 @@ int ldb_kv_repack(struct ldb_module *module)
struct ldb_kv_repack_context ctx;
int ret;
+ ctx.old_version = ldb_kv->pack_format_version;
ctx.count = 0;
ctx.error = LDB_SUCCESS;
ctx.normal_record_seen = false;
+ ldb_kv->pack_format_version = ldb_kv->target_pack_format_version;
+
/* Iterate all database records and repack them in the new format */
ret = ldb_kv->kv_ops->iterate(ldb_kv, re_pack, &ctx);
if (ret < 0) {