Update of /cvsroot/monetdb/MonetDB5/src/optimizer
In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv13533

Modified Files:
        opt_recycler.mx opt_support.mx 
Log Message:
Prepare the recycler to zap the table when it encounters an update operation


Index: opt_recycler.mx
===================================================================
RCS file: /cvsroot/monetdb/MonetDB5/src/optimizer/opt_recycler.mx,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- opt_recycler.mx     18 Mar 2008 07:00:31 -0000      1.13
+++ opt_recycler.mx     19 Mar 2008 07:53:34 -0000      1.14
@@ -86,6 +86,11 @@
 Just looking at a kept result target is not good enough.
 You have to sure that the arguments are also the same.
 This outrules function arguments.
+
+The recycler is targeted towards a query only database.
+Any update statement invalidates the recycle cache at
+the end of the query. Moreover, it does not perform
+any cach lookup.
 @c
 #include "mal_config.h"
 #include "opt_recycler.h"
@@ -94,7 +99,7 @@
 static int
 OPTrecycleImplementation(MalBlkPtr mb, MalStkPtr stk, InstrPtr p)
 {
-       int i, j, cnt, actions=0;
+       int i, j, cnt, actions=0, update=0;
        Lifespan span = newLifespan(mb);
        InstrPtr *old, q;
        int limit;
@@ -111,6 +116,8 @@
        for (i = 1; i<limit; i++) {
                p = old[i];
                if (hasSideEffects(p,TRUE) || isUnsafeFunction(p)){
+                       if( isUpdateInstruction(p))
+                               update++;
                        pushInstruction(mb,p);
                        continue;
                }
@@ -159,11 +166,15 @@
                        p->argc=2;
                        p->recycle = 1;
                }
-               if( p->token== ENDsymbol)
+               if( p->token== ENDsymbol){
+                       if (update)
+                               q= newFcnCall(mb,"recycle","shutdown");
+
                        q= newFcnCall(mb,"recycle","epilogue");
+               }
                pushInstruction(mb,p);
        }
-       if (actions)
+       if (actions && update==0)
                mb->version = -1;       /* will trigger the recycler runtime 
support */
        GDKfree(span);
        GDKfree(old);

Index: opt_support.mx
===================================================================
RCS file: /cvsroot/monetdb/MonetDB5/src/optimizer/opt_support.mx,v
retrieving revision 1.64
retrieving revision 1.65
diff -u -d -r1.64 -r1.65
--- opt_support.mx      12 Mar 2008 12:41:31 -0000      1.64
+++ opt_support.mx      19 Mar 2008 07:53:34 -0000      1.65
@@ -526,6 +526,7 @@
 opt_export int isUpdated(MalBlkPtr mb, int pc);
 opt_export int hasCommonResults(InstrPtr p, InstrPtr q);
 opt_export int isProcedure(MalBlkPtr mb, InstrPtr p);
+opt_export int isUpdateInstruction(InstrPtr p);
 opt_export int hasSideEffects(InstrPtr p, int strict);
 opt_export int isSideEffectFree(MalBlkPtr mb);
 opt_export int isBlocking(InstrPtr p);
@@ -1080,15 +1081,9 @@
 }
 
 int
-hasSideEffects(InstrPtr p, int strict)
-{
-       if( getFunctionId(p) == NULL) return FALSE;
-
-       if ( getModuleId(p) == algebraRef &&
-                getFunctionId(p) == reuseRef)
-                       return TRUE;
+isUpdateInstruction(InstrPtr p){
        if ( getModuleId(p) == batRef &&
-              (getFunctionId(p) == insertRef ||
+          (getFunctionId(p) == insertRef ||
                getFunctionId(p) == inplaceRef ||
                getFunctionId(p) == appendRef ||
                getFunctionId(p) == updateRef ||
@@ -1097,6 +1092,18 @@
                getFunctionId(p) == replaceRef ||
                getFunctionId(p) == deleteRef))
                return TRUE;
+       return FALSE;
+}
+int
+hasSideEffects(InstrPtr p, int strict)
+{
+       if( getFunctionId(p) == NULL) return FALSE;
+
+       if ( getModuleId(p) == algebraRef &&
+                getFunctionId(p) == reuseRef)
+                       return TRUE;
+       if( isUpdateInstruction(p) )
+               return TRUE;
 
        if (getFunctionId(p) == depositRef) 
                return TRUE;


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Monetdb-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-checkins

Reply via email to