Changeset: 978f3a11712d for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/978f3a11712d
Removed Files:
monetdb5/modules/mal/transaction.c
Modified Files:
gdk/gdk.h
gdk/gdk_bbp.c
gdk/gdk_private.h
gdk/gdk_tm.c
monetdb5/modules/mal/CMakeLists.txt
Branch: default
Log Message:
Removed unused code (TMabort).
diffs (truncated from 418 to 300 lines):
diff --git a/gdk/gdk.h b/gdk/gdk.h
--- a/gdk/gdk.h
+++ b/gdk/gdk.h
@@ -1996,68 +1996,8 @@ BUNtoid(BAT *b, BUN p)
/*
* @+ Transaction Management
- * @multitable @columnfractions 0.08 0.7
- * @item int
- * @tab
- * TMcommit ()
- * @item int
- * @tab
- * TMabort ()
- * @item int
- * @tab
- * TMsubcommit ()
- * @end multitable
- *
- * MonetDB by default offers a global transaction environment. The
- * global transaction involves all activities on all persistent BATs
- * by all threads. Each global transaction ends with either TMabort
- * or TMcommit, and immediately starts a new transaction. TMcommit
- * implements atomic commit to disk on the collection of all
- * persistent BATs. For all persistent BATs, the global commit also
- * flushes the delta status for these BATs (see
- * BATcommit/BATabort). This allows to perform TMabort quickly in
- * memory (without re-reading all disk images from disk). The
- * collection of which BATs is persistent is also part of the global
- * transaction state. All BATs that where persistent at the last
- * commit, but were made transient since then, are made persistent
- * again by TMabort. In other words, BATs that are deleted, are only
- * physically deleted at TMcommit time. Until that time, rollback
- * (TMabort) is possible.
- *
- * Use of TMabort is currently NOT RECOMMENDED due to two bugs:
- *
- * @itemize
- * @item
- * TMabort after a failed %TMcommit@ does not bring us back to the
- * previous committed state; but to the state at the failed TMcommit.
- * @item
- * At runtime, TMabort does not undo BAT name changes, whereas a cold
- * MonetDB restart does.
- * @end itemize
- *
- * In effect, the problems with TMabort reduce the functionality of
- * the global transaction mechanism to consistent checkpointing at
- * each TMcommit. For many applications, consistent checkpointingis
- * enough.
- *
- * Extension modules exist that provide fine grained locking (lock
- * module) and Write Ahead Logging (sqlserver). Applications that
- * need more fine-grained transactions, should build this on top of
- * these extension primitives.
- *
- * TMsubcommit is intended to quickly add or remove BATs from the
- * persistent set. In both cases, rollback is not necessary, such that
- * the commit protocol can be accelerated. It comes down to writing a
- * new BBP.dir.
- *
- * Its parameter is a BAT-of-BATs (in the tail); the persistence
- * status of that BAT is committed. We assume here that the calling
- * thread has exclusive access to these bats. An error is reported if
- * you try to partially commit an already committed persistent BAT (it
- * needs the rollback mechanism).
*/
gdk_export gdk_return TMcommit(void);
-gdk_export void TMabort(void);
gdk_export gdk_return TMsubcommit(BAT *bl);
gdk_export gdk_return TMsubcommit_list(bat *restrict subcommit, BUN *restrict
sizes, int cnt, lng logno, lng transid);
@@ -2089,13 +2029,7 @@ gdk_export gdk_return TMsubcommit_list(b
* commit protocol, and changes may be lost after quitting or crashing
* MonetDB.
*
- * BATabort undo-s all changes since the previous state. The global
- * TMabort achieves a rollback to the previously committed state by
- * doing BATabort on all persistent bats.
- *
- * BUG: after a failed TMcommit, TMabort does not do anything because
- * TMcommit does the BATcommits @emph{before} attempting to sync to
- * disk instead of @sc{after} doing this.
+ * BATabort undo-s all changes since the previous state.
*/
gdk_export void BATcommit(BAT *b, BUN size);
gdk_export void BATfakeCommit(BAT *b);
diff --git a/gdk/gdk_bbp.c b/gdk/gdk_bbp.c
--- a/gdk/gdk_bbp.c
+++ b/gdk/gdk_bbp.c
@@ -117,7 +117,7 @@ static gdk_return BBPfree(BAT *b);
static void BBPdestroy(BAT *b);
static void BBPuncacheit(bat bid, bool unloaddesc);
static gdk_return BBPprepare(bool subcommit);
-static BAT *getBBPdescriptor(bat i, bool lock, bool relock);
+static BAT *getBBPdescriptor(bat i);
static gdk_return BBPbackup(BAT *b, bool subcommit);
static gdk_return BBPdir_init(void);
static void BBPcallbacks(void);
@@ -2856,7 +2856,7 @@ BATdescriptor(bat i)
return NULL;
b = BBP_cache(i);
if (b == NULL)
- b = getBBPdescriptor(i, false, true);
+ b = getBBPdescriptor(i);
MT_lock_unset(&GDKswapLock(i));
}
return b;
@@ -3144,7 +3144,7 @@ BBPreclaim(BAT *b)
* this.
*/
static BAT *
-getBBPdescriptor(bat i, bool lock, bool relock)
+getBBPdescriptor(bat i)
{
bool load = false;
BAT *b = NULL;
@@ -3155,16 +3155,12 @@ getBBPdescriptor(bat i, bool lock, bool
return NULL;
}
assert(BBP_refs(i));
- if (lock)
- MT_lock_set(&GDKswapLock(i));
if ((b = BBP_cache(i)) == NULL || BBP_status(i) & BBPWAITING) {
while (BBP_status(i) & BBPWAITING) { /* wait for bat to be
loaded by other thread */
- if (relock)
- MT_lock_unset(&GDKswapLock(i));
+ MT_lock_unset(&GDKswapLock(i));
BBPspin(i, __func__, BBPWAITING);
- if (relock)
- MT_lock_set(&GDKswapLock(i));
+ MT_lock_set(&GDKswapLock(i));
}
if (BBPvalid(i)) {
b = BBP_cache(i);
@@ -3175,12 +3171,10 @@ getBBPdescriptor(bat i, bool lock, bool
}
}
}
- if (lock)
- MT_lock_unset(&GDKswapLock(i));
if (load) {
TRC_DEBUG(IO_, "load %s\n", BBP_logical(i));
- b = BATload_intern(i, lock);
+ b = BATload_intern(i, false);
/* clearing bits can be done without the lock */
BBP_status_off(i, BBPLOADING);
@@ -3190,14 +3184,6 @@ getBBPdescriptor(bat i, bool lock, bool
return b;
}
-BAT *
-BBPdescriptor(bat i)
-{
- bool lock = locked_by == 0 || locked_by != MT_getpid();
-
- return getBBPdescriptor(i, lock, lock);
-}
-
/*
* In BBPsave executes unlocked; it just marks the BBP_status of the
* BAT to BBPsaving, so others that want to save or unload this BAT
diff --git a/gdk/gdk_private.h b/gdk/gdk_private.h
--- a/gdk/gdk_private.h
+++ b/gdk/gdk_private.h
@@ -98,8 +98,6 @@ gdk_return BBPcacheit(BAT *bn, bool lock
__attribute__((__visibility__("hidden")));
void BBPclear(bat bid, bool lock)
__attribute__((__visibility__("hidden")));
-BAT *BBPdescriptor(bat b)
- __attribute__((__visibility__("hidden")));
void BBPdump(void) /* never called: for debugging only */
__attribute__((__cold__));
void BBPexit(void)
diff --git a/gdk/gdk_tm.c b/gdk/gdk_tm.c
--- a/gdk/gdk_tm.c
+++ b/gdk/gdk_tm.c
@@ -244,71 +244,3 @@ TMsubcommit(BAT *b)
GDKfree(subcommit);
return ret;
}
-
-/*
- * @- TMabort
- * Transaction abort is cheap. We use the delta statuses to go back to
- * the previous version of each BAT. Also for BATs that are currently
- * swapped out. Persistent BATs that were made transient in this
- * transaction become persistent again.
- */
-void
-TMabort(void)
-{
- int i;
-
- BBPlock();
- for (i = 1; i < getBBPsize(); i++) {
- if (BBP_status(i) & BBPNEW) {
- BAT *b = BBPquickdesc(i);
-
- if (b) {
- if (!b->batTransient)
- BBPrelease(i);
- b->batTransient = true;
- b->batDirtydesc = true;
- }
- }
- }
- for (i = 1; i < getBBPsize(); i++) {
- if (BBP_status(i) & (BBPPERSISTENT | BBPDELETED | BBPSWAPPED)) {
- BAT *b = BBPquickdesc(i);
-
- if (b == NULL)
- continue;
-
- BBPfix(i);
- if (BATdirty(b) || DELTAdirty(b)) {
- /* BUN move-backes need a real BAT! */
- /* Stefan:
- * Actually, in case DELTAdirty(b),
- * i.e., a BAT with differences that
- * is saved/swapped-out but not yet
- * committed, we (AFAIK) don't have to
- * load the BAT and apply the undo,
- * but rather could simply discard the
- * delta and revive the backup;
- * however, I don't know how to do
- * this (yet), hence we stick with
- * this solution for the time being
- * --- it should be correct though it
- * might not be the most efficient
- * way...
- */
- b = BBPdescriptor(i);
- BATundo(b);
- }
- if (BBP_status(i) & BBPDELETED) {
- BBP_status_on(i, BBPEXISTING);
- if (b->batTransient)
- BBPretain(i);
- b->batTransient = false;
- b->batDirtydesc = true;
- }
- BBPunfix(i);
- }
- BBP_status_off(i, BBPDELETED | BBPSWAPPED | BBPNEW);
- }
- BBPunlock();
- GDKclrerr();
-}
diff --git a/monetdb5/modules/mal/CMakeLists.txt
b/monetdb5/modules/mal/CMakeLists.txt
--- a/monetdb5/modules/mal/CMakeLists.txt
+++ b/monetdb5/modules/mal/CMakeLists.txt
@@ -28,7 +28,6 @@ target_sources(malmodules
mdb.c
pcre.c
mat.c
- transaction.c
wlc.c
mal_mapi.c
remote.c remote.h
diff --git a/monetdb5/modules/mal/transaction.c
b/monetdb5/modules/mal/transaction.c
deleted file mode 100644
--- a/monetdb5/modules/mal/transaction.c
+++ /dev/null
@@ -1,150 +0,0 @@
-/*
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * Copyright 1997 - July 2008 CWI, August 2008 - 2022 MonetDB B.V.
- */
-
-/*
- * @a M.L. Kersten, P. Boncz
- * @+ Transaction management
- * In the philosophy of Monet, transaction management overhead should only
- * be paid when necessary. Transaction management is for this purpose
- * implemented as a module.
- * This code base is largely absolute and should be re-considered when
- * serious OLTP is being supported.
- * Note, however, the SQL front-end obeys transaction semantics.
- *
- */
-#include "monetdb_config.h"
-#include "gdk.h"
-#include "mal.h"
-#include "mal_interpreter.h"
-#include "bat5.h"
-
-mal_export str TRNglobal_sync(bit *ret);
-mal_export str TRNglobal_abort(bit *ret);
-mal_export str TRNglobal_commit(bit *ret);
-mal_export str TRNtrans_clean(Client cntxt, MalBlkPtr mb, MalStkPtr stk,
InstrPtr p);
-mal_export str TRNtrans_abort(Client cntxt, MalBlkPtr mb, MalStkPtr stk,
InstrPtr p);
-mal_export str TRNtrans_commit(Client cntxt, MalBlkPtr mb, MalStkPtr stk,
InstrPtr p);
-mal_export str TRNsubcommit(bit *ret, bat *bid);
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]