Commit c5962eb9 authored by unknown's avatar unknown

ndb dd

  add reporting of shared pool


storage/ndb/src/kernel/blocks/cmvmi/Cmvmi.cpp:
  Add dumping of shared memory
storage/ndb/src/kernel/blocks/ndbfs/Ndbfs.cpp:
  Fix compile error
storage/ndb/src/kernel/vm/WOPool.cpp:
  remove debug printout
storage/ndb/src/kernel/vm/ndbd_malloc_impl.cpp:
  Add get resource usage
storage/ndb/src/kernel/vm/ndbd_malloc_impl.hpp:
  Add get resource usage
parent 069d315e
...@@ -1100,6 +1100,37 @@ Cmvmi::execDUMP_STATE_ORD(Signal* signal) ...@@ -1100,6 +1100,37 @@ Cmvmi::execDUMP_STATE_ORD(Signal* signal)
g_sectionSegmentPool.getNoOfFree()); g_sectionSegmentPool.getNoOfFree());
} }
if (dumpState->args[0] == 1000)
{
Uint32 len = signal->getLength();
if (signal->getLength() == 1)
{
signal->theData[1] = 0;
signal->theData[2] = ~0;
sendSignal(reference(), GSN_DUMP_STATE_ORD, signal, 3, JBB);
return;
}
Uint32 id = signal->theData[1];
Resource_limit rl;
if (!m_ctx.m_mm.get_resource_limit(id, rl))
len = 2;
else
{
if (rl.m_min || rl.m_curr || rl.m_max)
infoEvent("Resource %d min: %d max: %d curr: %d",
id, rl.m_min, rl.m_max, rl.m_curr);
}
if (len == 3)
{
signal->theData[0] = 1000;
signal->theData[1] = id+1;
signal->theData[2] = ~0;
sendSignal(reference(), GSN_DUMP_STATE_ORD, signal, 3, JBB);
}
return;
}
if (dumpState->args[0] == DumpStateOrd::CmvmiSetRestartOnErrorInsert){ if (dumpState->args[0] == DumpStateOrd::CmvmiSetRestartOnErrorInsert){
if(signal->getLength() == 1) if(signal->getLength() == 1)
m_ctx.m_config.setRestartOnErrorInsert((int)NRT_NoStart_Restart); m_ctx.m_config.setRestartOnErrorInsert((int)NRT_NoStart_Restart);
......
...@@ -325,13 +325,14 @@ Ndbfs::readWriteRequest(int action, Signal * signal) ...@@ -325,13 +325,14 @@ Ndbfs::readWriteRequest(int action, Signal * signal)
request->action = (Request::Action) action; request->action = (Request::Action) action;
request->theTrace = signal->getTrace(); request->theTrace = signal->getTrace();
Uint32 format = fsRWReq->getFormatFlag(fsRWReq->operationFlag);
if (fsRWReq->numberOfPages == 0) { //Zero pages not allowed if (fsRWReq->numberOfPages == 0) { //Zero pages not allowed
jam(); jam();
errorCode = FsRef::fsErrInvalidParameters; errorCode = FsRef::fsErrInvalidParameters;
goto error; goto error;
} }
Uint32 format = fsRWReq->getFormatFlag(fsRWReq->operationFlag);
if(format != FsReadWriteReq::fsFormatGlobalPage && if(format != FsReadWriteReq::fsFormatGlobalPage &&
format != FsReadWriteReq::fsFormatSharedPage) format != FsReadWriteReq::fsFormatSharedPage)
{ {
......
...@@ -38,7 +38,6 @@ WOPool::init(const Record_info& ri, const Pool_context& pc) ...@@ -38,7 +38,6 @@ WOPool::init(const Record_info& ri, const Pool_context& pc)
bool bool
WOPool::seize_new_page(Ptr<void>& ptr) WOPool::seize_new_page(Ptr<void>& ptr)
{ {
ndbout_c("WOPool::seize_new_page(%x)", m_record_info.m_type_id);
WOPage* page; WOPage* page;
Uint32 page_no = RNIL; Uint32 page_no = RNIL;
if ((page = (WOPage*)m_ctx.alloc_page(m_record_info.m_type_id, &page_no))) if ((page = (WOPage*)m_ctx.alloc_page(m_record_info.m_type_id, &page_no)))
...@@ -63,7 +62,6 @@ WOPool::seize_new_page(Ptr<void>& ptr) ...@@ -63,7 +62,6 @@ WOPool::seize_new_page(Ptr<void>& ptr)
void void
WOPool::release_not_current(Ptr<void> ptr) WOPool::release_not_current(Ptr<void> ptr)
{ {
ndbout_c("WOPool::release_not_current(%x)", m_record_info.m_type_id);
WOPage* page = (WOPage*)(UintPtr(ptr.p) & ~(GLOBAL_PAGE_SIZE - 1)); WOPage* page = (WOPage*)(UintPtr(ptr.p) & ~(GLOBAL_PAGE_SIZE - 1));
Uint32 cnt = page->m_ref_count; Uint32 cnt = page->m_ref_count;
Uint32 type = page->m_type_id; Uint32 type = page->m_type_id;
......
...@@ -166,6 +166,17 @@ Ndbd_mem_manager::set_resource_limit(const Resource_limit& rl) ...@@ -166,6 +166,17 @@ Ndbd_mem_manager::set_resource_limit(const Resource_limit& rl)
m_resource_limit[0].m_min = current_reserved + reserve; m_resource_limit[0].m_min = current_reserved + reserve;
} }
bool
Ndbd_mem_manager::get_resource_limit(Uint32 id, Resource_limit& rl) const
{
if (id < XX_RL_COUNT)
{
rl = m_resource_limit[id];
return true;
}
return false;
}
bool bool
Ndbd_mem_manager::init(bool alloc_less_memory) Ndbd_mem_manager::init(bool alloc_less_memory)
{ {
...@@ -173,6 +184,7 @@ Ndbd_mem_manager::init(bool alloc_less_memory) ...@@ -173,6 +184,7 @@ Ndbd_mem_manager::init(bool alloc_less_memory)
Uint32 pages = 0; Uint32 pages = 0;
Uint32 max_page = 0; Uint32 max_page = 0;
Uint32 reserved = m_resource_limit[0].m_min;
if (m_resource_limit[0].m_max) if (m_resource_limit[0].m_max)
{ {
pages = m_resource_limit[0].m_max; pages = m_resource_limit[0].m_max;
...@@ -267,7 +279,10 @@ Ndbd_mem_manager::init(bool alloc_less_memory) ...@@ -267,7 +279,10 @@ Ndbd_mem_manager::init(bool alloc_less_memory)
if (last > max_page) if (last > max_page)
max_page = last; max_page = last;
} }
m_resource_limit[0].m_resource_id = max_page; m_resource_limit[0].m_resource_id = max_page;
m_resource_limit[0].m_min = reserved;
m_resource_limit[0].m_max = 0;
for (Uint32 i = 0; i<cnt; i++) for (Uint32 i = 0; i<cnt; i++)
{ {
...@@ -567,6 +582,7 @@ Ndbd_mem_manager::release_page(Uint32 type, Uint32 i) ...@@ -567,6 +582,7 @@ Ndbd_mem_manager::release_page(Uint32 type, Uint32 i)
Uint32 sub = (rl.m_curr < rl.m_min) ? 0 : 1; // Over min ? Uint32 sub = (rl.m_curr < rl.m_min) ? 0 : 1; // Over min ?
release(i, 1); release(i, 1);
m_resource_limit[0].m_curr = tot.m_curr - sub; m_resource_limit[0].m_curr = tot.m_curr - sub;
m_resource_limit[idx].m_curr = rl.m_curr - 1;
} }
#ifdef UNIT_TEST #ifdef UNIT_TEST
......
...@@ -55,6 +55,7 @@ public: ...@@ -55,6 +55,7 @@ public:
Ndbd_mem_manager(); Ndbd_mem_manager();
void set_resource_limit(const Resource_limit& rl); void set_resource_limit(const Resource_limit& rl);
bool get_resource_limit(Uint32 id, Resource_limit& rl) const;
bool init(bool allow_alloc_less_than_requested = true); bool init(bool allow_alloc_less_than_requested = true);
void* get_memroot() const { return (void*)m_base_page;} void* get_memroot() const { return (void*)m_base_page;}
...@@ -65,7 +66,7 @@ public: ...@@ -65,7 +66,7 @@ public:
void dump() const ; void dump() const ;
void* alloc_page(Uint32 type, Uint32* i); void* alloc_page(Uint32 type, Uint32* i);
void release_page(Uint32 type, Uint32 i, void * p); void release_page(Uint32 type, Uint32 i);
void* alloc_pages(Uint32 type, Uint32* i, Uint32 *cnt, Uint32 min = 1); void* alloc_pages(Uint32 type, Uint32* i, Uint32 *cnt, Uint32 min = 1);
void release_pages(Uint32 type, Uint32 i, void*p, Uint32 cnt); void release_pages(Uint32 type, Uint32 i, void*p, Uint32 cnt);
......
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