void Dbacc::initRecords() { { AllocChunk chunks[16]; const Uint32 pages = (cpagesize + 3) / 4; const Uint32 chunkcnt = allocChunks(chunks, 16, RT_DBTUP_PAGE, pages, CFG_DB_INDEX_MEM); /** * Set base ptr */ Ptr<GlobalPage> pagePtr; m_shared_page_pool.getPtr(pagePtr, chunks[0].ptrI); page8 = (Page8*)pagePtr.p; /** * 1) Build free-list per chunk * 2) Add chunks to cfirstfreepage-list */ cfirstfreepage = RNIL; cpagesize = 0; cpageCount = 0; for (Int32 i = chunkcnt - 1; i >= 0; i--) { Ptr<GlobalPage> pagePtr; m_shared_page_pool.getPtr(pagePtr, chunks[i].ptrI); const Uint32 cnt = 4 * chunks[i].cnt; // 4 8k per 32k Page8* base = (Page8*)pagePtr.p; ndbrequire(base >= page8); const Uint32 ptrI = Uint32(base - page8); for (Uint32 j = 0; j < cnt; j++) { refresh_watch_dog(); base[j].word32[0] = ptrI + j + 1; } base[cnt-1].word32[0] = cfirstfreepage; cfirstfreepage = ptrI; cpageCount += cnt; if (ptrI + cnt > cpagesize) cpagesize = ptrI + cnt; } } operationrec = (Operationrec*)allocRecord("Operationrec", sizeof(Operationrec), coprecsize); dirRange = (DirRange*)allocRecord("DirRange", sizeof(DirRange), cdirrangesize); directoryarray = (Directoryarray*)allocRecord("Directoryarray", sizeof(Directoryarray), cdirarraysize); fragmentrec = (Fragmentrec*)allocRecord("Fragmentrec", sizeof(Fragmentrec), cfragmentsize); overflowRecord = (OverflowRecord*)allocRecord("OverflowRecord", sizeof(OverflowRecord), coverflowrecsize); scanRec = (ScanRec*)allocRecord("ScanRec", sizeof(ScanRec), cscanRecSize); tabrec = (Tabrec*)allocRecord("Tabrec", sizeof(Tabrec), ctablesize); }//Dbacc::initRecords()
void Dbtux::execREAD_CONFIG_REQ(Signal* signal) { jamEntry(); const ReadConfigReq * req = (ReadConfigReq*)signal->getDataPtr(); Uint32 ref = req->senderRef; Uint32 senderData = req->senderData; ndbrequire(req->noOfParameters == 0); Uint32 nIndex; Uint32 nFragment; Uint32 nAttribute; Uint32 nScanOp; Uint32 nScanBatch; Uint32 nStatAutoUpdate; Uint32 nStatSaveSize; Uint32 nStatSaveScale; Uint32 nStatTriggerPct; Uint32 nStatTriggerScale; Uint32 nStatUpdateDelay; const ndb_mgm_configuration_iterator * p = m_ctx.m_config.getOwnConfigIterator(); ndbrequire(p != 0); ndbrequire(!ndb_mgm_get_int_parameter(p, CFG_TUX_INDEX, &nIndex)); ndbrequire(!ndb_mgm_get_int_parameter(p, CFG_TUX_FRAGMENT, &nFragment)); ndbrequire(!ndb_mgm_get_int_parameter(p, CFG_TUX_ATTRIBUTE, &nAttribute)); ndbrequire(!ndb_mgm_get_int_parameter(p, CFG_TUX_SCAN_OP, &nScanOp)); ndbrequire(!ndb_mgm_get_int_parameter(p, CFG_DB_BATCH_SIZE, &nScanBatch)); nStatAutoUpdate = 0; ndb_mgm_get_int_parameter(p, CFG_DB_INDEX_STAT_AUTO_UPDATE, &nStatAutoUpdate); nStatSaveSize = 32768; ndb_mgm_get_int_parameter(p, CFG_DB_INDEX_STAT_SAVE_SIZE, &nStatSaveSize); nStatSaveScale = 100; ndb_mgm_get_int_parameter(p, CFG_DB_INDEX_STAT_SAVE_SCALE, &nStatSaveScale); nStatTriggerPct = 100; ndb_mgm_get_int_parameter(p, CFG_DB_INDEX_STAT_TRIGGER_PCT, &nStatTriggerPct); nStatTriggerScale = 100; ndb_mgm_get_int_parameter(p, CFG_DB_INDEX_STAT_TRIGGER_SCALE, &nStatTriggerScale); nStatUpdateDelay = 60; ndb_mgm_get_int_parameter(p, CFG_DB_INDEX_STAT_UPDATE_DELAY, &nStatUpdateDelay); const Uint32 nDescPage = (nIndex * DescHeadSize + nAttribute * KeyTypeSize + nAttribute * AttributeHeaderSize + DescPageSize - 1) / DescPageSize; const Uint32 nScanBoundWords = nScanOp * ScanBoundSegmentSize * 4; const Uint32 nScanLock = nScanOp * nScanBatch; const Uint32 nStatOp = 8; c_indexPool.setSize(nIndex); c_fragPool.setSize(nFragment); c_descPagePool.setSize(nDescPage); c_fragOpPool.setSize(MaxIndexFragments); c_scanOpPool.setSize(nScanOp); c_scanBoundPool.setSize(nScanBoundWords); c_scanLockPool.setSize(nScanLock); c_statOpPool.setSize(nStatOp); c_indexStatAutoUpdate = nStatAutoUpdate; c_indexStatSaveSize = nStatSaveSize; c_indexStatSaveScale = nStatSaveScale; c_indexStatTriggerPct = nStatTriggerPct; c_indexStatTriggerScale = nStatTriggerScale; c_indexStatUpdateDelay = nStatUpdateDelay; /* * Index id is physical array index. We seize and initialize all * index records now. */ IndexPtr indexPtr; while (1) { jam(); refresh_watch_dog(); c_indexPool.seize(indexPtr); if (indexPtr.i == RNIL) { jam(); break; } new (indexPtr.p) Index(); } // allocate buffers c_ctx.jamBuffer = jamBuffer(); c_ctx.c_searchKey = (Uint32*)allocRecord("c_searchKey", sizeof(Uint32), MaxAttrDataSize); c_ctx.c_entryKey = (Uint32*)allocRecord("c_entryKey", sizeof(Uint32), MaxAttrDataSize); c_ctx.c_dataBuffer = (Uint32*)allocRecord("c_dataBuffer", sizeof(Uint64), (MaxXfrmDataSize + 1) >> 1); #ifdef VM_TRACE c_ctx.c_debugBuffer = (char*)allocRecord("c_debugBuffer", sizeof(char), DebugBufferBytes); #endif // ack ReadConfigConf * conf = (ReadConfigConf*)signal->getDataPtrSend(); conf->senderRef = reference(); conf->senderData = senderData; sendSignal(ref, GSN_READ_CONFIG_CONF, signal, ReadConfigConf::SignalLength, JBB); }
void Dblqh::initRecords() { // Records with dynamic sizes addFragRecord = (AddFragRecord*)allocRecord("AddFragRecord", sizeof(AddFragRecord), caddfragrecFileSize); gcpRecord = (GcpRecord*)allocRecord("GcpRecord", sizeof(GcpRecord), cgcprecFileSize); hostRecord = (HostRecord*)allocRecord("HostRecord", sizeof(HostRecord), chostFileSize); lcpRecord = (LcpRecord*)allocRecord("LcpRecord", sizeof(LcpRecord), clcpFileSize); for(Uint32 i = 0; i<clcpFileSize; i++){ new (&lcpRecord[i])LcpRecord(); } logPartRecord = (LogPartRecord*)allocRecord("LogPartRecord", sizeof(LogPartRecord), NDB_MAX_LOG_PARTS); logFileRecord = (LogFileRecord*)allocRecord("LogFileRecord", sizeof(LogFileRecord), clogFileFileSize); logFileOperationRecord = (LogFileOperationRecord*) allocRecord("LogFileOperationRecord", sizeof(LogFileOperationRecord), clfoFileSize); { AllocChunk chunks[16]; const Uint32 chunkcnt = allocChunks(chunks, 16, RG_FILE_BUFFERS, clogPageFileSize, CFG_DB_REDO_BUFFER); { Ptr<GlobalPage> pagePtr; m_shared_page_pool.getPtr(pagePtr, chunks[0].ptrI); logPageRecord = (LogPageRecord*)pagePtr.p; } cfirstfreeLogPage = RNIL; clogPageFileSize = 0; clogPageCount = 0; for (Int32 i = chunkcnt - 1; i >= 0; i--) { const Uint32 cnt = chunks[i].cnt; ndbrequire(cnt != 0); Ptr<GlobalPage> pagePtr; m_shared_page_pool.getPtr(pagePtr, chunks[i].ptrI); LogPageRecord * base = (LogPageRecord*)pagePtr.p; ndbrequire(base >= logPageRecord); const Uint32 ptrI = Uint32(base - logPageRecord); for (Uint32 j = 0; j<cnt; j++) { refresh_watch_dog(); base[j].logPageWord[ZNEXT_PAGE] = ptrI + j + 1; base[j].logPageWord[ZPOS_IN_FREE_LIST]= 1; base[j].logPageWord[ZPOS_IN_WRITING]= 0; } base[cnt-1].logPageWord[ZNEXT_PAGE] = cfirstfreeLogPage; cfirstfreeLogPage = ptrI; clogPageCount += cnt; if (ptrI + cnt > clogPageFileSize) clogPageFileSize = ptrI + cnt; } cnoOfLogPages = clogPageCount; } #ifndef NO_REDO_PAGE_CACHE m_redo_page_cache.m_pool.set((RedoCacheLogPageRecord*)logPageRecord, clogPageFileSize); m_redo_page_cache.m_hash.setSize(63); const Uint32 * base = (Uint32*)logPageRecord; const RedoCacheLogPageRecord* tmp1 = (RedoCacheLogPageRecord*)logPageRecord; ndbrequire(&base[ZPOS_PAGE_NO] == &tmp1->m_page_no); ndbrequire(&base[ZPOS_PAGE_FILE_NO] == &tmp1->m_file_no); #endif #ifndef NO_REDO_OPEN_FILE_CACHE m_redo_open_file_cache.m_pool.set(logFileRecord, clogFileFileSize); #endif pageRefRecord = (PageRefRecord*)allocRecord("PageRefRecord", sizeof(PageRefRecord), cpageRefFileSize); c_scanRecordPool.setSize(cscanrecFileSize); c_scanTakeOverHash.setSize(64); tablerec = (Tablerec*)allocRecord("Tablerec", sizeof(Tablerec), ctabrecFileSize); tcConnectionrec = (TcConnectionrec*)allocRecord("TcConnectionrec", sizeof(TcConnectionrec), ctcConnectrecFileSize); m_commitAckMarkerPool.setSize(ctcConnectrecFileSize); m_commitAckMarkerHash.setSize(1024); tcNodeFailRecord = (TcNodeFailRecord*)allocRecord("TcNodeFailRecord", sizeof(TcNodeFailRecord), ctcNodeFailrecFileSize); /* ndbout << "FRAGREC SIZE = " << sizeof(Fragrecord) << endl; ndbout << "TAB SIZE = " << sizeof(Tablerec) << endl; ndbout << "GCP SIZE = " << sizeof(GcpRecord) << endl; ndbout << "LCP SIZE = " << sizeof(LcpRecord) << endl; ndbout << "LCPLOC SIZE = " << sizeof(LcpLocRecord) << endl; ndbout << "LOGPART SIZE = " << sizeof(LogPartRecord) << endl; ndbout << "LOGFILE SIZE = " << sizeof(LogFileRecord) << endl; ndbout << "TC SIZE = " << sizeof(TcConnectionrec) << endl; ndbout << "HOST SIZE = " << sizeof(HostRecord) << endl; ndbout << "LFO SIZE = " << sizeof(LogFileOperationRecord) << endl; ndbout << "PR SIZE = " << sizeof(PageRefRecord) << endl; ndbout << "SCAN SIZE = " << sizeof(ScanRecord) << endl; */ // Initialize BAT for interface to file system NewVARIABLE* bat = allocateBat(2); bat[1].WA = &logPageRecord->logPageWord[0]; bat[1].nrr = clogPageFileSize; bat[1].ClusterSize = sizeof(LogPageRecord); bat[1].bits.q = ZTWOLOG_PAGE_SIZE; bat[1].bits.v = 5; }//Dblqh::initRecords()