removed dead/unnecessary code; private methods are now static

This commit is contained in:
Sears Russell 2008-10-04 07:08:35 +00:00
parent 42d779838e
commit 132a567533
2 changed files with 6 additions and 48 deletions

View file

@ -32,42 +32,15 @@ typedef struct {
recordid next; recordid next;
} hashEntry; } hashEntry;
pblHashTable_t * openHashes = NULL; static pblHashTable_t * openHashes = NULL;
pblHashTable_t * lockedBuckets = NULL;
pthread_mutex_t linearHashMutex;
pthread_cond_t bucketUnlocked;
void lockBucket(pageid_t bucket) { static void rehash(int xid, recordid hash, pageid_t next_split, pageid_t i, unsigned int keySize, unsigned int valSize);
while(pblHtLookup(lockedBuckets, &bucket, sizeof(bucket))) { static void update_hash_header(int xid, recordid hash, pageid_t i, pageid_t next_split);
pthread_cond_wait(&bucketUnlocked, &linearHashMutex); static int deleteFromBucket(int xid, recordid hash, int bucket_number, hashEntry * bucket_contents,
}
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,
void * key, int keySize, int valSize, recordid * deletedEntry); 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); 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) { 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; return rid;
} }
pthread_mutex_t exp_mutex;
pthread_mutex_t exp_slow_mutex;
void ThashInit() { void ThashInit() {
openHashes = pblHtCreate(); 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() { void ThashDeinit() {
pblHtDelete(openHashes); pblHtDelete(openHashes);
pblHtDelete(lockedBuckets);
} }
void TnaiveHashInsert(int xid, recordid hashRid, void TnaiveHashInsert(int xid, recordid hashRid,

View file

@ -28,7 +28,4 @@ void ThashInit();
void ThashDeinit(); void ThashDeinit();
int ThashOpen(int xid, recordid hashRid, int keySize, int valSize); int ThashOpen(int xid, recordid hashRid, int keySize, int valSize);
int ThashClose(int xid, recordid hashRid) ; 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 #endif