-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(outbox): implement outbox queue on transaction #548
Conversation
Codecov ReportAttention: Patch coverage is
... and 4 files with indirect coverage changes Continue to review full report in Codecov by Sentry.
|
59bcf1d
to
72460ad
Compare
ae53270
to
995a24b
Compare
crates/jstz_core/src/kv/outbox.rs
Outdated
/// next flush. | ||
pub fn flush( | ||
&mut self, | ||
host: &mut impl Runtime, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
host: &mut impl Runtime, | |
rt: &mut impl Runtime, |
crates/jstz_core/src/kv/outbox.rs
Outdated
let max = u16::MAX as u32; | ||
let mut outbox_queue = OutboxQueue { | ||
meta: OutboxQueueMeta { | ||
queue_len: 120, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Incorrect setup? Initial queue length is 60
crates/jstz_core/src/kv/outbox.rs
Outdated
|
||
outbox_queue.flush(&mut host, outbox_queue_snapshot); | ||
|
||
assert_eq!(20, outbox_queue.queue_len()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Incorrect calculation: 120 - 60 (flushed) - 40 (written) = 20
Should be: 60 - 60 (flushed) + 20 (queued) = 20
bdbd15d
to
10d45f0
Compare
617b2ff
to
e4ad642
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm 🚀
feat(outbox): move outbox snapshots into outbox queue
Context
This PR omplements the lower level transactional outbox queue api
Part of JSTZ-27
Description
Why
The kernel is only allowed to write 100 messages per level. Luckily, the kernel sdk to expose an OutboxQueue which decouples enqueuing outbox messages and writing to the outbox, allowing a much high upper limit of outbox messages to be persisted as long as they are flushed (ideally, every level). However, the
OutboxQueue
is eager to write to persistent storage on message enqueue which makes it difficult to rollback and doesn't fit our transaction model.What
Instead, we define an outbox queue for each snapshot that adheres to the transaction rules. Furthermore, an api is added to transaction to enqueue messages to the latest snapshot and to flush messages (on commit).
Here are high level details:
Manually testing the PR
cargo test -p jstz_core kv