Skip to content
This repository has been archived by the owner on Apr 1, 2023. It is now read-only.

Pseudo code for handling replay #174

Open
iafuture opened this issue Apr 30, 2021 · 0 comments
Open

Pseudo code for handling replay #174

iafuture opened this issue Apr 30, 2021 · 0 comments

Comments

@iafuture
Copy link
Contributor

                                                                TimeOfReplay 
                    | ..... retention window ....           ... | /// TimeOfReplay - 1h

| TWIM_IPR_PIP | .| WI1 | WI2 |.| TXN_COMMIT_PIP | TWIM_FINALIZED_PIP | TXN_FINALIZED_PIP /// at TRH

| TWIM_IPR_PIP | .... | WI3 | WI4 | .. | TWIM_FINALIZED_PIP /// at participant finalized

| TWIM_IPR_PIP | .... | WI3 | WI4 | .. /// at participant not finalized

// these steps are executed with disabled persistence
for (entry: WAL) {
if (isTwimCreate(entry)) {
_twimMgr.add(entry)
if (keyBelongsToMe(entry.trh)) {
_txnMgr.add(entry); // make the record InProgress
}
}
else if isWI(entry) {
addWIinIndexer(entry);
registerWIWithTwim(entry);
}
else if isTxnEnd(entry) {
_txnMgr.update(entry)
}
else if isTwimFinalized(entry) {
_twimMgr.finalize(entry.ts)
}
else if isTxnFinalized(entry) {
_txnMgr.remove(entry)
}
}

// these steps are executed with enabled persistence
for (tr: txnMgr.txns()) {
if tr.inProgress() {
txnMgr.forceAbort(tr)
// trigger RWE if applicable
}
if tr.isEnded() {
txnMgr.finalize(tr)
}
}

for (twim: twimMgr.twims()) {
checkTwimWithTRH(twim); // could be Committed, Aborted, or still InProgress
}

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant