all naive linear hash methods now start with TnaiveHash; removed references to ThashAlloc from documentation
This commit is contained in:
parent
3c4c4f0916
commit
2c2c603dd2
8 changed files with 23 additions and 22 deletions
|
@ -20,7 +20,7 @@ int main(int argc, char** argv) {
|
||||||
|
|
||||||
int xid = Tbegin();
|
int xid = Tbegin();
|
||||||
|
|
||||||
recordid hash = ThashAlloc(xid, sizeof(int), sizeof(int));
|
recordid hash = TnaiveHashCreate(xid, sizeof(int), sizeof(int));
|
||||||
|
|
||||||
Tcommit(xid);
|
Tcommit(xid);
|
||||||
|
|
||||||
|
|
|
@ -43,7 +43,7 @@ int main(int argc, char** argv) {
|
||||||
|
|
||||||
Tinit();
|
Tinit();
|
||||||
int xid = Tbegin();
|
int xid = Tbegin();
|
||||||
hash = ThashAlloc(xid, sizeof(int), sizeof(int));
|
hash = TnaiveHashCreate(xid, sizeof(int), sizeof(int));
|
||||||
|
|
||||||
Tcommit(xid);
|
Tcommit(xid);
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@ int main (int argc, char ** argv) {
|
||||||
|
|
||||||
if(TrecordType(xid, ROOT_RECORD) == INVALID_SLOT) {
|
if(TrecordType(xid, ROOT_RECORD) == INVALID_SLOT) {
|
||||||
|
|
||||||
// ThashAlloc() will work here as well.
|
// ThashCreate() will work here as well.
|
||||||
rootEntry = Talloc(xid, sizeof(int));
|
rootEntry = Talloc(xid, sizeof(int));
|
||||||
|
|
||||||
assert(ROOT_RECORD.page == rootEntry.page);
|
assert(ROOT_RECORD.page == rootEntry.page);
|
||||||
|
|
|
@ -355,7 +355,7 @@ int deleteFromBucket(int xid, recordid hash, int bucket_number, hashEntry * buck
|
||||||
return found;
|
return found;
|
||||||
}
|
}
|
||||||
|
|
||||||
recordid ThashAlloc(int xid, int keySize, int valSize) {
|
recordid TnaiveHashCreate(int xid, int keySize, int valSize) {
|
||||||
/* Want 16 buckets, doubling on overflow. */
|
/* Want 16 buckets, doubling on overflow. */
|
||||||
recordid rid = TarrayListAlloc(xid, 4096, 2, sizeof(hashEntry) + keySize + valSize);
|
recordid rid = TarrayListAlloc(xid, 4096, 2, sizeof(hashEntry) + keySize + valSize);
|
||||||
assert(rid.size == 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;
|
return rid;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ThashInit() {
|
void TnaiveHashInit() {
|
||||||
openHashes = pblHtCreate();
|
openHashes = pblHtCreate();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ThashDeinit() {
|
void TnaiveHashDeinit() {
|
||||||
pblHtDelete(openHashes);
|
pblHtDelete(openHashes);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -461,7 +461,7 @@ int TnaiveHashDelete(int xid, recordid hashRid,
|
||||||
return ret;
|
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);
|
recordid * headerRidB = malloc(sizeof(recordid) + keySize + valSize);
|
||||||
hashRid.slot = 1;
|
hashRid.slot = 1;
|
||||||
Tread(xid, hashRid, headerRidB);
|
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));
|
recordid * freeMe = pblHtLookup(openHashes, &(hashRid.page), sizeof(hashRid.page));
|
||||||
pblHtRemove(openHashes, &(hashRid.page), sizeof(hashRid.page));
|
pblHtRemove(openHashes, &(hashRid.page), sizeof(hashRid.page));
|
||||||
free(freeMe);
|
free(freeMe);
|
||||||
|
|
|
@ -211,7 +211,7 @@ int Tinit() {
|
||||||
pageOperationsInit();
|
pageOperationsInit();
|
||||||
initNestedTopActions();
|
initNestedTopActions();
|
||||||
TallocInit();
|
TallocInit();
|
||||||
ThashInit();
|
TnaiveHashInit();
|
||||||
LinearHashNTAInit();
|
LinearHashNTAInit();
|
||||||
LinkedListNTAInit();
|
LinkedListNTAInit();
|
||||||
iterator_init();
|
iterator_init();
|
||||||
|
@ -420,7 +420,7 @@ int Tdeinit() {
|
||||||
}
|
}
|
||||||
assert( numActiveXactions == 0 );
|
assert( numActiveXactions == 0 );
|
||||||
truncationDeinit();
|
truncationDeinit();
|
||||||
ThashDeinit();
|
TnaiveHashDeinit();
|
||||||
TallocDeinit();
|
TallocDeinit();
|
||||||
deinitNestedTopActions();
|
deinitNestedTopActions();
|
||||||
bufDeinit();
|
bufDeinit();
|
||||||
|
@ -445,7 +445,7 @@ int TuncleanShutdown() {
|
||||||
// and active transactions get rolled back.
|
// and active transactions get rolled back.
|
||||||
stasis_suppress_unclean_shutdown_warnings = 1;
|
stasis_suppress_unclean_shutdown_warnings = 1;
|
||||||
truncationDeinit();
|
truncationDeinit();
|
||||||
ThashDeinit();
|
TnaiveHashDeinit();
|
||||||
simulateBufferManagerCrash();
|
simulateBufferManagerCrash();
|
||||||
if(slow_pfile) {
|
if(slow_pfile) {
|
||||||
slow_close(slow_pfile);
|
slow_close(slow_pfile);
|
||||||
|
|
|
@ -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,
|
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().
|
it is automatically freed. Otherwise, it should be manually freed with free().
|
||||||
@param xid transaction id
|
@param xid transaction id
|
||||||
@param hash the recordid returned by ThashAlloc
|
@param hash the recordid returned by ThashCreate()
|
||||||
@param keySize the same as the value passed into ThashAlloc.
|
@param keySize the same as the value passed into ThashCreate()
|
||||||
@param valueSize the same as the value passed into ThashAlloc
|
@param valueSize the same as the value passed into ThashCreate()
|
||||||
@deprecated @see interator.h. Use the linearHash implementation of that interface instead.
|
@deprecated @see interator.h. Use the linearHash implementation of that interface instead.
|
||||||
*/
|
*/
|
||||||
lladd_hash_iterator * ThashIterator(int xid, recordid hash, int keySize, int valueSize);
|
lladd_hash_iterator * ThashIterator(int xid, recordid hash, int keySize, int valueSize);
|
||||||
|
|
|
@ -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 TnaiveHashInsert(int xid, recordid hashRid,
|
||||||
void * key, int keySize,
|
void * key, int keySize,
|
||||||
|
@ -24,8 +24,8 @@ int TnaiveHashDelete(int xid, recordid hashRid,
|
||||||
void * key, int keySize, int valSize);
|
void * key, int keySize, int valSize);
|
||||||
void TnaiveHashUpdate(int xid, recordid hashRid, void * key, int keySize, void * val, 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);
|
int TnaiveHashLookup(int xid, recordid hashRid, void * key, int keySize, void * buf, int valSize);
|
||||||
void ThashInit();
|
void TnaiveHashInit();
|
||||||
void ThashDeinit();
|
void TnaiveHashDeinit();
|
||||||
int ThashOpen(int xid, recordid hashRid, int keySize, int valSize);
|
int TnaiveHashOpen(int xid, recordid hashRid, int keySize, int valSize);
|
||||||
int ThashClose(int xid, recordid hashRid) ;
|
int TnaiveHashClose(int xid, recordid hashRid) ;
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -71,7 +71,7 @@ START_TEST(simpleLinearHashTest)
|
||||||
|
|
||||||
int xid = Tbegin();
|
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++) {
|
for(int i = 0; i < NUM_ENTRIES; i++) {
|
||||||
recordid rid;
|
recordid rid;
|
||||||
|
@ -192,7 +192,7 @@ START_TEST(transactionalLinearHashTest)
|
||||||
|
|
||||||
// printf("%d %d %ld\n", foo.page, foo.slot, foo.size);
|
// 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);
|
// printf("%d %d %ld", hashRoot.page, hashRoot.slot, hashRoot.size);
|
||||||
|
|
||||||
|
@ -241,7 +241,7 @@ START_TEST(transactionalLinearHashTest)
|
||||||
if(TdurabilityLevel() == VOLATILE) return;
|
if(TdurabilityLevel() == VOLATILE) return;
|
||||||
Tinit();
|
Tinit();
|
||||||
xid = Tbegin();
|
xid = Tbegin();
|
||||||
ThashOpen(xid, hashRoot, sizeof(int), sizeof(recordid));
|
TnaiveHashOpen(xid, hashRoot, sizeof(int), sizeof(recordid));
|
||||||
for(i = 0; i < NUM_ENTRIES_XACT; i++) {
|
for(i = 0; i < NUM_ENTRIES_XACT; i++) {
|
||||||
if(!(i%10)) {
|
if(!(i%10)) {
|
||||||
recordid theVal;
|
recordid theVal;
|
||||||
|
@ -254,6 +254,7 @@ START_TEST(transactionalLinearHashTest)
|
||||||
assert(!TnaiveHashLookup(xid, hashRoot, &i, sizeof(int), &theVal, sizeof(recordid)));
|
assert(!TnaiveHashLookup(xid, hashRoot, &i, sizeof(int), &theVal, sizeof(recordid)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
TnaiveHashClose(xid, hsahRoot);
|
||||||
Tabort(xid);
|
Tabort(xid);
|
||||||
Tdeinit();
|
Tdeinit();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue