From 132a56753325b4ba28efd414dd8733c7584aefc4 Mon Sep 17 00:00:00 2001 From: Sears Russell Date: Sat, 4 Oct 2008 07:08:35 +0000 Subject: [PATCH] removed dead/unnecessary code; private methods are now static --- src/stasis/operations/naiveLinearHash.c | 51 +++---------------------- stasis/operations/naiveLinearHash.h | 3 -- 2 files changed, 6 insertions(+), 48 deletions(-) diff --git a/src/stasis/operations/naiveLinearHash.c b/src/stasis/operations/naiveLinearHash.c index 4b78a6b..9eee3bc 100644 --- a/src/stasis/operations/naiveLinearHash.c +++ b/src/stasis/operations/naiveLinearHash.c @@ -32,42 +32,15 @@ typedef struct { recordid next; } hashEntry; -pblHashTable_t * openHashes = NULL; -pblHashTable_t * lockedBuckets = NULL; -pthread_mutex_t linearHashMutex; -pthread_cond_t bucketUnlocked; +static pblHashTable_t * openHashes = NULL; -void lockBucket(pageid_t bucket) { - while(pblHtLookup(lockedBuckets, &bucket, sizeof(bucket))) { - pthread_cond_wait(&bucketUnlocked, &linearHashMutex); - } - pblHtInsert(lockedBuckets, &bucket, sizeof(bucket), (void*)1); -} - -int lockBucketForKey(const byte * key, int keySize, recordid * headerRidB) { - pageid_t bucket = hash(key, keySize, headerHashBits, headerNextSplit - 2) + 2; - - while(pblHtLookup(lockedBuckets, &bucket, sizeof(bucket))) { - pthread_cond_wait(&bucketUnlocked, &linearHashMutex); - bucket = hash(key, keySize, headerHashBits, headerNextSplit - 2) + 2; - } - - pblHtInsert(lockedBuckets, &bucket, sizeof(bucket), (void *) 1 ); - return bucket; -} - -void unlockBucket(pageid_t bucket) { - pblHtRemove(lockedBuckets, &bucket, sizeof(bucket)); - pthread_cond_broadcast(&bucketUnlocked); -} - -void rehash(int xid, recordid hash, pageid_t next_split, pageid_t i, unsigned int keySize, unsigned int valSize); -void update_hash_header(int xid, recordid hash, pageid_t i, pageid_t next_split); -int deleteFromBucket(int xid, recordid hash, int bucket_number, hashEntry * bucket_contents, +static void rehash(int xid, recordid hash, pageid_t next_split, pageid_t i, unsigned int keySize, unsigned int valSize); +static void update_hash_header(int xid, recordid hash, pageid_t i, pageid_t next_split); +static int deleteFromBucket(int xid, recordid hash, int bucket_number, hashEntry * bucket_contents, void * key, int keySize, int valSize, recordid * deletedEntry); -void insertIntoBucket(int xid, recordid hashRid, int bucket_number, hashEntry * bucket_contents, +static void insertIntoBucket(int xid, recordid hashRid, int bucket_number, hashEntry * bucket_contents, hashEntry * e, int keySize, int valSize, int skipDelete); -int findInBucket(int xid, recordid hashRid, int bucket_number, const void * key, int keySize, void * val, int valSize); +static int findInBucket(int xid, recordid hashRid, int bucket_number, const void * key, int keySize, void * val, int valSize); int findInBucket(int xid, recordid hashRid, int bucket_number, const void * key, int keySize, void * val, int valSize) { @@ -432,24 +405,12 @@ recordid ThashAlloc(int xid, int keySize, int valSize) { return rid; } -pthread_mutex_t exp_mutex; -pthread_mutex_t exp_slow_mutex; - - void ThashInit() { openHashes = pblHtCreate(); - lockedBuckets = pblHtCreate(); - - pthread_mutex_init(&linearHashMutex , NULL); - pthread_cond_init(&bucketUnlocked , NULL); - pthread_mutex_init(&exp_mutex, NULL); - pthread_mutex_init(&exp_slow_mutex, NULL); - } void ThashDeinit() { pblHtDelete(openHashes); - pblHtDelete(lockedBuckets); } void TnaiveHashInsert(int xid, recordid hashRid, diff --git a/stasis/operations/naiveLinearHash.h b/stasis/operations/naiveLinearHash.h index 29b2505..cd90e64 100644 --- a/stasis/operations/naiveLinearHash.h +++ b/stasis/operations/naiveLinearHash.h @@ -28,7 +28,4 @@ void ThashInit(); void ThashDeinit(); int ThashOpen(int xid, recordid hashRid, int keySize, int valSize); int ThashClose(int xid, recordid hashRid) ; -void lockBucket(pageid_t bucket); -void unlockBucket(pageid_t bucket); -int lockBucketForKey(const byte * key, int keySize, recordid * headerRidB); #endif