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)
committerAndrew Bartlett <abartlet@samba.org>
Thu, 7 Mar 2019 04:58:42 +0000 (04:58 +0000)
commit8b18da27cf261b0283fe66d2b827cab542488ac7
tree838f79edb524e4b15bb8355eab5b0016fbdabbd2
parent6f2558cab8113fd22800e41d46ede1465884f80b
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
source4/smbd/server.c