whitespace fixup after removal of compensations
This commit is contained in:
parent
aee5cca000
commit
4fb44b6f5f
14 changed files with 559 additions and 657 deletions
|
@ -128,8 +128,6 @@ static void bufManBufDeinit() {
|
|||
/**
|
||||
Just close file descriptors, don't do any other clean up. (For
|
||||
testing.)
|
||||
|
||||
@todo buffer manager should never call close_(); it not longer manages pageFile handles
|
||||
*/
|
||||
static void bufManSimulateBufferManagerCrash() {
|
||||
page_handle->close(page_handle);
|
||||
|
|
|
@ -17,8 +17,6 @@ typedef struct {
|
|||
lsn_t eof;
|
||||
} logMemory_fifo_t;
|
||||
|
||||
|
||||
|
||||
void logMemory_init() {
|
||||
/* NO-OP */
|
||||
}
|
||||
|
@ -49,9 +47,6 @@ lladdFifo_t * logMemoryFifo(size_t size, lsn_t initialOffset) {
|
|||
return fifo;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/*------------- iterator interface implementation --------------------*/
|
||||
|
||||
/** This function should not be called until next() or one of its
|
||||
|
@ -92,7 +87,6 @@ int logMemory_Iterator_next (int xid, void * impl) {
|
|||
pthread_mutex_unlock(&(fifo->mutex));
|
||||
pthread_mutex_unlock(&(fifo->readerMutex));
|
||||
return LLADD_INTERNAL_ERROR;
|
||||
|
||||
}
|
||||
assert(!ret);
|
||||
|
||||
|
@ -115,7 +109,6 @@ int logMemory_Iterator_next (int xid, void * impl) {
|
|||
pthread_mutex_unlock(&(fifo->mutex));
|
||||
pthread_mutex_unlock(&(fifo->readerMutex));
|
||||
return LLADD_INTERNAL_ERROR;
|
||||
|
||||
}
|
||||
|
||||
assert(!ret);
|
||||
|
@ -124,8 +117,8 @@ int logMemory_Iterator_next (int xid, void * impl) {
|
|||
|
||||
pthread_cond_broadcast(&(fifo->writeReady));
|
||||
pthread_mutex_unlock(&(fifo->mutex));
|
||||
return 1;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
/** @todo logMemory_Iterator_tryNext is a cut and pasted version of
|
||||
|
@ -161,7 +154,6 @@ int logMemory_Iterator_tryNext (int xid, void * impl) {
|
|||
pthread_mutex_unlock(&(fifo->mutex));
|
||||
pthread_mutex_unlock(&(fifo->readerMutex));
|
||||
return LLADD_INTERNAL_ERROR;
|
||||
|
||||
}
|
||||
assert(!ret);
|
||||
|
||||
|
@ -184,9 +176,7 @@ int logMemory_Iterator_tryNext (int xid, void * impl) {
|
|||
pthread_mutex_unlock(&(fifo->mutex));
|
||||
pthread_mutex_unlock(&(fifo->readerMutex));
|
||||
return LLADD_INTERNAL_ERROR;
|
||||
|
||||
}
|
||||
|
||||
assert(!ret);
|
||||
|
||||
fifo->cached_lsn = (lsn_t)lsn;
|
||||
|
@ -316,10 +306,6 @@ void logMemory_consumer_close(int xid, void *it){
|
|||
pthread_mutex_unlock(&(fifo->mutex));
|
||||
}
|
||||
|
||||
/*compensated_function void Tconsumer_close(int xid, lladdConsumer_t * cons) {
|
||||
logMemory_consumer_close(xid, cons);
|
||||
}*/
|
||||
|
||||
int logMemory_consumer_push(int xid, /*lladdConsumer_t * cons*/ void * it, byte * key, size_t keySize, byte * val, size_t valSize) {
|
||||
int ret;
|
||||
logMemory_fifo_t * fifo = (logMemory_fifo_t *) (it);
|
||||
|
@ -347,12 +333,3 @@ int logMemory_consumer_push(int xid, /*lladdConsumer_t * cons*/ void * it, byte
|
|||
return ret;
|
||||
|
||||
}
|
||||
/* if(it->type == LOG_MEMORY_CONSUMER) {
|
||||
return logMemory_consumer_push(xid, it, key, keySize, val, valSize);
|
||||
}
|
||||
if(it->type == POINTER_CONSUMER) {
|
||||
return pointer_consumer_push(xid, it, key, keySize, val, valSize);
|
||||
}
|
||||
|
||||
// always succeeds.
|
||||
}*/
|
||||
|
|
|
@ -4,22 +4,19 @@
|
|||
|
||||
#include <stasis/logger/logMemory.h>
|
||||
|
||||
lladdMultiplexer_t * lladdMultiplexer_alloc(int xid, lladdIterator_t * it,
|
||||
lladdMultiplexer_t * lladdMultiplexer_alloc(
|
||||
int xid, lladdIterator_t * it,
|
||||
void (*multiplexer)(byte * key,
|
||||
size_t keySize,
|
||||
byte * value,
|
||||
size_t valueSize,
|
||||
byte ** multiplexKey,
|
||||
size_t * multiplexKeySize),
|
||||
/* lladdConsumer_t * getConsumer(struct lladdFifoPool_t* fifoPool,
|
||||
byte* multiplexKey,
|
||||
size_t multiplexKeySize), */
|
||||
lladdFifoPool_t * fifoPool) {
|
||||
lladdMultiplexer_t * ret = malloc(sizeof(lladdMultiplexer_t));
|
||||
ret->it = it;
|
||||
ret->multiplexer = multiplexer;
|
||||
ret->consumerHash = pblHtCreate();
|
||||
// ret->getConsumer = getConsumer;
|
||||
ret->fifoPool = fifoPool;
|
||||
ret->xid = xid;
|
||||
return ret;
|
||||
|
@ -158,7 +155,6 @@ void multiplexHashLogByKey(byte * key,
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
void multiplexByValue(byte * key, size_t keySize, byte * value, size_t valueSize, byte **multiplexKey, size_t * multiplexSize) {
|
||||
*multiplexKey = value;
|
||||
*multiplexSize = valueSize;
|
||||
|
|
|
@ -15,7 +15,6 @@ typedef struct {
|
|||
pageid_t maxOffset;
|
||||
} array_list_parameter_t;
|
||||
|
||||
|
||||
static array_list_parameter_t array_list_read_parameter(int xid, Page * p) {
|
||||
|
||||
array_list_parameter_t alp;
|
||||
|
@ -63,6 +62,7 @@ static int array_list_op_init_header(const LogEntry* e, Page* p) {
|
|||
stasis_fixed_records_per_page(sizeof(pageid_t)));
|
||||
|
||||
recordid initialSizeRid, multiplierRid, slotSizeRid, maxOffsetRid, firstDataPageRid;
|
||||
|
||||
initialSizeRid.page
|
||||
= multiplierRid.page = slotSizeRid.page
|
||||
= maxOffsetRid.page = firstDataPageRid.page = p->id;
|
||||
|
@ -190,11 +190,10 @@ void TarrayListDealloc(int xid, recordid rid) {
|
|||
|
||||
/** @todo locking for arrayList... this isn't pressing since currently
|
||||
the only thing that calls arraylist (the hashtable
|
||||
implementations) serialize bucket list operations anyway...
|
||||
implementations) serializes bucket list operations anyway...
|
||||
|
||||
@todo this function calls pow(), which is horribly inefficient.
|
||||
*/
|
||||
|
||||
int TarrayListExtend(int xid, recordid rid, int slots) {
|
||||
Page * p = loadPage(xid, rid.page);
|
||||
readlock(p->rwlatch, 0);
|
||||
|
|
|
@ -17,7 +17,6 @@
|
|||
@todo Improve concurrency of linearHashNTA and linkedListNTA by leveraging Page.impl on the data structure header page?
|
||||
*/
|
||||
|
||||
|
||||
static void linearHashNTAIterator_close(int xid, void * it);
|
||||
static int linearHashNTAIterator_next (int xid, void * it);
|
||||
static int linearHashNTAIterator_key (int xid, void * it, byte **key);
|
||||
|
@ -116,17 +115,6 @@ void ThashDelete(int xid, recordid hash) {
|
|||
static int __ThashInsert(int xid, recordid hashHeader, const byte* key, int keySize, const byte* value, int valueSize);
|
||||
static int __ThashRemove(int xid, recordid hashHeader, const byte * key, int keySize);
|
||||
|
||||
/*typedef struct {
|
||||
recordid hashHeader;
|
||||
int keySize;
|
||||
} linearHash_insert_arg;
|
||||
|
||||
typedef struct {
|
||||
recordid hashHeader;
|
||||
int keySize;
|
||||
int valueSize;
|
||||
} linearHash_remove_arg;*/
|
||||
|
||||
static int op_linear_hash_insert(const LogEntry* e, Page* p) {
|
||||
const linearHash_remove_arg * args = stasis_log_entry_update_args_cptr(e);
|
||||
recordid hashHeader = args->hashHeader;
|
||||
|
@ -187,9 +175,7 @@ int ThashInsert(int xid, recordid hashHeader, const byte* key, int keySize, cons
|
|||
arg->keySize = keySize;
|
||||
memcpy(arg+1, key, keySize);
|
||||
|
||||
/** @todo MEMORY LEAK arg, handle on pthread_cancel.. */
|
||||
void * handle;
|
||||
|
||||
handle = TbeginNestedTopAction(xid, OPERATION_LINEAR_HASH_INSERT, (byte*)arg, argSize);
|
||||
free(arg);
|
||||
__ThashInsert(xid, hashHeader, key, keySize, value, valueSize);
|
||||
|
@ -229,16 +215,9 @@ static int __ThashInsert(int xid, recordid hashHeader, const byte* key, int keyS
|
|||
|
||||
Tread(xid, bucket, &bucketList);
|
||||
|
||||
// int before = TpagedListSpansPages(xid, bucketList);
|
||||
ret = TpagedListRemove(xid, bucketList, key, keySize);
|
||||
TpagedListInsert(xid, bucketList, key, keySize, value, valueSize);
|
||||
|
||||
// int after = TpagedListSpansPages(xid, bucketList);
|
||||
// if(before != after) { // Page overflowed...
|
||||
// T hashSplitBucket(xid, hashHeader, &lhh);
|
||||
// T hashSplitBucket(xid, hashHeader, &lhh);
|
||||
// }
|
||||
|
||||
} else {
|
||||
assert(lhh.keySize == keySize); assert(lhh.valueSize == valueSize);
|
||||
ret = TlinkedListRemove(xid, bucket, key, keySize);
|
||||
|
@ -406,10 +385,7 @@ lladd_hash_iterator * ThashIterator(int xid, recordid hashHeader, int keySize, i
|
|||
it->bucket = lhh.buckets;
|
||||
it->numBuckets = lhh.nextSplit + stasis_util_two_to_the(lhh.bits-1);
|
||||
it->bucket.slot = 0;
|
||||
/* it->keySize = keySize;
|
||||
it->valueSize = valueSize;
|
||||
assert(keySize == lhh.keySize);
|
||||
assert(valueSize == lhh.valueSize); */
|
||||
|
||||
keySize = lhh.keySize;
|
||||
it->keySize = lhh.keySize;
|
||||
valueSize = lhh.valueSize;
|
||||
|
@ -587,7 +563,6 @@ void * ThashAsyncWorker(void * argp) {
|
|||
return NULL;
|
||||
}
|
||||
|
||||
/*lladdMultiplexer_t **/
|
||||
lladdConsumer_t * TasyncHashInit(int xid, recordid rid, int numWorkerThreads,
|
||||
int mainFifoLen, int numFifos,
|
||||
int subFifoLen, int dirtyFifoLen,
|
||||
|
@ -607,7 +582,6 @@ lladdConsumer_t * TasyncHashInit(int xid, recordid rid, int numWorkerThreads,
|
|||
|
||||
int i = 0;
|
||||
|
||||
|
||||
for(i = 0; i < numWorkerThreads; i++) {
|
||||
pthread_t thread;
|
||||
pthread_create(&thread, &attr, ThashAsyncWorker, mux->fifoPool->dirtyPoolFifo->iterator);
|
||||
|
|
|
@ -7,10 +7,6 @@
|
|||
|
||||
#include <assert.h>
|
||||
|
||||
/*#ifndef PTHREAD_MUTEX_RECURSIVE
|
||||
#define PTHREAD_MUTEX_RECURSIVE PTHREAD_MUTEX_RECURSIVE_NP
|
||||
#endif*/
|
||||
|
||||
/** A quick note on the format of linked lists. Each entry consists
|
||||
of a struct with some variable length data appended to it.
|
||||
|
||||
|
@ -32,8 +28,6 @@
|
|||
|
||||
stasis_linkedList_entry next = entry->next;
|
||||
|
||||
|
||||
|
||||
@file
|
||||
*/
|
||||
|
||||
|
@ -150,8 +144,6 @@ stasis_operation_impl stasis_op_impl_linked_list_remove() {
|
|||
return o;
|
||||
}
|
||||
static void stasis_linked_list_insert_helper(int xid, recordid list, const byte * key, int keySize, const byte * value, int valueSize) {
|
||||
//int ret = Tli nkedListRemove(xid, list, key, keySize);
|
||||
|
||||
stasis_linkedList_entry * entry = malloc(sizeof(stasis_linkedList_entry) + keySize + valueSize);
|
||||
|
||||
Tread(xid, list, entry);
|
||||
|
@ -216,9 +208,6 @@ int TlinkedListFind(int xid, recordid list, const byte * key, int keySize, byte
|
|||
return ret;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
int TlinkedListRemove(int xid, recordid list, const byte * key, int keySize) {
|
||||
byte * value;
|
||||
int valueSize;
|
||||
|
@ -299,9 +288,6 @@ static int stasis_linked_list_remove_helper(int xid, recordid list, const byte *
|
|||
Tdealloc(xid, lastRead);
|
||||
free (entry2);
|
||||
}
|
||||
// free(entry);
|
||||
// pthread_mutex_unlock(&linked_list_mutex);
|
||||
// return 1;
|
||||
ret = 1;
|
||||
break;
|
||||
} else { // Entry doesn't match the key we're looking for.
|
||||
|
@ -328,14 +314,10 @@ int TlinkedListMove(int xid, recordid start_list, recordid end_list, const byte
|
|||
pthread_mutex_lock(&stasis_linked_list_mutex);
|
||||
int valueSize = TlinkedListFind(xid, start_list, key, keySize, &value);
|
||||
if(valueSize != -1) {
|
||||
// pthread_mutex_unlock(&linked_list_mutex);
|
||||
// return 0;
|
||||
ret = 0;
|
||||
} else {
|
||||
TlinkedListRemove(xid, start_list, key, keySize);
|
||||
TlinkedListInsert(xid, end_list, key, keySize, value, valueSize);
|
||||
// pthread_mutex_unlock(&linked_list_mutex);
|
||||
// return 1;
|
||||
ret = 1;
|
||||
}
|
||||
if(value) { free(value); }
|
||||
|
@ -410,9 +392,7 @@ int TlinkedListNext(int xid, stasis_linkedList_iterator * it, byte ** key, int *
|
|||
it->first = -1;
|
||||
it->next = it->listRoot;
|
||||
ret = TlinkedListNext(xid, it, key, keySize, value, valueSize);
|
||||
// pthread_mutex_unlock(&linked_list_mutex);
|
||||
done = 1;
|
||||
// return ret;
|
||||
} else {
|
||||
//continue as normal.
|
||||
it->first = 0;
|
||||
|
|
|
@ -40,7 +40,6 @@ static void insertIntoBucket(int xid, recordid hashRid, int bucket_number, hashE
|
|||
hashEntry * e, int keySize, int valSize, int skipDelete);
|
||||
static 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 found;
|
||||
|
||||
|
@ -259,9 +258,6 @@ static void insertIntoBucket(int xid, recordid hashRid, int bucket_number, hashE
|
|||
/*@todo consider recovery for insertIntoBucket. */
|
||||
|
||||
hashRid.slot = bucket_number;
|
||||
// Page * p = loadPage(xid, hashRid.page);
|
||||
// assert(stasis_record_type_to_size(stasis_record_dereference(xid, p, hashRid).size) == sizeof(hashEntry) + valSize + keySize);
|
||||
// releasePage(p);
|
||||
|
||||
Tread(xid, hashRid, bucket_contents);
|
||||
|
||||
|
@ -335,7 +331,6 @@ static int deleteFromBucket(int xid, recordid hash, int bucket_number, hashEntry
|
|||
found = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
free(A);
|
||||
|
@ -464,7 +459,6 @@ int TnaiveHashOpen(int xid, recordid hashRid, int keySize, int valSize) {
|
|||
void TnaiveHashUpdate(int xid, recordid hashRid, void * key, int keySize, void * val, int valSize) {
|
||||
TnaiveHashDelete(xid, hashRid, key, keySize, valSize);
|
||||
TnaiveHashInsert(xid, hashRid, key, keySize, val, valSize);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -476,7 +470,6 @@ int TnaiveHashClose(int xid, recordid hashRid) {
|
|||
}
|
||||
|
||||
int TnaiveHashLookup(int xid, recordid hashRid, void * key, int keySize, void * buf, int valSize) {
|
||||
|
||||
recordid * headerRidB = pblHtLookup(openHashes, &(hashRid.page), sizeof(hashRid.page));
|
||||
int bucket_number = stasis_linear_hash(key, keySize, headerHashBits, headerNextSplit - 2) + 2;
|
||||
int ret = findInBucket(xid, hashRid, bucket_number, key, keySize, buf, valSize);
|
||||
|
|
|
@ -172,7 +172,6 @@ int TpagedListMove(int xid, recordid start_list, recordid end_list, const byte *
|
|||
ret = TpagedListInsert(xid, end_list, key, keySize, value, valueSize);
|
||||
assert(!ret);
|
||||
if(value) { free(value); }
|
||||
// ret = 1;
|
||||
} else {
|
||||
ret = 0;
|
||||
}
|
||||
|
|
|
@ -161,7 +161,6 @@ int stasis_record_read(int xid, Page * p, recordid rid, byte *buf) {
|
|||
stasis_record_read_done(xid,p,rid,dat);
|
||||
|
||||
return 0;
|
||||
|
||||
}
|
||||
/**
|
||||
@todo stasis_record_dereference should dispatch via page_impl...
|
||||
|
|
|
@ -99,7 +99,6 @@ int Tinit() {
|
|||
iterator_init();
|
||||
consumer_init();
|
||||
setupLockManagerCallbacksNil();
|
||||
//setupLockManagerCallbacksPage();
|
||||
|
||||
stasis_recovery_initiate(stasis_log_file, stasis_transaction_table, stasis_alloc);
|
||||
stasis_truncation = stasis_truncation_init(stasis_dirty_page_table, stasis_transaction_table,
|
||||
|
@ -112,7 +111,6 @@ int Tinit() {
|
|||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int Tbegin() {
|
||||
|
||||
assert(stasis_initted);
|
||||
|
@ -461,10 +459,8 @@ typedef struct {
|
|||
int TnestedTopAction(int xid, int op, const byte * dat, size_t datSize) {
|
||||
stasis_transaction_table_entry_t * xact = stasis_transaction_table_get(stasis_transaction_table, xid);
|
||||
assert(xid >= 0);
|
||||
void * e = stasis_log_begin_nta(stasis_log_file,
|
||||
xact,
|
||||
op, dat, datSize);
|
||||
// HACK: breaks encapsulation.
|
||||
void * e = stasis_log_begin_nta(stasis_log_file, xact, op, dat, datSize);
|
||||
// XXX HACK: breaks encapsulation.
|
||||
stasis_operation_do(e, NULL);
|
||||
|
||||
stasis_log_end_nta(stasis_log_file, xact, e);
|
||||
|
@ -524,7 +520,6 @@ int TisActiveTransaction(stasis_transaction_fingerprint_t * fp) {
|
|||
&& stasis_transaction_table_get(stasis_transaction_table, fp->xid)->recLSN == fp->rec_lsn;
|
||||
}
|
||||
|
||||
|
||||
void * stasis_log() {
|
||||
return stasis_log_file;
|
||||
}
|
||||
|
|
|
@ -69,13 +69,6 @@ terms specified in this license.
|
|||
#ifndef __pageOrientedListNTA_H
|
||||
#define __pageOrientedListNTA_H
|
||||
|
||||
|
||||
//typedef struct {
|
||||
// long page;
|
||||
/* The slot of the next record to be returned. */
|
||||
// int slot;
|
||||
//} lladd_pagedList_iterator;
|
||||
|
||||
typedef struct {
|
||||
recordid headerRid;
|
||||
recordid entryRid;
|
||||
|
@ -87,7 +80,6 @@ typedef struct {
|
|||
} pagedListHeader;
|
||||
|
||||
|
||||
//recordid dereferencePagedListRID(int xid, recordid rid);
|
||||
/** @return 1 if the key was already in the list. */
|
||||
int TpagedListInsert(int xid, recordid list, const byte * key, int keySize, const byte * value, int valueSize);
|
||||
int TpagedListFind(int xid, recordid list, const byte * key, int keySize, byte ** value);
|
||||
|
|
Loading…
Reference in a new issue