stasis-aries-wal/benchmarks/readLogicalHash.c
Sears Russell 6198522971 Starting to rip the old jbhash implementation out, and replace it with a
linear hash implementation.  In particular, I've implemented (sort of) an
iterator for linear hash, and (sort of) ported libdfa to linearhash.c

I say 'sort of' since this functionality is broken with this commit.  On the other hand, CVS should build now, and the tests under lladd will pass.  libdfa's new tests don't pass at the moment.
2005-01-10 03:02:02 +00:00

54 lines
863 B
C

#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <lladd/transactional.h>
#include <unistd.h>
int main(int argc, char** argv) {
assert(argc == 2);
int count = atoi(argv[1]);
unlink("storefile.txt");
unlink("logfile.txt");
unlink("blob0_file.txt");
unlink("blob1_file.txt");
Tinit();
int xid = Tbegin();
recordid hash = ThashAlloc(xid, sizeof(int), sizeof(int));
int i;
for(i = 0; i < count ; i++) {
TlogicalHashInsert(xid, hash, &i, sizeof(int), &i, sizeof(int));
}
Tcommit(xid);
xid = Tbegin();
ThashOpen(xid, hash, sizeof(int), sizeof(int));
int k;
for(k = 0; k < 10; k++) {
for(i = 0; i < count ; i++) {
int j;
assert(TlogicalHashLookup(xid, hash, &i, sizeof(int), &j, sizeof(int)));
assert(i == j);
}
}
Tcommit(xid);
Tdeinit();
}