Commit e73d1aa0 authored by unknown's avatar unknown

ndb dd - bug#16657 - add new config variable


storage/ndb/include/kernel/ndb_limits.h:
  remove hardcoded limit
storage/ndb/include/kernel/signaldata/FsReadWriteReq.hpp:
  Add new format "shared" page to easily migrate from/to superpool
storage/ndb/include/mgmapi/mgmapi_config_parameters.h:
  Introduce new config parameter for "SharedGlobalMemory",
    only user is so far undo log buffer memory
storage/ndb/src/common/debugger/signaldata/FsReadWriteReq.cpp:
  Add new format "shared" page to easily migrate from/to superpool
storage/ndb/src/kernel/SimBlockList.cpp:
  Fix compiler error
storage/ndb/src/kernel/blocks/cmvmi/Cmvmi.cpp:
  Add new format "shared" page to easily migrate from/to superpool
storage/ndb/src/kernel/blocks/lgman.cpp:
  Add new format "shared" page to easily migrate from/to superpool
storage/ndb/src/kernel/blocks/ndbfs/Ndbfs.cpp:
  Add new format "shared" page to easily migrate from/to superpool
storage/ndb/src/kernel/vm/GlobalData.hpp:
  Add new format "shared" page to easily migrate from/to superpool
storage/ndb/src/kernel/vm/SimulatedBlock.cpp:
  Add new format "shared" page to easily migrate from/to superpool
storage/ndb/src/kernel/vm/SimulatedBlock.hpp:
  Add new format "shared" page to easily migrate from/to superpool
storage/ndb/src/kernel/vm/ndbd_malloc_impl.cpp:
  better startup printouts
storage/ndb/src/mgmsrv/ConfigInfo.cpp:
  Introduce new config parameter for "SharedGlobalMemory",
    only user is so far undo log buffer memory
storage/ndb/src/mgmsrv/InitConfigFileParser.cpp:
  Fix bug in handling of my.cnf files
parent 5296fd96
......@@ -149,10 +149,4 @@
*/
#define LCP_RESTORE_BUFFER (4*32)
/*
* Log buffer pages
* 8M
*/
#define LGMAN_LOG_BUFFER (8*32)
#endif
......@@ -60,6 +60,7 @@ public:
fsFormatArrayOfPages=1,
fsFormatListOfMemPages=2,
fsFormatGlobalPage=3,
fsFormatSharedPage=4,
fsFormatMax
};
......
......@@ -88,11 +88,12 @@
#define CFG_DB_STRING_MEMORY 161 /* used from 5.1 */
#define CFG_DB_INITIAL_OPEN_FILES 162 /* used from 5.1 */
#define CFG_DB_DATA_MEM_2 199 /* used in special build in 5.1 */
#define CFG_DB_DISK_PAGE_BUFFER_MEMORY 160
#define CFG_DB_STRING_MEMORY 161
#define CFG_DB_SGA 198 /* super pool mem */
#define CFG_DB_DATA_MEM_2 199 /* used in special build in 5.1 */
#define CFG_NODE_ARBIT_RANK 200
#define CFG_NODE_ARBIT_DELAY 201
......
......@@ -49,6 +49,8 @@ printFSREADWRITEREQ(FILE * output, const Uint32 * theData,
break;
case FsReadWriteReq::fsFormatGlobalPage:
fprintf(output, "List of global pages)\n");
case FsReadWriteReq::fsFormatSharedPage:
fprintf(output, "List of shared pages)\n");
break;
default:
fprintf(output, "fsFormatMax not handled\n");
......
......@@ -15,7 +15,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#include "SimBlockList.hpp"
#include "EmulatorData.hpp"
#include <Emulator.hpp>
#include <SimulatedBlock.hpp>
#include <Cmvmi.hpp>
#include <Ndbfs.hpp>
......@@ -85,7 +85,8 @@ SimBlockList::load(EmulatorData& data){
SimulatedBlock * fs = 0;
{
Uint32 dl;
const ndb_mgm_configuration_iterator * p = conf.getOwnConfigIterator();
const ndb_mgm_configuration_iterator * p =
ctx.m_config.getOwnConfigIterator();
if(p && !ndb_mgm_get_int_parameter(p, CFG_DB_DISCLESS, &dl) && dl){
fs = NEW_BLOCK(VoidFs)(ctx);
} else {
......
......@@ -324,13 +324,28 @@ Cmvmi::execREAD_CONFIG_REQ(Signal* signal)
Uint64 page_buffer = 64*1024*1024;
ndb_mgm_get_int64_parameter(p, CFG_DB_DISK_PAGE_BUFFER_MEMORY, &page_buffer);
page_buffer /= GLOBAL_PAGE_SIZE; // in pages
if (page_buffer > 0)
Uint32 pages = 0;
pages += page_buffer / GLOBAL_PAGE_SIZE; // in pages
pages += LCP_RESTORE_BUFFER;
m_global_page_pool.setSize(pages + 64, true);
Uint64 shared_mem = 8*1024*1024;
ndb_mgm_get_int64_parameter(p, CFG_DB_SGA, &shared_mem);
shared_mem /= GLOBAL_PAGE_SIZE;
if (shared_mem)
{
page_buffer += LGMAN_LOG_BUFFER;
Resource_limit rl;
rl.m_min = 0;
rl.m_max = shared_mem;
rl.m_resource_id = 0;
m_ctx.m_mm.set_resource_limit(rl);
}
ndbrequire(m_ctx.m_mm.init());
{
void* ptr = m_ctx.m_mm.get_memroot();
m_shared_page_pool.set((GlobalPage*)ptr, ~0);
}
page_buffer += LCP_RESTORE_BUFFER;
m_global_page_pool.setSize(page_buffer + 64, true);
ReadConfigConf * conf = (ReadConfigConf*)signal->getDataPtrSend();
conf->senderRef = reference();
......
......@@ -858,9 +858,6 @@ Lgman::Logfile_group::Logfile_group(const CreateFilegroupImplReq* req)
bool
Lgman::alloc_logbuffer_memory(Ptr<Logfile_group> ptr, Uint32 bytes)
{
/**
* TODO use buddy allocator
*/
Uint32 pages= (((bytes + 3) >> 2) + File_formats::NDB_PAGE_SIZE_WORDS - 1)
/ File_formats::NDB_PAGE_SIZE_WORDS;
Uint32 requested= pages;
......@@ -868,14 +865,14 @@ Lgman::alloc_logbuffer_memory(Ptr<Logfile_group> ptr, Uint32 bytes)
Page_map map(m_data_buffer_pool, ptr.p->m_buffer_pages);
while(pages)
{
Ptr<GlobalPage> page;
if(m_global_page_pool.seize(page))
Uint32 ptrI;
Uint32 cnt = pages > 64 ? 64 : pages;
m_ctx.m_mm.alloc(&ptrI, &cnt, 1);
if (cnt)
{
Buffer_idx range;
range.m_ptr_i= page.i;
range.m_idx = 1;
while(pages >range.m_idx && m_global_page_pool.seizeId(page, page.i+1))
range.m_idx++;
range.m_ptr_i= ptrI;
range.m_idx = cnt;
ndbrequire(map.append((Uint32*)&range, 2));
pages -= range.m_idx;
......@@ -988,12 +985,8 @@ Lgman::free_logbuffer_memory(Ptr<Logfile_group> ptr)
tmp[0] = *it.data;
ndbrequire(map.next(it));
tmp[1] = *it.data;
while(range.m_idx)
{
m_global_page_pool.release(range.m_ptr_i);
range.m_ptr_i++;
range.m_idx--;
}
m_ctx.m_mm.release(range.m_ptr_i, range.m_idx);
map.next(it);
}
map.release();
......@@ -1082,7 +1075,7 @@ Lgman::force_log_sync(Signal* signal,
* Do force
*/
Buffer_idx pos= ptr.p->m_pos[PRODUCER].m_current_pos;
GlobalPage *page = m_global_page_pool.getPtr(pos.m_ptr_i);
GlobalPage *page = m_shared_page_pool.getPtr(pos.m_ptr_i);
Uint32 free= File_formats::UNDO_PAGE_WORDS - pos.m_idx;
if(pos.m_idx) // don't flush empty page...
......@@ -1172,7 +1165,7 @@ Uint32*
Lgman::get_log_buffer(Ptr<Logfile_group> ptr, Uint32 sz)
{
GlobalPage *page;
page=m_global_page_pool.getPtr(ptr.p->m_pos[PRODUCER].m_current_pos.m_ptr_i);
page=m_shared_page_pool.getPtr(ptr.p->m_pos[PRODUCER].m_current_pos.m_ptr_i);
Uint32 total_free= ptr.p->m_free_buffer_words;
assert(total_free >= sz);
......@@ -1210,7 +1203,7 @@ next:
pos= 0;
assert(total_free >= free);
total_free -= free;
page= m_global_page_pool.getPtr(next_page(ptr.p, PRODUCER));
page= m_shared_page_pool.getPtr(next_page(ptr.p, PRODUCER));
goto next;
}
......@@ -1348,7 +1341,7 @@ Lgman::flush_log(Signal* signal, Ptr<Logfile_group> ptr, Uint32 force)
else
{
Buffer_idx pos= producer.m_current_pos;
GlobalPage *page = m_global_page_pool.getPtr(pos.m_ptr_i);
GlobalPage *page = m_shared_page_pool.getPtr(pos.m_ptr_i);
Uint32 free= File_formats::UNDO_PAGE_WORDS - pos.m_idx;
......@@ -1567,7 +1560,7 @@ Lgman::write_log_pages(Signal* signal, Ptr<Logfile_group> ptr,
req->data.pageData[0] = pageId;
req->operationFlag = 0;
FsReadWriteReq::setFormatFlag(req->operationFlag,
FsReadWriteReq::fsFormatGlobalPage);
FsReadWriteReq::fsFormatSharedPage);
if(max > pages)
{
......@@ -1588,7 +1581,7 @@ Lgman::write_log_pages(Signal* signal, Ptr<Logfile_group> ptr,
filePtr.p->m_state |= Undofile::FS_OUTSTANDING;
File_formats::Undofile::Undo_page *page= (File_formats::Undofile::Undo_page*)
m_global_page_pool.getPtr(pageId + max - 1);
m_shared_page_pool.getPtr(pageId + max - 1);
Uint64 lsn = 0;
lsn += page->m_page_header.m_page_lsn_hi; lsn <<= 32;
lsn += page->m_page_header.m_page_lsn_lo;
......@@ -1614,7 +1607,7 @@ Lgman::write_log_pages(Signal* signal, Ptr<Logfile_group> ptr,
filePtr.p->m_state |= Undofile::FS_OUTSTANDING;
File_formats::Undofile::Undo_page *page= (File_formats::Undofile::Undo_page*)
m_global_page_pool.getPtr(pageId + max - 1);
m_shared_page_pool.getPtr(pageId + max - 1);
Uint64 lsn = 0;
lsn += page->m_page_header.m_page_lsn_hi; lsn <<= 32;
lsn += page->m_page_header.m_page_lsn_lo;
......@@ -2095,7 +2088,7 @@ Lgman::find_log_head(Signal* signal, Ptr<Logfile_group> ptr)
req->data.pageData[0] = page_id;
req->operationFlag = 0;
FsReadWriteReq::setFormatFlag(req->operationFlag,
FsReadWriteReq::fsFormatGlobalPage);
FsReadWriteReq::fsFormatSharedPage);
sendSignal(NDBFS_REF, GSN_FSREADREQ, signal,
FsReadWriteReq::FixedLength + 1, JBA);
......@@ -2136,7 +2129,7 @@ Lgman::find_log_head(Signal* signal, Ptr<Logfile_group> ptr)
req->data.pageData[0] = page_id;
req->operationFlag = 0;
FsReadWriteReq::setFormatFlag(req->operationFlag,
FsReadWriteReq::fsFormatGlobalPage);
FsReadWriteReq::fsFormatSharedPage);
sendSignal(NDBFS_REF, GSN_FSREADREQ, signal,
FsReadWriteReq::FixedLength + 1, JBA);
......@@ -2197,7 +2190,7 @@ Lgman::execFSREADCONF(Signal* signal)
lg_ptr.p->m_outstanding_fs = cnt - 1;
Ptr<GlobalPage> page_ptr;
m_global_page_pool.getPtr(page_ptr, ptr.p->m_online.m_outstanding);
m_shared_page_pool.getPtr(page_ptr, ptr.p->m_online.m_outstanding);
ptr.p->m_online.m_outstanding= 0;
File_formats::Undofile::Undo_page* page =
......@@ -2329,7 +2322,7 @@ Lgman::find_log_head_in_file(Signal* signal,
req->data.pageData[0] = page_id;
req->operationFlag = 0;
FsReadWriteReq::setFormatFlag(req->operationFlag,
FsReadWriteReq::fsFormatGlobalPage);
FsReadWriteReq::fsFormatSharedPage);
sendSignal(NDBFS_REF, GSN_FSREADREQ, signal,
FsReadWriteReq::FixedLength + 1, JBA);
......@@ -2434,7 +2427,7 @@ Lgman::init_run_undo_log(Signal* signal)
Uint32 page = ptr.p->m_pos[CONSUMER].m_current_pos.m_ptr_i;
File_formats::Undofile::Undo_page* pageP =
(File_formats::Undofile::Undo_page*)m_global_page_pool.getPtr(page);
(File_formats::Undofile::Undo_page*)m_shared_page_pool.getPtr(page);
ptr.p->m_pos[CONSUMER].m_current_pos.m_idx = pageP->m_words_used;
ptr.p->m_pos[PRODUCER].m_current_pos.m_idx = 1;
......@@ -2574,7 +2567,7 @@ Lgman::read_undo_pages(Signal* signal, Ptr<Logfile_group> ptr,
req->userPointer = filePtr.i;
req->operationFlag = 0;
FsReadWriteReq::setFormatFlag(req->operationFlag,
FsReadWriteReq::fsFormatGlobalPage);
FsReadWriteReq::fsFormatSharedPage);
if(max > pages)
......@@ -2713,7 +2706,7 @@ Lgman::get_next_undo_record(Uint64 * this_lsn)
Uint32 page = consumer.m_current_pos.m_ptr_i;
File_formats::Undofile::Undo_page* pageP=(File_formats::Undofile::Undo_page*)
m_global_page_pool.getPtr(page);
m_shared_page_pool.getPtr(page);
if(pos == 0)
{
......@@ -2791,7 +2784,7 @@ Lgman::get_next_undo_record(Uint64 * this_lsn)
ndbout_c("reading from %d", consumer.m_current_pos.m_ptr_i);
pageP=(File_formats::Undofile::Undo_page*)
m_global_page_pool.getPtr(consumer.m_current_pos.m_ptr_i);
m_shared_page_pool.getPtr(consumer.m_current_pos.m_ptr_i);
pos= consumer.m_current_pos.m_idx= pageP->m_words_used;
......
......@@ -331,8 +331,10 @@ Ndbfs::readWriteRequest(int action, Signal * signal)
goto error;
}
if(fsRWReq->getFormatFlag(fsRWReq->operationFlag) !=
FsReadWriteReq::fsFormatGlobalPage){
Uint32 format = fsRWReq->getFormatFlag(fsRWReq->operationFlag);
if(format != FsReadWriteReq::fsFormatGlobalPage &&
format != FsReadWriteReq::fsFormatSharedPage)
{
if (fsRWReq->varIndex >= getBatSize(blockNumber)) {
jam();// Ensure that a valid variable is used
errorCode = FsRef::fsErrInvalidParameters;
......@@ -353,7 +355,7 @@ Ndbfs::readWriteRequest(int action, Signal * signal)
tNRR = myBaseAddrRef->nrr;
tWA = (char*)myBaseAddrRef->WA;
switch (fsRWReq->getFormatFlag(fsRWReq->operationFlag)) {
switch (format) {
// List of memory and file pages pairs
case FsReadWriteReq::fsFormatListOfPairs: {
......@@ -422,7 +424,9 @@ Ndbfs::readWriteRequest(int action, Signal * signal)
goto error;
}//default
}//switch
} else {
}
else if (format == FsReadWriteReq::fsFormatGlobalPage)
{
Ptr<GlobalPage> ptr;
m_global_page_pool.getPtr(ptr, fsRWReq->data.pageData[0]);
request->par.readWrite.pages[0].buf = (char*)ptr.p;
......@@ -430,6 +434,16 @@ Ndbfs::readWriteRequest(int action, Signal * signal)
request->par.readWrite.pages[0].offset= ((UintPtr)GLOBAL_PAGE_SIZE)*fsRWReq->varIndex;
request->par.readWrite.numberOfPages = 1;
}
else
{
ndbrequire(format == FsReadWriteReq::fsFormatSharedPage);
Ptr<GlobalPage> ptr;
m_shared_page_pool.getPtr(ptr, fsRWReq->data.pageData[0]);
request->par.readWrite.pages[0].buf = (char*)ptr.p;
request->par.readWrite.pages[0].size = ((UintPtr)GLOBAL_PAGE_SIZE)*fsRWReq->numberOfPages;
request->par.readWrite.pages[0].offset= ((UintPtr)GLOBAL_PAGE_SIZE)*fsRWReq->varIndex;
request->par.readWrite.numberOfPages = 1;
}
ndbrequire(forward(openFile, request));
return;
......
......@@ -81,6 +81,7 @@ private:
SimulatedBlock* blockTable[NO_OF_BLOCKS]; // Owned by Dispatcher::
public:
ArrayPool<GlobalPage> m_global_page_pool;
ArrayPool<GlobalPage> m_shared_page_pool;
};
extern GlobalData globalData;
......
......@@ -52,6 +52,7 @@ SimulatedBlock::SimulatedBlock(BlockNumber blockNumber,
theReference(numberToRef(blockNumber, globalData.ownId)),
m_ctx(ctx),
m_global_page_pool(globalData.m_global_page_pool),
m_shared_page_pool(globalData.m_shared_page_pool),
c_fragmentInfoHash(c_fragmentInfoPool),
c_linearFragmentSendList(c_fragmentSendPool),
c_segmentedFragmentSendList(c_fragmentSendPool),
......
......@@ -426,6 +426,7 @@ private:
protected:
ArrayPool<GlobalPage>& m_global_page_pool;
ArrayPool<GlobalPage>& m_shared_page_pool;
private:
/**
......
......@@ -181,12 +181,21 @@ Ndbd_mem_manager::init(bool alloc_less_memory)
{
pages = m_resource_limit[0].m_min; // reserved
}
assert(pages);
if (m_resource_limit[0].m_min == 0)
{
m_resource_limit[0].m_min = pages;
}
g_eventLogger.info("Ndbd_mem_manager::init(%d) min: %dMb initial: %dMb",
alloc_less_memory,
(sizeof(Alloc_page)*m_resource_limit[0].m_min)>>20,
(sizeof(Alloc_page)*m_resource_limit[0].m_max)>>20);
(sizeof(Alloc_page)*pages)>>20);
if (pages == 0)
{
return 0;
}
/**
* Do malloc
......
......@@ -772,6 +772,18 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
"4M",
"1024G" },
{
CFG_DB_SGA,
"SharedGlobalMemory",
DB_TOKEN,
"Total number bytes on each "DB_TOKEN_PRINT" node allocated for any use",
ConfigInfo::CI_USED,
false,
ConfigInfo::CI_INT64,
"20M",
"0",
"65536G" }, // 32k pages * 32-bit i value
{
CFG_DB_START_PARTIAL_TIMEOUT,
"StartPartialTimeout",
......
......@@ -800,6 +800,7 @@ InitConfigFileParser::parse_mycnf()
/**
* Add ndbd, ndb_mgmd, api/mysqld
*/
Uint32 idx = options.size();
{
struct my_option opt;
bzero(&opt, sizeof(opt));
......@@ -809,7 +810,6 @@ InitConfigFileParser::parse_mycnf()
opt.var_type = GET_STR;
opt.arg_type = REQUIRED_ARG;
options.push_back(opt);
ndbd = &options.back();
opt.name = "ndb_mgmd";
opt.id = 256;
......@@ -817,7 +817,6 @@ InitConfigFileParser::parse_mycnf()
opt.var_type = GET_STR;
opt.arg_type = REQUIRED_ARG;
options.push_back(opt);
ndb_mgmd = &options.back();
opt.name = "mysqld";
opt.id = 256;
......@@ -825,7 +824,6 @@ InitConfigFileParser::parse_mycnf()
opt.var_type = GET_STR;
opt.arg_type = REQUIRED_ARG;
options.push_back(opt);
mysqld = &options.back();
opt.name = "api";
opt.id = 256;
......@@ -833,10 +831,14 @@ InitConfigFileParser::parse_mycnf()
opt.var_type = GET_STR;
opt.arg_type = REQUIRED_ARG;
options.push_back(opt);
api = &options.back();
bzero(&opt, sizeof(opt));
options.push_back(opt);
ndbd = &options[idx];
ndb_mgmd = &options[idx+1];
mysqld = &options[idx+2];
api = &options[idx+3];
}
......
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