Changeset: cc83777f77d9 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=cc83777f77d9
Modified Files:
        MonetDB5/src/optimizer/opt_mitosis.mx
        MonetDB5/src/optimizer/optimizer.mx
Branch: Jun2010
Log Message:

back-ported eligibility test of mitosis for primary key checks from default


diffs (57 lines):

diff -r 138abbed9155 -r cc83777f77d9 MonetDB5/src/optimizer/opt_mitosis.mx
--- a/MonetDB5/src/optimizer/opt_mitosis.mx     Mon Jun 14 15:41:05 2010 +0200
+++ b/MonetDB5/src/optimizer/opt_mitosis.mx     Tue Jun 15 06:58:11 2010 +0200
@@ -66,6 +66,21 @@
 /* #define _DEBUG_OPT_MITOSIS*/
 #define PARTITION_THRESHOLD (BUN) GDKnr_threads        /* should be increased 
in production version */
 
+static int eligible(MalBlkPtr mb )
+{
+       InstrPtr p;
+       int i;
+       for (i=1; i< mb->stop; i++){
+               p = getInstrPtr(mb,i);
+               if ( getModuleId(p) == sqlRef && getFunctionId(p) == assertRef 
&&
+                       p->argc > 2 && getArgType(mb,p,2) == TYPE_str &&
+                       getVarConstant(mb, getArg(p,2)).val.sval != NULL &&
+                       strstr(getVarConstant(mb, getArg(p,2)).val.sval, 
"PRIMARY KEY constraint") )
+               return 0;
+       }
+       return 1;
+}
+
 static int
 OPTmitosisImplementation(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr p)
 {
@@ -80,6 +95,8 @@
 
        (void)cntxt;
        (void) stk;
+       if ( !eligible(mb))
+               return 0;
        
        /* locate the largest non-partitioned table */
        for (i=1; i< mb->stop; i++){
diff -r 138abbed9155 -r cc83777f77d9 MonetDB5/src/optimizer/optimizer.mx
--- a/MonetDB5/src/optimizer/optimizer.mx       Mon Jun 14 15:41:05 2010 +0200
+++ b/MonetDB5/src/optimizer/optimizer.mx       Tue Jun 15 06:58:11 2010 +0200
@@ -229,8 +229,8 @@
        str nme, fcn,msg=MAL_SUCCEED;
 
        (void)stk;
-       nme= getConstant(mb, getArg(p,1)).val.sval;
-       fcn= getConstant(mb, getArg(p,2)).val.sval;
+       nme= getVarConstant(mb, getArg(p,1)).val.sval;
+       fcn= getVarConstant(mb, getArg(p,2)).val.sval;
 #ifdef DEBUG_OPT_MACRO
        printf("@1optimizer: %s.%s\n",nme,fcn);
 #endif
@@ -265,7 +265,7 @@
        (void) cntxt;
        (void) stk; 
        removeInstruction(mb,p);
-       fcn= getConstant(mb, getArg(p,1)).val.sval;
+       fcn= getVarConstant(mb, getArg(p,1)).val.sval;
        s= findModule(cntxt->nspace, putName(fcn,strlen(fcn)));
 #ifdef DEBUG_OPT_MACRO
        printf("@1optimizer: %s\n",fcn);
_______________________________________________
Checkin-list mailing list
Checkin-list@monetdb.org
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to