diff --git a/benchmarks/berkeleyDB/bdbHashThreaded.c b/benchmarks/berkeleyDB/bdbHashThreaded.c index f860a81..37b0f51 100644 --- a/benchmarks/berkeleyDB/bdbHashThreaded.c +++ b/benchmarks/berkeleyDB/bdbHashThreaded.c @@ -86,7 +86,7 @@ main(int argc, char *argv[]) #endif pthread_t * threads = malloc(num_threads * sizeof(pthread_t)); - int i ; + long i ; for(i = 0; i < num_threads; i++) { if ((ret = pthread_create(&(threads[i]), &attr, runThread, (void *)i)) != 0){ fprintf(stderr, @@ -114,7 +114,7 @@ main(int argc, char *argv[]) void * runThread(void * arg) { - int offset = (int) arg; + long offset = (long) arg; pthread_mutex_lock(&mutex); activeThreads++; diff --git a/benchmarks/berkeleyDB/bdbHashWriteRequests.c b/benchmarks/berkeleyDB/bdbHashWriteRequests.c index fdc2453..c9d29d0 100644 --- a/benchmarks/berkeleyDB/bdbHashWriteRequests.c +++ b/benchmarks/berkeleyDB/bdbHashWriteRequests.c @@ -3,7 +3,7 @@ #include #include - +#include // if we're using linux's crazy version of the pthread header, // it probably forgot to include PTHREAD_STACK_MIN @@ -97,7 +97,7 @@ main(int argc, char *argv[]) pthread_t * threads = malloc(num_threads * sizeof(pthread_t)); - int i ; + long i; for(i = 0; i < num_threads; i++) { if ((ret = pthread_create(&(threads[i]), &attr, runThread, (void *)i)) != 0){ fprintf(stderr, @@ -132,7 +132,7 @@ main(int argc, char *argv[]) void * runThread(void * arg) { - int offset = (int) arg; + long offset = (long)arg; pthread_mutex_lock(&mutex); activeThreads++; diff --git a/lladd/hash.h b/lladd/hash.h index f3515fb..e9ea047 100644 --- a/lladd/hash.h +++ b/lladd/hash.h @@ -3,6 +3,10 @@ #ifndef __HASH_H #define __HASH_H +/** + @todo write a test harness for this... +*/ + unsigned int max_bucket(unsigned char tableBits, unsigned int nextExtension); /** This function maps from the length of the bucket list to a appropriate set diff --git a/lladd/logger/logger2.h b/lladd/logger/logger2.h index ad7f6d0..753a088 100644 --- a/lladd/logger/logger2.h +++ b/lladd/logger/logger2.h @@ -132,6 +132,13 @@ LogEntry * LogUpdate(TransactionLog * l, Page * p, recordid rid, int operation, Whenever a LogEntry is returned by a function that is defined by logger2.h or logHandle.h, the caller should eventually call this function to release any resources held by that entry. + + @todo The 'const' modifier on FreeLogEntry's parameter is a hack; + for some log types (in memory) it is very important that the caller + does not modify LogEntries returned by this API, so we always + return 'const' pointers to callers. The implementation of + FreeLogEntry knows whether the const is important, and ignores it + if appropriate, so const isn't really the right concept... */ void FreeLogEntry(const LogEntry * e); diff --git a/lladd/multiplexer.h b/lladd/multiplexer.h index ed0d539..5fee06a 100644 --- a/lladd/multiplexer.h +++ b/lladd/multiplexer.h @@ -31,6 +31,7 @@ typedef struct { int xid; } lladdMultiplexer_t; +void * lladdMultiplexer_flush(lladdMultiplexer_t * m) ; lladdMultiplexer_t * lladdMultiplexer_alloc(int xid, lladdIterator_t * it, void (*multiplexer)(byte * key, diff --git a/pobj/pobj.h b/pobj/pobj.h index 707f8d5..99d41f4 100644 --- a/pobj/pobj.h +++ b/pobj/pobj.h @@ -69,7 +69,7 @@ int pobj_ref_typify (void *, int *); /* Object modification. */ void *pobj_memcpy (void *, void *, void *, size_t); -void *pobj_memset (void *, void *, int, size_t); +void *pobj_memset (void *, void *, long, size_t); int pobj_set_int (void *, int *, int); int pobj_set_unsigned (void *, unsigned *, unsigned); int pobj_set_long (void *, long *, long); diff --git a/src/lladd/logger/logWriter.c b/src/lladd/logger/logWriter.c index db01d7a..6b4f4db 100644 --- a/src/lladd/logger/logWriter.c +++ b/src/lladd/logger/logWriter.c @@ -233,8 +233,6 @@ int openLogWriter() { */ -//static int flushLog(); - int writeLogEntry(LogEntry * e) { const lsn_t size = sizeofLogEntry(e); diff --git a/src/lladd/logger/logger2.c b/src/lladd/logger/logger2.c index e066426..51fa7dc 100644 --- a/src/lladd/logger/logger2.c +++ b/src/lladd/logger/logger2.c @@ -139,11 +139,11 @@ const LogEntry * LogReadLSN(lsn_t lsn) { void FreeLogEntry(const LogEntry * e) { if(LOG_TO_FILE == loggerType) { - free(e); + free((LogEntry*)e); return; } else if(LOG_TO_MEMORY == loggerType) { if(e->LSN == -1) { - free(e); + free((LogEntry*)e); } return; } diff --git a/src/pobj/pobj.c b/src/pobj/pobj.c index ea2e5d2..c4a1483 100644 --- a/src/pobj/pobj.c +++ b/src/pobj/pobj.c @@ -202,7 +202,7 @@ pobj_end (void) if (active_xid >= 0) { if (pthread_setspecific (g_active_xid_key, NULL)) return -1; - Tcommit ((int)active_xid); + Tcommit ((long)active_xid); } else return -1; /* Attempt to close a non-open transaction. */ @@ -855,7 +855,7 @@ pobj_set (void *obj, void *fld, void *data, size_t len, unsigned char flags) if (CHECK_FLAG (flags, POBJ_SET_F_COPY)) memcpy (fld, data, len); else - memset (fld, (byte) data, len); + memset (fld, (byte) (long)data, len); /* Update corresponding record (persistent objects only). */ if (p->repo_index >= 0) { @@ -883,7 +883,7 @@ pobj_memcpy (void *obj, void *fld, void *data, size_t len) } void * -pobj_memset (void *obj, void *fld, int c, size_t len) +pobj_memset (void *obj, void *fld, long c, size_t len) { return (pobj_set (obj, fld, (void *) c, len, 0) < 0 ? NULL : obj); } diff --git a/test/cht/client.c b/test/cht/client.c index a360ffe..39b50cb 100644 --- a/test/cht/client.c +++ b/test/cht/client.c @@ -28,7 +28,7 @@ int main(int argc, char ** argv) { int newOne, newTwo; newOne = i; newTwo = 0; - unsigned int newLen = sizeof(int); + size_t newLen = sizeof(int); int ret = cHtLookup(xid, cht_client, &new_ht, &newOne, sizeof(int), &newTwo, &newLen); // xid++; //printf("lookup returned %d (%d->%d)\n", ret, newOne, newTwo); @@ -41,7 +41,7 @@ int main(int argc, char ** argv) { for(i = 0; i < 10000; i+=10) { int one = i; int two = -1; - unsigned int size = sizeof(int); + size_t size = sizeof(int); int removed = cHtRemove(xid, cht_client, &new_ht, &one, sizeof(int), &two, &size); assert(removed); @@ -53,7 +53,7 @@ int main(int argc, char ** argv) { int newOne, newTwo; newOne = i; newTwo = 0; - unsigned int newLen = sizeof(int); + size_t newLen = sizeof(int); int ret = cHtLookup(xid, cht_client, &new_ht, &newOne, sizeof(int), &newTwo, &newLen); assert(!ret); @@ -67,7 +67,7 @@ int main(int argc, char ** argv) { int newOne, newTwo; newOne = i; newTwo = 0; - unsigned int newLen = sizeof(int); + size_t newLen = sizeof(int); int ret = cHtLookup(xid, cht_client, &new_ht, &newOne, sizeof(int), &newTwo, &newLen); // xid++; //printf("lookup returned %d (%d->%d)\n", ret, newOne, newTwo); diff --git a/test/lladd/check_bTree.c b/test/lladd/check_bTree.c index 1683d1e..44b3085 100644 --- a/test/lladd/check_bTree.c +++ b/test/lladd/check_bTree.c @@ -58,7 +58,8 @@ terms specified in this license. /** @test */ - +void testFunctions(); +int SimpleExample(); START_TEST(bTreeTest) { @@ -157,7 +158,7 @@ int insert(Page* p, recordid rid_caller, int valueIn){ } // convert the input valueIn into a byte array - byte * valueInBuff = (byte *) & valueIn; + // byte * valueInBuff = (byte *) & valueIn; // get the rid ready to write to the insertLocation (determined above) rid.slot = insertLocation; @@ -167,7 +168,7 @@ int insert(Page* p, recordid rid_caller, int valueIn){ printf("\n***rid.page = %d\n", rid.page); - + return 0; } @@ -176,7 +177,7 @@ int insert(Page* p, recordid rid_caller, int valueIn){ it to be a BTreeNode. Just puts the value 0 in the first index of the page. */ -int initializeNewBTreeNode(Page* p, recordid rid){ +void initializeNewBTreeNode(Page* p, recordid rid){ // need access to the first slot rid.slot = 0; @@ -189,7 +190,7 @@ int initializeNewBTreeNode(Page* p, recordid rid){ fixedWrite(p, rid, countBuff); } -int testFunctions(){ +void testFunctions(){ printf("testing functions"); // getting things ready @@ -213,8 +214,8 @@ int testFunctions(){ int SimpleExample(){ int DEBUGP = 0; - int DEBUGT = 0; - int DEBUGA = 0; + // int DEBUGT = 0; + // int DEBUGA = 0; int xid = Tbegin(); /* Where to find stuff @@ -245,7 +246,7 @@ int SimpleExample(){ /* check to make sure page is recorded as a FIXED_PAGE */ assert( *page_type_ptr(p1) == FIXED_PAGE); - if (DEBUGP) { printf("\n%d\n", rid1); } + if (DEBUGP) { printf("\n%d\n", rid1.page); } byte * b1 = (byte *) malloc (sizeof (int)); byte * b2 = (byte *) malloc (sizeof (int)); byte * b3 = (byte *) malloc (sizeof (int)); diff --git a/test/lladd/check_blobRecovery.c b/test/lladd/check_blobRecovery.c index f02d270..733eaff 100644 --- a/test/lladd/check_blobRecovery.c +++ b/test/lladd/check_blobRecovery.c @@ -45,6 +45,7 @@ terms specified in this license. #include #include +#include #include "../../src/lladd/logger/logWriter.h" #include "../check_includes.h" #include diff --git a/test/lladd/check_linearHash.c b/test/lladd/check_linearHash.c index fc02934..a98363f 100644 --- a/test/lladd/check_linearHash.c +++ b/test/lladd/check_linearHash.c @@ -61,26 +61,6 @@ terms specified in this license. /* #define NUM_ENTRIES 1000 */ /*#define NUM_ENTRIES 100 */ -/** - @test Runs some simple tests on the hash() function. Not comprehensive enough. - @todo the checkHashFcn test is broken. -*/ -START_TEST(checkHashFcn) { - int i; - srandom(12312313); - for(i = 0; i < 100000;i++) { - int j = (int) (100000.0*random()/(RAND_MAX+1.0)); /* int for CRC. */ - int k = (int) 2+(30.0*random()/(RAND_MAX+1.0)); /* number of bits in result. */ - - unsigned long first = hash(&j, sizeof(int), k, UINT_MAX); - int boundary = first + 10; - unsigned long second = hash(&j, sizeof(int), k, boundary); - assert(first == second); - unsigned long third = hash(&j, sizeof(int), k+1, UINT_MAX); - assert((first == third) || (pow(2,k)+ first == third)); - } -} END_TEST - /** @test Insert some stuff into a linear hash, delete some stuff, and make sure that abort() and commit() work. diff --git a/test/lladd/check_logWriter.c b/test/lladd/check_logWriter.c index df470dd..2978af0 100644 --- a/test/lladd/check_logWriter.c +++ b/test/lladd/check_logWriter.c @@ -47,7 +47,7 @@ terms specified in this license. /*#include */ #include "../../src/lladd/logger/logHandle.h" #include -//#include "../../src/lladd/logger/logWriter.h" +#include "../../src/lladd/logger/logWriter.h" #include "../../src/lladd/latches.h" #include diff --git a/test/lladd/check_logicalLinearHash.c b/test/lladd/check_logicalLinearHash.c index 127a0f2..2246cac 100644 --- a/test/lladd/check_logicalLinearHash.c +++ b/test/lladd/check_logicalLinearHash.c @@ -62,27 +62,6 @@ terms specified in this license. #define NUM_ENTRIES 1000 /*#define NUM_ENTRIES 100 */ -/** - @test Runs some simple tests on the hash() function. Not comprehensive enough. - @todo the checkHashFcn test is broken. -*/ - -START_TEST(checkHashFcn) { - int i; - srandom(12312313); - for(i = 0; i < 100000;i++) { - int j = (int) (100000.0*random()/(RAND_MAX+1.0)); /* int for CRC. */ - int k = (int) 2+(30.0*random()/(RAND_MAX+1.0)); /* number of bits in result. */ - - unsigned long first = hash(&j, sizeof(int), k, UINT_MAX); - int boundary = first + 10; - unsigned long second = hash(&j, sizeof(int), k, boundary); - assert(first == second); - unsigned long third = hash(&j, sizeof(int), k+1, UINT_MAX); - assert((first == third) || (pow(2,k)+ first == third)); - } -} END_TEST - /** @test Insert some stuff into a linear hash, delete some stuff, and make sure that abort() and commit() work. diff --git a/test/lladd/check_operations.c b/test/lladd/check_operations.c index b203b08..7e6514b 100644 --- a/test/lladd/check_operations.c +++ b/test/lladd/check_operations.c @@ -46,7 +46,7 @@ terms specified in this license. #include "../../src/lladd/logger/logWriter.h" #include #include - +#include #include "../check_includes.h" #include "../../src/lladd/page.h" #include "../../src/lladd/page/slotted.h" diff --git a/test/lladd/check_pageOperations.c b/test/lladd/check_pageOperations.c index 7643a5a..c5217f8 100644 --- a/test/lladd/check_pageOperations.c +++ b/test/lladd/check_pageOperations.c @@ -48,6 +48,7 @@ terms specified in this license. #include "../../src/lladd/page/slotted.h" #include #include +#include #include #include "../../src/lladd/latches.h" diff --git a/test/lladd/check_recovery.c b/test/lladd/check_recovery.c index daeb047..831656d 100644 --- a/test/lladd/check_recovery.c +++ b/test/lladd/check_recovery.c @@ -45,6 +45,7 @@ terms specified in this license. #include #include +#include #include "../../src/lladd/logger/logWriter.h" #include "../check_includes.h" diff --git a/test/lladd/check_transactional2.c b/test/lladd/check_transactional2.c index fdc2069..d20fced 100644 --- a/test/lladd/check_transactional2.c +++ b/test/lladd/check_transactional2.c @@ -452,7 +452,7 @@ Suite * check_suite(void) { tcase_add_test(tc, transactional_nothreads_abort); tcase_add_test(tc, transactional_threads_abort); tcase_add_test(tc, transactional_blobs_nothreads_abort); - /* tcase_add_test(tc, transactional_blobs_threads_abort); */ + tcase_add_test(tc, transactional_blobs_threads_abort); /* --------------------------------------------- */ tcase_add_checked_fixture(tc, setup, teardown); suite_add_tcase(s, tc);