Changeset: ba0b5cf13c2a for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/ba0b5cf13c2a
Branch: Jan2022_prof_ext
Log Message:

Merge with Jan2022.


diffs (162 lines):

diff --git a/.hgtags b/.hgtags
--- a/.hgtags
+++ b/.hgtags
@@ -769,3 +769,4 @@ 1252291e5c0ddc91ccb16d612d04e34e6a7d3bc3
 1252291e5c0ddc91ccb16d612d04e34e6a7d3bc3 Jun2020_SP2_release
 59de1ee118d4eccc072c0cf3938f90635a7db311 Jan2022_15
 59de1ee118d4eccc072c0cf3938f90635a7db311 Jan2022_SP3_release
+38ba6e40ba9148c762fe4a4b40f4937f86e516b6 Jul2021_25
diff --git a/gdk/ChangeLog.Jan2022 b/gdk/ChangeLog.Jan2022
--- a/gdk/ChangeLog.Jan2022
+++ b/gdk/ChangeLog.Jan2022
@@ -1,6 +1,11 @@
 # ChangeLog file for GDK
 # This file is updated with Maddlog
 
+* Tue Aug  2 2022 Sjoerd Mullender <sjo...@acm.org>
+- When destroying a bat, make sure there are no files left over in
+  the BACKUP directory since they can cause problems when the bat id
+  gets reused.
+
 * Thu Jul 28 2022 Sjoerd Mullender <sjo...@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.
diff --git a/gdk/gdk_bbp.c b/gdk/gdk_bbp.c
--- a/gdk/gdk_bbp.c
+++ b/gdk/gdk_bbp.c
@@ -2510,7 +2510,7 @@ BBPinsert(BAT *bn)
        MT_lock_unset(&GDKswapLock(i));
 
 #ifdef HAVE_HGE
-       if (bn->ttype == TYPE_hge)
+       if (bn->ttype == TYPE_hge && !havehge)
                havehge = true;
 #endif
 
diff --git a/gdk/gdk_join.c b/gdk/gdk_join.c
--- a/gdk/gdk_join.c
+++ b/gdk/gdk_join.c
@@ -3162,7 +3162,6 @@ count_unique(BAT *b, BAT *s, BUN *cnt1, 
                seen = NULL;
        } else {
                BUN prb;
-               BUN p;
                BUN mask;
                Hash hs = {0};
 
@@ -3176,7 +3175,7 @@ count_unique(BAT *b, BAT *s, BUN *cnt1, 
                    (hs.heapbckt.farmid = BBPselectfarm(TRANSIENT, b->ttype, 
hashheap)) < 0 ||
                    snprintf(hs.heaplink.filename, 
sizeof(hs.heaplink.filename), "%s.thshjnl%x", nme, (unsigned) THRgettid()) >= 
(int) sizeof(hs.heaplink.filename) ||
                    snprintf(hs.heapbckt.filename, 
sizeof(hs.heapbckt.filename), "%s.thshjnb%x", nme, (unsigned) THRgettid()) >= 
(int) sizeof(hs.heapbckt.filename) ||
-                   HASHnew(&hs, b->ttype, BUNlast(b), mask, BUN_NONE, false) 
!= GDK_SUCCEED) {
+                   HASHnew(&hs, b->ttype, ci.ncand, mask, BUN_NONE, false) != 
GDK_SUCCEED) {
                        GDKerror("cannot allocate hash table\n");
                        HEAPfree(&hs.heaplink, true);
                        HEAPfree(&hs.heapbckt, true);
@@ -3192,15 +3191,15 @@ count_unique(BAT *b, BAT *s, BUN *cnt1, 
                        for (hb = HASHget(&hs, prb);
                             hb != BUN_NONE;
                             hb = HASHgetlink(&hs, hb)) {
-                               if (cmp(v, BUNtail(bi, hb)) == 0)
+                               BUN p = canditer_idx(&ci, hb) - b->hseqbase;
+                               if (cmp(v, BUNtail(bi, p)) == 0)
                                        break;
                        }
                        if (hb == BUN_NONE) {
-                               p = o - b->hseqbase;
                                cnt++;
                                /* enter into hash table */
-                               HASHputlink(&hs, p, HASHget(&hs, prb));
-                               HASHput(&hs, prb, p);
+                               HASHputlink(&hs, i, HASHget(&hs, prb));
+                               HASHput(&hs, prb, i);
                        }
                }
                *cnt2 = cnt;
diff --git a/gdk/gdk_storage.c b/gdk/gdk_storage.c
--- a/gdk/gdk_storage.c
+++ b/gdk/gdk_storage.c
@@ -974,7 +974,8 @@ BATdelete(BAT *b)
        STRMPdestroy(b);
        if (b->theap) {
                HEAPfree(b->theap, true);
-               if ((f = GDKfilepath(b->theap->farmid, BAKDIR, o, "tail1")) != 
NULL) {
+               if (!GDKinmemory(b->theap->farmid) &&
+                   (f = GDKfilepath(b->theap->farmid, BAKDIR, o, "tail1")) != 
NULL) {
                        MT_remove(f);
                        size_t i = strlen(f) - 1;
                        f[i] = '2';
@@ -990,7 +991,8 @@ BATdelete(BAT *b)
        }
        if (b->tvheap) {
                HEAPfree(b->tvheap, true);
-               if ((f = GDKfilepath(b->theap->farmid, BAKDIR, o, "theap")) != 
NULL) {
+               if (!GDKinmemory(b->tvheap->farmid) &&
+                   (f = GDKfilepath(b->theap->farmid, BAKDIR, o, "theap")) != 
NULL) {
                        MT_remove(f);
                        GDKfree(f);
                }
diff --git a/testing/Mtest.py.in b/testing/Mtest.py.in
--- a/testing/Mtest.py.in
+++ b/testing/Mtest.py.in
@@ -304,11 +304,11 @@ def remove(file):
     except FileNotFoundError:
         pass
     except IsADirectoryError:
-        shutil.rmtree(file)
+        shutil.rmtree(file, ignore_errors=True)
     except PermissionError:
         # on Windows we get a weird error from os.remove on a directory
         if os.name == "nt":
-            shutil.rmtree(file)
+            shutil.rmtree(file, ignore_errors=True)
         else:
             Warn('could not remove {}'.format(file))
     except:
diff --git a/testing/sqltest.py b/testing/sqltest.py
--- a/testing/sqltest.py
+++ b/testing/sqltest.py
@@ -336,6 +336,7 @@ class MclientTestResult(TestCaseResult, 
     def __init__(self, test_case, **kwargs):
         super().__init__(test_case, **kwargs)
         self.did_run = False
+        self.output = ''
 
     def _parse_error(self, err:str):
         err_code = None
@@ -379,7 +380,7 @@ class MclientTestResult(TestCaseResult, 
                             stdout=process.PIPE, stderr=process.PIPE) as p:
                         out, err = p.communicate(query)
                         if out:
-                            self.data = out
+                            self.output = out
                             self.rowcount = self._get_row_count(out)
                         if err:
                             self.test_run_error = err
@@ -391,7 +392,7 @@ class MclientTestResult(TestCaseResult, 
                             stdout=process.PIPE, stderr=process.PIPE) as p:
                         out, err = p.communicate()
                         if out:
-                            self.data = out
+                            self.output = out
                         if err:
                             self.test_run_error = err
                             self.err_code, self.err_message = 
self._parse_error(err)
@@ -402,7 +403,7 @@ class MclientTestResult(TestCaseResult, 
 
     def assertMatchStableOut(self, fout, ignore_headers=False):
         stable = []
-        data = list(filter(filter_junk, self.data.split('\n')))
+        data = list(filter(filter_junk, self.output.split('\n')))
         with open(fout, 'r') as f:
             stable = list(filter(filter_junk, f.read().split('\n')))
         if ignore_headers:
@@ -438,7 +439,7 @@ class MclientTestResult(TestCaseResult, 
         return self
 
     def assertDataResultMatch(self, expected):
-        data = list(filter(filter_junk, self.data.split('\n')))
+        data = list(filter(filter_junk, self.output.split('\n')))
         data = list(filter(filter_headers, data))
         a, b = filter_matching_blocks(expected, data)
         diff = list(difflib.unified_diff(a, b, fromfile='expected', 
tofile='test'))
_______________________________________________
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org

Reply via email to