MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / BufferControl

Class BufferControl

src/jrd/cch.h:78–175  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

76// BufferControl -- Buffer control block -- one per system
77
78class BufferControl : public pool_alloc<type_bcb>
79{
80 BufferControl(MemoryPool& p, Firebird::MemoryStats& parentStats)
81 : bcb_bufferpool(&p),
82 bcb_memory_stats(&parentStats),
83 bcb_memory(p),
84 bcb_writer_fini(p, cache_writer, THREAD_medium),
85 bcb_bdbBlocks(p)
86 {
87 bcb_database = NULL;
88 QUE_INIT(bcb_in_use);
89 QUE_INIT(bcb_pending);
90 QUE_INIT(bcb_empty);
91 QUE_INIT(bcb_dirty);
92 bcb_dirty_count = 0;
93 bcb_free = NULL;
94 bcb_flags = 0;
95 bcb_free_minimum = 0;
96 bcb_count = 0;
97 bcb_inuse = 0;
98 bcb_prec_walk_mark = 0;
99 bcb_page_size = 0;
100 bcb_page_incarnation = 0;
101 bcb_hashTable = nullptr;
102#ifdef SUPERSERVER_V2
103 bcb_prefetch = NULL;
104#endif
105 }
106
107public:
108
109 static BufferControl* create(Database* dbb);
110 static void destroy(BufferControl*);
111
112 Database* bcb_database;
113
114 Firebird::MemoryPool* bcb_bufferpool;
115 Firebird::MemoryStats bcb_memory_stats;
116
117 UCharStack bcb_memory; // Large block partitioned into buffers
118 que bcb_in_use; // Que of buffers in use, main LRU que
119 que bcb_pending; // Que of buffers which are going to be freed and reassigned
120 que bcb_empty; // Que of empty buffers
121
122 // Recently used buffer put there without locking common LRU que (bcb_in_use).
123 // When bcb_syncLRU is locked this chain is merged into bcb_in_use. See also
124 // requeueRecentlyUsed() and recentlyUsed()
125 std::atomic<BufferDesc*> bcb_lru_chain;
126
127 que bcb_dirty; // que of dirty buffers
128 SLONG bcb_dirty_count; // count of pages in dirty page btree
129
130 Precedence* bcb_free; // Free precedence blocks
131 Firebird::AtomicCounter bcb_flags; // see below
132 SSHORT bcb_free_minimum; // Threshold to activate cache writer
133 ULONG bcb_count; // Number of buffers allocated
134 ULONG bcb_inuse; // Number of buffers in use
135 ULONG bcb_prec_walk_mark; // mark value used in precedence graph walk

Callers 1

createMethod · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected