MonetDB: geo - testweb errors fix
Changeset: 4e3a217cbe0e for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=4e3a217cbe0e Modified Files: geom/monetdb5/geom.c geom/monetdb5/geomPoints.c Branch: geo Log Message: testweb errors fix diffs (41 lines): diff --git a/geom/monetdb5/geom.c b/geom/monetdb5/geom.c --- a/geom/monetdb5/geom.c +++ b/geom/monetdb5/geom.c @@ -1196,7 +1196,6 @@ static str wkbBasicInt(int *out, wkb *ge GDKerrbuf[0]='\0'; } return ret; - } diff --git a/geom/monetdb5/geomPoints.c b/geom/monetdb5/geomPoints.c --- a/geom/monetdb5/geomPoints.c +++ b/geom/monetdb5/geomPoints.c @@ -376,7 +376,7 @@ static str pnpolyWithHoles_(int *out, GE const GEOSCoordSequence *exteriorRingCoordSeq; double **xPoints, **yPoints; //arrays with the points of the rings so that we do not read them every time unsigned int *pointsNum; //array with the number of points in each ring - bool checked = false; //used to know when the internal rings have been checked + bte checked = 0; //used to know when the internal rings have been checked /*Get the BATs*/ if ((bpx = BATdescriptor(*point_x)) == NULL) { @@ -467,7 +467,7 @@ static str pnpolyWithHoles_(int *out, GE //inside the polygon, check the holes for (h = 0; h < interiorRingsNum; h++) { - const GEOSCoordSequence *interiorRingCoordSeq; + const GEOSCoordSequence *interiorRingCoordSeq = NULL; if(!checked) { const GEOSGeometry *interiorRingGeometry; @@ -520,7 +520,7 @@ static str pnpolyWithHoles_(int *out, GE } } - checked = true; + checked = 1; } BATsetcount(bo,BATcount(bpx)); ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: geo - Link in openSSL libraries since we use the rand f...
Changeset: 6c3f75425c05 for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=6c3f75425c05 Modified Files: tools/merovingian/daemon/Makefile.ag Branch: geo Log Message: Link in openSSL libraries since we use the rand function. diffs (11 lines): diff --git a/tools/merovingian/daemon/Makefile.ag b/tools/merovingian/daemon/Makefile.ag --- a/tools/merovingian/daemon/Makefile.ag +++ b/tools/merovingian/daemon/Makefile.ag @@ -60,6 +60,7 @@ bin_monetdbd = { ../../../monetdb5/tools/libmonetdb5 \ ../../../gdk/libbat \ $(UUID_LIBS) \ + $(openssl_LIBS) \ $(curl_LIBS) \ $(SOCKET_LIBS) \ $(MALLOC_LIBS) \ ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: Oct2014 - Add a const.
Changeset: bdc3a453fb39 for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=bdc3a453fb39 Modified Files: clients/Tests/exports.stable.out gdk/gdk.h gdk/gdk_batop.c Branch: Oct2014 Log Message: Add a const. diffs (36 lines): diff --git a/clients/Tests/exports.stable.out b/clients/Tests/exports.stable.out --- a/clients/Tests/exports.stable.out +++ b/clients/Tests/exports.stable.out @@ -146,7 +146,7 @@ BAT *BATkunion(BAT *b, BAT *c); BAT *BATleftfetchjoin(BAT *b, BAT *s, BUN estimate); BAT *BATleftjoin(BAT *l, BAT *r, BUN estimate); BAT *BATmark(BAT *b, oid base); -BAT *BATmark_grp(BAT *b, BAT *g, oid *base); +BAT *BATmark_grp(BAT *b, BAT *g, const oid *base); void *BATmax(BAT *b, void *aggr); size_t BATmemsize(BAT *b, int dirty); BAT *BATmergecand(BAT *a, BAT *b); diff --git a/gdk/gdk.h b/gdk/gdk.h --- a/gdk/gdk.h +++ b/gdk/gdk.h @@ -1612,7 +1612,7 @@ gdk_export int BATgetaccess(BAT *b); gdk_export BAT *BATclear(BAT *b, int force); gdk_export BAT *BATcopy(BAT *b, int ht, int tt, int writeable, int role); gdk_export BAT *BATmark(BAT *b, oid base); -gdk_export BAT *BATmark_grp(BAT *b, BAT *g, oid *base); +gdk_export BAT *BATmark_grp(BAT *b, BAT *g, const oid *base); gdk_export gdk_return BATgroup(BAT **groups, BAT **extents, BAT **histo, BAT *b, BAT *g, BAT *e, BAT *h); diff --git a/gdk/gdk_batop.c b/gdk/gdk_batop.c --- a/gdk/gdk_batop.c +++ b/gdk/gdk_batop.c @@ -1526,7 +1526,7 @@ BATmark(BAT *b, oid oid_base) } while (0) BAT * -BATmark_grp(BAT *b, BAT *g, oid *s) +BATmark_grp(BAT *b, BAT *g, const oid *s) { BAT *bn = NULL, *gc = NULL; bit trivprop = FALSE; ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: Oct2014 - Some better bat_nil handling.
Changeset: c096fcdd13d8 for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=c096fcdd13d8 Modified Files: gdk/gdk_bbp.c gdk/gdk_value.c Branch: Oct2014 Log Message: Some better bat_nil handling. diffs (49 lines): diff --git a/gdk/gdk_bbp.c b/gdk/gdk_bbp.c --- a/gdk/gdk_bbp.c +++ b/gdk/gdk_bbp.c @@ -1625,9 +1625,11 @@ BBPindex(const char *nme) BATstore * BBPgetdesc(bat i) { + if (i == bat_nil) + return NULL; if (i < 0) i = -i; - if (i != bat_nil && i < (bat) ATOMIC_GET(BBPsize, BBPsizeLock, "BBPgetdesc") && i && BBP_logical(i)) { + if (i != 0 && i < (bat) ATOMIC_GET(BBPsize, BBPsizeLock, "BBPgetdesc") && i && BBP_logical(i)) { return BBP_desc(i); } return NULL; @@ -3048,7 +3050,7 @@ BBPquickdesc(bat bid, int delaccess) { BAT *b; - if ( bid == 0) + if (bid == bat_nil || bid == 0) return NULL; if (bid < 0) { GDKerror("BBPquickdesc: called with negative batid.\n"); diff --git a/gdk/gdk_value.c b/gdk/gdk_value.c --- a/gdk/gdk_value.c +++ b/gdk/gdk_value.c @@ -277,14 +277,19 @@ VALisnil(const ValRecord *v) case TYPE_sht: return v->val.shval == sht_nil; case TYPE_int: - case TYPE_bat: return v->val.ival == int_nil; + case TYPE_wrd: + return v->val.wval == wrd_nil; case TYPE_lng: return v->val.lval == lng_nil; case TYPE_flt: return v->val.fval == flt_nil; case TYPE_dbl: return v->val.dval == dbl_nil; + case TYPE_oid: + return v->val.oval == oid_nil; + case TYPE_bat: + return v->val.bval == bat_nil || v->val.bval == 0; default: break; } ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: Oct2014 - Duplicated line.
Changeset: babf77c94f93 for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=babf77c94f93 Modified Files: monetdb5/mal/mal.c Branch: Oct2014 Log Message: Duplicated line. diffs (11 lines): diff --git a/monetdb5/mal/mal.c b/monetdb5/mal/mal.c --- a/monetdb5/mal/mal.c +++ b/monetdb5/mal/mal.c @@ -65,7 +65,6 @@ void tstAligned(void) val= (ptr) & v.val.bval; if(val != base){ allAligned = -1; } val= (ptr) & v.val.btval; if(val != base){ allAligned = -1; } val= (ptr) & v.val.shval; if(val != base){ allAligned = -1; } - val= (ptr) & v.val.bval; if(val != base){ allAligned = -1; } val= (ptr) & v.val.ival; if(val != base){ allAligned = -1; } val= (ptr) & v.val.oval; if(val != base){ allAligned = -1; } val= (ptr) & v.val.pval; if(val != base){ allAligned = -1; } ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: Oct2014 - Use bat_nil instead of 0 for nil:bat.
Changeset: e0110e589d40 for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=e0110e589d40 Modified Files: monetdb5/mal/mal_builder.c monetdb5/mal/mal_debugger.c monetdb5/mal/mal_instruction.c monetdb5/mal/mal_interpreter.c monetdb5/mal/mal_recycle.c monetdb5/mal/mal_runtime.c monetdb5/modules/kernel/algebra.c monetdb5/modules/kernel/bat5.c monetdb5/modules/mal/mat.c sql/backends/monet5/generator/generator.c sql/backends/monet5/sql.c Branch: Oct2014 Log Message: Use bat_nil instead of 0 for nil:bat. diffs (279 lines): diff --git a/monetdb5/mal/mal_builder.c b/monetdb5/mal/mal_builder.c --- a/monetdb5/mal/mal_builder.c +++ b/monetdb5/mal/mal_builder.c @@ -419,7 +419,7 @@ pushNil(MalBlkPtr mb, InstrPtr q, int tp _t = defConstant(mb,tpe,&cst); } else { cst.vtype = TYPE_bat; - cst.val.bval = 0; + cst.val.bval = bat_nil; _t = defConstant(mb,TYPE_bat,&cst); mb->var[_t]->type = tpe; } diff --git a/monetdb5/mal/mal_debugger.c b/monetdb5/mal/mal_debugger.c --- a/monetdb5/mal/mal_debugger.c +++ b/monetdb5/mal/mal_debugger.c @@ -1346,7 +1346,7 @@ printStackElm(stream *f, MalBlkPtr mb, V mnstr_printf(f, "\n"); GDKfree(nmeOnStk); - if (cnt && v && (isaBatType(n->type) || v->vtype == TYPE_bat) && v->val.ival) { + if (cnt && v && (isaBatType(n->type) || v->vtype == TYPE_bat) && v->val.bval != bat_nil) { BAT *b, *bs; b = BATdescriptor(v->val.ival); diff --git a/monetdb5/mal/mal_instruction.c b/monetdb5/mal/mal_instruction.c --- a/monetdb5/mal/mal_instruction.c +++ b/monetdb5/mal/mal_instruction.c @@ -1334,7 +1334,7 @@ convertConstant(int type, ValPtr vr) if (type == TYPE_bat || isaBatType(type)) { /* BAT variables can only be set to nil */ vr->vtype = type; - vr->val.bval = 0; + vr->val.bval = bat_nil; return MAL_SUCCEED; } switch (ATOMstorage(type)) { @@ -1385,7 +1385,7 @@ convertConstant(int type, ValPtr vr) case TYPE_bat: /* BAT variables can only be set to nil */ vr->vtype = type; - vr->val.bval = 0; + vr->val.bval = bat_nil; return MAL_SUCCEED; case TYPE_ptr: /* all coercions should be avoided to protect against memory probing */ @@ -1521,7 +1521,7 @@ defConstant(MalBlkPtr mb, int type, ValP if (isaBatType(type) && cst->vtype == TYPE_void) { cst->vtype = TYPE_bat; - cst->val.bval = 0; + cst->val.bval = bat_nil; } else if (cst->vtype != type && !isaBatType(type) && !isPolyType(type)) { ValRecord vr = *cst; int otype = cst->vtype; diff --git a/monetdb5/mal/mal_interpreter.c b/monetdb5/mal/mal_interpreter.c --- a/monetdb5/mal/mal_interpreter.c +++ b/monetdb5/mal/mal_interpreter.c @@ -637,7 +637,7 @@ str runMALsequence(Client cntxt, MalBlkP lhs = &stk->stk[pci->argv[k]]; rhs = &stk->stk[pci->argv[i]]; VALcopy(lhs, rhs); - if (lhs->vtype == TYPE_bat && lhs->val.bval) + if (lhs->vtype == TYPE_bat && lhs->val.bval != bat_nil) BBPincref(lhs->val.bval, TRUE); } FREE_EXCEPTION(ret); @@ -767,7 +767,8 @@ str runMALsequence(Client cntxt, MalBlkP for (i = 0; i < pci->retc; i++) { if (garbage[i] == -1 && stk->stk[getArg(pci, i)].vtype == TYPE_bat && - stk->stk[getArg(pci, i)].val.bval) { + stk->stk[getArg(pci, i)].val.bval != bat_nil && + stk->stk[getArg(pci, i)].val.bval != 0) { b = BBPquickdesc(abs(stk->stk[getArg(pci, i)].val.bval), FALSE); if (b == NULL) { ret = createException(MAL, "mal.propertyCheck", RUNTIME_OBJECT_MISSING); @@ -803,15 +804,15 @@ str runMALsequence(Client cntxt, MalBlkP if (isaBatType(getArgType(mb, pci, i))) { bat bid = stk->stk[a].val.bval; - if (i < pci->retc && backup[i].val.bval) { + if
MonetDB: Oct2014 - Use correct type (bat) and use const.
Changeset: ede862bdc2bd for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=ede862bdc2bd Modified Files: clients/Tests/exports.stable.out monetdb5/modules/kernel/algebra.c monetdb5/modules/kernel/algebra.h monetdb5/modules/kernel/bat5.c monetdb5/modules/kernel/bat5.h monetdb5/modules/kernel/batcolor.c monetdb5/modules/kernel/batcolor.h monetdb5/modules/mal/cluster.c monetdb5/modules/mal/cluster.h monetdb5/modules/mal/tokenizer.c Branch: Oct2014 Log Message: Use correct type (bat) and use const. diffs (truncated from 3139 to 300 lines): diff --git a/clients/Tests/exports.stable.out b/clients/Tests/exports.stable.out --- a/clients/Tests/exports.stable.out +++ b/clients/Tests/exports.stable.out @@ -717,113 +717,113 @@ str ALARMsleep(int *res, int *secs); str ALARMtime(int *res); str ALARMtimers(int *res); str ALARMusec(lng *ret); -str ALGantijoin(int *result, int *lid, int *rid); -str ALGantijoin2(int *l, int *r, int *lid, int *rid); -str ALGavg(dbl *res, int *bid); -str ALGbandjoin(int *result, int *lid, int *rid, const void *minus, const void *plus, bit *li, bit *hi); -str ALGbandjoin2(int *l, int *r, int *lid, int *rid, const void *minus, const void *plus, bit *li, bit *hi); -str ALGbandjoin_default(int *result, int *lid, int *rid, const void *minus, const void *plus); -str ALGcard(lng *result, int *bid); -str ALGcopy(int *result, int *bid); -str ALGcount_bat(wrd *result, int *bid); -str ALGcount_nil(wrd *result, int *bid, bit *ignore_nils); -str ALGcount_no_nil(wrd *result, int *bid); -str ALGcross(int *result, int *lid, int *rid); -str ALGcrossproduct2(int *l, int *r, int *lid, int *rid); -str ALGexist(bit *ret, int *bid, ptr val); -str ALGfetch(ptr ret, int *bid, lng *pos); -str ALGfetchint(int *ret, int *bid, int *pos); -str ALGfetchoid(int *ret, int *bid, oid *pos); -str ALGfind(ptr ret, int *bid, ptr val); +str ALGantijoin(bat *result, const bat *lid, const bat *rid); +str ALGantijoin2(bat *l, bat *r, const bat *lid, const bat *rid); +str ALGavg(dbl *res, const bat *bid); +str ALGbandjoin(bat *result, const bat *lid, const bat *rid, const void *minus, const void *plus, const bit *li, const bit *hi); +str ALGbandjoin2(bat *l, bat *r, const bat *lid, const bat *rid, const void *minus, const void *plus, const bit *li, const bit *hi); +str ALGbandjoin_default(bat *result, const bat *lid, const bat *rid, const void *minus, const void *plus); +str ALGcard(lng *result, const bat *bid); +str ALGcopy(bat *result, const bat *bid); +str ALGcount_bat(wrd *result, const bat *bid); +str ALGcount_nil(wrd *result, const bat *bid, const bit *ignore_nils); +str ALGcount_no_nil(wrd *result, const bat *bid); +str ALGcross(bat *result, const bat *lid, const bat *rid); +str ALGcrossproduct2(bat *l, bat *r, const bat *lid, const bat *rid); +str ALGexist(bit *ret, const bat *bid, ptr val); +str ALGfetch(ptr ret, const bat *bid, const lng *pos); +str ALGfetchint(ptr ret, const bat *bid, const int *pos); +str ALGfetchoid(ptr ret, const bat *bid, const oid *pos); +str ALGfind(ptr ret, const bat *bid, ptr val); str ALGfirstn(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci); -str ALGgroupby(int *res, int *gids, int *cnts); -str ALGhmarkp(int *result, int *bid, int *nr_parts, int *part_nr); -str ALGhsort(int *result, int *bid); -str ALGhsort_rev(int *result, int *bid); -str ALGhtsort(int *result, int *lid); -str ALGidentity(int *ret, int *bid); -str ALGindexjoin(int *result, int *lid, int *rid); -str ALGjoin(int *result, int *lid, int *rid); -str ALGjoin2(int *l, int *r, int *lid, int *rid); +str ALGgroupby(bat *res, const bat *gids, const bat *cnts); +str ALGhmarkp(bat *result, const bat *bid, const int *nr_parts, const int *part_nr); +str ALGhsort(bat *result, const bat *bid); +str ALGhsort_rev(bat *result, const bat *bid); +str ALGhtsort(bat *result, const bat *lid); +str ALGidentity(bat *ret, const bat *bid); +str ALGindexjoin(bat *result, const bat *lid, const bat *rid); +str ALGjoin(bat *result, const bat *lid, const bat *rid); +str ALGjoin2(bat *l, bat *r, const bat *lid, const bat *rid); str ALGjoinPath(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci); BAT *ALGjoinPathBody(Client cntxt, int top, BAT **joins, int flag); -str ALGjoinestimate(int *result, int *lid, int *rid, lng *estimate); -str ALGkdiff(int *result, int *lid, int *rid); -str ALGkunion(int *result, int *lid, int *rid); -str ALGleftfetchjoin(int *result, int *lid, int *rid); -str ALGleftjoin(int *result, int *lid, int *rid); -str ALGleftjoinestimate(int *result, int *lid, int *rid, lng *estimate); -str ALGlike(int *ret, int *bid, str *k); -str ALGmarkHead(int *result, int *bid, oid *base); -str ALGmarkHead_default(int *result, int *bid); -str ALGmark_grp_1(int *result, int *bid, int *gid); -str ALGmark_grp_2(int *result, int *bid, int *gid, oid *base); -str ALGmaxany(ptr result, int *bid); -str ALGminany(ptr result, int *bid); -st
MonetDB: Oct2014 - Introduce getArgReference_{bte,bit,sht,...} t...
Changeset: c473cd5ffa76 for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=c473cd5ffa76 Modified Files: geom/monetdb5/geom.c monetdb5/extras/mal_optimizer_template/opt_sql_append.c monetdb5/extras/rapi/rapi.c monetdb5/mal/mal_dataflow.c monetdb5/mal/mal_debugger.c monetdb5/mal/mal_factory.c monetdb5/mal/mal_interpreter.c monetdb5/mal/mal_interpreter.h monetdb5/mal/mal_profiler.c monetdb5/mal/mal_recycle.c monetdb5/mal/mal_runtime.c monetdb5/modules/atoms/batxml.c monetdb5/modules/atoms/json.c monetdb5/modules/atoms/xml.c monetdb5/modules/kernel/algebra.c monetdb5/modules/kernel/status.c monetdb5/modules/mal/batExtensions.c monetdb5/modules/mal/batcalc.c monetdb5/modules/mal/bbp.c monetdb5/modules/mal/calc.c monetdb5/modules/mal/clients.c monetdb5/modules/mal/cluster.c monetdb5/modules/mal/factories.c monetdb5/modules/mal/groupby.c monetdb5/modules/mal/inspect.c monetdb5/modules/mal/iterator.c monetdb5/modules/mal/joinpath.c monetdb5/modules/mal/language.c monetdb5/modules/mal/mal_io.c monetdb5/modules/mal/mal_mapi.c monetdb5/modules/mal/manifold.c monetdb5/modules/mal/manual.c monetdb5/modules/mal/mat.c monetdb5/modules/mal/mdb.c monetdb5/modules/mal/mkey.c monetdb5/modules/mal/profiler.c monetdb5/modules/mal/querylog.c monetdb5/modules/mal/recycle.c monetdb5/modules/mal/remote.c monetdb5/modules/mal/sysmon.c monetdb5/modules/mal/tokenizer.c monetdb5/modules/mal/trader.c monetdb5/modules/mal/transaction.c monetdb5/optimizer/opt_centipede.c monetdb5/optimizer/opt_octopus.c monetdb5/optimizer/opt_wrapper.c monetdb5/optimizer/optimizer.c monetdb5/scheduler/run_adder.c monetdb5/scheduler/run_memo.c monetdb5/scheduler/run_octopus.c monetdb5/scheduler/srvpool.c sql/backends/monet5/LSST/lsst.c sql/backends/monet5/bam/bam_export.c sql/backends/monet5/bam/bam_loader.c sql/backends/monet5/datacell/basket.c sql/backends/monet5/datacell/datacell.c sql/backends/monet5/datacell/petrinet.c sql/backends/monet5/generator/generator.c sql/backends/monet5/sql.c sql/backends/monet5/sql_cast.c sql/backends/monet5/sql_rdf.c sql/backends/monet5/sql_scenario.c sql/backends/monet5/sql_statistics.c sql/backends/monet5/sql_user.c sql/backends/monet5/vaults/fits.c sql/backends/monet5/vaults/mseed.c sql/backends/monet5/vaults/vault.c Branch: Oct2014 Log Message: Introduce getArgReference_{bte,bit,sht,...} to make sure we use correct types. Most of the calls to getArgReference have been replaced by type-specific calls like getArgReference_int and also getArgReference_TYPE which has an extra TYPE parameter at the end. These macros do three things: - they return a properly typed value (so no extra casting should be needed); - there is no switch involved to get a pointer to the correct field in the union (i.e. it should be slightly faster); - on GCC with assertions enabled, they cause an assertion error if the expected type (as encoded in the macro name) and the actual argument's type don't match. Using this, a whole bunch of errors were corrected, e.g. where int was used when the argument was bit (really bad!) or where int was used where the argument was bat (not really good either). diffs (truncated from 6186 to 300 lines): diff --git a/geom/monetdb5/geom.c b/geom/monetdb5/geom.c --- a/geom/monetdb5/geom.c +++ b/geom/monetdb5/geom.c @@ -80,7 +80,7 @@ geom_export wkb *geos2wkb(GEOSGeom geosG geom_export str wkbgetcoordX(double *out, wkb **geom); geom_export str wkbgetcoordY(double *out, wkb **geom); geom_export str wkbcreatepoint(wkb **out, dbl *x, dbl *y); -geom_export str wkbcreatepoint_bat(int *out, int *x, int *y); +geom_export str wkbcreatepoint_bat(int *out, bat *x, bat *y); geom_export str mbroverlaps(bit *out, mbr **b1, mbr **b2); geom_export str wkbDimension(int *out, wkb **geom); geom_export str wkbGeometryTypeId(int *out, wkb **geom); @@ -768,7 +768,7 @@ wkbcreatepoint(wkb **out, dbl *x, dbl *y } str -wkbcreatepoint_bat(int *out, int *ix, int *iy) +wkbcreatepoint_bat(int *out, bat *ix, bat *iy) { BAT *bo = NULL, *bx = NULL, *by = NULL; dbl *x = NULL, *y = NULL; diff --git a/monetdb5/extras/mal_optimizer_template/opt_sql_append.c b/monetdb5/extras/mal_optimizer_template/opt_sql_append.c --- a/monetdb5/extras/mal_optimizer_template/opt_sql_append.c +++ b/monetdb5/extras/mal_optimizer_template/opt_sql_append.c @@ -281,8 +281,8 @@ str OPTsql_append(Client cntxt, MalBlkPt throw(MAL, "optimizer.sql_append", ILLARG_CONSTANTS);
MonetDB: default - Merge with Oct2014 branch.
Changeset: 732d15fd5323 for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=732d15fd5323 Modified Files: clients/Tests/MAL-signatures_all.stable.out clients/Tests/MAL-signatures_fits_geom.stable.out clients/Tests/MAL-signatures_geom.stable.out clients/Tests/MAL-signatures_none.stable.out clients/Tests/exports.stable.out gdk/gdk.h gdk/gdk_batop.c gdk/gdk_bbp.c gdk/gdk_value.c geom/monetdb5/geom.c monetdb5/extras/mal_optimizer_template/opt_sql_append.c monetdb5/extras/rapi/rapi.c monetdb5/mal/mal.c monetdb5/mal/mal_builder.c monetdb5/mal/mal_dataflow.c monetdb5/mal/mal_debugger.c monetdb5/mal/mal_factory.c monetdb5/mal/mal_instruction.c monetdb5/mal/mal_interpreter.c monetdb5/mal/mal_interpreter.h monetdb5/mal/mal_profiler.c monetdb5/mal/mal_recycle.c monetdb5/mal/mal_runtime.c monetdb5/modules/atoms/batxml.c monetdb5/modules/atoms/json.c monetdb5/modules/atoms/xml.c monetdb5/modules/kernel/algebra.c monetdb5/modules/kernel/algebra.h monetdb5/modules/kernel/bat5.c monetdb5/modules/kernel/bat5.h monetdb5/modules/kernel/batcolor.c monetdb5/modules/kernel/batcolor.h monetdb5/modules/kernel/status.c monetdb5/modules/mal/batExtensions.c monetdb5/modules/mal/batcalc.c monetdb5/modules/mal/bbp.c monetdb5/modules/mal/calc.c monetdb5/modules/mal/clients.c monetdb5/modules/mal/cluster.c monetdb5/modules/mal/cluster.h monetdb5/modules/mal/factories.c monetdb5/modules/mal/groupby.c monetdb5/modules/mal/inspect.c monetdb5/modules/mal/iterator.c monetdb5/modules/mal/joinpath.c monetdb5/modules/mal/language.c monetdb5/modules/mal/mal_io.c monetdb5/modules/mal/mal_mapi.c monetdb5/modules/mal/manifold.c monetdb5/modules/mal/manual.c monetdb5/modules/mal/mat.c monetdb5/modules/mal/mdb.c monetdb5/modules/mal/mkey.c monetdb5/modules/mal/profiler.c monetdb5/modules/mal/querylog.c monetdb5/modules/mal/recycle.c monetdb5/modules/mal/remote.c monetdb5/modules/mal/sample.c monetdb5/modules/mal/sample.h monetdb5/modules/mal/sample.mal monetdb5/modules/mal/sysmon.c monetdb5/modules/mal/tokenizer.c monetdb5/modules/mal/trader.c monetdb5/modules/mal/transaction.c monetdb5/optimizer/opt_centipede.c monetdb5/optimizer/opt_octopus.c monetdb5/optimizer/opt_wrapper.c monetdb5/optimizer/optimizer.c monetdb5/scheduler/run_adder.c monetdb5/scheduler/run_memo.c monetdb5/scheduler/run_octopus.c monetdb5/scheduler/srvpool.c monetdb5/tests/BugReports/Tests/no.016.mal monetdb5/tests/BugReports/Tests/no.016.stable.out sql/backends/monet5/LSST/lsst.c sql/backends/monet5/bam/bam_export.c sql/backends/monet5/bam/bam_loader.c sql/backends/monet5/datacell/basket.c sql/backends/monet5/datacell/datacell.c sql/backends/monet5/datacell/petrinet.c sql/backends/monet5/generator/generator.c sql/backends/monet5/sql.c sql/backends/monet5/sql_cast.c sql/backends/monet5/sql_rdf.c sql/backends/monet5/sql_scenario.c sql/backends/monet5/sql_statistics.c sql/backends/monet5/sql_user.c sql/backends/monet5/vaults/fits.c sql/backends/monet5/vaults/mseed.c sql/backends/monet5/vaults/vault.c Branch: default Log Message: Merge with Oct2014 branch. diffs (truncated from 9741 to 300 lines): diff --git a/clients/Tests/MAL-signatures_all.stable.out b/clients/Tests/MAL-signatures_all.stable.out --- a/clients/Tests/MAL-signatures_all.stable.out +++ b/clients/Tests/MAL-signatures_all.stable.out @@ -41204,15 +41204,11 @@ pattern recycle.setCache(clines:int):voi address RECYCLEsetCache; comment Set recycler cache line parameter -command sample.subuniform(b:bat[:oid,:any],s:wrd):bat[:oid,:oid] -address SAMPLEuniform; -comment Returns the oids of a uniform sample of size s - -command sample.uniform(b:bat[:oid,:any],p:dbl):bat[:oid,:oid] +command sample.subuniform(b:bat[:oid,:any],p:dbl):bat[:oid,:oid] address SAMPLEuniform_dbl; comment Returns the oids of a uniform sample of size = (p x count(b)), where 0 <= p <= 1.0 -command sample.uniform(b:bat[:oid,:any],s:wrd):bat[:oid,:oid] +command sample.subuniform(b:bat[:oid,:any],s:wrd):bat[:oid,:oid] address SAMPLEuniform; comment Returns the oids of a uniform sample of size s diff --git a/clients/Tests/MAL-signatures_fits_geom.stable.out b/clients/Tests/MAL-signatures_fits_geom.stable.out --- a/clients/Tests/MAL-signatures_fits_geom.stable.out +++ b/clients/Tests/MAL-signatures_fits_geom.stable.
MonetDB: default - Added getArgReference_hge.
Changeset: a0ecfa1b848e for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=a0ecfa1b848e Modified Files: monetdb5/mal/mal_interpreter.h Branch: default Log Message: Added getArgReference_hge. diffs (28 lines): diff --git a/monetdb5/mal/mal_interpreter.h b/monetdb5/mal/mal_interpreter.h --- a/monetdb5/mal/mal_interpreter.h +++ b/monetdb5/mal/mal_interpreter.h @@ -128,6 +128,14 @@ mal_export ptr getArgReference(MalStkPtr assert(v->vtype == TYPE_lng); \ &v->val.lval; \ }) +#ifdef HAVE_HGE +#define getArgReference_hge(s, pci, k) \ + ({ \ + ValRecord *v = &(s)->stk[(pci)->argv[k]]; \ + assert(v->vtype == TYPE_hge); \ + &v->val.hval; \ + }) +#endif #define getArgReference_str(s, pci, k) \ ({ \ ValRecord *v = &(s)->stk[(pci)->argv[k]]; \ @@ -147,6 +155,9 @@ mal_export ptr getArgReference(MalStkPtr #define getArgReference_flt(s, pci, k) (&(s)->stk[(pci)->argv[k]].val.fval) #define getArgReference_dbl(s, pci, k) (&(s)->stk[(pci)->argv[k]].val.dval) #define getArgReference_lng(s, pci, k) (&(s)->stk[(pci)->argv[k]].val.lval) +#ifdef HAVE_HGE +#define getArgReference_hge(s, pci, k) (&(s)->stk[(pci)->argv[k]].val.hval) +#endif #define getArgReference_str(s, pci, k) (&(s)->stk[(pci)->argv[k]].val.sval) #endif ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: geo - Kosti's PDBS algorithm added
Changeset: d001c325af71 for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=d001c325af71 Modified Files: geom/monetdb5/geom.h geom/monetdb5/geomPoints.c Branch: geo Log Message: Kosti's PDBS algorithm added diffs (truncated from 363 to 300 lines): diff --git a/geom/monetdb5/geom.h b/geom/monetdb5/geom.h --- a/geom/monetdb5/geom.h +++ b/geom/monetdb5/geom.h @@ -270,6 +270,7 @@ geom_export str wkbPointsDistance1_geom_ geom_export str wkbPointsDistance2_geom_bat(bat* outBAT_id, wkb** geomWKB, bat* xBAT_id, bat* yBAT_id, int* srid); geom_export str wkbFilterWithImprints_geom_bat(bat*, wkb**, bat*, bat*); +geom_export str wkbFilterWithPBSM_geom_bat(bat*, wkb**, bat*, bat*); geom_export int isLeft( double P0x, double P0y, double P1x, double P1y, double P2x, double P2y); diff --git a/geom/monetdb5/geomPoints.c b/geom/monetdb5/geomPoints.c --- a/geom/monetdb5/geomPoints.c +++ b/geom/monetdb5/geomPoints.c @@ -23,6 +23,15 @@ #include "geom.h" #include "time.h" +typedef struct pbsm_ptr { + BUN offset; + unsigned long count; +} pbsm_ptr; + +static pbsm_ptr *pbsm_idx = NULL; +static oid *oids = NULL; + + //it gets two BATs with x,y coordinates and returns a new BAT with the points static BAT* BATMakePoint2D(BAT* xBAT, BAT* yBAT) { BAT *outBAT = NULL; @@ -993,4 +1002,332 @@ str wkbFilterWithImprints_geom_bat(bat* } +/* PBSM */ +static char * +PBSMcreateindex (const dbl *x, const dbl *y, BUN n, double minx, double maxx, double miny, double maxy) { + FILE *f; + BAT *pbsm; +sht *cells; + unsigned long i; + int shift = sizeof(sht) * 8 / 2; +sht prevCell, cell; +unsigned long m = 0, prevO; + clock_t t = clock(); + + assert (pbsm_idx == NULL && oids == NULL); + + if ((pbsm_idx = GDKmalloc(USHRT_MAX * sizeof(pbsm_ptr))) == NULL) + throw(MAL, "pbsm.createindex", MAL_MALLOC_FAIL); + + for (i = 0; i < USHRT_MAX; i++) { + pbsm_idx[i].count = 0; + pbsm_idx[i].offset = 0; + } + + /* have we precomputed the grid? */ + if ((f = fopen("20m-pbsm16.idx", "rb"))) { + if (fread(pbsm_idx, sizeof(pbsm_idx[0]), USHRT_MAX, f) != USHRT_MAX) { + fclose(f); + GDKfree(pbsm_idx); + throw(MAL, "batpbsm.contains16", "Could not read the PBSM index from disk (source: 20m-pbsm16.idx)"); + } + fclose(f); + + if ((oids = GDKmalloc(n * sizeof(oid))) == NULL) { + GDKfree(pbsm_idx); + throw(MAL, "pbsm.createindex", MAL_MALLOC_FAIL); + } + + if ((f = fopen("20m-pbsm16.dat", "rb"))) { + if (fread(oids, sizeof(oids[0]), n, f) != n) { + fclose(f); + GDKfree(pbsm_idx); + GDKfree(oids); + throw(MAL, "batpbsm.contains16", "Could not read the PBSM index from disk (source: 20m-pbsm16.dat)"); + } + + fclose(f); + + t = clock() - t; + fprintf(stderr, "[PBSM] Index loading: %d clicks - %f seconds\n", (unsigned int)t, ((float)t)/CLOCKS_PER_SEC); + + return MAL_SUCCEED; + } else { + GDKfree(pbsm_idx); + GDKfree(oids); + throw(MAL, "batpbsm.contains16", "Could not read the PBSM index (.dat)."); + } + } + + /* No. Let's compute the grid! */ + // version 1 + if((pbsm = BATnew(TYPE_void, TYPE_sht, n, TRANSIENT)) == NULL) + throw(MAL, "pbsm.createindex", MAL_MALLOC_FAIL); + cells = (sht*) Tloc(pbsm, BUNfirst(pbsm)); + + // version 1: calculate the pbsm values + for (i = 0; i < n; i++) { + unsigned char cellx = ((x[i] - minx)/(maxx - minx))*UCHAR_MAX; +unsigned char celly = ((y[i] - miny)/(maxy - miny))*UCHAR_MAX; + cells[i] = unsigned short) cellx) << shift)) | ((unsigned short) celly); + } + + // version 1: order the BAT according to the cell values + /* set some properties */ + BATsetcount(pbsm,n); + BATseqbase(pbsm, 0); + pbsm->hsorted = 1; + pbsm->hrevsorted = (BATcount(pbsm) <= 1); + pbsm->tsorted = 0; + pbsm->trevsorted = 0; + pbsm->hdense = true; + pbsm->tdense = false; + BATmaterialize(pbsm); + //BATderiveProps(pbsm, false); + //BATassertProps(pbsm); + pbsm = BATorder(BATmirror(pbsm)); + //BATprint(pbsm); + + // version 1: compress the head +cells = (sht*) Hloc(pbsm, BUNfirst(pbsm)); + oids = (oid*) Tloc(pbsm, BUNfirst(pbsm)); + +prevCell = cells[0]; +cell = cells[0]
MonetDB: geo - Kosti's pbsm implementation
Changeset: 3c54dfe29fd4 for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=3c54dfe29fd4 Modified Files: geom/monetdb5/geom.h geom/monetdb5/geomPoints.c Branch: geo Log Message: Kosti's pbsm implementation diffs (truncated from 363 to 300 lines): diff --git a/geom/monetdb5/geom.h b/geom/monetdb5/geom.h --- a/geom/monetdb5/geom.h +++ b/geom/monetdb5/geom.h @@ -270,6 +270,7 @@ geom_export str wkbPointsDistance1_geom_ geom_export str wkbPointsDistance2_geom_bat(bat* outBAT_id, wkb** geomWKB, bat* xBAT_id, bat* yBAT_id, int* srid); geom_export str wkbFilterWithImprints_geom_bat(bat*, wkb**, bat*, bat*); +geom_export str wkbFilterWithPBSM_geom_bat(bat*, wkb**, bat*, bat*); geom_export int isLeft( double P0x, double P0y, double P1x, double P1y, double P2x, double P2y); diff --git a/geom/monetdb5/geomPoints.c b/geom/monetdb5/geomPoints.c --- a/geom/monetdb5/geomPoints.c +++ b/geom/monetdb5/geomPoints.c @@ -23,6 +23,15 @@ #include "geom.h" #include "time.h" +typedef struct pbsm_ptr { + BUN offset; + unsigned long count; +} pbsm_ptr; + +static pbsm_ptr *pbsm_idx = NULL; +static oid *oids = NULL; + + //it gets two BATs with x,y coordinates and returns a new BAT with the points static BAT* BATMakePoint2D(BAT* xBAT, BAT* yBAT) { BAT *outBAT = NULL; @@ -993,4 +1002,332 @@ str wkbFilterWithImprints_geom_bat(bat* } +/* PBSM */ +static char * +PBSMcreateindex (const dbl *x, const dbl *y, BUN n, double minx, double maxx, double miny, double maxy) { + FILE *f; + BAT *pbsm; +sht *cells; + unsigned long i; + int shift = sizeof(sht) * 8 / 2; +sht prevCell, cell; +unsigned long m = 0, prevO; + clock_t t = clock(); + + assert (pbsm_idx == NULL && oids == NULL); + + if ((pbsm_idx = GDKmalloc(USHRT_MAX * sizeof(pbsm_ptr))) == NULL) + throw(MAL, "pbsm.createindex", MAL_MALLOC_FAIL); + + for (i = 0; i < USHRT_MAX; i++) { + pbsm_idx[i].count = 0; + pbsm_idx[i].offset = 0; + } + + /* have we precomputed the grid? */ + if ((f = fopen("20m-pbsm16.idx", "rb"))) { + if (fread(pbsm_idx, sizeof(pbsm_idx[0]), USHRT_MAX, f) != USHRT_MAX) { + fclose(f); + GDKfree(pbsm_idx); + throw(MAL, "batpbsm.contains16", "Could not read the PBSM index from disk (source: 20m-pbsm16.idx)"); + } + fclose(f); + + if ((oids = GDKmalloc(n * sizeof(oid))) == NULL) { + GDKfree(pbsm_idx); + throw(MAL, "pbsm.createindex", MAL_MALLOC_FAIL); + } + + if ((f = fopen("20m-pbsm16.dat", "rb"))) { + if (fread(oids, sizeof(oids[0]), n, f) != n) { + fclose(f); + GDKfree(pbsm_idx); + GDKfree(oids); + throw(MAL, "batpbsm.contains16", "Could not read the PBSM index from disk (source: 20m-pbsm16.dat)"); + } + + fclose(f); + + t = clock() - t; + fprintf(stderr, "[PBSM] Index loading: %d clicks - %f seconds\n", (unsigned int)t, ((float)t)/CLOCKS_PER_SEC); + + return MAL_SUCCEED; + } else { + GDKfree(pbsm_idx); + GDKfree(oids); + throw(MAL, "batpbsm.contains16", "Could not read the PBSM index (.dat)."); + } + } + + /* No. Let's compute the grid! */ + // version 1 + if((pbsm = BATnew(TYPE_void, TYPE_sht, n, TRANSIENT)) == NULL) + throw(MAL, "pbsm.createindex", MAL_MALLOC_FAIL); + cells = (sht*) Tloc(pbsm, BUNfirst(pbsm)); + + // version 1: calculate the pbsm values + for (i = 0; i < n; i++) { + unsigned char cellx = ((x[i] - minx)/(maxx - minx))*UCHAR_MAX; +unsigned char celly = ((y[i] - miny)/(maxy - miny))*UCHAR_MAX; + cells[i] = unsigned short) cellx) << shift)) | ((unsigned short) celly); + } + + // version 1: order the BAT according to the cell values + /* set some properties */ + BATsetcount(pbsm,n); + BATseqbase(pbsm, 0); + pbsm->hsorted = 1; + pbsm->hrevsorted = (BATcount(pbsm) <= 1); + pbsm->tsorted = 0; + pbsm->trevsorted = 0; + pbsm->hdense = true; + pbsm->tdense = false; + BATmaterialize(pbsm); + //BATderiveProps(pbsm, false); + //BATassertProps(pbsm); + pbsm = BATorder(BATmirror(pbsm)); + //BATprint(pbsm); + + // version 1: compress the head +cells = (sht*) Hloc(pbsm, BUNfirst(pbsm)); + oids = (oid*) Tloc(pbsm, BUNfirst(pbsm)); + +prevCell = cells[0]; +cell = cells[0];
MonetDB: geo - merged
Changeset: c0bbb25698d7 for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=c0bbb25698d7 Branch: geo Log Message: merged ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: HTM - Remove duplicated SQLcommit
Changeset: f4f44e5444b0 for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=f4f44e5444b0 Modified Files: sql/backends/monet5/sql.c Branch: HTM Log Message: Remove duplicated SQLcommit diffs (32 lines): diff --git a/sql/backends/monet5/sql.c b/sql/backends/monet5/sql.c --- a/sql/backends/monet5/sql.c +++ b/sql/backends/monet5/sql.c @@ -368,28 +368,6 @@ SQLpersistcommit(Client cntxt, MalBlkPtr } str -SQLcommit(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci) -{ - int ret; - mvc *sql = NULL; - str msg; - (void) stk; - (void) pci; - - if ((msg = getSQLContext(cntxt, mb, &sql, NULL)) != NULL) - return msg; - if ((msg = checkSQLContext(cntxt)) != NULL) - return msg; - - if (sql->session->auto_commit != 0) - throw(SQL, "sql.trans", "2DM30!COMMIT: not allowed in auto commit mode"); - ret = mvc_commit(sql, 0, 0); - if (ret < 0) - throw(SQL, "sql.trans", "2D000!COMMIT: failed"); - return msg; -} - -str SQLshutdown_wrap(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci) { str answ = *(str *) getArgReference(stk, pci, 0); ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: HTM - Add boilerplate SQLprecommit and SQLpersistcommit
Changeset: 84cd96121c42 for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=84cd96121c42 Modified Files: sql/backends/monet5/sql.c sql/backends/monet5/sql.h sql/backends/monet5/sql.mal Branch: HTM Log Message: Add boilerplate SQLprecommit and SQLpersistcommit - Add MAL reference and export - Add boilerplate function definition diffs (72 lines): diff --git a/sql/backends/monet5/sql.c b/sql/backends/monet5/sql.c --- a/sql/backends/monet5/sql.c +++ b/sql/backends/monet5/sql.c @@ -356,6 +356,40 @@ SQLabort(Client cntxt, MalBlkPtr mb, Mal } str +SQLprecommit(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci) +{ + return MAL_SUCCEED; +} + +str +SQLpersistcommit(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci) +{ + return MAL_SUCCEED; +} + +str +SQLcommit(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci) +{ + int ret; + mvc *sql = NULL; + str msg; + (void) stk; + (void) pci; + + if ((msg = getSQLContext(cntxt, mb, &sql, NULL)) != NULL) + return msg; + if ((msg = checkSQLContext(cntxt)) != NULL) + return msg; + + if (sql->session->auto_commit != 0) + throw(SQL, "sql.trans", "2DM30!COMMIT: not allowed in auto commit mode"); + ret = mvc_commit(sql, 0, 0); + if (ret < 0) + throw(SQL, "sql.trans", "2D000!COMMIT: failed"); + return msg; +} + +str SQLshutdown_wrap(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci) { str answ = *(str *) getArgReference(stk, pci, 0); diff --git a/sql/backends/monet5/sql.h b/sql/backends/monet5/sql.h --- a/sql/backends/monet5/sql.h +++ b/sql/backends/monet5/sql.h @@ -81,6 +81,8 @@ sql5_export str SQLmvc(Client cntxt, Mal sql5_export str SQLtransaction(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci); sql5_export str SQLcommit(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci); sql5_export str SQLabort(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci); +sql5_export str SQLprecommit(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr p); +sql5_export str SQLpersistcommit(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr p); sql5_export str SQLshutdown_wrap(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci); sql5_export str SQLtransaction2(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci); sql5_export str SQLcatalog(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci); diff --git a/sql/backends/monet5/sql.mal b/sql/backends/monet5/sql.mal --- a/sql/backends/monet5/sql.mal +++ b/sql/backends/monet5/sql.mal @@ -66,6 +66,12 @@ pattern abort() address SQLabort comment "Trigger the abort operation for a MAL block"; +address SQLprecommit() +comment "Pre-commit changes, writing them only to the WAL."; +pattern persistcommit(c:any...) +address SQLpersistcommit() +comment "Persists per-commited changes, writing them to certain BATs."; + pattern catalog(type:int,sname:str,name:str,action:int):void address SQLcatalog comment "a catalog statement"; ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: HTM - Split pull mvc_commit_prepare and mvc_commit_fini...
Changeset: b3db30cb03cc for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=b3db30cb03cc Modified Files: sql/backends/monet5/sql.c sql/server/sql_mvc.c sql/server/sql_mvc.h Branch: HTM Log Message: Split pull mvc_commit_prepare and mvc_commit_finish out of mvc commit Add mvc_precommit and mvc_persistcommit Wire mvc_precommit to SQLprecommit diffs (185 lines): diff --git a/sql/backends/monet5/sql.c b/sql/backends/monet5/sql.c --- a/sql/backends/monet5/sql.c +++ b/sql/backends/monet5/sql.c @@ -358,12 +358,34 @@ SQLabort(Client cntxt, MalBlkPtr mb, Mal str SQLprecommit(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci) { + mvc *sql = NULL; + str msg; + sql_trans *tr = NULL; + (void) stk; + (void) pci; + + if ((msg = getSQLContext(cntxt, mb, &sql, NULL)) != NULL) + return msg; + if ((msg = checkSQLContext(cntxt)) != NULL) + return msg; + + if (sql->session->auto_commit != 0) + throw(SQL, "sql.trans", "2DM30!COMMIT: not allowed in auto commit mode"); + tr = mvc_precommit(sql, 0, 0); + + if (tr == NULL) { + throw(SQL, "sql.trans", "2D000!COMMIT: failed"); + } return MAL_SUCCEED; } str SQLpersistcommit(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci) { + (void) cntxt; + (void) mb; + (void) stk; + (void) pci; return MAL_SUCCEED; } diff --git a/sql/server/sql_mvc.c b/sql/server/sql_mvc.c --- a/sql/server/sql_mvc.c +++ b/sql/server/sql_mvc.c @@ -192,16 +192,15 @@ mvc_trans(mvc *m) } int -mvc_commit(mvc *m, int chain, char *name) -{ - sql_trans *cur, *tr = m->session->tr; +mvc_commit_prepare(mvc *m, int chain, char *name, sql_trans *tr) { + sql_trans *cur = m->session->tr; int ok = SQL_OK;//, wait = 0; assert(tr); assert(m->session->active); /* only commit an active transaction */ if (mvc_debug) - fprintf(stderr, "#mvc_commit %s\n", (name) ? name : ""); + fprintf(stderr, "#mvc_commit_prepare %s\n", (name) ? name : ""); if (m->session->status < 0) { (void)sql_error(m, 010, "4!COMMIT: transaction is aborted, will ROLLBACK instead"); @@ -223,7 +222,7 @@ build up the hash (not copied in the tra qc_clean(m->qc); m->session->schema = find_sql_schema(m->session->tr, m->session->schema_name); if (mvc_debug) - fprintf(stderr, "#mvc_commit %s done\n", name); + fprintf(stderr, "#mvc_commit_prepare %s done\n", name); return 0; } @@ -247,7 +246,7 @@ build up the hash (not copied in the tra sql_trans_end(m->session); m->type = Q_TRANS; if (mvc_debug) - fprintf(stderr, "#mvc_commit %s done\n", (name) ? name : ""); + fprintf(stderr, "#mvc_commit_prepare %s done\n", (name) ? name : ""); store_unlock(); return 0; } @@ -265,8 +264,32 @@ build up the hash (not copied in the tra store_lock(); } * */ - /* validation phase */ + return ok; +} + +void +mvc_commit_finish(mvc *m, int chain, char *name) { + sql_trans_end(m->session); + if (chain) + sql_trans_begin(m->session); + store_unlock(); + m->type = Q_TRANS; + if (mvc_debug) + fprintf(stderr, "#mvc_commit_finish %s done\n", (name) ? name : ""); +} + +int +mvc_commit(mvc *m, int chain, char *name) +{ + sql_trans *tr = m->session->tr; + int ok = SQL_OK;//, wait = 0; + + if ((ok = mvc_commit_prepare(m, chain, name, tr)) != SQL_OK) { + return 0; + } + if (sql_trans_validate(tr)) { + /* execute commit */ if ((ok = sql_trans_commit(tr)) != SQL_OK) { char *msg = sql_message("4!COMMIT: transaction commit failed (perhaps your disk is full?) exiting (kernel error: %s)", GDKerrbuf); GDKfatal("%s", msg); @@ -278,13 +301,49 @@ build up the hash (not copied in the tra mvc_rollback(m, chain, name); return -1; } - sql_trans_end(m->session); - if (chain) - sql_trans_begin(m->session); - store_unlock(); - m->type = Q_TRANS; - if (mvc_debug) - fprintf(stderr, "#mvc_commit %s done\n", (name) ? name : ""); + + mvc_commit_finish(m, chain, name); + + return ok; +} + +sql_trans * +mvc_precommit(mvc *m, int chain, char *name) { + sql_trans *tr = m->session->tr; + int ok = SQL_OK;//, wait = 0; + + if ((ok = mvc_commit_prepare(m, chain, name, tr)) != SQL_OK) { + return 0; + } + + if (sql_trans_validate(tr)) { +
MonetDB: HTM - Merge with default branch
Changeset: fe1c6c81cd22 for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=fe1c6c81cd22 Modified Files: clients/Tests/MAL-signatures_all.stable.out clients/Tests/MAL-signatures_fits_geom.stable.out clients/Tests/MAL-signatures_geom.stable.out clients/Tests/MAL-signatures_none.stable.out clients/Tests/exports.stable.out gdk/gdk.h gdk/gdk_batop.c gdk/gdk_bbp.c gdk/gdk_value.c geom/monetdb5/geom.c monetdb5/extras/mal_optimizer_template/opt_sql_append.c monetdb5/extras/rapi/rapi.c monetdb5/mal/mal.c monetdb5/mal/mal_builder.c monetdb5/mal/mal_dataflow.c monetdb5/mal/mal_debugger.c monetdb5/mal/mal_factory.c monetdb5/mal/mal_instruction.c monetdb5/mal/mal_interpreter.c monetdb5/mal/mal_interpreter.h monetdb5/mal/mal_profiler.c monetdb5/mal/mal_recycle.c monetdb5/mal/mal_runtime.c monetdb5/modules/atoms/batxml.c monetdb5/modules/atoms/json.c monetdb5/modules/atoms/xml.c monetdb5/modules/kernel/algebra.c monetdb5/modules/kernel/algebra.h monetdb5/modules/kernel/bat5.c monetdb5/modules/kernel/bat5.h monetdb5/modules/kernel/batcolor.c monetdb5/modules/kernel/batcolor.h monetdb5/modules/kernel/status.c monetdb5/modules/mal/batExtensions.c monetdb5/modules/mal/batcalc.c monetdb5/modules/mal/bbp.c monetdb5/modules/mal/calc.c monetdb5/modules/mal/clients.c monetdb5/modules/mal/cluster.c monetdb5/modules/mal/cluster.h monetdb5/modules/mal/factories.c monetdb5/modules/mal/groupby.c monetdb5/modules/mal/inspect.c monetdb5/modules/mal/iterator.c monetdb5/modules/mal/joinpath.c monetdb5/modules/mal/language.c monetdb5/modules/mal/mal_io.c monetdb5/modules/mal/mal_mapi.c monetdb5/modules/mal/manifold.c monetdb5/modules/mal/manual.c monetdb5/modules/mal/mat.c monetdb5/modules/mal/mdb.c monetdb5/modules/mal/mkey.c monetdb5/modules/mal/profiler.c monetdb5/modules/mal/querylog.c monetdb5/modules/mal/recycle.c monetdb5/modules/mal/remote.c monetdb5/modules/mal/sample.c monetdb5/modules/mal/sample.h monetdb5/modules/mal/sample.mal monetdb5/modules/mal/sysmon.c monetdb5/modules/mal/tokenizer.c monetdb5/modules/mal/trader.c monetdb5/modules/mal/transaction.c monetdb5/optimizer/opt_centipede.c monetdb5/optimizer/opt_octopus.c monetdb5/optimizer/opt_wrapper.c monetdb5/optimizer/optimizer.c monetdb5/scheduler/run_adder.c monetdb5/scheduler/run_memo.c monetdb5/scheduler/run_octopus.c monetdb5/scheduler/srvpool.c monetdb5/tests/BugReports/Tests/no.016.mal monetdb5/tests/BugReports/Tests/no.016.stable.out sql/backends/monet5/LSST/lsst.c sql/backends/monet5/bam/bam_export.c sql/backends/monet5/bam/bam_loader.c sql/backends/monet5/datacell/basket.c sql/backends/monet5/datacell/datacell.c sql/backends/monet5/datacell/petrinet.c sql/backends/monet5/generator/generator.c sql/backends/monet5/sql.c sql/backends/monet5/sql_cast.c sql/backends/monet5/sql_rdf.c sql/backends/monet5/sql_scenario.c sql/backends/monet5/sql_statistics.c sql/backends/monet5/sql_user.c sql/backends/monet5/vaults/fits.c sql/backends/monet5/vaults/mseed.c sql/backends/monet5/vaults/vault.c Branch: HTM Log Message: Merge with default branch diffs (truncated from 9752 to 300 lines): diff --git a/clients/Tests/MAL-signatures_all.stable.out b/clients/Tests/MAL-signatures_all.stable.out --- a/clients/Tests/MAL-signatures_all.stable.out +++ b/clients/Tests/MAL-signatures_all.stable.out @@ -41204,15 +41204,11 @@ pattern recycle.setCache(clines:int):voi address RECYCLEsetCache; comment Set recycler cache line parameter -command sample.subuniform(b:bat[:oid,:any],s:wrd):bat[:oid,:oid] -address SAMPLEuniform; -comment Returns the oids of a uniform sample of size s - -command sample.uniform(b:bat[:oid,:any],p:dbl):bat[:oid,:oid] +command sample.subuniform(b:bat[:oid,:any],p:dbl):bat[:oid,:oid] address SAMPLEuniform_dbl; comment Returns the oids of a uniform sample of size = (p x count(b)), where 0 <= p <= 1.0 -command sample.uniform(b:bat[:oid,:any],s:wrd):bat[:oid,:oid] +command sample.subuniform(b:bat[:oid,:any],s:wrd):bat[:oid,:oid] address SAMPLEuniform; comment Returns the oids of a uniform sample of size s diff --git a/clients/Tests/MAL-signatures_fits_geom.stable.out b/clients/Tests/MAL-signatures_fits_geom.stable.out --- a/clients/Tests/MAL-signatures_fits_geom.stable.out +++ b/clients/Tests/MAL-signatures_fits_geom.stable.out @
MonetDB: Oct2014 - Once we logged enough 'updates', we try to fl...
Changeset: a5743f049052 for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=a5743f049052 Modified Files: sql/storage/store.c Branch: Oct2014 Log Message: Once we logged enough 'updates', we try to flush the log as quickly as possible (ie check for silent moment (no active transactions) every 50 msec). In the old scheme we tried to flush only every 30seconds, but the change for 'no active transactions' is then to small. diffs (21 lines): diff --git a/sql/storage/store.c b/sql/storage/store.c --- a/sql/storage/store.c +++ b/sql/storage/store.c @@ -1581,11 +1581,15 @@ store_manager(void) return; } MT_lock_set(&bs_lock, "store_manager"); - if (store_nr_active || GDKexiting() || - logger_funcs.changes() < 1000) { + if (GDKexiting() || logger_funcs.changes() < 1000) { MT_lock_unset(&bs_lock, "store_manager"); continue; } + while (store_nr_active) { /* find a moment to flush */ + MT_lock_unset(&bs_lock, "store_manager"); + MT_sleep_ms(50); + MT_lock_set(&bs_lock, "store_manager"); + } logging = 1; /* make sure we reset all transactions on re-activation */ gtrans->wstime = timestamp(); ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: geo - PBSM works (single thread)
Changeset: b2621951a42f for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=b2621951a42f Modified Files: geom/monetdb5/geom.h geom/monetdb5/geom.mal geom/monetdb5/geomPoints.c Branch: geo Log Message: PBSM works (single thread) diffs (248 lines): diff --git a/geom/monetdb5/geom.h b/geom/monetdb5/geom.h --- a/geom/monetdb5/geom.h +++ b/geom/monetdb5/geom.h @@ -271,6 +271,8 @@ geom_export str wkbPointsDistance2_geom_ geom_export str wkbFilterWithImprints_geom_bat(bat*, wkb**, bat*, bat*); geom_export str wkbFilterWithPBSM_geom_bat(bat*, wkb**, bat*, bat*); +geom_export str wkbFilterWithImprints_geom_bat(bat*, wkb**, bat*, bat*); +geom_export str wkbFilterWithImprintsAndPBSM_geom_bat(bat*, wkb**, bat*, bat*); geom_export int isLeft( double P0x, double P0y, double P1x, double P1y, double P2x, double P2y); diff --git a/geom/monetdb5/geom.mal b/geom/monetdb5/geom.mal --- a/geom/monetdb5/geom.mal +++ b/geom/monetdb5/geom.mal @@ -463,8 +463,10 @@ command Contains2(g:wkb, x:bat[:oid,:dbl command Filter(a:wkb, b:bat[:oid,:wkb]) :bat[:oid,:wkb] address wkbFilter_geom_bat comment "Filters the points in the bats according to the MBR of the other bat."; command Filter(a:bat[:oid,:wkb], b:wkb) :bat[:oid,:wkb] address wkbFilter_bat_geom; -command Filter(geom:wkb, x:bat[:oid,:dbl], y:bat[:oid,:dbl]) :bat[:oid,:oid] address wkbFilterWithImprints_geom_bat +command Filter1(geom:wkb, x:bat[:oid,:dbl], y:bat[:oid,:dbl]) :bat[:oid,:oid] address wkbFilterWithImprints_geom_bat comment "Filters x,y coordinates in the BATs using imprints"; +command Filter(geom:wkb, x:bat[:oid,:dbl], y:bat[:oid,:dbl]) :bat[:oid,:oid] address wkbFilterWithPBSM_geom_bat +comment "Filters x,y coordinates in the BATs using PBSM"; #command point(x:bat[:oid,:dbl],y:bat[:oid,:dbl]) :bat[:oid,:wkb] #address wkbcreatepoint_bat diff --git a/geom/monetdb5/geomPoints.c b/geom/monetdb5/geomPoints.c --- a/geom/monetdb5/geomPoints.c +++ b/geom/monetdb5/geomPoints.c @@ -1157,23 +1157,27 @@ PBSMcreateindex (const dbl *x, const dbl return MAL_SUCCEED; } -static char * -PBSMarraycontains16(BAT **bres, const dbl *x, BAT *batx, const dbl *y, BAT *baty, mbr *mbb, BUN n, double minx, double maxx, double miny, double maxy) { +static BAT* +PBSMarraycontains16(const dbl *x, BAT *batx, const dbl *y, BAT *baty, mbr *mbb, BUN n, double minx, double maxx, double miny, double maxy) { unsigned long csize = 0, u; oid *candidates; unsigned char mbrcellxmin, mbrcellxmax, mbrcellymin, mbrcellymax, k,l; int shift = sizeof(sht) * 8 / 2; unsigned long i; - str msg; + BAT* bres = NULL; /* assert calling sanity */ -assert(*bres != NULL && x != NULL && y != NULL && batx != NULL && baty != NULL); +assert(x != NULL && y != NULL && batx != NULL && baty != NULL); /* read the pbsm index to memory */ if (pbsm_idx == NULL || oids == NULL) { + str err; /* the index has not been materialized/loaded yet */ - if ((msg = PBSMcreateindex(x, y, n, minx, maxx, miny, maxy)) != MAL_SUCCEED) - return msg; + if ((err = PBSMcreateindex(x, y, n, minx, maxx, miny, maxy)) != MAL_SUCCEED) { + GDKerror("PBSMarraycontains16: %s", err); + GDKfree(err); + return NULL; + } } /* generate a pbsm value from the geometry */ @@ -1192,8 +1196,10 @@ PBSMarraycontains16(BAT **bres, const db } /* get candidate oid from the pbsm index */ - if ((candidates = GDKmalloc(csize * sizeof(oid))) == NULL) - throw(MAL, "batpbsm.contains16", MAL_MALLOC_FAIL); + if ((candidates = GDKmalloc(csize * sizeof(oid))) == NULL) { + GDKerror("PBSMarraycontains16: Problem allocating space"); + return NULL; + } i = 0; for (k = mbrcellxmin; k <= mbrcellxmax; k++) { for (l = mbrcellymin; l <= mbrcellymax; l++) { @@ -1209,64 +1215,66 @@ PBSMarraycontains16(BAT **bres, const db } } + +//it creates the bres bat twice. In this function and the one that calls it assert(BAThdense(batx) && BAThdense(baty)); - if ((*bres = BATnew(TYPE_void, TYPE_oid, csize, TRANSIENT)) == NULL) { - throw(MAL, "batpbsm.contains16", MAL_MALLOC_FAIL); + if ((bres = BATnew(TYPE_void, TYPE_oid, csize, TRANSIENT)) == NULL) { + GDKerror("PBSMarraycontains16: Could not create new BAT for the output"); + return NULL; } + BATseqbase(bres, batx->hseqbase); //the results BAT is aligned with the x and y BATs for (i = 0; i < csize; i++) { oid *o = &(candidates[i]); - BUNfastins(*bres, NULL, o); + BUNfastins(bres, NULL, o); } /* candidates are exp
MonetDB: Oct2014 - fixed bug in delta cleanup code
Changeset: 658fb5fde582 for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=658fb5fde582 Modified Files: sql/storage/bat/bat_storage.c Branch: Oct2014 Log Message: fixed bug in delta cleanup code diffs (30 lines): diff --git a/sql/storage/bat/bat_storage.c b/sql/storage/bat/bat_storage.c --- a/sql/storage/bat/bat_storage.c +++ b/sql/storage/bat/bat_storage.c @@ -1767,7 +1767,7 @@ update_table(sql_trans *tr, sql_table *f p = b; b = b->next; } - if (b && b->wtime > oldest->stime && p) { + if (b && b->wtime <= oldest->stime && p) { p->next = NULL; destroy_dbat(tr, b); } @@ -1792,7 +1792,7 @@ update_table(sql_trans *tr, sql_table *f p = b; b = b->next; } - if (b && b->wtime > oldest->stime && p) { + if (b && b->wtime <= oldest->stime && p) { p->next = NULL; destroy_bat(tr, b); } @@ -1842,7 +1842,7 @@ update_table(sql_trans *tr, sql_table *f p = b; b = b->next; } - if (b && b->wtime > oldest->stime && p) { + if (b && b->wtime <= oldest->stime && p) { p->next = NULL; destroy_bat(tr, b); } ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list