Changeset: 371dc0ceb65c for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=371dc0ceb65c
Removed Files:
monetdb5/modules/mal/trader.c
monetdb5/modules/mal/trader.h
monetdb5/modules/mal/trader.mal
monetdb5/optimizer/Tests/octopus00.mal
monetdb5/optimizer/Tests/octopus01.mal
monetdb5/optimizer/opt_octopus.c
monetdb5/optimizer/opt_octopus.h
monetdb5/scheduler/run_octopus.c
monetdb5/scheduler/run_octopus.h
monetdb5/scheduler/run_octopus.mal
sql/backends/monet5/sql_octopus.mal
sql/scripts/octopus.sql
sql/test/octopus/Tests/All
sql/test/octopus/Tests/lhminit.sql
sql/test/octopus/Tests/lhmquery00.sql
sql/test/octopus/Tests/lhmviews00.sql
sql/test/octopus/Tests/squid.sql
sql/test/octopus/Tests/squid.stable.err
sql/test/octopus/Tests/squid.stable.out
sql/test/octopus/Tests/squid00.sql
sql/test/octopus/Tests/squid00.stable.err
sql/test/octopus/Tests/squid00.stable.out
sql/test/octopus/Tests/squid01.sql
sql/test/octopus/Tests/squid01.stable.err
sql/test/octopus/Tests/squid01.stable.out
sql/test/octopus/Tests/squidtrace.mal
Modified Files:
clients/Tests/exports.stable.out
monetdb5/mal/mal_import.c
monetdb5/modules/mal/Makefile.ag
monetdb5/modules/mal/mal_init.mal
monetdb5/optimizer/Makefile.ag
monetdb5/optimizer/Tests/dataflow3.stable.out
monetdb5/optimizer/opt_mitosis.c
monetdb5/optimizer/opt_pipes.c
monetdb5/optimizer/opt_prelude.c
monetdb5/optimizer/opt_prelude.h
monetdb5/optimizer/opt_reorder.c
monetdb5/optimizer/opt_support.c
monetdb5/optimizer/opt_support.h
monetdb5/optimizer/opt_wrapper.c
monetdb5/optimizer/optimizer.mal
monetdb5/scheduler/Makefile.ag
monetdb5/scheduler/srvpool.c
monetdb5/scheduler/srvpool.h
sql/backends/monet5/Makefile.ag
sql/scripts/Makefile.ag
Branch: default
Log Message:
Moving the octopus code to the attic
diffs (truncated from 14533 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
@@ -1673,13 +1673,6 @@ str MTIMEtzone_get_local(tzone *z);
str MTIMEtzone_set_local(void *res, const tzone *z);
str MTIMEtzone_tostr(str *s, const tzone *ret);
str MTIMEunix_epoch(timestamp *ret);
-str OCTOPUSbidding(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci);
-str OCTOPUSconnect(str *c, str *dbname);
-str OCTOPUSdiscoverRegister(Client cntxt, MalBlkPtr mb, MalStkPtr stk,
InstrPtr p);
-str OCTOPUSgetVersion(int *res);
-str OCTOPUSmakeSchedule(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr p);
-str OCTOPUSregister(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci);
-str OCTOPUSrun(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr p);
int OPTaccumulatorsImplementation(Client cntxt, MalBlkPtr mb, MalStkPtr stk,
InstrPtr pci);
void OPTaliasRemap(InstrPtr p, int *alias);
int OPTaliasesImplementation(Client cntxt, MalBlkPtr mb, MalStkPtr stk,
InstrPtr p);
@@ -1701,8 +1694,6 @@ int OPTinlineImplementation(Client cntxt
int OPTisAlias(InstrPtr p);
int OPTjoinPathImplementation(Client cntxt, MalBlkPtr mb, MalStkPtr stk,
InstrPtr p);
int OPTjsonImplementation(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr
pci);
-str OPTlegAdvice(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci);
-int OPTlegAdviceInternal(MalBlkPtr mb, MalStkPtr stk, InstrPtr pci);
str OPTmacro(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr p);
int OPTmacroImplementation(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr
p);
int OPTmatpackImplementation(Client cntxt, MalBlkPtr mb, MalStkPtr stk,
InstrPtr pci);
@@ -1710,7 +1701,6 @@ int OPTmergetableImplementation(Client c
int OPTmitosisImplementation(Client cntxt, MalBlkPtr mb, MalStkPtr stk,
InstrPtr p);
int OPTmultiplexImplementation(Client cntxt, MalBlkPtr mb, MalStkPtr stk,
InstrPtr pci);
str OPTmultiplexSimple(Client cntxt);
-int OPToctopusImplementation(Client cntxt, MalBlkPtr mb, MalStkPtr stk,
InstrPtr pci);
str OPTorcam(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr p);
int OPTorcamImplementation(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr
p);
int OPTpushrangesImplementation(Client cntxt, MalBlkPtr mb, MalStkPtr stk,
InstrPtr pci);
@@ -2007,8 +1997,6 @@ str TKNZRlocate(Client cntxt, MalBlkPtr
str TKNZRopen(void *r, str *name);
str TKNZRtakeOid(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci);
void TRACEtable(BAT **r);
-str TRADERmakeBid(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci);
-str TRADERmakeBids(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci);
str TRNglobal_abort(bit *ret);
str TRNglobal_commit(bit *ret);
str TRNglobal_sync(bit *ret);
@@ -2520,7 +2508,6 @@ str not_ilikeRef;
str not_likeRef;
str not_uniqueRef;
int notnilProp;
-str octopusRef;
str oidRef;
void oldmoveInstruction(InstrPtr dst, InstrPtr src);
str openProfilerStream(stream *fd);
diff --git a/monetdb5/mal/mal_import.c b/monetdb5/mal/mal_import.c
--- a/monetdb5/mal/mal_import.c
+++ b/monetdb5/mal/mal_import.c
@@ -94,7 +94,7 @@ malLoadScript(Client c, str name, bstrea
size_t sz;
fd = malOpenSource(name);
- if (mnstr_errnr(fd) == MNSTR_OPEN_ERROR) {
+ if (fd == 0 || mnstr_errnr(fd) == MNSTR_OPEN_ERROR) {
mnstr_destroy(fd);
throw(MAL, "malInclude", "could not open file: %s", name);
}
diff --git a/monetdb5/modules/mal/Makefile.ag b/monetdb5/modules/mal/Makefile.ag
--- a/monetdb5/modules/mal/Makefile.ag
+++ b/monetdb5/modules/mal/Makefile.ag
@@ -55,7 +55,6 @@ lib_mal = {
sysmon.c sysmon.h \
tablet.c tablet.h \
tokenizer.c tokenizer.h \
- trader.c trader.h \
transaction.c \
txtsim.c txtsim.h \
zorder.c zorder.h \
@@ -75,7 +74,7 @@ headers_mal = {
transaction.mal \
mal_mapi.mal sabaoth.mal remote.mal \
txtsim.mal recycle.mal \
- cluster.mal trader.mal \
+ cluster.mal \
tokenizer.mal zorder.mal sample.mal json_util.mal \
batmtime.mal querylog.mal sysmon.mal
}
@@ -97,7 +96,7 @@ headers_hge = {
EXTRA_DIST = batExtensions.mal iterator.mal \
groupby.mal mal_init.mal manual.mal mkey.mal manifold.mal pcre.mal \
- profiler.mal recycle.mal remote.mal sabaoth.mal trader.mal \
+ profiler.mal recycle.mal remote.mal sabaoth.mal \
transaction.mal txtsim.mal tablet.mal tablet.h sample.mal json_util.mal
\
mal_mapi.mal mat.mal tokenizer.mal \
batmtime.mal querylog.mal sysmon.mal \
diff --git a/monetdb5/modules/mal/mal_init.mal
b/monetdb5/modules/mal/mal_init.mal
--- a/monetdb5/modules/mal/mal_init.mal
+++ b/monetdb5/modules/mal/mal_init.mal
@@ -108,7 +108,6 @@ include zorder;
# scheduler components
include run_isolate;
include run_memo;
-include run_octopus;
include srvpool;
include mal_mapi;
diff --git a/monetdb5/modules/mal/trader.c b/monetdb5/modules/mal/trader.c
deleted file mode 100644
--- a/monetdb5/modules/mal/trader.c
+++ /dev/null
@@ -1,232 +0,0 @@
-/*
- * The contents of this file are subject to the MonetDB Public License
- * Version 1.1 (the "License"); you may not use this file except in
- * compliance with the License. You may obtain a copy of the License at
- * http://www.monetdb.org/Legal/MonetDBLicense
- *
- * Software distributed under the License is distributed on an "AS IS"
- * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
- * License for the specific language governing rights and limitations
- * under the License.
- *
- * The Original Code is the MonetDB Database System.
- *
- * The Initial Developer of the Original Code is CWI.
- * Portions created by CWI are Copyright (C) 1997-July 2008 CWI.
- * Copyright August 2008-2015 MonetDB B.V.
- * All Rights Reserved.
- */
-
-/*
- * @a M. Ivanova, M. Kersten
- * @f trader
- * @- This module contains primitives for bidding of (sub)-query execution
- * among mservers.
- *
- * trader.makeBid() is used to ask another server to make a bid for a mal
function (sub-query) execution.
- *
- * Currently the bid estimate is made using only the recycle cache.
- * ToDo: use the info about server load
- * FactFinder
- */
-#include "monetdb_config.h"
-#include <mal.h>
-#include <mal_exception.h>
-#include <mal_instruction.h>
-#include <mal_module.h>
-#include <mal_recycle.h>
-#include "trader.h"
-#include <time.h>
-
-/*
-static lng estimateSavings0(MalBlkPtr mb, sht bidtype)
-{
- (void) mb;
- (void) bidtype;
- return (lng)100;
-}
-*/
-
-static lng estimateSavings(MalBlkPtr mb, sht bidtype)
-{
- MalStkPtr stk = NULL;
- int i, j, k, marked = 0, maxparam = 0;
- ValPtr lhs, rhs;
- InstrPtr p, q;
- lng savedInstr = 0, savedKB = 0;
- static str octopusRef = 0, bindRef = 0, bindidxRef = 0;
-
- if (octopusRef == 0)
- octopusRef = putName("octopus",7);
- if (bindRef == 0)
- bindRef = putName("bind",4);
- if (bindidxRef == 0)
- bindidxRef = putName("bind_idxbat",11);
-
- if( recycleBlk == 0 )
- return 0;
-
- /* Create a phony exec. stack */
- stk = newGlobalStack(mb->vsize);
- stk->stktop = mb->vtop;
- stk->stkbot = 0;
- stk->blk = mb;
-
- /* Init symbol table of the phony stack */
- for(i= 0; i< mb->vtop; i++) {
- lhs = &stk->stk[i];
- if( isVarConstant(mb,i) > 0 ){
-/* assert(!isVarCleanup(mb,i)); */
- if( !isVarDisabled(mb,i)){
- rhs = &getVarConstant(mb,i);
- *lhs = *rhs;
- if (rhs->vtype == TYPE_str && rhs->val.sval !=
0)
- lhs->val.sval =
GDKstrdup(rhs->val.sval);
- }
- } else{
- lhs->vtype = getVarGDKType(mb,i);
- lhs->val.pval = 0;
- lhs->len = 0;
- }
- }
- maxparam = getArg(mb->stmt[0], mb->stmt[0]->argc - 1);
- /* don't compare function parameters */
-
- for (k = 0; k < mb->stop; k++){
- p = getInstrPtr(mb,k);
- if ( !RECYCLEinterest(p) )
- continue;
- marked++;
- if ( bidtype == BID_TRANS ) /* check only octopus.bind */
- if ( getModuleId(p) != octopusRef ||
- getFunctionId(p) != bindRef )
- continue;
-
- /* Match p against the recycle pool */
- for (i = 0; i < recycleBlk->stop; i++){
- q = getInstrPtr(recycleBlk,i);
-
- if ((getFunctionId(p) != getFunctionId(q)) ||
- (getModuleId(p) != getModuleId(q)))
- continue;
-
- if (p->argc < q->argc-1) continue;
- /* sub-range instructions can be subsumed from entire
table */
-
- else if (p->argc == q->argc-1) { /* check for exact
match */
-
- if ( bidtype == BID_TRANS ) j = p->retc + 1;
- else j = p->retc;
- for ( ; j < p->argc; j++){
- if (getArg(p,j) <= maxparam) continue;
- if (VALcmp(&stk->stk[getArg(p,j)],
&getVarConstant(recycleBlk,getArg(q,j))))
- goto nomatch;
- }
-
- /* found an exact match - get the results on
the stack */
- for( j=0; j<p->retc; j++){
- VALcopy(&stk->stk[getArg(p,j)],
-
&getVarConstant(recycleBlk,getArg(q,j)) );
- }
-
- if ( bidtype == BID_TRANS )
- savedKB += recycleBlk->stmt[i]->wbytes;
- else savedInstr++;
- break;
- }
- else { /* check for bind subsumption */
- int nr_part = 0;
- if ( bidtype != BID_TRANS )
- continue;
- for (j = p->retc + 1; j < 6; j++)
- if ( VALcmp(&stk->stk[getArg(p,j)],
- &getVarConstant(recycleBlk,
getArg(q,j))) )
- goto nomatch;
- nr_part = * (int*) getVarValue(mb, getArg(p,7));
- savedKB +=
nr_part?recycleBlk->stmt[i]->wbytes/nr_part : 0;
- }
-
- nomatch:
- continue;
- } /* end loop over RP */
- }
-
- /* clean up the phony stack */
- freeStack(stk);
-
- if ( bidtype == BID_TRANS )
- return savedKB;
- return (marked? (lng)100*savedInstr/marked: 0) ;
-}
-
-
-str TRADERmakeBid(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci)
-{
- lng *c = getArgReference_lng(stk,pci,0);
- str fnname = *getArgReference_str(stk,pci,1);
- sht bidtype = *getArgReference_sht(stk,pci,2);
- Symbol sym;
- static char fname[BUFSIZ] = "";
- static str biddingLog = NULL;
- stream *s;
- time_t now;
- struct tm *nowtm;
- char timestr[20];
-
- (void) mb;
- sym = findSymbol(cntxt->nspace, putName("octopus",7), fnname);
- if ( sym == NULL)
- throw(MAL,"trader.makeBid", RUNTIME_SIGNATURE_MISSING "%s", fnname);
-
- *c = estimateSavings(sym->def, bidtype);
-
- /* log bidding */
- if ( biddingLog == NULL) {
- sprintf(fname,"%s%cbidding.log", GDKgetenv("gdk_dbpath"),
DIR_SEP);
- biddingLog = fname;
- }
- s = append_wastream(biddingLog);
- if (s == NULL )
- throw(MAL,"trader.makeBid", RUNTIME_FILE_NOT_FOUND
"%s", biddingLog);
- if (mnstr_errnr(s)) {
- mnstr_close(s);
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list