From 239c931f267c3e15c9c61049d2fd3c121f129576 Mon Sep 17 00:00:00 2001 From: Marko Mikulicic Date: Tue, 13 Jul 2021 17:44:08 +0200 Subject: [PATCH] fix: Raise max message to 10M And log message size on kafka write error. Turns out the kafka partition message size limit default is 1MB, but also the client side "max request size" default is also 1MB. The error message we get from our kafka client is misleading: it says ``` KafkaError (Message production error: MessageSizeTooLarge (Broker: Message size too large)) } ``` which to my mind it seemed like if ("Broker:") the broker said "Message size too large". That was a lie; I killed the broker and the client kept saying the same error message which means it didn't even try to send the message out. TODO: make this a proper parameter. (but let's unblock) --- server/src/lib.rs | 8 +++++--- server/src/write_buffer.rs | 1 + 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/server/src/lib.rs b/server/src/lib.rs index ef5487d69a..6ee36d1110 100644 --- a/server/src/lib.rs +++ b/server/src/lib.rs @@ -203,8 +203,8 @@ pub enum Error { ))] WritingOnlyAllowedThroughWriteBuffer { db_name: String }, - #[snafu(display("Cannot write to write buffer: {}", source))] - WriteBuffer { source: db::Error }, + #[snafu(display("Cannot write to write buffer, bytes {}: {}", bytes, source))] + WriteBuffer { source: db::Error, bytes: u64 }, #[snafu(display("no remote configured for node group: {:?}", node_group))] NoRemoteConfigured { node_group: NodeGroup }, @@ -805,7 +805,9 @@ where db_name: db_name.into(), } } - db::Error::WriteBufferWritingError { .. } => Error::WriteBuffer { source: e }, + db::Error::WriteBufferWritingError { .. } => { + Error::WriteBuffer { source: e, bytes } + } _ => Error::UnknownDatabaseError { source: Box::new(e), }, diff --git a/server/src/write_buffer.rs b/server/src/write_buffer.rs index 011ce08244..e68892f5ad 100644 --- a/server/src/write_buffer.rs +++ b/server/src/write_buffer.rs @@ -126,6 +126,7 @@ impl KafkaBufferProducer { let mut cfg = ClientConfig::new(); cfg.set("bootstrap.servers", &conn); cfg.set("message.timeout.ms", "5000"); + cfg.set("max.request.size", "10000000"); let producer: FutureProducer = cfg.create()?;