From 76b4f3dd9580f12d0b895bb35cc3432bdb0c0e39 Mon Sep 17 00:00:00 2001 From: David Hall Date: Thu, 22 Sep 2016 09:30:20 -0500 Subject: [PATCH 1/4] MCOL-176 Stop the arethmetic underflow --- utils/funcexp/func_div.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/utils/funcexp/func_div.cpp b/utils/funcexp/func_div.cpp index 676b5a824..d75942b6d 100644 --- a/utils/funcexp/func_div.cpp +++ b/utils/funcexp/func_div.cpp @@ -24,6 +24,8 @@ #include #include #include +#define __STDC_LIMIT_MACROS +#include using namespace std; #include "functor_real.h" @@ -56,6 +58,12 @@ int64_t Func_div::getIntVal(rowgroup::Row& row, return 0; } int64_t int_val1 = (int64_t)(val1 > 0 ? val1 + 0.5 : val1 - 0.5); + // MCOL-176 If abs(int_val2) is small enough (like -1), then, this may cause overflow. + // This kludge stops the crash. + if (int_val1 == INT64_MIN) + { + --int_val1; + } return int_val1 / int_val2; } From e48ef0063a26e274d415a09a1586d500f720d4c3 Mon Sep 17 00:00:00 2001 From: David Hall Date: Thu, 22 Sep 2016 09:31:12 -0500 Subject: [PATCH 2/4] MCOL-290 Use the proper enum to check for state --- procmon/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/procmon/main.cpp b/procmon/main.cpp index 3a1942c50..36e6ab98d 100644 --- a/procmon/main.cpp +++ b/procmon/main.cpp @@ -2326,7 +2326,7 @@ void processStatusMSG(messageqcpp::IOSocket* cfIos) log.writeLog(__LINE__, "statusControl: Set Process " + moduleName + "/" + processName + + " State = " + oamState[state] + " PID = " + oam.itoa(PID), LOG_TYPE_DEBUG); //update table - if ( state < STATE_MAX ) + if ( state < PID_UPDATE ) fShmProcessStatus[shmIndex].ProcessOpState = state; if ( PID != 1 ) fShmProcessStatus[shmIndex].ProcessID = PID; From afab801b5f0884e47bfe6c694371232db19d0b82 Mon Sep 17 00:00:00 2001 From: David Hall Date: Thu, 22 Sep 2016 09:34:13 -0500 Subject: [PATCH 3/4] MCOL-299 Change the getStrVal() for float and double to match the results of the mariadb display string for same. --- dbcon/execplan/treenode.h | 42 ++- utils/joiner/joiner.vpj | 452 ++++++++++++++++---------------- utils/utils.vpj | 532 +++++++++++++++++++++----------------- 3 files changed, 555 insertions(+), 471 deletions(-) diff --git a/dbcon/execplan/treenode.h b/dbcon/execplan/treenode.h index d246fae53..b80ecbc59 100644 --- a/dbcon/execplan/treenode.h +++ b/dbcon/execplan/treenode.h @@ -39,8 +39,7 @@ #include "calpontsystemcatalog.h" #include "exceptclasses.h" #include "dataconvert.h" - -namespace messageqcpp { +namespace messageqecpp { class ByteStream; } @@ -483,8 +482,24 @@ inline const std::string& TreeNode::getStrVal() } else { - snprintf(tmp, 312, "%e", fResult.floatVal); - fResult.strVal = tmp; + // MCOL-299 Print scientific with 5 mantissa and no + sign for exponent + int exponent = (int)floor(log10( fabs(fResult.floatVal))); // This will round down the exponent + double base = fResult.floatVal * pow(10, -1.0*exponent); + if (isnan(exponent) || isnan(base)) + { + snprintf(tmp, 312, "%f", fResult.floatVal); + fResult.strVal = removeTrailing0(tmp, 312); + } + else + { + snprintf(tmp, 312, "%.5f", base); + fResult.strVal = removeTrailing0(tmp, 312); + snprintf(tmp, 312, "e%02d", exponent); + fResult.strVal += tmp; + } + +// snprintf(tmp, 312, "%e.5", fResult.floatVal); +// fResult.strVal = tmp; } break; } @@ -499,8 +514,23 @@ inline const std::string& TreeNode::getStrVal() } else { - snprintf(tmp, 312, "%e", fResult.doubleVal); - fResult.strVal = tmp; + // MCOL-299 Print scientific with 9 mantissa and no + sign for exponent + int exponent = (int)floor(log10( fabs(fResult.doubleVal))); // This will round down the exponent + double base = fResult.doubleVal * pow(10, -1.0*exponent); + if (isnan(exponent) || isnan(base)) + { + snprintf(tmp, 312, "%f", fResult.doubleVal); + fResult.strVal = removeTrailing0(tmp, 312); + } + else + { + snprintf(tmp, 312, "%.9f", base); + fResult.strVal = removeTrailing0(tmp, 312); + snprintf(tmp, 312, "e%02d", exponent); + fResult.strVal += tmp; + } +// snprintf(tmp, 312, "%e", fResult.doubleVal); +// fResult.strVal = tmp; } break; } diff --git a/utils/joiner/joiner.vpj b/utils/joiner/joiner.vpj index 65df93f5a..8de9d375f 100644 --- a/utils/joiner/joiner.vpj +++ b/utils/joiner/joiner.vpj @@ -1,228 +1,230 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + Version="10.0" + VendorName="SlickEdit" + TemplateName="GNU C/C++" + WorkingDir="."> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/utils/utils.vpj b/utils/utils.vpj index 52badc5cc..342be0482 100644 --- a/utils/utils.vpj +++ b/utils/utils.vpj @@ -1,243 +1,295 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + Version="10.0" + VendorName="SlickEdit" + TemplateName="GNU C/C++" + WorkingDir="."> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From f20345f79868ca75909dc98d8e10c6c98daa3084 Mon Sep 17 00:00:00 2001 From: David Hall Date: Fri, 23 Sep 2016 09:18:28 -0500 Subject: [PATCH 4/4] MCOL-290 - Fix spurious typo --- dbcon/execplan/treenode.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dbcon/execplan/treenode.h b/dbcon/execplan/treenode.h index b80ecbc59..1f1166fa3 100644 --- a/dbcon/execplan/treenode.h +++ b/dbcon/execplan/treenode.h @@ -39,7 +39,7 @@ #include "calpontsystemcatalog.h" #include "exceptclasses.h" #include "dataconvert.h" -namespace messageqecpp { +namespace messageqcpp { class ByteStream; }