21 #include <SimulatedBlock.hpp>
23 #include <DLCHashTable.hpp>
24 #include <DLCFifoList.hpp>
25 #include <NodeBitmask.hpp>
26 #include <signaldata/LCP.hpp>
30 #include <OutputStream.hpp>
242 BLOCK_DEFINES(
Pgman);
249 friend struct Page_entry;
251 struct Page_request {
259 ,UNLOCK_PAGE = 0x0400
271 Uint64 m_delay_until_time;
281 struct Page_entry_stack_ptr {
286 struct Page_entry_queue_ptr {
291 struct Page_entry_sublist_ptr {
296 typedef Uint16 Page_state;
298 struct Page_entry : Page_entry_stack_ptr,
299 Page_entry_queue_ptr,
300 Page_entry_sublist_ptr {
302 Page_entry(Uint32 file_no, Uint32 page_no);
340 Uint32 m_real_page_i;
344 Uint32 m_dirty_count;
345 Uint32 m_copy_page_i;
356 Uint32 hashValue()
const {
return m_file_no << 16 | m_page_no; }
357 bool equal(
const Page_entry& obj)
const {
359 m_file_no == obj.m_file_no && m_page_no == obj.m_page_no;
373 class Lgman *c_lgman;
374 class Tsman *c_tsman;
377 bool m_stats_loop_on;
379 bool m_cleanup_loop_on;
386 ,LS_LCP_MAX_LCP_OUTSTANDING = 2
390 Uint32 m_last_lcp_complete;
391 Uint32 m_lcp_curr_bucket;
392 Uint32 m_lcp_outstanding;
409 Page_sublist* m_page_sublist[Page_entry::SUBLIST_COUNT];
415 Uint32 m_lirs_stack_mult;
416 Uint32 m_max_hot_pages;
417 Uint32 m_max_loop_count;
418 Uint32 m_max_io_waits;
419 Uint32 m_stats_loop_delay;
420 Uint32 m_cleanup_loop_delay;
421 Uint32 m_lcp_loop_delay;
429 m_current_io_waits(0),
433 m_pages_written_lcp(0),
436 m_page_requests_direct_return(0),
437 m_page_requests_wait_q(0),
438 m_page_requests_wait_io(0)
441 Uint32 m_num_hot_pages;
442 Uint32 m_current_io_waits;
444 Uint64 m_page_faults;
445 Uint64 m_pages_written;
446 Uint64 m_pages_written_lcp;
449 Uint64 m_page_requests_direct_return;
450 Uint64 m_page_requests_wait_q;
451 Uint64 m_page_requests_wait_io;
456 LOGSYNC_CALLBACK = 1,
463 void execSTTOR(
Signal* signal);
464 void sendSTTORRY(
Signal*);
465 void execREAD_CONFIG_REQ(
Signal* signal);
466 void execCONTINUEB(
Signal* signal);
468 void execLCP_FRAG_ORD(
Signal*);
469 void execEND_LCP_REQ(
Signal*);
470 void execRELEASE_PAGES_REQ(
Signal*);
472 void execFSREADCONF(
Signal*);
473 void execFSREADREF(
Signal*);
474 void execFSWRITECONF(
Signal*);
475 void execFSWRITEREF(
Signal*);
477 void execDUMP_STATE_ORD(
Signal* signal);
479 void execDATA_FILE_ORD(
Signal*);
481 void execDBINFO_SCANREQ(
Signal*);
484 static Uint32 get_sublist_no(Page_state state);
488 void release_cache_page(Uint32
i);
490 bool find_page_entry(
Ptr<Page_entry>&, Uint32 file_no, Uint32 page_no);
491 Uint32 seize_page_entry(
Ptr<Page_entry>&, Uint32 file_no, Uint32 page_no);
495 void lirs_stack_prune();
496 void lirs_stack_pop();
499 void do_stats_loop(
Signal*);
500 void do_busy_loop(
Signal*,
bool direct =
false);
501 void do_cleanup_loop(
Signal*);
502 void do_lcp_loop(
Signal*);
504 bool process_bind(
Signal*);
506 bool process_map(
Signal*);
508 bool process_callback(
Signal*);
511 bool process_cleanup(
Signal*);
514 LCP_STATE process_lcp(
Signal*);
522 void logsync_callback(
Signal*, Uint32 ptrI, Uint32 res);
529 Uint32 create_data_file();
530 Uint32 alloc_data_file(Uint32 file_no);
531 void map_file_no(Uint32 file_no, Uint32 fd);
532 void free_data_file(Uint32 file_no, Uint32 fd = RNIL);
537 bool debugSummaryFlag;
539 void verify_page_lists();
541 bool dump_page_lists(Uint32 ptrI = RNIL);
543 static const char* get_sublist_name(Uint32 list_no);
544 friend class NdbOut& operator<<(NdbOut&, Ptr<Page_request>);
545 friend class NdbOut& operator<<(NdbOut&, Ptr<Page_entry>);
548 class NdbOut& operator<<(NdbOut&, Ptr<Pgman::Page_request>);
549 class NdbOut& operator<<(NdbOut&, Ptr<Pgman::Page_entry>);
557 DEBUG_OUT_DEFINES(PGMAN);
567 Uint64 m_delay_until_time;
574 LOCK_PAGE = Pgman::Page_request::LOCK_PAGE
575 ,EMPTY_PAGE = Pgman::Page_request::EMPTY_PAGE
576 ,ALLOC_REQ = Pgman::Page_request::ALLOC_REQ
577 ,COMMIT_REQ = Pgman::Page_request::COMMIT_REQ
578 ,DIRTY_REQ = Pgman::Page_request::DIRTY_REQ
579 ,UNLOCK_PAGE = Pgman::Page_request::UNLOCK_PAGE
580 ,CORR_REQ = Pgman::Page_request::CORR_REQ
582 ,DELAY_REQ = Pgman::Page_request::DELAY_REQ