Changeset: d04d3b23a2f8 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/d04d3b23a2f8
Modified Files:
gdk/gdk_rtree.c
geom/monetdb5/geomBulk.c
Branch: geo-update-dev
Log Message:
Write and read the bsrt rtree files from the BAT farm directory, with the
appropriate BAT id in the file.
diffs (92 lines):
diff --git a/gdk/gdk_rtree.c b/gdk/gdk_rtree.c
--- a/gdk/gdk_rtree.c
+++ b/gdk/gdk_rtree.c
@@ -3,6 +3,8 @@
#include "gdk_private.h"
#include "gdk_rtree.h"
+//TODO Why use BBPselectfarm?
+
// Persist rtree to disk if the conditions are right
static gdk_return
persistRtree (BAT *b)
@@ -22,12 +24,10 @@ persistRtree (BAT *b)
rtree_t *rtree = b->T.rtree;
if (rtree) {
- //TODO Change the filename and ext
- const char *filename = "rtree";
- const char *ext = "new";
+ const char * filename = BBP_physical(b->batCacheid);
int farmid = b->theap->farmid;
- int fd = GDKfdlocate(farmid, filename, "w", ext);
+ int fd = GDKfdlocate(farmid, filename, "w", "bsrt");
FILE *file_stream = fdopen(fd,"w");
if (file_stream != NULL) {
@@ -64,14 +64,11 @@ persistRtree (BAT *b)
static gdk_return
BATcheckrtree(BAT *b) {
- //TODO When do you load from disk?
- //TODO Lock
+ const char * filename = BBP_physical(b->batCacheid);
+ int farmid = b->theap->farmid;
+ int fd = GDKfdlocate(farmid, filename, "r", "bsrt");
- //TODO Change the filename and ext
- const char *filename = "rtree";
- const char *ext = "new";
- int farmid = b->theap->farmid;
- int fd = GDKfdlocate(farmid, filename, "r", ext);
+ //Do we have the rtree on file?
if (fd == -1)
return GDK_SUCCEED;
@@ -115,7 +112,6 @@ RTREEexists(BAT *b)
}
-//MBR bat
gdk_return
BATrtree(BAT *wkb, BAT *mbr)
{
@@ -124,8 +120,6 @@ BATrtree(BAT *wkb, BAT *mbr)
rtree_t *rtree = NULL;
struct canditer ci;
- //TODO check for MBR type
-
//Check for a parent BAT of wkb, load if exists
if (VIEWtparent(wkb)) {
pb = BBP_cache(VIEWtparent(wkb));
diff --git a/geom/monetdb5/geomBulk.c b/geom/monetdb5/geomBulk.c
--- a/geom/monetdb5/geomBulk.c
+++ b/geom/monetdb5/geomBulk.c
@@ -51,24 +51,8 @@ filterSelectRTree(bat* outid, const bat
throw(MAL, name, SQLSTATE(HY013) MAL_MALLOC_FAIL);
}
- //TODO First thread that gets here should build the whole tree (using
the parent BAT array)
- //TODO The lock on the check should not be released
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);
- mbr *inMBR = NULL;
- wkbMBR(&inMBR, &inWKB);
-
- if (RTREEaddmbr(b,(mbr_t*)inMBR,j) != GDK_SUCCEED) {
- //TODO Cleanup
- }
- GDKfree(inMBR);
- inMBR = NULL;
- }
+ //TODO Do we create RTree on the first thread that gets here?
}
//Calculate the MBR for the constant geometry
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]