Changeset: d1331bcd17a0 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/d1331bcd17a0
Modified Files:
gdk/gdk_bbp.c
Branch: Jul2021
Log Message:
Move tail check test (-d65536) to start of commit.
At this location it is a bit more useful than at the end of the
commit.
Also removed some unused code in this check.
diffs (108 lines):
diff --git a/gdk/gdk_bbp.c b/gdk/gdk_bbp.c
--- a/gdk/gdk_bbp.c
+++ b/gdk/gdk_bbp.c
@@ -3500,34 +3500,21 @@ BBPbackup(BAT *b, bool subcommit)
}
static inline void
-BBPcheckHeap(bool subcommit, Heap *h)
+BBPcheckHeap(Heap *h)
{
struct stat statb;
char *path;
- if (subcommit) {
- char *s = strrchr(h->filename, DIR_SEP);
- if (s)
- s++;
- else
- s = h->filename;
- path = GDKfilepath(0, BAKDIR, s, NULL);
- if (path == NULL)
- return;
- if (MT_stat(path, &statb) < 0) {
- GDKfree(path);
- path = GDKfilepath(0, BATDIR, h->filename, NULL);
- if (path == NULL)
- return;
- if (MT_stat(path, &statb) < 0) {
- assert(0);
- GDKsyserror("cannot stat file %s (expected size
%zu)\n",
- path, h->free);
- GDKfree(path);
- return;
- }
- }
- } else {
+ char *s = strrchr(h->filename, DIR_SEP);
+ if (s)
+ s++;
+ else
+ s = h->filename;
+ path = GDKfilepath(0, BAKDIR, s, NULL);
+ if (path == NULL)
+ return;
+ if (MT_stat(path, &statb) < 0) {
+ GDKfree(path);
path = GDKfilepath(0, BATDIR, h->filename, NULL);
if (path == NULL)
return;
@@ -3550,7 +3537,7 @@ BBPcheckHeap(bool subcommit, Heap *h)
}
static void
-BBPcheckBBPdir(bool subcommit)
+BBPcheckBBPdir(void)
{
FILE *fp;
int lineno = 0;
@@ -3558,10 +3545,14 @@ BBPcheckBBPdir(bool subcommit)
unsigned bbpversion;
lng logno, transid;
- fp = GDKfileopen(0, BATDIR, "BBP", "dir", "r");
+ fp = GDKfileopen(0, BAKDIR, "BBP", "dir", "r");
assert(fp != NULL);
- if (fp == NULL)
- return;
+ if (fp == NULL) {
+ fp = GDKfileopen(0, BATDIR, "BBP", "dir", "r");
+ assert(fp != NULL);
+ if (fp == NULL)
+ return;
+ }
bbpversion = BBPheader(fp, &lineno, &bbpsize, &logno, &transid);
if (bbpversion == 0) {
fclose(fp);
@@ -3610,9 +3601,9 @@ BBPcheckBBPdir(bool subcommit)
continue;
}
if (b.theap->free > 0)
- BBPcheckHeap(subcommit, b.theap);
+ BBPcheckHeap(b.theap);
if (b.tvheap != NULL && b.tvheap->free > 0)
- BBPcheckHeap(subcommit, b.tvheap);
+ BBPcheckHeap(b.tvheap);
}
}
@@ -3647,6 +3638,9 @@ BBPsync(int cnt, bat *restrict subcommit
TRC_DEBUG_IF(PERF) t0 = t1 = GDKms();
+ if ((GDKdebug & TAILCHKMASK) && !GDKinmemory(0))
+ BBPcheckBBPdir();
+
ret = BBPprepare(subcommit != NULL);
/* PHASE 1: safeguard everything in a backup-dir */
@@ -3813,9 +3807,6 @@ BBPsync(int cnt, bat *restrict subcommit
* succeeded, so no changing of ret after this
* call anymore */
- if ((GDKdebug & TAILCHKMASK) && !GDKinmemory(0))
- BBPcheckBBPdir(subcommit != NULL);
-
if (MT_rename(bakdir, deldir) < 0 &&
/* maybe there was an old deldir, so remove and try again */
(GDKremovedir(0, DELDIR) != GDK_SUCCEED ||
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]