diff --git a/lladd/bufferManager.h b/lladd/bufferManager.h index a4f4756..4b97dc1 100644 --- a/lladd/bufferManager.h +++ b/lladd/bufferManager.h @@ -121,35 +121,6 @@ int bufInit(); */ void bufDeinit(); -/** - * all actions necessary when committing a transaction. Can assume that the log - * has been written as well as any other udpates that do not depend on the - * buffer manager - * - * @param xid transaction ID - * @param lsn the lsn at which the transaction aborted. (Currently - * unused, but may be useful for other implementations of the buffer - * manager.) - * @return 0 on success - * @return error code on failure - */ -int bufTransCommit(int xid, lsn_t lsn); - -/** - * - * Currently identical to bufTransCommit. - * - * @param xid transaction ID - * - * @param lsn the lsn at which the transaction aborted. (Currently - * unused, but may be useful for other implementations of the buffer - * manager.) - * - * @return 0 on success - * @return error code on failure - */ -int bufTransAbort(int xid, lsn_t lsn); - END_C_DECLS #endif diff --git a/lladd/transactional.h b/lladd/transactional.h index 4ea48d0..061c80d 100644 --- a/lladd/transactional.h +++ b/lladd/transactional.h @@ -386,6 +386,14 @@ void Trevive(int xid, long lsn); */ void TsetXIDCount(int xid); +/** + * Checks to see if a transaction is still active. + * + * @param xid The transaction id to be tested. + * @return true if the transacation is still running, false otherwise. + */ +int TisActiveTransaction(int xid); + /** This is used by log truncation. */ diff --git a/src/lladd/blobManager.c b/src/lladd/blobManager.c index 4449077..ee65422 100644 --- a/src/lladd/blobManager.c +++ b/src/lladd/blobManager.c @@ -68,10 +68,3 @@ void writeBlob(int xid, Page * p2, lsn_t lsn, recordid rid, const byte * buf) { } -void commitBlobs(int xid) { - -} - -void abortBlobs(int xid) { - -} diff --git a/src/lladd/blobManager.h b/src/lladd/blobManager.h index c3acd44..a6d6578 100644 --- a/src/lladd/blobManager.h +++ b/src/lladd/blobManager.h @@ -56,21 +56,6 @@ void readBlob(int xid, Page * p, recordid rid, void * buf); */ void writeBlob(int xid, Page * p, lsn_t lsn, recordid rid, const void * buf); - -/** - Atomicly (with respect to recovery) make the dirty version of the - blob the primary copy and mark it not-dirty. -*/ - -void commitBlobs(int xid); - -/** - Revert the blob to the last clean version. -*/ - -void abortBlobs(int xid); - - compensated_function recordid preAllocBlob(int xid, long blobsize); compensated_function recordid preAllocBlobFromPage(int xid, long page, long blobsize); diff --git a/src/lladd/bufferManager.c b/src/lladd/bufferManager.c index fe84f2e..ac7a233 100644 --- a/src/lladd/bufferManager.c +++ b/src/lladd/bufferManager.c @@ -151,23 +151,6 @@ void releasePage (Page * p) { } -int bufTransCommit(int xid, lsn_t lsn) { - commitBlobs(xid); - pageCommit(xid); - if(globalLockManager.commit) { globalLockManager.commit(xid);} - - return 0; -} - -int bufTransAbort(int xid, lsn_t lsn) { - - abortBlobs(xid); /* abortBlobs doesn't write any log entries, so it doesn't need the lsn. */ - pageAbort(xid); - if(globalLockManager.abort) { globalLockManager.abort(xid);} - - return 0; -} - static Page * getPage(int pageid, int locktype) { Page * ret; int spin = 0; diff --git a/src/lladd/page.c b/src/lladd/page.c index 4675850..84f9e2a 100644 --- a/src/lladd/page.c +++ b/src/lladd/page.c @@ -129,12 +129,6 @@ void pageDeInit() { slottedPageDeInit(); } -void pageCommit(int xid) { -} - -void pageAbort(int xid) { -} - void writeRecord(int xid, Page * p, lsn_t lsn, recordid rid, const void *dat) { assert( (p->id == rid.page) && (p->memAddr != NULL) ); diff --git a/src/lladd/page.h b/src/lladd/page.h index d292815..3c5be85 100644 --- a/src/lladd/page.h +++ b/src/lladd/page.h @@ -253,14 +253,6 @@ int readRecord(int xid, Page * page, recordid rid, void *dat); * The same as readRecord, but does not obtain a latch. */ int readRecordUnlocked(int xid, Page * p, recordid rid, void *buf); -/** - Should be called when transaction xid commits. -*/ -void pageCommit(int xid); -/** - Should be called when transaction xid aborts. -*/ -void pageAbort(int xid); /** Allocate memory to hold a new page. diff --git a/src/lladd/transactional2.c b/src/lladd/transactional2.c index 256381a..a172d9b 100644 --- a/src/lladd/transactional2.c +++ b/src/lladd/transactional2.c @@ -299,7 +299,7 @@ int Tcommit(int xid) { #endif lsn = LogTransCommit(&XactionTable[xid % MAX_TRANSACTIONS]); - bufTransCommit(xid, lsn); /* unlocks pages */ + if(globalLockManager.commit) { globalLockManager.commit(xid); } pthread_mutex_lock(&transactional_2_mutex); XactionTable[xid%MAX_TRANSACTIONS].xid = INVALID_XTABLE_XID; @@ -319,7 +319,7 @@ int Tabort(int xid) { /** @todo is the order of the next two calls important? */ undoTrans(*t/*XactionTable[xid%MAX_TRANSACTIONS]*/); - bufTransAbort(xid, lsn); + if(globalLockManager.abort) { globalLockManager.abort(xid); } pthread_mutex_lock(&transactional_2_mutex); @@ -392,3 +392,10 @@ lsn_t transactions_minRecLSN() { return minRecLSN; } +int TisActiveTransaction(int xid) { + pthread_mutex_lock(&transactional_2_mutex); + int ret = XactionTable[xid%MAX_TRANSACTIONS].xid == xid; + pthread_mutex_unlock(&transactional_2_mutex); + return ret; +} +