changeset 86190:daea8245a12f Jan2022 tip

Merge with Jul2021 branch.
author Sjoerd Mullender <sjoerd@acm.org>
date Thu, 28 Jul 2022 20:25:14 +0200
parents aec3dfc4d53b (current diff) 72c33149e1a9 (diff)
children
files gdk/ChangeLog.Jan2022 gdk/gdk_bbp.c gdk/gdk_storage.c
diffstat 3 files changed, 35 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/gdk/ChangeLog.Jan2022
+++ b/gdk/ChangeLog.Jan2022
@@ -1,6 +1,15 @@
 # ChangeLog file for GDK
 # This file is updated with Maddlog
 
+* Thu Jul 28 2022 Sjoerd Mullender <sjoerd@acm.org>
+- Fixed an off-by-one error in the logger which caused older log files
+  to stick around longer in the write-ahead log than necessary.
+- When an empty BAT is committed, skip writing (and synchronizing to
+  disk) the heap (tail and theap) files and write 0 for their sizes to
+  the BBP.dir file.  When reading the BBP.dir file, if an empty BAT is
+  encountered, set the sizes of those files to 0.  This fixes potential
+  issues during startup of the server (BBPcheckbats reporting errors).
+
 * Wed Jun 22 2022 Sjoerd Mullender <sjoerd@acm.org>
 - Make sure heap files of transient bats get deleted when the bat is
   destroyed.  If the bat was a partial view (sharing the vheap but not
--- a/gdk/gdk_bbp.c
+++ b/gdk/gdk_bbp.c
@@ -3275,10 +3275,6 @@ BBPdestroy(BAT *b)
 	bat tp = VIEWtparent(b);
 	bat vtp = VIEWvtparent(b);
 
-	HASHdestroy(b);
-	IMPSdestroy(b);
-	OIDXdestroy(b);
-	PROPdestroy_nolock(b);
 	if (tp == 0) {
 		/* bats that get destroyed must unfix their atoms */
 		gdk_return (*tunfix) (const void *) = BATatoms[b->ttype].atomUnfix;
@@ -3295,12 +3291,7 @@ BBPdestroy(BAT *b)
 	}
 	if (tp || vtp)
 		VIEWunlink(b);
-	if (b->theap) {
-		HEAPfree(b->theap, true);
-	}
-	if (b->tvheap)
-		HEAPfree(b->tvheap, true);
-	b->batCopiedtodisk = false;
+	BATdelete(b);
 
 	BBPclear(b->batCacheid, true);	/* if destroyed; de-register from BBP */
 
--- a/gdk/gdk_storage.c
+++ b/gdk/gdk_storage.c
@@ -959,8 +959,11 @@ BATdelete(BAT *b)
 {
 	bat bid = b->batCacheid;
 	BAT *loaded = BBP_cache(bid);
+	char o[10];
+	char *f;
 
 	assert(bid > 0);
+	snprintf(o, sizeof(o), "%o", (unsigned) bid);
 	if (loaded) {
 		b = loaded;
 	}
@@ -969,9 +972,29 @@ BATdelete(BAT *b)
 	OIDXdestroy(b);
 	PROPdestroy_nolock(b);
 	STRMPdestroy(b);
-	HEAPfree(b->theap, true);
-	if (b->tvheap)
+	if (b->theap) {
+		HEAPfree(b->theap, true);
+		if ((f = GDKfilepath(b->theap->farmid, BAKDIR, o, "tail1")) != NULL) {
+			MT_remove(f);
+			size_t i = strlen(f) - 1;
+			f[i] = '2';
+			MT_remove(f);
+#if SIZEOF_VAR_T == 8
+			f[i] = '4';
+			MT_remove(f);
+#endif
+			f[i] = '\0';
+			MT_remove(f);
+			GDKfree(f);
+		}
+	}
+	if (b->tvheap) {
 		HEAPfree(b->tvheap, true);
+		if ((f = GDKfilepath(b->theap->farmid, BAKDIR, o, "theap")) != NULL) {
+			MT_remove(f);
+			GDKfree(f);
+		}
+	}
 	b->batCopiedtodisk = false;
 }