-
Notifications
You must be signed in to change notification settings - Fork 118
[Bifrost] BackgroundAppender respects record-size-limit when cutting batches #4144
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
Conversation
Test Results 5 files - 2 5 suites - 2 1m 14s ⏱️ - 2m 7s Results for commit d4a4d9c. ± Comparison against base commit 81a5288. This pull request removes 47 and adds 34 tests. Note that renamed tests count towards both. |
tillrohrmann
left a comment
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.
Great work @AhmedSoliman. Thanks a lot for making our batching logic aware of byte limits so that we don't generate too large batches! LGTM. +1 for merging :-)
| let token = sender.notify_committed().await?; | ||
| token.await?; | ||
|
|
||
| handle.drain().await?; |
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.
Is this important for the below assertion to succeed? Or would it be enought to await the token and then to the find_tail operation?
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.
it's superfluous.
e3c3aca to
efa7924
Compare
Add a record size limit check at append time in Bifrost to validate that individual records do not exceed a configured maximum size. Important note: This configuration option is not going to be effective without implementing size estimation of records. At the moment, all typed records are assumed to be 2048 bytes in size which makes this check useless. Nevertheless, This check is useful for the future when we implement size estimation of records. Changes: - Add `bifrost.record-size-limit` configuration option that defaults to `networking.message-size-limit` (32 MiB) and is clamped to that value - Add `BatchTooLarge/RecordTooLarge` error variants to get notified when a record too large or when a batch is too large depending on whether you're using Appender or BackgroundAppender. - Add record size validation to all `LogSender` enqueue methods in `BackgroundAppender` to fail fast at enqueue time This prevents oversized records from being written to the log, which could cause issues during replication and network transmission. Part of #4130, #4132
The goal is to make sure that the user can still set the VO state to a value within the message size limit without failing. For instance, using the large-state-service, with this change, we can do: ``` curl http://localhost:8080/LargeState/224/state --silent --json '50000000' "State set"% ``` While running the server with ```RESTATE_NETWORKING__MESSAGE_SIZE_LIMIT=50000000``` Related to #4130
…batches Previously, BackgroundAppender used recv_many() to batch records by count only (max_batch_size). This change adds byte-size awareness to batch cutting, ensuring batches do not exceed the configured record_size_limit. Closes #4132 Changes: - Introduce Batch struct to track accumulated bytes alongside operations - Add AppendOperation::cost_in_bytes() to calculate record sizes - Replace recv_many() with recv()/try_recv() loop that checks both byte and count limits before adding to batch - Flush batch when adding a new operation would exceed limits - Use cancellation_token() instead of cancellation_watcher() for drain The batch is cut when either: - Adding the next record would exceed batch_limit_bytes - The batch reaches max_batch_size count
Previously, BackgroundAppender used recv_many() to batch records by count
only (max_batch_size). This change adds byte-size awareness to batch cutting,
ensuring batches do not exceed the configured record_size_limit.
Closes #4132
Changes:
and count limits before adding to batch
The batch is cut when either:
Stack created with Sapling. Best reviewed with ReviewStack.