| 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 |
no test coverage detected