replmd: Single DB operation per source object during link processing
authorTim Beale <timbeale@catalyst.net.nz>
Wed, 24 Oct 2018 02:40:52 +0000 (15:40 +1300)
committerAndrew Bartlett <abartlet@samba.org>
Thu, 1 Nov 2018 22:48:21 +0000 (23:48 +0100)
commit775054afbe15129691c76f3b276ab4473cbc995b
tree2bb7a9e74a5437c39d6c31343627894f393a3ac6
parentd54956fd51f356439173b24833ee88b38719fb80
replmd: Single DB operation per source object during link processing

Move the source object checks and DB modify operation up a level, so we
only do them once per source object rather than once per link.

This allows LMDB joins to succeed with ~15,000 members in a group.
Previously LMDB would fail with the error:

 Failed to apply linked attribute change '(-30792) - MDB_MAP_FULL:
  Environment mapsize limit reached at ../lib/ldb/ldb_mdb/ldb_mdb.c:203'

Rewriting the same object ~15000 times seemed to completely fill up
the LMDB 8Gb buffer. Presumably this was because LMDB is 'copy on
write', so it was storing ~15,000 copies of the same object. Strangely,
we don't see this problem writing the backlinks (which this patch won't
have helped with at all, because that's modifying the target object).

Note uSNChanged was only being added to the msg once, so the code has
been modified to replace the usnChanged each time (i.e. remove it and
re-add it).

Signed-off-by: Tim Beale <timbeale@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Thu Nov  1 23:48:21 CET 2018 on sn-devel-144
source4/dsdb/samdb/ldb_modules/repl_meta_data.c