diff --git a/benchmarks/Makefile.am b/benchmarks/Makefile.am index 47afda5..1f663ef 100644 --- a/benchmarks/Makefile.am +++ b/benchmarks/Makefile.am @@ -1,7 +1,7 @@ LDADD=$(top_builddir)/src/2pc/lib2pc.a $(top_builddir)/src/libdfa/libdfa.a \ $(top_builddir)/src/lladd/liblladd.a $(top_builddir)/src/pbl/libpbl.a \ $(top_builddir)/src/libdfa/librw.a -bin_PROGRAMS=naiveHash logicalHash readLogicalHash naiveMultiThreaded logicalMultThreaded rawSet arrayListSet logicalMultiReaders +bin_PROGRAMS=naiveHash logicalHash readLogicalHash naiveMultiThreaded logicalMultThreaded rawSet arrayListSet logicalMultiReaders linearHashNTA linkedListNTA AM_CFLAGS= -g -Wall -pedantic -std=gnu99 SUBDIRS=berkeleyDB diff --git a/benchmarks/linearHashNTA.c b/benchmarks/linearHashNTA.c new file mode 100644 index 0000000..2234948 --- /dev/null +++ b/benchmarks/linearHashNTA.c @@ -0,0 +1,46 @@ +#include +#include +#include +#include +#include + + +int main(int argc, char** argv) { + + assert(argc == 3); + + int xact_count = atoi(argv[1]); + int count = atoi(argv[2]); + int k; + + /* unlink("storefile.txt"); + unlink("logfile.txt"); + unlink("blob0_file.txt"); + unlink("blob1_file.txt"); */ + + Tinit(); + int xid = Tbegin(); + + recordid hash = ThashCreate(xid, sizeof(int), sizeof(int)); + + Tcommit(xid); + + int i = 0; + + for(k = 0; k < xact_count; k++) { + + xid = Tbegin(); + + for(;i < count *(k+1) ; i++) { + + ThashInsert(xid, hash, (byte*)&i, sizeof(int), (byte*)&i, sizeof(int)); + + } + + Tcommit(xid); + + } + + Tdeinit(); + +} diff --git a/benchmarks/linkedListNTA.c b/benchmarks/linkedListNTA.c new file mode 100644 index 0000000..aaa3181 --- /dev/null +++ b/benchmarks/linkedListNTA.c @@ -0,0 +1,46 @@ +#include +#include +#include +#include +#include + + +int main(int argc, char** argv) { + + assert(argc == 3); + + int xact_count = atoi(argv[1]); + int count = atoi(argv[2]); + int k; + + /* unlink("storefile.txt"); + unlink("logfile.txt"); + unlink("blob0_file.txt"); + unlink("blob1_file.txt"); */ + + Tinit(); + int xid = Tbegin(); + + recordid hash = TlinkedListCreate(xid, sizeof(int), sizeof(int)); + + Tcommit(xid); + + int i = 0; + + for(k = 0; k < xact_count; k++) { + + xid = Tbegin(); + + for(;i < count *(k+1) ; i++) { + + TlinkedListInsert(xid, hash, (byte*)&i, sizeof(int), (byte*)&i, sizeof(int)); + + } + + Tcommit(xid); + + } + + Tdeinit(); + +} diff --git a/src/lladd/operations/linearHashNTA.c b/src/lladd/operations/linearHashNTA.c index 140c1ed..c799f28 100644 --- a/src/lladd/operations/linearHashNTA.c +++ b/src/lladd/operations/linearHashNTA.c @@ -223,7 +223,8 @@ compensated_function static int __ThashInsert(int xid, recordid hashHeader, cons // int before = TpagedListSpansPages(xid, bucketList); - ret = TpagedListInsert(xid, bucketList, key, keySize, value, valueSize); + ret = TpagedListRemove(xid, bucketList, key, keySize); + TpagedListInsert(xid, bucketList, key, keySize, value, valueSize); // int after = TpagedListSpansPages(xid, bucketList); // if(before != after) { // Page overflowed... @@ -233,7 +234,8 @@ compensated_function static int __ThashInsert(int xid, recordid hashHeader, cons } else { assert(lhh.keySize == keySize); assert(lhh.valueSize == valueSize); - ret = TlinkedListInsert(xid, bucket, key, keySize, value, valueSize); + ret = TlinkedListRemove(xid, bucket, key, keySize); + TlinkedListInsert(xid, bucket, key, keySize, value, valueSize); } if(ret) { lhh.numEntries--; } Tset(xid, hashHeader, &lhh); diff --git a/src/lladd/operations/linkedListNTA.c b/src/lladd/operations/linkedListNTA.c index 8347304..4f14391 100644 --- a/src/lladd/operations/linkedListNTA.c +++ b/src/lladd/operations/linkedListNTA.c @@ -106,10 +106,10 @@ compensated_function static int operateRemove(int xid, Page *p, lsn_t lsn, reco } compensated_function int TlinkedListInsert(int xid, recordid list, const byte * key, int keySize, const byte * value, int valueSize) { - int ret; - try_ret(compensation_error()) { + int ret = 0; + /* try_ret(compensation_error()) { ret = TlinkedListRemove(xid, list, key, keySize); - } end_ret(compensation_error()); + } end_ret(compensation_error()); */ lladd_linkedListInsert_log * undoLog = malloc(sizeof(lladd_linkedListInsert_log) + keySize); diff --git a/src/lladd/operations/pageOrientedListNTA.c b/src/lladd/operations/pageOrientedListNTA.c index 223993d..51196c4 100644 --- a/src/lladd/operations/pageOrientedListNTA.c +++ b/src/lladd/operations/pageOrientedListNTA.c @@ -29,12 +29,13 @@ compensated_function int TpagedListInsert(int xid, recordid list, const byte * k Tread(xid, list, &header); recordid headerRid = list; - byte * garbage; - ret = (TpagedListFind(xid, list, key, keySize, &garbage) != -1); + /* byte * garbage; + ret = (TpagedListFind(xid, list, key, keySize, &garbage) != -1); if(ret) { free(garbage); TpagedListRemove(xid, list, key, keySize); - } + } */ + ret = 0; int entrySize = sizeof(pagedListEntry) + keySize + valueSize; recordid rid = TallocFromPage(xid, headerRid.page, entrySize);