Changeset: 72c33149e1a9 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/72c33149e1a9
Modified Files:
        gdk/gdk_bbp.c
        gdk/gdk_storage.c
Branch: Jul2021
Log Message:

When destroying a bat, make sure there are no remnants in the BACKUP directory.


diffs (75 lines):

diff --git a/gdk/gdk_bbp.c b/gdk/gdk_bbp.c
--- a/gdk/gdk_bbp.c
+++ b/gdk/gdk_bbp.c
@@ -2992,10 +2992,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;
@@ -3012,12 +3008,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 */
 
diff --git a/gdk/gdk_storage.c b/gdk/gdk_storage.c
--- a/gdk/gdk_storage.c
+++ b/gdk/gdk_storage.c
@@ -955,8 +955,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;
        }
@@ -964,9 +967,29 @@ BATdelete(BAT *b)
        IMPSdestroy(b);
        OIDXdestroy(b);
        PROPdestroy_nolock(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;
 }
 
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to