summaryrefslogtreecommitdiff
path: root/lib/ntdb
AgeCommit message (Collapse)AuthorFilesLines
2012-06-19ntdb: remove last block transactoin logic.Rusty Russell1-44/+1
Now our database is always a multiple of NTDB_PGSIZE, we can remove the special handling for the last block. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2012-06-19ntdb: create initial database to be multiple of NTDB_PGSIZE.Rusty Russell8-88/+138
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>
2012-06-19ntdb: make sure file is always a multiple of PAGESIZE (now NTDB_PGSIZE)Rusty Russell6-46/+73
ntdb uses tdb's transaction code, and it has an undocumented but implicit assumption: that the transaction recovery area is always aligned to the transaction pagesize. This means that no block will overlap the recovery area. This is maintained by rounding the size of the database up, so do the same for ntdb. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2012-06-19ntdb: fix recovery data write.Rusty Russell2-9/+36
We were missing the last few bytes. Found by 100 runs of ntdbtorture -t -k. The transaction test code didn't catch this, because usually those last few bytes are irrelevant to the actual contents of the database. We fix the test. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2012-06-19ntdb: enhance external-helper test code.Rusty Russell6-18/+36
Our external test helper is a bit primitive when it comes to doing STORE or FETCH commands: let us specify the data we expect, instead of assuming it's the same as the key. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2012-06-19ntdb: use NTDB_LOG_WARNING level for failed open() without O_CREAT.Rusty Russell2-1/+11
This is a fairly common pattern in Samba, and if we log an error on every open it spams the logs. On the other hand, other errors are potentially more serious, so we still use NTDB_LOG_ERROR on them. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2012-06-19ntdb: make fork test more thorough.Rusty Russell2-9/+29
We document that the child of a fork() can do a brunlock() if the parent does a brlock: we should not log an error when they do this. Also, test the case where we fork() and return inside a parse function (which is allowed). Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2012-06-19ntdb: print \n at end of log messages in tests.Rusty Russell1-1/+1
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2012-06-19ntdb: reduce race between creating file and getting open lock.Rusty Russell1-23/+30
In tdb, we grab the open lock immediately after we open the file. In ntdb, we usually did some work first. tdbtorture managed to get in before the creator grabbed the lock: testing with 3 processes, 5000 loops, seed=1338246020 ntdb:torture.ntdb:IO Error:ntdb_open: torture.ntdb is not a ntdb file 29023:torture.ntdb:db open failed At cost of a little duplicated code, we can reduce the race. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2012-06-19ntdb: catch any valgrind errors in testRusty Russell1-2/+2
Make --valgrind and --valgrind-log options work! Amitay figured this out! Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2012-06-19ntdb: catch any valgrind errors in testRusty Russell1-1/+1
We need --error-exitcode=, otherwise valgrind errors don't cause the test to fail. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2012-06-19ntdb: remove ntdb_error()Rusty Russell14-190/+144
It was a hack to make compatibility easier. Since we're not doing that, it can go away: all callers must use the return value now. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2012-06-19TDB2: Goodbye TDB2, Hello NTDB.Rusty Russell101-0/+28840
This renames everything from tdb2 to ntdb: importantly, we no longer use the tdb_ namespace, so you can link against both ntdb and tdb if you want to. This also enables building of standalone ntdb by the autobuild script. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>