Skip to content
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

Feature: add PayloadTooLarge error #951

Merged
merged 1 commit into from
Nov 26, 2023

Conversation

drmingdrmer
Copy link
Member

@drmingdrmer drmingdrmer commented Nov 24, 2023

Changelog

Feature: add PayloadTooLarge error

If a RaftNetwork implmentation found an AppendEntriesRequest is too
large, it could return a PayloadTooLarge::new_entries_hint(n) error to
tell openraft devide request into smaller chunks containing at most n
entries. Openraft will limit the number of entries in the next 10
AppendEntrie RPC.

Exmaple:

impl<C: RaftTypeConfig> RaftNetwork<C> for MyNetwork {
    fn append_entries(&self,
            rpc: AppendEntriesRequest<C>,
            option: RPCOption
    ) -> Result<_, RPCError<C::NodeId, C::Node, RaftError<C::NodeId>>> {
        if rpc.entries.len() > 10 {
            return Err(PayloadTooLarge::new_entries_hint(10).into());
        }
        // ...
    }
}

This change is Reviewable

If a `RaftNetwork` implmentation found an `AppendEntriesRequest` is too
large, it could return a `PayloadTooLarge::new_entries_hint(n)` error to
tell openraft devide request into smaller chunks containing at most `n`
entries. Openraft will limit the number of entries in the next 10
`AppendEntrie` RPC.

Exmaple:

```rust
impl<C: RaftTypeConfig> RaftNetwork<C> for MyNetwork {
    fn append_entries(&self,
            rpc: AppendEntriesRequest<C>,
            option: RPCOption
    ) -> Result<_, RPCError<C::NodeId, C::Node, RaftError<C::NodeId>>> {
        if rpc.entries.len() > 10 {
            return Err(PayloadTooLarge::new_entries_hint(10).into());
        }
        // ...
    }
}
```
@drmingdrmer drmingdrmer force-pushed the 32-handle-failed-append branch from fe330a0 to 961469c Compare November 26, 2023 02:54
@drmingdrmer drmingdrmer added this pull request to the merge queue Nov 26, 2023
Merged via the queue into databendlabs:main with commit f4d047f Nov 26, 2023
24 checks passed
@drmingdrmer drmingdrmer deleted the 32-handle-failed-append branch November 26, 2023 09:08
@drmingdrmer drmingdrmer mentioned this pull request Mar 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants