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

Method ChangeLog

src/jrd/replication/ChangeLog.cpp:350–388  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

348// ChangeLog class implementation
349
350ChangeLog::ChangeLog(MemoryPool& pool,
351 const string& dbId,
352 const Guid& guid,
353 const FB_UINT64 sequence,
354 const Replication::Config* config)
355 : PermanentStorage(pool),
356 m_dbId(dbId), m_config(config), m_segments(pool),
357 m_sequence(sequence), m_generation(0), m_shutdown(false)
358{
359 memcpy(&m_guid, &guid, sizeof(Guid));
360
361 initSharedFile();
362
363 { // scope
364 LockGuard guard(this);
365
366 // If the server crashes while archiving, segments may remain in the ARCH state forever.
367 // This code allows to recover their state and retry archiving them.
368
369 const auto state = m_sharedMemory->getHeader();
370
371 if (!state->pidUpper)
372 {
373 fb_assert(!state->pidLower);
374
375 for (const auto segment : m_segments)
376 {
377 if (segment->getState() == SEGMENT_STATE_ARCH)
378 segment->setState(SEGMENT_STATE_FULL);
379 }
380 }
381
382 linkSelf();
383 }
384
385 Thread::start(archiver_thread, this, THREAD_medium);
386 m_startupSemaphore.enter();
387 m_workingSemaphore.release();
388}
389
390ChangeLog::~ChangeLog()
391{

Callers

nothing calls this directly

Calls 6

startFunction · 0.50
getHeaderMethod · 0.45
getStateMethod · 0.45
setStateMethod · 0.45
enterMethod · 0.45
releaseMethod · 0.45

Tested by

no test coverage detected