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

Function replicate

src/remote/server/ReplServer.cpp:600–636  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

598 enum ActionType { REPLICATE, REPLAY, FAST_FORWARD };
599
600 void replicate(Target* target,
601 TransactionList& transactions,
602 FB_UINT64 sequence, ULONG offset,
603 ULONG length, const UCHAR* data,
604 ActionType action)
605 {
606 const Block* const header = (Block*) data;
607
608 const auto traNumber = header->traNumber;
609
610 if (action == REPLICATE ||
611 (action == REPLAY && (!traNumber || transactions.exist(traNumber))))
612 {
613 target->replicate(sequence, offset, length, data);
614 }
615
616 if (header->flags & BLOCK_END_TRANS)
617 {
618 if (traNumber)
619 {
620 FB_SIZE_T pos;
621 if (transactions.find(traNumber, pos))
622 transactions.remove(pos);
623 }
624 else if (action != REPLAY)
625 {
626 transactions.clear();
627 }
628 }
629 else if (header->flags & BLOCK_BEGIN_TRANS)
630 {
631 fb_assert(traNumber);
632
633 if (action != REPLAY && !transactions.exist(traNumber))
634 transactions.add(ActiveTransaction(traNumber, sequence));
635 }
636 }
637
638 enum ProcessStatus { PROCESS_SUSPEND, PROCESS_CONTINUE, PROCESS_ERROR, PROCESS_SHUTDOWN };
639

Callers 1

process_archiveFunction · 0.85

Calls 7

ActiveTransactionClass · 0.85
existMethod · 0.45
replicateMethod · 0.45
findMethod · 0.45
removeMethod · 0.45
clearMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected