Changeset: 9d227fd8661e for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/9d227fd8661e
Modified Files:
gdk/gdk_bbp.c
gdk/gdk_tm.c
Branch: Jan2022
Log Message:
Merge with Jul2021 branch.
diffs (110 lines):
diff --git a/gdk/gdk_bbp.c b/gdk/gdk_bbp.c
--- a/gdk/gdk_bbp.c
+++ b/gdk/gdk_bbp.c
@@ -3405,7 +3405,7 @@ dirty_bat(bat *i, bool subcommit)
static gdk_return
file_move(int farmid, const char *srcdir, const char *dstdir, const char
*name, const char *ext)
{
- if (GDKmove(farmid, srcdir, name, ext, dstdir, name, ext, true) ==
GDK_SUCCEED) {
+ if (GDKmove(farmid, srcdir, name, ext, dstdir, name, ext, false) ==
GDK_SUCCEED) {
return GDK_SUCCEED;
} else {
char *path;
@@ -3686,7 +3686,7 @@ do_backup(const char *srcdir, const char
mvret = heap_move(h, srcdir,
subcommit ? SUBDIR : BAKDIR,
nme, extnew);
- else
+ else if (file_exists(h->farmid, srcdir, nme, ext))
mvret = heap_move(h, srcdir,
subcommit ? SUBDIR : BAKDIR,
nme, ext);
@@ -3960,7 +3960,7 @@ BBPsync(int cnt, bat *restrict subcommit
break;
}
if (BBP_status(i) & BBPEXISTING) {
- if (b != NULL) {
+ if (b != NULL && b->batInserted > 0) {
if (BBPbackup(b, subcommit != NULL) !=
GDK_SUCCEED) {
if (lock)
MT_lock_unset(&GDKswapLock(i));
@@ -4027,6 +4027,7 @@ BBPsync(int cnt, bat *restrict subcommit
assert(sizes == NULL || bi.width == 0 ||
(bi.type == TYPE_msk ? ((size + 31) / 32) * 4 : size << bi.shift) <= bi.hfree);
if (size > bi.count) /* includes sizes==NULL */
size = bi.count;
+ bi.b->batInserted = size;
if (b && size != 0) {
/* wait for BBPSAVING so that we
* can set it, wait for
diff --git a/gdk/gdk_tm.c b/gdk/gdk_tm.c
--- a/gdk/gdk_tm.c
+++ b/gdk/gdk_tm.c
@@ -44,36 +44,6 @@
* situation is COLD-abort: quit the server and restart, so you get
* the recovered disk images.
*/
-/* in the commit prelude, the delta status in the memory image of all
- * bats is commited */
-static gdk_return
-prelude(int cnt, bat *restrict subcommit, BUN *restrict sizes)
-{
- int i = 0;
-
- while (++i < cnt) {
- bat bid = subcommit ? subcommit[i] : i;
-
- if (BBP_status(bid) & BBPPERSISTENT) {
- BAT *b = BBP_cache(bid);
-
- if (b == NULL && (BBP_status(bid) & BBPSWAPPED)) {
- b = BBPquickdesc(bid);
- if (b == NULL)
- return GDK_FAIL;
- }
- if (b) {
- MT_lock_set(&b->theaplock);
- assert(!isVIEW(b));
- assert(b->batRole == PERSISTENT);
- assert(sizes == NULL || sizes[i] <=
BATcount(b));
- BATcommit(b, sizes ? sizes[i] : BUN_NONE);
- MT_lock_unset(&b->theaplock);
- }
- }
- }
- return GDK_SUCCEED;
-}
/* in the commit epilogue, the BBP-status of the bats is changed to
* reflect their presence in the succeeded checkpoint. Also bats from
@@ -139,8 +109,7 @@ TMcommit(void)
/* commit with the BBP globally locked */
BBPlock();
- if (prelude(getBBPsize(), NULL, NULL) == GDK_SUCCEED &&
- BBPsync(getBBPsize(), NULL, NULL, getBBPlogno(), getBBPtransid())
== GDK_SUCCEED) {
+ if (BBPsync(getBBPsize(), NULL, NULL, getBBPlogno(), getBBPtransid())
== GDK_SUCCEED) {
epilogue(getBBPsize(), NULL, true);
ret = GDK_SUCCEED;
}
@@ -205,15 +174,13 @@ TMsubcommit_list(bat *restrict subcommit
}
}
}
- if (prelude(cnt, subcommit, sizes) == GDK_SUCCEED) { /* save the new
bats outside the lock */
- /* lock just prevents other global (sub-)commits */
- MT_lock_set(&GDKtmLock);
- if (BBPsync(cnt, subcommit, sizes, logno, transid) ==
GDK_SUCCEED) { /* write BBP.dir (++) */
- epilogue(cnt, subcommit, false);
- ret = GDK_SUCCEED;
- }
- MT_lock_unset(&GDKtmLock);
+ /* lock just prevents other global (sub-)commits */
+ MT_lock_set(&GDKtmLock);
+ if (BBPsync(cnt, subcommit, sizes, logno, transid) == GDK_SUCCEED) { /*
write BBP.dir (++) */
+ epilogue(cnt, subcommit, false);
+ ret = GDK_SUCCEED;
}
+ MT_lock_unset(&GDKtmLock);
return ret;
}
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]