diff --git a/lladd/constants.h b/lladd/constants.h index d708129..59559df 100644 --- a/lladd/constants.h +++ b/lladd/constants.h @@ -80,11 +80,11 @@ terms specified in this license. #define PAGE_SIZE 4096 -/* #define MAX_BUFFER_SIZE 100003 */ +#define MAX_BUFFER_SIZE 100003 /*#define MAX_BUFFER_SIZE 20029 */ //#define MAX_BUFFER_SIZE 10007 /*#define MAX_BUFFER_SIZE 5003*/ -#define MAX_BUFFER_SIZE 2003 +/*#define MAX_BUFFER_SIZE 2003 */ /* #define MAX_BUFFER_SIZE 71 */ /*#define MAX_BUFFER_SIZE 7 */ /*#define BUFFER_ASOOCIATIVE 2 */ diff --git a/src/lladd/truncation.c b/src/lladd/truncation.c index a653fb8..3c0af38 100644 --- a/src/lladd/truncation.c +++ b/src/lladd/truncation.c @@ -17,9 +17,15 @@ static pblHashTable_t * dirtyPages = 0; static pthread_mutex_t dirtyPages_mutex = PTHREAD_MUTEX_INITIALIZER; int lladd_enableAutoTruncation = 1; +#ifdef LONG_TEST +#define TARGET_LOG_SIZE (1024 * 1024 * 5) +#define TRUNCATE_INTERVAL 1 +#define MIN_INCREMENTAL_TRUNCATION (1024 * 1024 * 1) +#else #define TARGET_LOG_SIZE (1024 * 1024 * 50) #define TRUNCATE_INTERVAL 1 -#define MIN_INCREMENTAL_TRUNCATION (1024 * 1024 * 10) +#define MIN_INCREMENTAL_TRUNCATION (1024 * 1024 * 25) +#endif void dirtyPages_add(Page * p) { pthread_mutex_lock(&dirtyPages_mutex); if(!p->dirty) { diff --git a/test/lladd/check_linearHashNTA.c b/test/lladd/check_linearHashNTA.c index 2326a5c..06c967c 100644 --- a/test/lladd/check_linearHashNTA.c +++ b/test/lladd/check_linearHashNTA.c @@ -50,6 +50,10 @@ terms specified in this license. #include #include #include + +#include +#include + #define LOG_NAME "check_linearHashNTA.log" #define NUM_ENTRIES 100000 /** @test @@ -187,9 +191,13 @@ START_TEST(linearHashNTAVariableSizetest) } END_TEST +#define DEFAULT_NUM_THREADS 100 + +#define DEFAULT_NUM_T_ENTRIES 500 + +int NUM_THREADS = DEFAULT_NUM_THREADS; +int NUM_T_ENTRIES = DEFAULT_NUM_T_ENTRIES; -#define NUM_THREADS 100 -#define NUM_T_ENTRIES 500 typedef struct { int thread; recordid rid; @@ -264,6 +272,38 @@ START_TEST(linearHashNTAThreadedTest) { Tdeinit(); } END_TEST +START_TEST(linearHashNTAThreadedTestRandomized) { + Tinit(); + struct timeval tv; + gettimeofday(&tv, 0); + + srandom(tv.tv_sec * 1000000 + tv.tv_usec); + NUM_THREADS = (int)(((double)random()/(double)RAND_MAX)* ((double)DEFAULT_NUM_THREADS) * 5.0); + NUM_T_ENTRIES = (int)(((double)random()/(double)RAND_MAX) * ((double)DEFAULT_NUM_T_ENTRIES) * 5.0); + + printf("\n%d threads, %d entries", NUM_THREADS, NUM_T_ENTRIES); + + int xid = Tbegin(); + recordid rid = ThashCreate(xid, sizeof(recordid), sizeof(int)); + int i; + Tcommit(xid); + pthread_t threads[NUM_THREADS]; + for(i = 0; i < NUM_THREADS; i++) { + linear_hash_worker_args * args = malloc(sizeof(linear_hash_worker_args)); + args->thread = i; + args->rid= rid; + pthread_create(&threads[i], NULL, &worker, args); + if(!(i % 50)) { + sleep(1); + } + } + for(i = 0; i < NUM_THREADS; i++) { + void * ret; + pthread_join(threads[i], &ret); + } + Tdeinit(); +} END_TEST + START_TEST(linearHashNTAIteratortest) { Tinit(); int xid = Tbegin(); @@ -365,6 +405,11 @@ Suite * check_suite(void) { tcase_set_timeout(tc, 0); // disable timeouts /* Sub tests are added, one per line, here */ +#ifdef LONG_TEST + tcase_add_test(tc, linearHashNTAThreadedTestRandomized); + tcase_add_test(tc, linearHashNTAThreadedTestRandomized); + tcase_add_test(tc, linearHashNTAThreadedTestRandomized); +#endif tcase_add_test(tc, emptyHashIterator); tcase_add_test(tc, emptyHashIterator2); tcase_add_test(tc, linearHashNTAVariableSizetest);