Skip to content

Commit

Permalink
feat: show actual record size when throw maximum request size error (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
fraidev authored Nov 12, 2024
1 parent 2f31d45 commit 4734e0c
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ k8-diff = { version = "0.1.2" }
trybuild = { branch = "check_option", git = "https://github.com/infinyon/trybuild" }

# Internal fluvio dependencies
fluvio = { version = "0.24.0", path = "crates/fluvio" }
fluvio = { version = "0.25.0", path = "crates/fluvio" }
fluvio-auth = { path = "crates/fluvio-auth" }
fluvio-channel = { path = "crates/fluvio-channel" }
fluvio-cli-common = { path = "crates/fluvio-cli-common"}
Expand Down
2 changes: 1 addition & 1 deletion crates/fluvio/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "fluvio"
version = "0.24.0"
version = "0.25.0"
edition = "2021"
license = "Apache-2.0"
authors = ["Fluvio Contributors <[email protected]>"]
Expand Down
4 changes: 2 additions & 2 deletions crates/fluvio/src/producer/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ use crate::producer::PartitionId;
#[derive(thiserror::Error, Debug, Clone)]
#[non_exhaustive]
pub enum ProducerError {
#[error("the given record is larger than the max_request_size ({0} bytes)")]
RecordTooLarge(usize),
#[error("record size ({0} bytes), exceeded maximum request size ({0} bytes)")]
RecordTooLarge(usize, usize),
#[error("failed to send record metadata: {0}")]
SendRecordMetadata(#[from] async_channel::SendError<RecordMetadata>),
#[error("failed to get record metadata")]
Expand Down
5 changes: 4 additions & 1 deletion crates/fluvio/src/producer/memory_batch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,10 @@ impl MemoryBatch {
// Error if the record is too large
if actual_batch_size > self.write_limit {
self.is_full = true;
return Err(ProducerError::RecordTooLarge(actual_batch_size));
return Err(ProducerError::RecordTooLarge(
record_size,
actual_batch_size,
));
}

// is full, but is first record, add to the batch and then we will send it directly
Expand Down
2 changes: 1 addition & 1 deletion rfc/produce-message-size.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ fluvio produce large-data-topic --max-request-size 16384 --file large-data-file.
Will be displayed the following error:

```bash
the given record is larger than the max_request_size (16384 bytes).
record size (xyz bytes), exceeded maximum request size (1048576 bytes)
```

### Compression
Expand Down
2 changes: 1 addition & 1 deletion tests/cli/fluvio_smoke_tests/produce-error.bats
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ teardown_file() {
skip "don't check output on stable version"
fi

assert_output --partial "the given record is larger than the max_request_size"
assert_output --partial "exceeded maximum request size"
}

# This should fail due to wrong compression algorithm
Expand Down

0 comments on commit 4734e0c

Please sign in to comment.