Bug 12493 - samba-tool dbcheck very slow
Summary: samba-tool dbcheck very slow
Status: RESOLVED FIXED
Alias: None
Product: Samba 4.1 and newer
Classification: Unclassified
Component: AD: LDB/DSDB/SAMDB (show other bugs)
Version: 4.4.4
Hardware: All Linux
: P5 normal (vote)
Target Milestone: ---
Assignee: Andrew Bartlett
QA Contact: Samba QA Contact
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-01-03 08:32 UTC by Jan Dvořák
Modified: 2022-08-04 04:21 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jan Dvořák 2017-01-03 08:32:51 UTC
Command recommended by the Updating Samba wiki page:

    samba-tool dbcheck --cross-ncs --fix

takes ages to complete, which makes it complicated to run after every update. The last time it did not complete and I had to terminate it after 20 minutes.

Size of /var/lib/samba for this installation is about 370M. It holds ~13K users.
Comment 1 Andrew Bartlett 2017-01-03 09:07:26 UTC
This should be much better in Samba 4.5.

We found a single line fix in 2ef0c9a8d4623d88414eaaf32cdd18c6ef17900a was responsible for 20% of the time some of our tests took, increasing with each additional object checked. 

Can you please try Samba 4.5.3 and let us know if it is still an issue.  

If it is, please with all the required debug packages installed, then run it under perf and generate a flame graph per:

http://www.brendangregg.com/FlameGraphs/cpuflamegraphs.html

The resulting .svg file is often quite enlightening.
Comment 2 Jan Dvořák 2017-01-03 19:00:13 UTC
(In reply to Andrew Bartlett from comment #1)
Sorry for reporting an issue for an older release. Will try to upgrade as soon as possible. Thanks!
Comment 3 Andrew Bartlett 2017-01-03 19:12:07 UTC
As long as you shut down Samba first, or use tdbbackup, you can make a copy of the DB, and run a newer Samba (say built in a prefix, or on a different machine) over the sam.ldb copy.

That will let you test the newer codebase and get an idea if it is reasonable to re-run in in production during the upgrade, or to get me the flame graph.

Normally (sadly) Samba bugs in older releases are in the current release also, so no apology is needed, it just happens that in this case we put a lot of effort into performance during the 4.5 cycle, including dbcheck in particular. 

This work has continued, and git master or 4.6 should be even better.
Comment 4 Douglas Bagnall 2022-08-04 04:21:03 UTC
fixed in 4.5+ with commit 2ef0c9a8d4623d88414eaaf32cdd18c6ef17900a, as mentioned in comment 1.