s4-server: Open and close a transaction on sam.ldb at startup
authorAndrew Bartlett <abartlet@samba.org>
Tue, 5 Mar 2019 01:38:41 +0000 (01:38 +0000)
committerKarolin Seeger <kseeger@samba.org>
Mon, 11 Mar 2019 07:55:37 +0000 (07:55 +0000)
commit2f4d82146018a6bed6ea447e023fe1949208bbe2
tree190af277e1b3e2b80a96fb6260e745233cf4d31e
parent0e80b245bf4af890f275f1cc7409063983a12a78
s4-server: Open and close a transaction on sam.ldb at startup

This fixes upgrading from 4.7 and earlier releases, and makes the DB
reindexing more transparent. It should also make it easier to handle
future normalisation rule changes, e.g. if we change the pack-format
of integer indexes in a future release.

Without this change, the  should have still handled reindexing the
database. We don't know why exactly this wasn't happening correctly,
but opening a transaction early in the samba process startup should
now guarantee that the DB is correctly reindexed by the time the main
samba code runs.

An alternative fix would have been to open a transaction in the the
DSDB module stack every time we connect to the database. However, this
would add an extra write lock every time we open the DB, whereas
starting samba happens much more infrequently.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13760

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Tim Beale <timbeale@catalyst.net.nz>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Thu Mar  7 04:58:42 UTC 2019 on sn-devel-144

(cherry picked from commit 8b18da27cf261b0283fe66d2b827cab542488ac7)
source4/smbd/server.c