Changeset: 3da1a8a4ab38 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/3da1a8a4ab38
Modified Files:
        gdk/gdk_bat.c
Branch: Aug2024
Log Message:

Merge with Dec2023 branch.


diffs (84 lines):

diff --git a/common/stream/Tests/urlstream.py b/common/stream/Tests/urlstream.py
--- a/common/stream/Tests/urlstream.py
+++ b/common/stream/Tests/urlstream.py
@@ -9,25 +9,6 @@ import time
 
 OUTPUT = io.StringIO()
 
-def wait_for_server(timeout):
-    deadline = time.time() + timeout
-    while time.time() < deadline:
-        if port == 0:
-            time.sleep(0.25)
-            continue
-        s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
-        s.settimeout(0.1)
-        try:
-            s.connect(('localhost', port))
-            break
-        except ConnectionRefusedError:
-            time.sleep(0.1)
-        finally:
-            s.close()
-    else:
-        print(f'Warning: waited {timeout} seconds for the server to start but 
could still not connect', file=OUTPUT)
-
-
 class Handler(http.server.BaseHTTPRequestHandler):
     def log_message(self, format, *args):
         # add a # at the beginning of the line to not mess up Mtest diffs
@@ -66,19 +47,23 @@ class Handler(http.server.BaseHTTPReques
             self.end_headers()
             self.wfile.write(b'NOT FOUND\n')
 
+b = threading.Barrier(2)
+
 def runserver():
     global port
     addr = ('127.0.0.1', 0)
     srv = http.server.HTTPServer(addr, Handler)
     port = srv.server_port
     print(f"Listening on {port}", file=OUTPUT)
+    b.wait()
     srv.serve_forever()
 
 # Start the http server
 port = 0
 t = threading.Thread(target=lambda: runserver(), daemon=True)
 t.start()
-wait_for_server(5.0)
+# and wait for it to fill in the port
+b.wait()
 
 url = f'http://localhost:{port}'
 
diff --git a/gdk/gdk_bat.c b/gdk/gdk_bat.c
--- a/gdk/gdk_bat.c
+++ b/gdk/gdk_bat.c
@@ -817,11 +817,26 @@ COLcopy(BAT *b, int tt, bool writable, r
         * table and that would result in buckets containing values
         * beyond the original vheap that we're copying */
        MT_lock_set(&b->theaplock);
+       BAT *pb = NULL, *pvb = NULL;
+       if (b->theap->parentid != b->batCacheid) {
+               pb = BBP_desc(b->theap->parentid);
+               MT_lock_set(&pb->theaplock);
+       }
+       if (b->tvheap &&
+           b->tvheap->parentid != b->batCacheid &&
+           b->tvheap->parentid != b->theap->parentid) {
+               pvb = BBP_desc(b->tvheap->parentid);
+               MT_lock_set(&pvb->theaplock);
+       }
        bi = bat_iterator_nolock(b);
        if (ATOMstorage(b->ttype) == TYPE_str && b->tvheap->free >= 
GDK_STRHASHSIZE)
                memcpy(strhash, b->tvheap->base, GDK_STRHASHSIZE);
 
        bat_iterator_incref(&bi);
+       if (pvb)
+               MT_lock_unset(&pvb->theaplock);
+       if (pb)
+               MT_lock_unset(&pb->theaplock);
        MT_lock_unset(&b->theaplock);
 
        /* first try case (1); create a view, possibly with different
_______________________________________________
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org

Reply via email to