You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafodion.apache.org by se...@apache.org on 2017/03/03 04:59:25 UTC
[1/2] incubator-trafodion git commit: [TRAFODION-2514] Obscure cores
seen in Trafodion while running jenkins tests with RH7
Repository: incubator-trafodion
Updated Branches:
refs/heads/master b19286ba7 -> e0128dff2
[TRAFODION-2514] Obscure cores seen in Trafodion while running jenkins tests with RH7
The global object gv_sb_thread_table was not constructed in a
thread safe manner.
There was buffer overrun while creating explain fragment involving hive tables.
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/commit/85d1596e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/tree/85d1596e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/diff/85d1596e
Branch: refs/heads/master
Commit: 85d1596e8d8e4975f400cc5fa85a3af4cafab3cd
Parents: 63ab728
Author: selvaganesang <se...@esgyn.com>
Authored: Wed Mar 1 17:56:35 2017 +0000
Committer: selvaganesang <se...@esgyn.com>
Committed: Wed Mar 1 17:56:35 2017 +0000
----------------------------------------------------------------------
core/sqf/src/seabed/src/threadl.cpp | 38 ++++++++++++++++++++++----------
core/sql/generator/GenExplain.cpp | 27 +++++++++++------------
2 files changed, 39 insertions(+), 26 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/85d1596e/core/sqf/src/seabed/src/threadl.cpp
----------------------------------------------------------------------
diff --git a/core/sqf/src/seabed/src/threadl.cpp b/core/sqf/src/seabed/src/threadl.cpp
index c734845..2a04a52 100644
--- a/core/sqf/src/seabed/src/threadl.cpp
+++ b/core/sqf/src/seabed/src/threadl.cpp
@@ -149,12 +149,8 @@ private:
static void sb_thread_ctx_key_dtor(void *pp_ctx);
static void sb_thread_name_key_dtor(void *pp_name);
-SB_Thread_Table_Entry_Mgr gv_sb_thread_table_entry_mgr;
-SB_Ts_Table_Mgr<SB_Thread_Ctx_Type> gv_sb_thread_table("tablemgr-THREAD-MGR",
- SB_Table_Mgr_Alloc::ALLOC_FAST,
- SB_Table_Mgr_Alloc::ALLOC_ENTRY_DYN,
- &gv_sb_thread_table_entry_mgr,
- 10, 10); // cap-init, cap-inc
+SB_Ts_Table_Mgr<SB_Thread_Ctx_Type> *gv_sb_thread_table = NULL;
+SB_Thread_Table_Entry_Mgr *gv_sb_thread_table_entry_mgr = NULL;
static int gv_sb_thread_ctx_tls_inx =
SB_create_tls_key(sb_thread_ctx_key_dtor,
"thread-ctx");
@@ -166,6 +162,24 @@ static int gv_sb_thread_name_tls_inx =
SB_Thread_Lock_Stats gv_sb_lock_stats;
#endif
+SB_Ts_Table_Mgr<SB_Thread_Ctx_Type> *getGlobalTsTableMgr() {
+ if (gv_sb_thread_table != NULL)
+ return gv_sb_thread_table;
+ SB_util_short_lock();
+ if (gv_sb_thread_table != NULL) {
+ SB_util_short_unlock();
+ return gv_sb_thread_table;
+ }
+ gv_sb_thread_table_entry_mgr = new SB_Thread_Table_Entry_Mgr();
+ gv_sb_thread_table = new SB_Ts_Table_Mgr<SB_Thread_Ctx_Type> ("tablemgr-THREAD-MGR",
+ SB_Table_Mgr_Alloc::ALLOC_FAST,
+ SB_Table_Mgr_Alloc::ALLOC_ENTRY_DYN,
+ gv_sb_thread_table_entry_mgr,
+ 10, 10); // cap-init, cap-inc
+ SB_util_short_unlock();
+ return gv_sb_thread_table;
+}
+
typedef struct Sthr_Disp {
int iv_ctx_id;
@@ -189,7 +203,7 @@ static void sb_thread_ctx_key_dtor(void *pp_ctx) {
trace_where_printf(WHERE,
"thread exiting ctx-id=%d, name=%s\n",
lp_ctx->iv_ctx_id, lp_ctx->ia_thread_name);
- gv_sb_thread_table.free_entry(lp_ctx->iv_ctx_id);
+ getGlobalTsTableMgr()->free_entry(lp_ctx->iv_ctx_id);
}
static void sb_thread_name_key_dtor(void *pp_name) {
@@ -232,7 +246,7 @@ static void *sb_thread_sthr_disp(void *pp_arg) {
lp_arg = lp_disp->ip_arg;
lp_name = lp_disp->ip_name;
lv_ctx_id = lp_disp->iv_ctx_id;
- lp_ctx = gv_sb_thread_table.get_entry(lv_ctx_id);
+ lp_ctx = getGlobalTsTableMgr()->get_entry(lv_ctx_id);
lp_ctx->ip_fun = lp_fun;
lp_ctx->iv_self = pthread_self();
lp_ctx->iv_tid = gettid();
@@ -261,8 +275,8 @@ void SB_thread_main() {
SB_Thread_Ctx_Type *lp_ctx;
int lv_ctx_id;
- lv_ctx_id = static_cast<int>(gv_sb_thread_table.alloc_entry());
- lp_ctx = gv_sb_thread_table.get_entry(lv_ctx_id);
+ lv_ctx_id = static_cast<int>(getGlobalTsTableMgr()->alloc_entry());
+ lp_ctx = getGlobalTsTableMgr()->get_entry(lv_ctx_id);
lp_ctx->iv_ctx_id = lv_ctx_id;
strcpy(lp_ctx->ia_thread_name, "main");
lp_ctx->iv_self = pthread_self();
@@ -282,9 +296,9 @@ SB_Thread::Sthr::Id_Ptr SB_Thread::Sthr::create(char *pp_name,
lp_disp->ip_arg = pp_arg;
lp_disp->ip_name = pp_name;
- lp_disp->iv_ctx_id = static_cast<int>(gv_sb_thread_table.alloc_entry());
+ lp_disp->iv_ctx_id = static_cast<int>(getGlobalTsTableMgr()->alloc_entry());
SB_Thread_Ctx_Type *lp_ctx =
- gv_sb_thread_table.get_entry(lp_disp->iv_ctx_id);
+ getGlobalTsTableMgr()->get_entry(lp_disp->iv_ctx_id);
lp_ctx->iv_ctx_id = lp_disp->iv_ctx_id;
lp_ctx->ia_thread_name[sizeof(lp_ctx->ia_thread_name)-1] = '\0';
strncpy(lp_ctx->ia_thread_name,
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/85d1596e/core/sql/generator/GenExplain.cpp
----------------------------------------------------------------------
diff --git a/core/sql/generator/GenExplain.cpp b/core/sql/generator/GenExplain.cpp
index e6d608b..8b6729e 100644
--- a/core/sql/generator/GenExplain.cpp
+++ b/core/sql/generator/GenExplain.cpp
@@ -954,60 +954,60 @@ HbaseAccess::addSpecificExplainInfo(ExplainTupleMaster *explainTuple,
description += "small_scanner: " ;
description += "ON " ;
}
-
- char buf[20];
+ size_t BUFFER_SIZE=512;
+ char buf[BUFFER_SIZE];
if ((((ComTdbHbaseAccess *)tdb)->getHbasePerfAttributes()->dopParallelScanner())>0.0) {
description += "parallel_scanner: " ;
- sprintf(buf, "%g ", ((ComTdbHbaseAccess *)tdb)->getHbasePerfAttributes()->dopParallelScanner());
+ snprintf(buf, BUFFER_SIZE, "%g ", ((ComTdbHbaseAccess *)tdb)->getHbasePerfAttributes()->dopParallelScanner());
description += buf;
}
if ( getProbes().getValue() > 0.0 ) {
description += "probes: "; // total number of probes
- sprintf(buf, "%g ", getProbes().getValue());
+ snprintf(buf, BUFFER_SIZE, "%g ", getProbes().getValue());
description += buf;
}
if ( getSuccessfulProbes().getValue() > 0.0 ) {
description += "successful_probes: "; // # of probes returning data
- sprintf(buf, "%g ", getSuccessfulProbes().getValue());
+ snprintf(buf, BUFFER_SIZE, "%g ", getSuccessfulProbes().getValue());
description += buf;
}
if ( getUniqueProbes().getValue() > 0.0 ) {
description += "unique_probes: "; // # of probes returning 1 row
- sprintf(buf, "%g ", getUniqueProbes().getValue());
+ snprintf(buf, BUFFER_SIZE, "%g ", getUniqueProbes().getValue());
description += buf;
}
if ( getDuplicatedSuccProbes().getValue() > 0.0 ) {
description += "duplicated_succ_probes: "; // # of succ probes returning
- sprintf(buf, "%g ", getDuplicatedSuccProbes().getValue()); // more than 1 row
+ snprintf(buf, BUFFER_SIZE, "%g ", getDuplicatedSuccProbes().getValue()); // more than 1 row
description += buf;
}
if ( getEstRowsAccessed().getValue() ) {
description += "rows_accessed: "; // # rows accessed
- sprintf(buf, "%g ", getEstRowsAccessed().getValue());
+ snprintf(buf, BUFFER_SIZE, "%g ", getEstRowsAccessed().getValue());
description += buf;
}
if (((ComTdbHbaseAccess *)tdb)->getHbaseSnapshotScanAttributes()->getUseSnapshotScan())
{
description += "use_snapshot_scan: ";
- sprintf(buf, "%s ", "TRUE" );
+ snprintf(buf, BUFFER_SIZE, "%s ", "TRUE" );
description += buf;
description += "full_table_name: ";
- sprintf(buf, "%s ", ((ComTdbHbaseAccess *)tdb)->getTableName());
+ snprintf(buf, BUFFER_SIZE, "%s ", ((ComTdbHbaseAccess *)tdb)->getTableName());
description += buf;
description += "snapshot_name: ";
- sprintf(buf, "%s ", ((ComTdbHbaseAccess *)tdb)->getHbaseSnapshotScanAttributes()->getSnapshotName());
+ snprintf(buf, BUFFER_SIZE, "%s ", ((ComTdbHbaseAccess *)tdb)->getHbaseSnapshotScanAttributes()->getSnapshotName());
description += buf;
description += "snapshot_temp_location: ";
- sprintf(buf, "%s ", ((ComTdbHbaseAccess *)tdb)->getHbaseSnapshotScanAttributes()->getSnapScanTmpLocation());
+ snprintf(buf, BUFFER_SIZE, "%s ", ((ComTdbHbaseAccess *)tdb)->getHbaseSnapshotScanAttributes()->getSnapScanTmpLocation());
description += buf;
}
@@ -1031,9 +1031,8 @@ HbaseAccess::addSpecificExplainInfo(ExplainTupleMaster *explainTuple,
/*
// now get columns_retrieved
description += "columns_retrieved: ";
- char buf[27];
//sprintf(buf, "%d ", retrievedCols().entries());
- sprintf(buf, "%d ", getIndexDesc()->getIndexColumns().entries());
+ snprintf(buf, BUFFER_SIZE, "%d ", getIndexDesc()->getIndexColumns().entries());
description += buf;
*/
[2/2] incubator-trafodion git commit: Merge [TRAFODION-2514] PR 985
Obscure cores seen in Trafodion while running jenkins tests with RH7
Posted by se...@apache.org.
Merge [TRAFODION-2514] PR 985 Obscure cores seen in Trafodion while running jenkins tests with RH7
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/commit/e0128dff
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/tree/e0128dff
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/diff/e0128dff
Branch: refs/heads/master
Commit: e0128dff28280317f06d6fa5d54de08216a69e75
Parents: b19286b 85d1596
Author: selvaganesang <se...@apache.org>
Authored: Fri Mar 3 04:58:46 2017 +0000
Committer: selvaganesang <se...@apache.org>
Committed: Fri Mar 3 04:58:46 2017 +0000
----------------------------------------------------------------------
core/sqf/src/seabed/src/threadl.cpp | 38 ++++++++++++++++++++++----------
core/sql/generator/GenExplain.cpp | 27 +++++++++++------------
2 files changed, 39 insertions(+), 26 deletions(-)
----------------------------------------------------------------------