Commit ca967328 authored by unknown's avatar unknown

ndb - add support for periodic mem-reporting


storage/ndb/include/mgmapi/mgmapi_config_parameters.h:
  Add new config paramemter
storage/ndb/src/kernel/blocks/dbacc/Dbacc.hpp:
  add support for periodic mem-reporting
storage/ndb/src/kernel/blocks/dbacc/DbaccMain.cpp:
  add support for periodic mem-reporting
storage/ndb/src/kernel/blocks/dbtup/Dbtup.hpp:
  add support for periodic mem-reporting
storage/ndb/src/kernel/blocks/dbtup/DbtupGen.cpp:
  add support for periodic mem-reporting
storage/ndb/src/mgmsrv/ConfigInfo.cpp:
  add support for periodic mem-reporting
parent 11964cdf
...@@ -96,6 +96,8 @@ ...@@ -96,6 +96,8 @@
#define CFG_DB_CHECKPOINT_SPEED 164 #define CFG_DB_CHECKPOINT_SPEED 164
#define CFG_DB_CHECKPOINT_SPEED_SR 165 #define CFG_DB_CHECKPOINT_SPEED_SR 165
#define CFG_DB_MEMREPORT_FREQUENCY 166
#define CFG_DB_SGA 198 /* super pool mem */ #define CFG_DB_SGA 198 /* super pool mem */
#define CFG_DB_DATA_MEM_2 199 /* used in special build in 5.1 */ #define CFG_DB_DATA_MEM_2 199 /* used in special build in 5.1 */
......
...@@ -1100,6 +1100,7 @@ private: ...@@ -1100,6 +1100,7 @@ private:
}; };
Uint32 c_errorInsert3000_TableId; Uint32 c_errorInsert3000_TableId;
Uint32 c_memusage_report_frequency;
}; };
#endif #endif
...@@ -112,6 +112,7 @@ void Dbacc::execCONTINUEB(Signal* signal) ...@@ -112,6 +112,7 @@ void Dbacc::execCONTINUEB(Signal* signal)
} }
case ZREPORT_MEMORY_USAGE:{ case ZREPORT_MEMORY_USAGE:{
jam(); jam();
Uint32 cnt = signal->theData[1];
static int c_currentMemUsed = 0; static int c_currentMemUsed = 0;
int now = cpagesize ? (cnoOfAllocatedPages * 100)/cpagesize : 0; int now = cpagesize ? (cnoOfAllocatedPages * 100)/cpagesize : 0;
const int thresholds[] = { 99, 90, 80, 0}; const int thresholds[] = { 99, 90, 80, 0};
...@@ -125,14 +126,22 @@ void Dbacc::execCONTINUEB(Signal* signal) ...@@ -125,14 +126,22 @@ void Dbacc::execCONTINUEB(Signal* signal)
} }
} }
if(now != c_currentMemUsed){ if(now != c_currentMemUsed ||
reportMemoryUsage(signal, now > c_currentMemUsed ? 1 : -1); (c_memusage_report_frequency && cnt + 1 == c_memusage_report_frequency))
} {
reportMemoryUsage(signal,
now > c_currentMemUsed ? 1 :
now < c_currentMemUsed ? -1 : 0);
cnt = 0;
c_currentMemUsed = now; c_currentMemUsed = now;
}
else
{
cnt ++;
}
signal->theData[0] = ZREPORT_MEMORY_USAGE; signal->theData[0] = ZREPORT_MEMORY_USAGE;
sendSignalWithDelay(reference(), GSN_CONTINUEB, signal, 2000, 1); signal->theData[1] = cnt;
sendSignalWithDelay(reference(), GSN_CONTINUEB, signal, 1000, 2);
return; return;
} }
...@@ -199,7 +208,8 @@ void Dbacc::execNDB_STTOR(Signal* signal) ...@@ -199,7 +208,8 @@ void Dbacc::execNDB_STTOR(Signal* signal)
csystemRestart = ZFALSE; csystemRestart = ZFALSE;
signal->theData[0] = ZREPORT_MEMORY_USAGE; signal->theData[0] = ZREPORT_MEMORY_USAGE;
sendSignalWithDelay(reference(), GSN_CONTINUEB, signal, 2000, 1); signal->theData[1] = 0;
sendSignalWithDelay(reference(), GSN_CONTINUEB, signal, 1000, 2);
break; break;
default: default:
jam(); jam();
...@@ -353,6 +363,10 @@ void Dbacc::execREAD_CONFIG_REQ(Signal* signal) ...@@ -353,6 +363,10 @@ void Dbacc::execREAD_CONFIG_REQ(Signal* signal)
initRecords(); initRecords();
ndbrestart1Lab(signal); ndbrestart1Lab(signal);
c_memusage_report_frequency = 0;
ndb_mgm_get_int_parameter(p, CFG_DB_MEMREPORT_FREQUENCY,
&c_memusage_report_frequency);
tdata0 = 0; tdata0 = 0;
initialiseRecordsLab(signal, ref, senderData); initialiseRecordsLab(signal, ref, senderData);
return; return;
......
...@@ -2571,6 +2571,7 @@ private: ...@@ -2571,6 +2571,7 @@ private:
// Trigger variables // Trigger variables
Uint32 c_maxTriggersPerTable; Uint32 c_maxTriggersPerTable;
Uint32 c_memusage_report_frequency;
Uint32 c_errorInsert4000TableId; Uint32 c_errorInsert4000TableId;
Uint32 c_min_list_size[MAX_FREE_LIST + 1]; Uint32 c_min_list_size[MAX_FREE_LIST + 1];
......
...@@ -169,6 +169,7 @@ void Dbtup::execCONTINUEB(Signal* signal) ...@@ -169,6 +169,7 @@ void Dbtup::execCONTINUEB(Signal* signal)
case ZREPORT_MEMORY_USAGE:{ case ZREPORT_MEMORY_USAGE:{
ljam(); ljam();
static int c_currentMemUsed = 0; static int c_currentMemUsed = 0;
Uint32 cnt = signal->theData[1];
Uint32 tmp = c_page_pool.getSize(); Uint32 tmp = c_page_pool.getSize();
int now = tmp ? (cnoOfAllocatedPages * 100)/tmp : 0; int now = tmp ? (cnoOfAllocatedPages * 100)/tmp : 0;
const int thresholds[] = { 100, 90, 80, 0 }; const int thresholds[] = { 100, 90, 80, 0 };
...@@ -182,12 +183,22 @@ void Dbtup::execCONTINUEB(Signal* signal) ...@@ -182,12 +183,22 @@ void Dbtup::execCONTINUEB(Signal* signal)
} }
} }
if(now != c_currentMemUsed){ if(now != c_currentMemUsed ||
reportMemoryUsage(signal, now > c_currentMemUsed ? 1 : -1); (c_memusage_report_frequency && cnt + 1 == c_memusage_report_frequency))
{
reportMemoryUsage(signal,
now > c_currentMemUsed ? 1 :
now < c_currentMemUsed ? -1 : 0);
cnt = 0;
c_currentMemUsed = now; c_currentMemUsed = now;
} }
else
{
cnt++;
}
signal->theData[0] = ZREPORT_MEMORY_USAGE; signal->theData[0] = ZREPORT_MEMORY_USAGE;
sendSignalWithDelay(reference(), GSN_CONTINUEB, signal, 2000, 1); signal->theData[1] = cnt;
sendSignalWithDelay(reference(), GSN_CONTINUEB, signal, 1000, 2);
return; return;
} }
case ZBUILD_INDEX: case ZBUILD_INDEX:
...@@ -337,6 +348,10 @@ void Dbtup::execREAD_CONFIG_REQ(Signal* signal) ...@@ -337,6 +348,10 @@ void Dbtup::execREAD_CONFIG_REQ(Signal* signal)
clastBitMask = 1; clastBitMask = 1;
clastBitMask = clastBitMask << 31; clastBitMask = clastBitMask << 31;
c_memusage_report_frequency = 0;
ndb_mgm_get_int_parameter(p, CFG_DB_MEMREPORT_FREQUENCY,
&c_memusage_report_frequency);
initialiseRecordsLab(signal, 0, ref, senderData); initialiseRecordsLab(signal, 0, ref, senderData);
}//Dbtup::execSIZEALT_REP() }//Dbtup::execSIZEALT_REP()
...@@ -499,7 +514,8 @@ void Dbtup::execNDB_STTOR(Signal* signal) ...@@ -499,7 +514,8 @@ void Dbtup::execNDB_STTOR(Signal* signal)
/* RESTART. */ /* RESTART. */
/*****************************************/ /*****************************************/
signal->theData[0] = ZREPORT_MEMORY_USAGE; signal->theData[0] = ZREPORT_MEMORY_USAGE;
sendSignalWithDelay(reference(), GSN_CONTINUEB, signal, 2000, 1); signal->theData[1] = 0;
sendSignalWithDelay(reference(), GSN_CONTINUEB, signal, 1000, 1);
break; break;
default: default:
ljam(); ljam();
......
...@@ -1299,6 +1299,18 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = { ...@@ -1299,6 +1299,18 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
"0", "0",
STR_VALUE(MAX_INT_RNIL) }, STR_VALUE(MAX_INT_RNIL) },
{
CFG_DB_MEMREPORT_FREQUENCY,
"MemReportFrequency",
DB_TOKEN,
"Frequency of mem reports in seconds, 0 = only when passing %-limits",
ConfigInfo::CI_USED,
false,
ConfigInfo::CI_INT,
"0",
"0",
STR_VALUE(MAX_INT_RNIL) },
/*************************************************************************** /***************************************************************************
* API * API
***************************************************************************/ ***************************************************************************/
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment