summaryrefslogtreecommitdiffstats
path: root/lib/ntdb
Commit message (Collapse)AuthorAgeFilesLines
...
* ntdb: special accessor functions for read/write of an offset.Rusty Russell2012-06-193-50/+114
| | | | | | | | | | | | | | | | | | | | | | | | | | | | We also split off the NTDB_CONVERT case (where the ntdb is of a different endian) into its own io function. NTDB speed: Adding 10000 records: 3894-9951(8553) ns (815528 bytes) Finding 10000 records: 1644-4294(3580) ns (815528 bytes) Missing 10000 records: 1497-4018(3303) ns (815528 bytes) Traversing 10000 records: 1585-4225(3505) ns (815528 bytes) Deleting 10000 records: 3088-8154(6927) ns (815528 bytes) Re-adding 10000 records: 3192-8308(7089) ns (815528 bytes) Appending 10000 records: 5187-13307(11365) ns (1274312 bytes) Churning 10000 records: 6772-17567(15078) ns (1274312 bytes) NTDB speed in transaction: Adding 10000 records: 1602-2404(2214) ns (815528 bytes) Finding 10000 records: 456-871(778) ns (815528 bytes) Missing 10000 records: 393-522(503) ns (815528 bytes) Traversing 10000 records: 729-1015(945) ns (815528 bytes) Deleting 10000 records: 1065-1476(1374) ns (815528 bytes) Re-adding 10000 records: 1397-1930(1819) ns (815528 bytes) Appending 10000 records: 2927-3351(3184) ns (1274312 bytes) Churning 10000 records: 3921-4697(4378) ns (1274312 bytes) smbtorture results: ntdb speed 86581-191518(175666) ops/sec Applying patch..increase-top-level.patch
* ntdb: inline oob checkRusty Russell2012-06-196-14/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | The simple "is it in range" check can be inline; complex cases can be handed through to the normal or transaction handler. NTDB speed: Adding 10000 records: 4111-9983(9149) ns (815528 bytes) Finding 10000 records: 1667-4464(3810) ns (815528 bytes) Missing 10000 records: 1511-3992(3546) ns (815528 bytes) Traversing 10000 records: 1698-4254(3724) ns (815528 bytes) Deleting 10000 records: 3608-7998(7358) ns (815528 bytes) Re-adding 10000 records: 3259-8504(7805) ns (815528 bytes) Appending 10000 records: 5393-13579(12356) ns (1274312 bytes) Churning 10000 records: 6966-17813(16136) ns (1274312 bytes) NTDB speed in transaction: Adding 10000 records: 916-2230(2004) ns (815528 bytes) Finding 10000 records: 330-866(770) ns (815528 bytes) Missing 10000 records: 196-520(471) ns (815528 bytes) Traversing 10000 records: 356-879(800) ns (815528 bytes) Deleting 10000 records: 505-1267(1108) ns (815528 bytes) Re-adding 10000 records: 658-1681(1477) ns (815528 bytes) Appending 10000 records: 1088-2827(2498) ns (1274312 bytes) Churning 10000 records: 1636-4267(3785) ns (1274312 bytes) smbtorture results: ntdb speed 85588-189430(157110) ops/sec
* ntdb: allocator attribute.Rusty Russell2012-06-1915-92/+311
| | | | | | | | | This is designed to allow us to make ntdb_context (and NTDB_DATA returned from ntdb_fetch) a talloc pointer. But it can also be used for any other alternate allocator. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
* ntdb: still prepare recovery area with NTDB_NOSYNC.Rusty Russell2012-06-191-10/+8
| | | | | | | | | | NTDB_NOSYNC now just prevents the fsync/msync calls, which speeds testing while still providing full coverage. It also provides safety against processes dying during transaction commit (though obviously, not against the machine dying). Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
* ntdb: simply disallow NULL names.Rusty Russell2012-06-193-10/+5
| | | | | | | | | | | | TDB allows this for internal databases, but it's a bad idea, since the name is useful for logging. They're a hassle to deal with, and we'd just end up putting "unnamed" in there, so let the user deal with it. If they don't, they get an informative core dump. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
* ntdb: reduce transaction pagesize from 64k to 16k.Rusty Russell2012-06-191-1/+1
| | | | | | | | | | | | | | | | | The performance numbers for transaction pagesize are indeterminate: larger pagesizes means a smaller transaction array, and a better chance of having a contiguous record (more efficient for ntdb_parse_record and some internal operations inside a transaction). On the other hand, large pagesize means more I/O even if we change a few bytes. But it also controls the multiple by which we will enlarge the file, and hence the minimum db size. It's 4k for tdb1, but 16k seems reasonable in these modern times. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
* ntdb: remove last block transactoin logic.Rusty Russell2012-06-191-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>
* ntdb: create initial database to be multiple of NTDB_PGSIZE.Rusty Russell2012-06-198-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>
* ntdb: make sure file is always a multiple of PAGESIZE (now NTDB_PGSIZE)Rusty Russell2012-06-196-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>
* ntdb: fix recovery data write.Rusty Russell2012-06-192-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>
* ntdb: enhance external-helper test code.Rusty Russell2012-06-196-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>
* ntdb: use NTDB_LOG_WARNING level for failed open() without O_CREAT.Rusty Russell2012-06-192-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>
* ntdb: make fork test more thorough.Rusty Russell2012-06-192-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>
* ntdb: print \n at end of log messages in tests.Rusty Russell2012-06-191-1/+1
| | | | | Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
* ntdb: reduce race between creating file and getting open lock.Rusty Russell2012-06-191-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>
* ntdb: catch any valgrind errors in testRusty Russell2012-06-191-2/+2
| | | | | | | | | Make --valgrind and --valgrind-log options work! Amitay figured this out! Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
* ntdb: catch any valgrind errors in testRusty Russell2012-06-191-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>
* ntdb: remove ntdb_error()Rusty Russell2012-06-1914-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>
* TDB2: Goodbye TDB2, Hello NTDB.Rusty Russell2012-06-19101-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>