From 80ed16c18ed0a2a3bf6cfe3dfcb7ad8e8b1a04f9 Mon Sep 17 00:00:00 2001 From: Jimmy Kittiyachavalit Date: Mon, 14 Mar 2005 20:54:06 +0000 Subject: [PATCH] Initial implementation of logMemory.c. Haven't yet done any testing, but it seems to compile. However, as of now, the current source code in the cvs repository does not build, dying on check_, due to an a reference to an undefined symbol 'mutex'. --- benchmarks/berkeleyDB/Makefile.am | 2 +- lladd/consumer.h | 12 ++++++------ lladd/iterator.h | 10 ++++++++++ m4/db.m4 | 4 ++-- src/lladd/Makefile.am | 4 +++- src/lladd/blobManager.c | 4 ++-- src/lladd/page.c | 2 +- src/lladd/pageFile.c | 2 +- 8 files changed, 26 insertions(+), 14 deletions(-) diff --git a/benchmarks/berkeleyDB/Makefile.am b/benchmarks/berkeleyDB/Makefile.am index e25448b..bd6ea46 100644 --- a/benchmarks/berkeleyDB/Makefile.am +++ b/benchmarks/berkeleyDB/Makefile.am @@ -1,3 +1,3 @@ -LDADD=-ldb -lpthread +LDADD=-lpthread bin_PROGRAMS=transapp bdbRaw bdbHash bdbHashThreaded bdbHashWriteRequests AM_CFLAGS=-g diff --git a/lladd/consumer.h b/lladd/consumer.h index a400b43..cbeefa7 100644 --- a/lladd/consumer.h +++ b/lladd/consumer.h @@ -3,9 +3,10 @@ #ifndef __CONSUMER_H #define __ITERATOR_H -#define MAX_ITERATOR_TYPES 10 -#define FIFO_CONSUMER 0 -#define ARRAY_CONSUMER 1 +#define MAX_ITERATOR_TYPES 10 +#define FIFO_CONSUMER 0 +#define ARRAY_CONSUMER 1 +#define LOG_MEMORY_CONSUMER 2 typedef struct { int foo; @@ -22,8 +23,7 @@ void consumer_init(); void Tconsumer_close(int xid, lladdConsumer_t * it); /** - @param xid Transaction id - @param it The consumer + @param xid Transaction id @param it The consumer @param key Can be null if there is no key. @param value Can be null if there is no value, but both can't be null. (Or can they???) @@ -37,4 +37,4 @@ int Tconsumer_push(int xid, lladdConsumer_t * it, byte * key, size_t keySize, by */ //int Tconsumer_tryPush(int xid, ....); -#endif +#endif // __CONSUMER_H diff --git a/lladd/iterator.h b/lladd/iterator.h index 0944fa8..591ead8 100644 --- a/lladd/iterator.h +++ b/lladd/iterator.h @@ -6,6 +6,7 @@ #define MAX_ITERATOR_TYPES 10 #define LINEAR_HASH_NTA_ITERATOR 0 #define ARRAY_ITERATOR 1 +#define LOG_MEMORY_ITERATOR 2 typedef struct { // void * new(void * arg); @@ -13,6 +14,7 @@ typedef struct { int (*next) (int xid, void * it); int (*key) (int xid, void * it, byte ** key); int (*value)(int xid, void * it, byte ** value); + int (*releaseTuple)(int xid, void * it); } lladdIterator_def_t; typedef struct { @@ -38,6 +40,14 @@ void Titerator_close(int xid, lladdIterator_t * it); */ int Titerator_next(int xid, lladdIterator_t * it); +/** + NOTE: next acquires a mutex, releaseTuple releases mutex, + next key value --atomic + provides , allows iterator to clean up if necessary + > such as release lock +*/ +int (*releaseTuple)(int xid, void * it); + /** This function allows the caller to access the current iterator position. When an iterator is initialized, it is in the 'null' diff --git a/m4/db.m4 b/m4/db.m4 index 8a1fd6b..9709c0c 100644 --- a/m4/db.m4 +++ b/m4/db.m4 @@ -96,7 +96,7 @@ AC_DEFUN([AC_FIND_DB], [ if test ! x"$ac_dbdir" = x"yes" ; then ac_dbincdirs=$ac_dbdir/include else - ac_dbincdirs="/usr/include /usr/local/include/db4" + ac_dbincdirs="/usr/include /usr/local/include/db4 /usr/local/include/db42" ac_dbincdirs="$ac_dbincdirs /usr/include/db$ac_dbver" ac_dbincdirs="$ac_dbincdirs /usr/local/BerkeleyDB.$ac_dbver/include" fi @@ -104,7 +104,7 @@ AC_DEFUN([AC_FIND_DB], [ if test ! x"$ac_dbdir" = x"yes" ; then ac_dblibdirs="$ac_dbdir/lib" else - ac_dblibdirs="/usr/lib /usr/local/lib" + ac_dblibdirs="/usr/lib /usr/local/lib /usr/local/lib/db42" ac_dblibdirs="$ac_dblibdirs /usr/local/BerkeleyDB.$ac_dbver/lib" fi diff --git a/src/lladd/Makefile.am b/src/lladd/Makefile.am index dcee269..b14ecb5 100644 --- a/src/lladd/Makefile.am +++ b/src/lladd/Makefile.am @@ -5,7 +5,7 @@ lib_LIBRARIES=liblladd.a # removed: recovery.c transactional.c logger.c logger/logparser.c logger/logstreamer.c liblladd_a_SOURCES=crc32.c common.c stats.c io.c bufferManager.c linkedlist.c operations.c \ pageFile.c pageCache.c page.c blobManager.c recovery2.c transactional2.c \ - lockManager.c iterator.c arrayCollection.c \ + lockManager.c iterator.c arrayCollection.c ringbuffer.c \ logger/logEntry.c logger/logWriter.c logger/logHandle.c logger/logger2.c \ logger/logMemory.c multiplexer.c\ page/slotted.c page/header.c page/fixed.c compensations.c \ @@ -16,5 +16,7 @@ liblladd_a_SOURCES=crc32.c common.c stats.c io.c bufferManager.c linkedlist.c op operations/naiveLinearHash.c operations/nestedTopActions.c \ operations/linearHashNTA.c operations/linkedListNTA.c \ operations/pageOrientedListNTA.c + +# logger/logMemory.c \ ringbuffer.c \ asdfas #operations/lladdhash.c AM_CFLAGS= -g -Wall -pedantic -std=gnu99 diff --git a/src/lladd/blobManager.c b/src/lladd/blobManager.c index ff1ec71..f3c39c3 100644 --- a/src/lladd/blobManager.c +++ b/src/lladd/blobManager.c @@ -287,7 +287,7 @@ void allocBlob(int xid, Page * p, lsn_t lsn, recordid rid) { fdatasync(fileno(blobf0)); fdatasync(fileno(blobf1)); #else -#warn Not using fdatasync +//#warn Not using fdatasync fsync(fileno(blobf0)); fsync(fileno(blobf1)); #endif @@ -434,7 +434,7 @@ void writeBlob(int xid, Page * p, lsn_t lsn, recordid rid, const void * buf) { #ifdef HAVE_FDATASYNC fdatasync(fileno(fd)); #else -#warn Not using fdatasync() +//#warn Not using fdatasync() fsync(fileno(fd)); #endif diff --git a/src/lladd/page.c b/src/lladd/page.c index 57d6651..5bcc74f 100644 --- a/src/lladd/page.c +++ b/src/lladd/page.c @@ -163,7 +163,7 @@ void pageInit() { int ret = posix_memalign((void*)(&(pool[i].memAddr)), PAGE_SIZE, PAGE_SIZE); assert(!ret); #else -#warn Not using posix_memalign +//#warn Not using posix_memalign pool[i].memAddr = malloc(PAGE_SIZE); assert(pool[i].memAddr); #endif diff --git a/src/lladd/pageFile.c b/src/lladd/pageFile.c index 4939de4..927e9fd 100644 --- a/src/lladd/pageFile.c +++ b/src/lladd/pageFile.c @@ -133,7 +133,7 @@ void openPageFile() { // O_DIRECT is broken under linux 2.4.. stable = open (STORE_FILE, O_CREAT | O_RDWR /*| O_DIRECT*/, S_IRWXU | S_IRWXG | S_IRWXO); #else -#warn Not using O_DIRECT +//#warn Not using O_DIRECT // If we don't have posix_memalign(), then we aren't aligning our pages in memory, and can't use O_DIRECT. stable = open (STORE_FILE, O_CREAT | O_RDWR, S_IRWXU | S_IRWXG | S_IRWXO); #endif