You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafodion.apache.org by db...@apache.org on 2016/03/22 16:40:54 UTC

[2/3] incubator-trafodion git commit: Add comments to explain the use of stack variable to minimize impact on runtime code based optimization.

Add comments to explain the use of stack variable to minimize impact on runtime code based optimization.


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

Branch: refs/heads/master
Commit: 263b90ccd96eab24cb697d8cacc1b669f4ce225c
Parents: 96bcc40
Author: Eric Owhadi <er...@esgyn.com>
Authored: Mon Mar 21 18:06:47 2016 +0000
Committer: Eric Owhadi <er...@esgyn.com>
Committed: Mon Mar 21 18:06:47 2016 +0000

----------------------------------------------------------------------
 core/sql/executor/ExHbaseSelect.cpp | 9 +++++++++
 1 file changed, 9 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/263b90cc/core/sql/executor/ExHbaseSelect.cpp
----------------------------------------------------------------------
diff --git a/core/sql/executor/ExHbaseSelect.cpp b/core/sql/executor/ExHbaseSelect.cpp
index 04478f0..2bd904b 100644
--- a/core/sql/executor/ExHbaseSelect.cpp
+++ b/core/sql/executor/ExHbaseSelect.cpp
@@ -445,6 +445,15 @@ ExWorkProcRetcode ExHbaseScanSQTaskTcb::work(short &rc)
   rc = 0;
   Lng32 remainingInBatch = batchSize_;
   NABoolean isFirstBatch = false;
+  // isFirstInBatch is a stack variable for optimization reason. It is used for the mdam small scanner optimization heuristic that
+  // is performed at runtime. Since this function is invoke intensively for all scan (mdam or regular scan), minimizing CPU/memory access
+  // impact on runtime code to a strict minimum is attempted. Given that we are trying to detect if the actual scan is bellow the size
+  // of an HBase block, having the runtime logic performing the detection only affect the first work invoke looks like the right idea.
+  // and leveraging an existing counter (remainingInBatch) instead of creating a new one. The reasonable asumption to allow this is that
+  // 1- batchSize_ being 8K, most likely times the row size, we are good in assuming that first hbase block will fit in batchSize
+  // 2- parent buffer size will be large enough to deal with one HBAse_Block_size without having to rely on re-invoking work in the middle.
+  // and anyway, if none of the reasonable assumption is true, then that's fine, the heuristic won't work, and we will use regular scanner,
+  // meaning optimization is off for the scan part of MDAM (still on for the probe side of it).
 
   while (1)
     {