repack the ldb after re-indexing
authorAndrew Tridgell <tridge@samba.org>
Tue, 16 Dec 2008 03:41:21 +0000 (14:41 +1100)
committerAndrew Tridgell <tridge@samba.org>
Tue, 16 Dec 2008 03:41:21 +0000 (14:41 +1100)
re-indexing in ldb is triggered on any modification to the @ATTRIBUTES
or @INDEXLIST records. This happens to produce a worst-case
fragmentation of the database, as all @INDEX records are deleted then
re-created. By repacking after re-indexing we ensure that the database
ends up without extreme fragmentation.

source4/lib/ldb/ldb_tdb/ldb_index.c

index 65711d9f4b90cb68568a0e85e1a4e367cccff743..eedbda41706c656bd678dd9d6fe9be5d4e168a45 100644 (file)
@@ -1250,5 +1250,9 @@ int ltdb_reindex(struct ldb_module *module)
                return LDB_ERR_OPERATIONS_ERROR;
        }
 
+       if (tdb_repack(ltdb->tdb) != 0) {
+               return LDB_ERR_OPERATIONS_ERROR;                
+       }
+
        return LDB_SUCCESS;
 }