Changeset: b516eaf986af for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/b516eaf986af
Modified Files:
        gdk/gdk_bbp.c
Branch: Jun2023
Log Message:

Add free bats to free list during initialization.
This fixes bug #7394.


diffs (28 lines):

diff --git a/gdk/gdk_bbp.c b/gdk/gdk_bbp.c
--- a/gdk/gdk_bbp.c
+++ b/gdk/gdk_bbp.c
@@ -332,7 +332,7 @@ BBPselectfarm(role_t role, int type, enu
 static gdk_return
 BBPextend(bat newsize)
 {
-       if (newsize >= N_BBPINIT * BBPINIT) {
+       if (newsize > N_BBPINIT * BBPINIT) {
                GDKerror("trying to extend BAT pool beyond the "
                         "limit (%d)\n", N_BBPINIT * BBPINIT);
                return GDK_FAIL;
@@ -1699,6 +1699,15 @@ BBPinit(void)
                fclose(fp);
        }
 
+       /* add free bats to free list in such a way that low numbered
+        * ones are at the head of the list */
+       for (bat i = (bat) ATOMIC_GET(&BBPsize) - 1; i > 0; i--) {
+               if (BBP_desc(i) == NULL) {
+                       BBP_next(i) = BBP_free;
+                       BBP_free = i;
+               }
+       }
+
        /* will call BBPrecover if needed */
        if (!GDKinmemory(0)) {
                BBPtmlock();
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to