1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-24 21:34:56 +03:00

Port from SAMBA tdb: commit a6cc04a200 Author: Andrew Tridgell <tridge@samba.org> Date: Mon Jun 1 13:13:07 2009 +1000

overallocate all records by 25%

    This greatly reduces the fragmentation of databases where records
    tend to grow slowly by a small amount each time. The case where this
    is most seen is the ldb index records. Adding this overallocation
    reduced the size of the resulting database by more than 20x when
    running a test that adds 10k users.

(This used to be ctdb commit e72974e5cefabc7035399d16633f727f868caa61)
This commit is contained in:
Rusty Russell 2009-07-29 14:51:34 +09:30
parent 94ee0cbe3a
commit 825391de1d

View File

@ -284,6 +284,9 @@ tdb_off_t tdb_allocate(struct tdb_context *tdb, tdb_len_t length, struct list_st
if (tdb_lock(tdb, -1, F_WRLCK) == -1)
return 0;
/* over-allocate to reduce fragmentation */
length *= 1.25;
/* Extra bytes required for tailer */
length += sizeof(tdb_off_t);
length = TDB_ALIGN(length, TDB_ALIGNMENT);