You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafodion.apache.org by sa...@apache.org on 2015/10/27 05:38:28 UTC

[1/2] incubator-trafodion git commit: fix TRAFODION-1555

Repository: incubator-trafodion
Updated Branches:
  refs/heads/master d060bef04 -> 7cf4caa53


fix TRAFODION-1555


Project: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/commit/9937f92f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/tree/9937f92f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/diff/9937f92f

Branch: refs/heads/master
Commit: 9937f92f6d8c11849f661db84262977b4409a21c
Parents: a266807
Author: Qifan Chen <qf...@dev02.trafodion.org>
Authored: Fri Oct 23 17:34:43 2015 +0000
Committer: Qifan Chen <qf...@dev02.trafodion.org>
Committed: Fri Oct 23 17:34:43 2015 +0000

----------------------------------------------------------------------
 core/sql/optimizer/ScanOptimizer.cpp | 17 +++++++++++++++--
 core/sql/sqlcomp/DefaultConstants.h  |  3 +++
 core/sql/sqlcomp/nadefaults.cpp      |  1 +
 3 files changed, 19 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/9937f92f/core/sql/optimizer/ScanOptimizer.cpp
----------------------------------------------------------------------
diff --git a/core/sql/optimizer/ScanOptimizer.cpp b/core/sql/optimizer/ScanOptimizer.cpp
index e7e912c..65ec12a 100644
--- a/core/sql/optimizer/ScanOptimizer.cpp
+++ b/core/sql/optimizer/ScanOptimizer.cpp
@@ -89,6 +89,9 @@ THREAD_P NABoolean MdamTrace::okToRedirectStdOut_ = FALSE;
 THREAD_P FILE* MdamTrace::console_ = NULL;
 THREAD_P enum MdamTraceLevel MdamTrace::level_ = MDAM_TRACE_LEVEL_NONE;
 
+// use MTL3 to debug MDAM issues
+//THREAD_P enum MdamTraceLevel MdamTrace::level_ = MTL3;
+
 void MdamTrace::setHeader(const char *override)
 {
   overrideHeader_ = override;
@@ -8464,6 +8467,7 @@ void MDAMCostWA::compute()
 // 	  // invalidate the cache
 // 	  disjunctsFR_.reset();
 // 	  disjunctsLR_.reset();
+          MDAM_DEBUG0(MTL2, "Mdam scan lost because disjunctMdamOK_ is false");
 	  return;
 	}
 
@@ -8552,6 +8556,7 @@ void MDAMCostWA::compute()
 	    costBoundPtr_->scmCompareCosts(*scmCost_) == LESS)
         {
 	  mdamWon_ = FALSE;
+          MDAM_DEBUG0(MTL2, "Mdam scan lost due to higher cost determined by scmCompareCosts()");
           return;
 	}
       }
@@ -8590,6 +8595,7 @@ void MDAMCostWA::compute()
 // 	  // invalidate the cache
 // 	  disjunctsFR_.reset();
 // 	  disjunctsLR_.reset();
+          MDAM_DEBUG0(MTL2, "Mdam scan lost due to exceeding cost bound");
           return;
 	}
       }
@@ -8625,9 +8631,11 @@ void MDAMCostWA::computeDisjunct()
   if( NOT (allKeyPredicates) )
     noExePreds_ = FALSE;
 
+
   // return with a NULL cost if there are no key predicates
   // "costBoundPtr_ == NULL" means "MDAM is forced"
   if (disjunctKeyPreds.isEmpty() AND costBoundPtr_ != NULL) {
+    MDAM_DEBUG0(MTL2, "MDAMCostWA::computeDisjunct(): disjunctKeyPreds is empty"); 
     disjunctMdamOK_ = FALSE;
     return; // full table scan, MDAM is worthless here
   }
@@ -8693,8 +8701,10 @@ void MDAMCostWA::computeDisjunct()
 	     (currKeyColumn->getType() ==
 	      KeyColumns::KeyColumn::INLIST) );
       
-      if( NOT conflict ) // single subset should be chosen.
+      if( NOT conflict ) { // single subset should be chosen.
+        MDAM_DEBUG0(MTL2, "MDAMCostWA::computeDisjunct(): conflict predicate for single subset, force MDAM off"); 
 	mdamMakeSense = FALSE;
+      }
     }
   }
 
@@ -8703,11 +8713,14 @@ void MDAMCostWA::computeDisjunct()
   if(CURRSTMT_OPTDEFAULTS->indexEliminationLevel() != OptDefaults::MINIMUM
      && (!mdamForced_)
 	 && (CmpCommon::getDefault(RANGESPEC_TRANSFORMATION) == DF_ON )
+	 && (CmpCommon::getDefault(MDAM_APPLY_RESTRICTION_CHECK) == DF_ON )
 	 &&
    (!checkMDAMadditionalRestriction(keyPredsByCol,optimizer_.computeLastKeyColumnOfDisjunct(keyPredsByCol),noOfmissingKeyColumnsTot,presentKeyColumnsTot))
    )
   {
-  mdamMakeSense = FALSE;
+        
+    MDAM_DEBUG0(MTL2, "MDAMCostWA::computeDisjunct(): MDAM additional restriction check failed"); 
+    mdamMakeSense = FALSE;
   }
   disjunctMdamOK_ = mdamMakeSense;
 }

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/9937f92f/core/sql/sqlcomp/DefaultConstants.h
----------------------------------------------------------------------
diff --git a/core/sql/sqlcomp/DefaultConstants.h b/core/sql/sqlcomp/DefaultConstants.h
index c702b8f..e8eaa57 100644
--- a/core/sql/sqlcomp/DefaultConstants.h
+++ b/core/sql/sqlcomp/DefaultConstants.h
@@ -3767,6 +3767,9 @@ enum DefaultConstants
   HBASE_DELETE_COSTING,
   HBASE_UPDATE_COSTING,
 
+  // decide if to apply the additional restriction check (majority of keys with predicates)
+  MDAM_APPLY_RESTRICTION_CHECK,
+
   // This enum constant must be the LAST one in the list; it's a count,
   // not an Attribute (it's not IN DefaultDefaults; it's the SIZE of it)!
   __NUM_DEFAULT_ATTRIBUTES

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/9937f92f/core/sql/sqlcomp/nadefaults.cpp
----------------------------------------------------------------------
diff --git a/core/sql/sqlcomp/nadefaults.cpp b/core/sql/sqlcomp/nadefaults.cpp
index 9e23cfe..3f2f0b9 100644
--- a/core/sql/sqlcomp/nadefaults.cpp
+++ b/core/sql/sqlcomp/nadefaults.cpp
@@ -2156,6 +2156,7 @@ SDDkwd__(ISO_MAPPING,           (char *)SQLCHARSETSTRING_ISO88591),
   XDDflt__(MC_SKEW_SENSITIVITY_THRESHOLD,        "0.1"),
 
 
+  DDkwd__(MDAM_APPLY_RESTRICTION_CHECK,	"OFF"),
   DDflt0_(MDAM_CPUCOST_NET_OVH,			"2000."),
 
 


[2/2] incubator-trafodion git commit: Merge remote branch 'origin/pr/144/head' into merge_trafodion144

Posted by sa...@apache.org.
Merge remote branch 'origin/pr/144/head' into merge_trafodion144


Project: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/commit/7cf4caa5
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/tree/7cf4caa5
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/diff/7cf4caa5

Branch: refs/heads/master
Commit: 7cf4caa53e28247d628e378b26a4c32fb3fedc7a
Parents: d060bef 9937f92
Author: Sandhya Sundaresan <sa...@apache.org>
Authored: Tue Oct 27 04:38:05 2015 +0000
Committer: Sandhya Sundaresan <sa...@apache.org>
Committed: Tue Oct 27 04:38:05 2015 +0000

----------------------------------------------------------------------
 core/sql/optimizer/ScanOptimizer.cpp | 17 +++++++++++++++--
 core/sql/sqlcomp/DefaultConstants.h  |  3 +++
 core/sql/sqlcomp/nadefaults.cpp      |  1 +
 3 files changed, 19 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/7cf4caa5/core/sql/sqlcomp/DefaultConstants.h
----------------------------------------------------------------------
diff --cc core/sql/sqlcomp/DefaultConstants.h
index fe28164,e8eaa57..07f58d0
--- a/core/sql/sqlcomp/DefaultConstants.h
+++ b/core/sql/sqlcomp/DefaultConstants.h
@@@ -3766,8 -3766,10 +3766,11 @@@ enum DefaultConstant
    // costing code has broader exposure.
    HBASE_DELETE_COSTING,
    HBASE_UPDATE_COSTING,
 +  TRAF_LOAD_FLUSH_SIZE_IN_KB,
  
+   // decide if to apply the additional restriction check (majority of keys with predicates)
+   MDAM_APPLY_RESTRICTION_CHECK,
+ 
    // This enum constant must be the LAST one in the list; it's a count,
    // not an Attribute (it's not IN DefaultDefaults; it's the SIZE of it)!
    __NUM_DEFAULT_ATTRIBUTES

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/7cf4caa5/core/sql/sqlcomp/nadefaults.cpp
----------------------------------------------------------------------