Changeset: 5718439adb42 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/5718439adb42
Modified Files:
        gdk/gdk_rtree.c
        geom/monetdb5/geomBulk.c
Branch: geo-update-dev
Log Message:

WIP locking + multi-threaded


diffs (70 lines):

diff --git a/gdk/gdk_rtree.c b/gdk/gdk_rtree.c
--- a/gdk/gdk_rtree.c
+++ b/gdk/gdk_rtree.c
@@ -94,7 +94,10 @@ RTREEaddmbr (BAT *b, mbr_t *inMBR, BUN i
                rect[1] = inMBR->ymin;
                rect[2] = inMBR->xmax;
                rect[3] = inMBR->ymax;
+               //TODO Is this lock really needed? Test rtreelib concurrency
+               MT_lock_set(&pb->batIdxLock);
                rtree_add_rect(pb->T.rtree,rtree_id,rect);
+               MT_lock_unset(&pb->batIdxLock);
        }
        else {
                GDKerror("Tried to insert mbr into RTree that was not 
initialized\n");
@@ -188,7 +191,7 @@ RTREEsearch(BAT *b, mbr_t *inMBR, int re
        rtree_t *rtree = pb->T.rtree;
        if (rtree != NULL) {
                BUN *candidates = GDKmalloc(result_limit*sizeof(BUN));
-               memset(candidates,BUN_NONE,result_limit*sizeof(BUN*));
+               memset(candidates,BUN_NONE,result_limit*sizeof(BUN));
 
                rtree_coord_t rect[4];
                rect[0] = inMBR->xmin;
diff --git a/geom/monetdb5/geomBulk.c b/geom/monetdb5/geomBulk.c
--- a/geom/monetdb5/geomBulk.c
+++ b/geom/monetdb5/geomBulk.c
@@ -50,13 +50,13 @@ filterSelectRTree(bat* outid, const bat 
                throw(MAL, name, SQLSTATE(HY013) MAL_MALLOC_FAIL);
        }
 
-       /*if (!RTREEexists(b)) {
+       if (!RTREEexists(b)) {
                if (RTREEcreate(b) != GDK_SUCCEED) {
                        //TODO What to do?
                        throw(MAL, name, "Failed to initialize RTree");
                }
                for (BUN j = 0; j < BATcount(b); j++) {
-                       wkb *inWKB = (wkb *) BUNtvar(b_iter, j - b->hseqbase);
+                       wkb *inWKB = (wkb *) BUNtvar(b_iter, j + b->hseqbase);
                        mbr *inMBR = NULL;
                        wkbMBR(&inMBR, &inWKB);
 
@@ -66,7 +66,7 @@ filterSelectRTree(bat* outid, const bat 
                        GDKfree(inMBR);
                        inMBR = NULL;
                }
-       }*/
+       }
 
        //Calculate the MBR for the constant geometry
        mbr *const_mbr = NULL;
@@ -80,7 +80,8 @@ filterSelectRTree(bat* outid, const bat 
        //Cycle through rtree candidates
        //If there is a original candidate list, make sure the rtree cand is in 
there
        //Then do the actual calculation for the geo predicate using the GEOS 
func
-       for (int i = 0; results_rtree[i] != BUN_NONE; i++) {
+       //TODO Change literal of BUN_NONE to BUN_NONE in loop condition
+       for (int i = 0; results_rtree[i] != 18446744073709551615U && i < (int) 
b->batCount; i++) {
                BUN cand = results_rtree[i];
                //If we have a candidate list that is not dense, we need to 
check if the rtree candidate is also on the original candidate list
                //TODO Check w Stefanos
@@ -89,7 +90,7 @@ filterSelectRTree(bat* outid, const bat 
                        if (!canditer_contains(&ci,cand))
                                continue;
                }
-               const wkb *col_wkb = BUNtvar(b_iter, cand - b->hseqbase);
+               const wkb *col_wkb = BUNtvar(b_iter, cand + b->hseqbase);
                if ((col_geom = wkb2geos(col_wkb)) == NULL)
                        throw(MAL, name, SQLSTATE(38000) "WKB2Geos operation 
failed");
                if (GEOSGetSRID(col_geom) != GEOSGetSRID(const_geom)) {
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to