diff options
author | Andrew Bartlett <abartlet@samba.org> | 2017-06-09 14:09:30 +1200 |
---|---|---|
committer | Garming Sam <garming@samba.org> | 2017-06-15 01:24:25 +0200 |
commit | f6f73f70919e3360197713e378d49e6eecfe2f1c (patch) | |
tree | 8704405687e7efa9812f25133f616f921e8df2fe /lib | |
parent | d8f3034c163831c5143d95fd803b8c765bf5767f (diff) | |
download | samba-f6f73f70919e3360197713e378d49e6eecfe2f1c.tar.gz |
ldb_tdb: Remove the idxptr DB before we re-index
We do not want the cache or any of the values in it, we want to read the real DB
@INDEX: records.
This matters if a re-index is tiggered in the same transaction
as the modify of the values in the index. Otherwise we won't see
the old index record (it will not show up in the tdb_traverse)
and so fail to remove it.
That in turn can cause a spurious unqiue index violation.
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/ldb/ldb_tdb/ldb_index.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/ldb/ldb_tdb/ldb_index.c b/lib/ldb/ldb_tdb/ldb_index.c index e1e54ba38db..76f3cb392e2 100644 --- a/lib/ldb/ldb_tdb/ldb_index.c +++ b/lib/ldb/ldb_tdb/ldb_index.c @@ -1655,6 +1655,18 @@ int ltdb_reindex(struct ldb_module *module) return LDB_ERR_OPERATIONS_ERROR; } + /* + * Ensure we read (and so remove) the entries from the real + * DB, no values stored so far are any use as we want to do a + * re-index + */ + ltdb_index_transaction_cancel(module); + + ret = ltdb_index_transaction_start(module); + if (ret != LDB_SUCCESS) { + return ret; + } + /* first traverse the database deleting any @INDEX records by * putting NULL entries in the in-memory tdb */ |