Changeset: d47c77656d44 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=d47c77656d44
Added Files:
        sql/test/BugTracker-2013/Tests/between.Bug-3259.sql
        sql/test/BugTracker-2013/Tests/between.Bug-3259.stable.err
        sql/test/BugTracker-2013/Tests/between.Bug-3259.stable.out
        sql/test/BugTracker-2013/Tests/between.Bug-3259.stable.out.single
        sql/test/BugTracker-2013/Tests/correlated_select.Bug-3250.sql
        sql/test/BugTracker-2013/Tests/correlated_select.Bug-3250.stable.err
        sql/test/BugTracker-2013/Tests/correlated_select.Bug-3250.stable.out
        sql/test/Tests/setoptimizer.stable.out.Windows
Modified Files:
        README
        monetdb5/mal/mal_client.h
        monetdb5/mal/mal_interpreter.c
        monetdb5/mal/mal_profiler.c
        monetdb5/mal/mal_properties.c
        monetdb5/mal/mal_runtime.c
        monetdb5/mal/mal_stack.h
        monetdb5/modules/mal/clients.c
        monetdb5/modules/mal/clients.mal
        monetdb5/optimizer/Tests/tst4631.stable.out
        monetdb5/optimizer/opt_centipede.c
        monetdb5/optimizer/opt_dataflow.c
        monetdb5/optimizer/opt_wrapper.c
        sql/backends/monet5/sql_gencode.c
        sql/backends/monet5/sql_optimizer.c
        sql/backends/monet5/sql_scenario.c
        sql/server/rel_optimizer.c
        sql/server/rel_select.c
        
sql/test/BugTracker-2010/Tests/group-by_ordered_column.Bug-2564.stable.out.32bit
        
sql/test/BugTracker-2012/Tests/predicate_select.Bug-3090_nogeom.stable.out
        sql/test/BugTracker-2013/Tests/All
        
sql/test/BugTracker/Tests/cardinality_violation.SF-1240701.stable.err.Windows
        sql/test/BugTracker/Tests/jdbc_no_debug.SF-1739356.stable.out.32bit
        sql/test/Dump/Tests/dump.stable.out.Windows
        sql/test/Tests/systemfunctions_nogeom.stable.out
        sql/test/Tests/trace_nogeom.stable.out
        sql/test/leaks/Tests/check0_nogeom.stable.out
        sql/test/leaks/Tests/check1_nogeom.stable.out
        sql/test/leaks/Tests/check2_nogeom.stable.out
        sql/test/leaks/Tests/check3_nogeom.stable.out
        sql/test/leaks/Tests/check4_nogeom.stable.out
        sql/test/leaks/Tests/check5_nogeom.stable.out
        sql/test/leaks/Tests/drop3_nogeom.stable.out
        sql/test/leaks/Tests/select1_nogeom.stable.out
        sql/test/leaks/Tests/select2_nogeom.stable.out
        sql/test/leaks/Tests/temp1_nogeom.stable.out
        sql/test/leaks/Tests/temp2_nogeom.stable.out
        sql/test/leaks/Tests/temp3_nogeom.stable.out
        sql/test/mapi/Tests/php_monetdb_nogeom.stable.out
Branch: rdf
Log Message:

Merge with default branch


diffs (truncated from 2482 to 300 lines):

diff --git a/monetdb5/mal/mal_client.h b/monetdb5/mal/mal_client.h
--- a/monetdb5/mal/mal_client.h
+++ b/monetdb5/mal/mal_client.h
@@ -95,8 +95,8 @@ typedef struct CLIENT {
 #define footprintFlag  16
        time_t      login;  
        time_t      lastcmd;    /* set when input is received */
-       int         qtimeout;   /* query abort after x seconds */
-       int         stimeout;   /* session abort after x seconds */
+       lng         qtimeout;   /* query abort after x milliseconds */
+       lng             stimeout;       /* session abort after x milliseconds */
        /*
         * Communication channels for the interconnect are stored here.
         * It is perfectly legal to have a client without input stream.
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
@@ -380,7 +380,7 @@ str runMAL(Client cntxt, MalBlkPtr mb, M
        if (stk && stk != env) {
                GDKfree(stk);
        }
-       if (cntxt->qtimeout && time(NULL) - stk->clock.tv_usec > 
cntxt->qtimeout)
+       if (cntxt->qtimeout && GDKms() > cntxt->qtimeout)
                throw(MAL, "mal.interpreter", RUNTIME_QRY_TIMEOUT);
        return ret;
 }
@@ -471,7 +471,7 @@ callMAL(Client cntxt, MalBlkPtr mb, MalS
                throw(MAL, "mal.interpreter", RUNTIME_UNKNOWN_INSTRUCTION);
        }
        MT_sema_up(&mal_parallelism,"callMAL");
-       if (cntxt->qtimeout && time(NULL) - stk->clock.tv_usec > 
cntxt->qtimeout)
+       if (cntxt->qtimeout && GDKms() > cntxt->qtimeout)
                throw(MAL, "mal.interpreter", RUNTIME_QRY_TIMEOUT);
        return ret;
 }
@@ -544,7 +544,7 @@ str runMALsequence(Client cntxt, MalBlkP
 
                runtimeProfileBegin(cntxt, mb, stk, stkpc, &runtimeProfile, 1);
                if (pci->recycle > 0)
-                       stk->clk = GDKusec();
+                       stk->clk = GDKms();
                if (!RECYCLEentry(cntxt, mb, stk, pci)){
 /* The interpreter loop
  * The interpreter is geared towards execution a MAL procedure together
@@ -702,7 +702,7 @@ str runMALsequence(Client cntxt, MalBlkP
                                runtimeProfileFinish(cntxt, mb);
                                if (pcicaller && garbageControl(getInstrPtr(mb, 
0)))
                                        garbageCollector(cntxt, mb, stk, TRUE);
-                               if (cntxt->qtimeout && time(NULL) - 
stk->clock.tv_usec > cntxt->qtimeout){
+                               if (cntxt->qtimeout && GDKms() > 
cntxt->qtimeout){
                                        ret= createException(MAL, 
"mal.interpreter", RUNTIME_QRY_TIMEOUT);
                                        break;
                                }
@@ -717,7 +717,7 @@ str runMALsequence(Client cntxt, MalBlkP
                                w= instruction2str(mb, 0, pci, FALSE);
                                ret = createScriptException(mb, stkpc, MAL, 
NULL, "unkown operation:%s",w);
                                GDKfree(w);
-                               if (cntxt->qtimeout && time(NULL) - 
stk->clock.tv_usec > cntxt->qtimeout){
+                               if (cntxt->qtimeout && GDKms() > 
cntxt->qtimeout){
                                        ret= createException(MAL, 
"mal.interpreter", RUNTIME_QRY_TIMEOUT);
                                        break;
                                }
@@ -852,7 +852,7 @@ str runMALsequence(Client cntxt, MalBlkP
                                if (exceptionVar == -1) {
                                        runtimeProfileExit(cntxt, mb, stk, pci, 
&runtimeProfile);
                                        runtimeProfileFinish(cntxt, mb);
-                                       if (cntxt->qtimeout && time(NULL) - 
stk->clock.tv_usec > cntxt->qtimeout)
+                                       if (cntxt->qtimeout && GDKms() > 
cntxt->qtimeout)
                                                ret= createException(MAL, 
"mal.interpreter", RUNTIME_QRY_TIMEOUT);
                                        stkpc = mb->stop;
                                        continue;
@@ -899,7 +899,7 @@ str runMALsequence(Client cntxt, MalBlkP
                                        }
                                }
                                if (stkpc == mb->stop) {
-                                       if (cntxt->qtimeout && time(NULL) - 
stk->clock.tv_usec > cntxt->qtimeout){
+                                       if (cntxt->qtimeout && GDKms() > 
cntxt->qtimeout){
                                                ret= createException(MAL, 
"mal.interpreter", RUNTIME_QRY_TIMEOUT);
                                                stkpc = mb->stop;
                                        }
@@ -1122,7 +1122,7 @@ str runMALsequence(Client cntxt, MalBlkP
                default:
                        stkpc++;
                }
-               if (cntxt->qtimeout && time(NULL) - stk->clock.tv_usec > 
cntxt->qtimeout){
+               if (cntxt->qtimeout && GDKms() > cntxt->qtimeout){
                        ret= createException(MAL, "mal.interpreter", 
RUNTIME_QRY_TIMEOUT);
                        stkpc= mb->stop;
                }
diff --git a/monetdb5/mal/mal_profiler.c b/monetdb5/mal/mal_profiler.c
--- a/monetdb5/mal/mal_profiler.c
+++ b/monetdb5/mal/mal_profiler.c
@@ -1333,7 +1333,6 @@ void profilerHeartbeatEvent(str msg)
 #endif
        struct timeval tv;
        time_t clock;
-       //time_t prevclock=0;
 #ifdef HAVE_TIMES
        struct tms newTms;
        struct tms prevtimer;
@@ -1346,7 +1345,6 @@ void profilerHeartbeatEvent(str msg)
                getrusage(RUSAGE_SELF, &prevUsage);
 #endif
        gettimeofday(&tv,NULL);
-       //prevclock = (time_t) tv.tv_sec;
 
        /* without this cast, compilation on Windows fails with
         * argument of type "long *" is incompatible with parameter of type 
"const time_t={__time64_t={__int64}} *"
diff --git a/monetdb5/mal/mal_properties.c b/monetdb5/mal/mal_properties.c
--- a/monetdb5/mal/mal_properties.c
+++ b/monetdb5/mal/mal_properties.c
@@ -21,228 +21,6 @@
  * @f mal_properties
  * @a M. Kersten
  * @+ Property Management
- * Properties come in several classes, those linked with the symbol table and
- * those linked with the runtime environment. The former are determined
- * once upon parsing or catalog lookup. The runtime properties have two
- * major subclasses, i.e. reflective and prescriptive. The reflective 
properties
- * merely provide a fast cache to information aggregated from the target.
- * Prescriptive properties communicate desirable states, leaving it to other
- * system components to reach this state at the cheapest cost possible.
- * This multifacetted world makes it difficult to come up with a concise model
- * for dealing with properties. The approach taken here is an experimental step
- * into this direction.
- *
- * This @sc{mal_properties} module
- * provides a generic scheme to administer property sets and
- * a concise API to manage them.
- * Its design is geared towards support of MAL optimizers, which
- * typically make multiple passes over a program to derive an
- * alternative, better version. Such code-transformations are
- * aided by keeping track of derived information, e.g. the expected
- * size of a temporary result or the alignment property between BATs.
- *
- * Properties capture part of the state of the system in the form of an
- * simple term expression @sc{(name, operator, constant)}.
- * The property model assumes a namespace built around Identifiers.
- * The operator satisfy the syntax rules for MAL operators.
- * Conditional operators are quite common, e.g. the triple (count, <, 1000)
- * can be used to denote a small table.
- *
- * The property bearing objects in the MAL setting are
- * variables (symbol table entries).
- * The direct relationship between instructions and
- * a target variable, make it possible to keep the instruction properties
- * in the corresponding target variable.
- *
- * @emph{Variables properties}
- * The variables can be extended at any time with a property set.
- * Properties have a scope identical to the scope of the corresponding 
variable.
- * Ommision of the operator and value turns it into a boolean valued property,
- * whose default value is @sc{true}.
- * @verbatim
- *     b{count=1000,sorted}:= mymodule.action("table");
- *     name{aligngroup=312} := bbp.take("person_name");
- *     age{aligngroup=312} := bbp.take("person_age");
- * @end verbatim
- * The example illustrates a mechanism to maintain alignment information.
- * Such a property is helpful for optimizers to pick an efficient algorithm.
- *
- * @emph{MAL function signatures.}
- * A function signature contains a description of
- * the objects it is willing to accept and an indication of the
- * expected result. The arguments can be tagged with properties
- * that 'should be obeyed, or implied' by the actual arguments.
- * It extends the typing scheme used during compilation/optimization.
- * Likewise, the return values can be tagged with properties that 'at least'
- * exist upon function return.
- * @verbatim
- *     function test(b:bat[:oid,:int]{count<1000}):bat[:oid,:int]{sorted}
- *        #code block
- *     end test
- * @end verbatim
- *
- * These properties are informative to optimizers.
- * They can be enforced at runtime using the operation
- * @sc{optimizer.enforceRules()} which injects calls into
- * the program to check them.
- * An assertion error is raised if the property does not hold.
- * The code snippet
- * @verbatim
- *     z:= user.test(b);
- * @end verbatim
- * is translated into the following code block;
- * @verbatim
- *     mal.assert(b,"count","<",1000);
- *     z:= user.test(b);
- *     mal.assert(z,"sorted");
- * @end verbatim
- *
- * @emph{How to propagate properties?}
- * Property inspection and manipulation is strongly linked with the operators
- * of interest. Optimizers continuously inspect and update the properties, 
while
- * kernel operators should not be bothered with their existence.
- * Property propagation is strongly linked with the actual operator
- * implementation.  We examine a few recurring cases.
- *
- * V:=W; Both V and W should be type compatible, otherwise the compiler will
- * already complain.(Actually, it requires V.type()==W.type() and 
~V.isaConstant())
- * But what happens with all others? What is the property propagation rule for
- * the assignment? Several cases can be distinguished:
- *
- * I)   W has a property P, unknown to V.
- * II)  V has a propery P, unknown to W.
- * III) V has property P, and W has property Q, P and Q are incompatible.
- * IV)  V and W have a property P, but its value disaggrees.
- *
- * case I). If the variable V was not initialized, we can simply copy or share
- * the properties. Copying might be too expensive, while shareing leads
- * to managing the dependencies.
- * case II) It means that V is re-assigned a value, and depending on its type 
and
- * properties we may have to 'garbage collect/finalize' it first. 
Alternatively,
- * it could be interpreted as a property that will hold after assignment
- * which is not part of the right-hand side expression.
- * case III) if P and Q are type compatible, it means an update of the P value.
- * Otherwise, it should generates an exception.
- * case IV) this calls for an update of V.P using the value of W.P. How this
- * should be done is property specific.
- *
- * Overall, the policy would be to 'disgard' all knowledge from V first and
- * then copy the properties from W.
- *
- * [Try 1]
- * V:= fcn(A,B,C) and signature fcn(A:int,B:int,C:int):int
- * The signature provides several handles to attach properties.
- * Each formal parameter could come with a list of 'desirable/necessary'
- * properties. Likewise, the return values have a property set.
- * This leads to the extended signature
- * function fcn(A:T@{P1@},....,B:T@{Pn@}): (C:T@{Pk@}...D:T@{Pm@})
- * where each Pi denotes a property set.
- * Properties P1..Pn can be used to select the proper function variant.
- * At its worst, several signatures of fcn() should be inspected at
- * runtime to find one with matching properties. To enable analysis and
- * optimization, however, it should be clear that once the function is 
finished,
- * the properties Pk..Pm exist.
- *
- * [Try 2]
- * V:= fcn(A,B,C) and signature fcn(A:int,B:int,C:int):int
- * The function is applicable when a (simple conjuntive) predicate over
- * the properties of the actual arguments holds. A side-effect of execution
- * of the function leads to an update of the property set associated with
- * the actual arguments. An example:
- * @example
- * function fcn (A:int,B:bat[int,int],C:int):int
- *         ?@{A.read=true, B.count<1000@}
- *         @{fcn.write:=true;@}
- * @end example
- *
- * [Try 3] Organize property management by the processor involved, e.g.
- * a cost-based optimizer or a access control enforcer.
- * For each optimizer we should then specify the 'symbolic' effect of
- * execution of instructions of interest. This means 'duplication' of
- * the instruction set.
- *
- * Can you drop properties? It seems possible, but since property operations
- * occur before actual execution there is no guarantee that they actually
- * take place.
- *
- * [case: how to handle sort(b:bat@{P@}):bat@{+sorted@} as a means to 
propagate  ]
- * [actually we need an expression language to indicate the propety set,
- * e.g. sort(b:bat):bat@{sorted,+b@} which first obtains the properties of b 
and
- * extends it with sorted. A nested structure emerge
- *
- * Is it necessary to construct the property list intersection?
- * Or do we need a user defined function to consolidate property lists?
- * ]
- *
- * Aside, it may be valuable to collect information on e.g. the execution time
- * of functions as a basis for future optimizations. Rather than cluttering the
- * property section, it makes sense to explicitly update this information in
- * a catalog.
- * @+ Properties at the MAL level
- * Aside from routines targeted as changing the MAL blocks, it should
- * be possible to reason about the properties within the language itself.
- * This calls for gaining access and update.
- * For example, the following snippet shows how properties
- * are used in a code block.
- *
- * @example
- * B := bbp.new(int,int);
- * I := properties.has(B,@{hsorted@});
- * J := properties.get(B,@{cost@});
- * print(J);
- *
- * properties.set(B,@{cost@},2315);
- * barrier properties.has(B,@{sorted@});
- * exit;
- * @end example
- * @-
- * These example illustrate that the property manipulations are
- * executed throug patterns, which also accept a stack frame.
- *
- * Sample problem with dropping properties:
- * @example
- *     B := bbp.new(int,int);
- * barrier tst:= randomChoice()
- *     I := properties.drop(B,@{hsorted@});
- * exit        tst;
- * @end example
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to