diff options
author | Rusty Russell <rusty@rustcorp.com.au> | 2012-06-18 22:30:29 +0930 |
---|---|---|
committer | Rusty Russell <rusty@rustcorp.com.au> | 2012-06-19 05:38:06 +0200 |
commit | db2508840d55842ebaf0c0d7a2fa3c855498e75f (patch) | |
tree | 6123390e0616ed98eb173422e94e8c5c0e862459 /lib/ntdb/test/api-91-get-stats.c | |
parent | 9396757676c304398a3e94ad01f2657e667b113c (diff) | |
download | samba-db2508840d55842ebaf0c0d7a2fa3c855498e75f.tar.gz samba-db2508840d55842ebaf0c0d7a2fa3c855498e75f.tar.xz samba-db2508840d55842ebaf0c0d7a2fa3c855498e75f.zip |
ntdb: create initial database to be multiple of NTDB_PGSIZE.
As copied from tdb1, there is logic in the transaction code to handle
a non-PGSIZE multiple db, but in fact this only happens for a
completely unused database: as soon as we add anything to it, it is
expanded to a NTDB_PGSIZE multiple.
If we create the database with a free record which pads it out to
NTDB_PGSIZE, we can remove this last-page-is-different logic.
Of course, the fake ntdbs we create in our tests now also need to be
multiples of NTDB_PGSIZE, so we change some numbers there too.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Diffstat (limited to 'lib/ntdb/test/api-91-get-stats.c')
-rw-r--r-- | lib/ntdb/test/api-91-get-stats.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/ntdb/test/api-91-get-stats.c b/lib/ntdb/test/api-91-get-stats.c index 786885b44c..e44b8a5061 100644 --- a/lib/ntdb/test/api-91-get-stats.c +++ b/lib/ntdb/test/api-91-get-stats.c @@ -19,12 +19,16 @@ int main(int argc, char *argv[]) for (i = 0; i < sizeof(flags) / sizeof(flags[0]); i++) { union ntdb_attribute *attr; - NTDB_DATA key = ntdb_mkdata("key", 3); + NTDB_DATA key = ntdb_mkdata("key", 3), data; ntdb = ntdb_open("run-91-get-stats.ntdb", flags[i], O_RDWR|O_CREAT|O_TRUNC, 0600, &tap_log_attr); ok1(ntdb); - ok1(ntdb_store(ntdb, key, key, NTDB_REPLACE) == 0); + /* Force an expansion */ + data.dsize = 65536; + data.dptr = calloc(data.dsize, 1); + ok1(ntdb_store(ntdb, key, data, NTDB_REPLACE) == 0); + free(data.dptr); /* Use malloc so valgrind will catch overruns. */ attr = malloc(sizeof *attr); |