diff --git a/benchmarks/naiveHash.c b/benchmarks/naiveHash.c index b075bc6..643103f 100644 --- a/benchmarks/naiveHash.c +++ b/benchmarks/naiveHash.c @@ -20,7 +20,7 @@ int main(int argc, char** argv) { int xid = Tbegin(); - recordid hash = ThashAlloc(xid, sizeof(int), sizeof(int)); + recordid hash = TnaiveHashCreate(xid, sizeof(int), sizeof(int)); Tcommit(xid); diff --git a/benchmarks/naiveMultiThreaded.c b/benchmarks/naiveMultiThreaded.c index bbed852..64d61b1 100644 --- a/benchmarks/naiveMultiThreaded.c +++ b/benchmarks/naiveMultiThreaded.c @@ -43,7 +43,7 @@ int main(int argc, char** argv) { Tinit(); int xid = Tbegin(); - hash = ThashAlloc(xid, sizeof(int), sizeof(int)); + hash = TnaiveHashCreate(xid, sizeof(int), sizeof(int)); Tcommit(xid); diff --git a/examples/ex2.c b/examples/ex2.c index f2390c1..064c105 100644 --- a/examples/ex2.c +++ b/examples/ex2.c @@ -12,7 +12,7 @@ int main (int argc, char ** argv) { if(TrecordType(xid, ROOT_RECORD) == INVALID_SLOT) { - // ThashAlloc() will work here as well. + // ThashCreate() will work here as well. rootEntry = Talloc(xid, sizeof(int)); assert(ROOT_RECORD.page == rootEntry.page); diff --git a/src/stasis/operations/naiveLinearHash.c b/src/stasis/operations/naiveLinearHash.c index 34d4225..d6d3a7e 100644 --- a/src/stasis/operations/naiveLinearHash.c +++ b/src/stasis/operations/naiveLinearHash.c @@ -355,7 +355,7 @@ int deleteFromBucket(int xid, recordid hash, int bucket_number, hashEntry * buck return found; } -recordid ThashAlloc(int xid, int keySize, int valSize) { +recordid TnaiveHashCreate(int xid, int keySize, int valSize) { /* Want 16 buckets, doubling on overflow. */ recordid rid = TarrayListAlloc(xid, 4096, 2, sizeof(hashEntry) + keySize + valSize); assert(rid.size == sizeof(hashEntry) + keySize + valSize); @@ -405,11 +405,11 @@ recordid ThashAlloc(int xid, int keySize, int valSize) { return rid; } -void ThashInit() { +void TnaiveHashInit() { openHashes = pblHtCreate(); } -void ThashDeinit() { +void TnaiveHashDeinit() { pblHtDelete(openHashes); } @@ -461,7 +461,7 @@ int TnaiveHashDelete(int xid, recordid hashRid, return ret; } -int ThashOpen(int xid, recordid hashRid, int keySize, int valSize) { +int TnaiveHashOpen(int xid, recordid hashRid, int keySize, int valSize) { recordid * headerRidB = malloc(sizeof(recordid) + keySize + valSize); hashRid.slot = 1; Tread(xid, hashRid, headerRidB); @@ -478,7 +478,7 @@ void TnaiveHashUpdate(int xid, recordid hashRid, void * key, int keySize, void * } -int ThashClose(int xid, recordid hashRid) { +int TnaiveHashClose(int xid, recordid hashRid) { recordid * freeMe = pblHtLookup(openHashes, &(hashRid.page), sizeof(hashRid.page)); pblHtRemove(openHashes, &(hashRid.page), sizeof(hashRid.page)); free(freeMe); diff --git a/src/stasis/transactional2.c b/src/stasis/transactional2.c index 3b25bfa..4a458f9 100644 --- a/src/stasis/transactional2.c +++ b/src/stasis/transactional2.c @@ -211,7 +211,7 @@ int Tinit() { pageOperationsInit(); initNestedTopActions(); TallocInit(); - ThashInit(); + TnaiveHashInit(); LinearHashNTAInit(); LinkedListNTAInit(); iterator_init(); @@ -420,7 +420,7 @@ int Tdeinit() { } assert( numActiveXactions == 0 ); truncationDeinit(); - ThashDeinit(); + TnaiveHashDeinit(); TallocDeinit(); deinitNestedTopActions(); bufDeinit(); @@ -445,7 +445,7 @@ int TuncleanShutdown() { // and active transactions get rolled back. stasis_suppress_unclean_shutdown_warnings = 1; truncationDeinit(); - ThashDeinit(); + TnaiveHashDeinit(); simulateBufferManagerCrash(); if(slow_pfile) { slow_close(slow_pfile); diff --git a/stasis/operations/linearHashNTA.h b/stasis/operations/linearHashNTA.h index 608b804..48e08ca 100644 --- a/stasis/operations/linearHashNTA.h +++ b/stasis/operations/linearHashNTA.h @@ -57,9 +57,9 @@ compensated_function int ThashLookup(int xid, recordid hash, const byte* key, in overloaded, and is subject to change. If the iterator is run to completion, it is automatically freed. Otherwise, it should be manually freed with free(). @param xid transaction id - @param hash the recordid returned by ThashAlloc - @param keySize the same as the value passed into ThashAlloc. - @param valueSize the same as the value passed into ThashAlloc + @param hash the recordid returned by ThashCreate() + @param keySize the same as the value passed into ThashCreate() + @param valueSize the same as the value passed into ThashCreate() @deprecated @see interator.h. Use the linearHash implementation of that interface instead. */ lladd_hash_iterator * ThashIterator(int xid, recordid hash, int keySize, int valueSize); diff --git a/stasis/operations/naiveLinearHash.h b/stasis/operations/naiveLinearHash.h index cd90e64..61b4aaa 100644 --- a/stasis/operations/naiveLinearHash.h +++ b/stasis/operations/naiveLinearHash.h @@ -15,7 +15,7 @@ -recordid ThashAlloc(int xid, int keySize, int valSize) ; +recordid TnaiveHashCreate(int xid, int keySize, int valSize) ; void TnaiveHashInsert(int xid, recordid hashRid, void * key, int keySize, @@ -24,8 +24,8 @@ int TnaiveHashDelete(int xid, recordid hashRid, void * key, int keySize, int valSize); void TnaiveHashUpdate(int xid, recordid hashRid, void * key, int keySize, void * val, int valSize); int TnaiveHashLookup(int xid, recordid hashRid, void * key, int keySize, void * buf, int valSize); -void ThashInit(); -void ThashDeinit(); -int ThashOpen(int xid, recordid hashRid, int keySize, int valSize); -int ThashClose(int xid, recordid hashRid) ; +void TnaiveHashInit(); +void TnaiveHashDeinit(); +int TnaiveHashOpen(int xid, recordid hashRid, int keySize, int valSize); +int TnaiveHashClose(int xid, recordid hashRid) ; #endif diff --git a/test/stasis/check_linearHash.c b/test/stasis/check_linearHash.c index ad1b040..2d8a594 100644 --- a/test/stasis/check_linearHash.c +++ b/test/stasis/check_linearHash.c @@ -71,7 +71,7 @@ START_TEST(simpleLinearHashTest) int xid = Tbegin(); - recordid hashRoot = ThashAlloc(xid, sizeof(int), sizeof(recordid)); + recordid hashRoot = TnaiveHashCreate(xid, sizeof(int), sizeof(recordid)); for(int i = 0; i < NUM_ENTRIES; i++) { recordid rid; @@ -192,7 +192,7 @@ START_TEST(transactionalLinearHashTest) // printf("%d %d %ld\n", foo.page, foo.slot, foo.size); - recordid hashRoot = ThashAlloc(xid, sizeof(int), sizeof(recordid)); + recordid hashRoot = TnaiveHashCreate(xid, sizeof(int), sizeof(recordid)); // printf("%d %d %ld", hashRoot.page, hashRoot.slot, hashRoot.size); @@ -241,7 +241,7 @@ START_TEST(transactionalLinearHashTest) if(TdurabilityLevel() == VOLATILE) return; Tinit(); xid = Tbegin(); - ThashOpen(xid, hashRoot, sizeof(int), sizeof(recordid)); + TnaiveHashOpen(xid, hashRoot, sizeof(int), sizeof(recordid)); for(i = 0; i < NUM_ENTRIES_XACT; i++) { if(!(i%10)) { recordid theVal; @@ -254,6 +254,7 @@ START_TEST(transactionalLinearHashTest) assert(!TnaiveHashLookup(xid, hashRoot, &i, sizeof(int), &theVal, sizeof(recordid))); } } + TnaiveHashClose(xid, hsahRoot); Tabort(xid); Tdeinit();