File tree 3 files changed +5
-5
lines changed
3 files changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -232,7 +232,7 @@ type ProducerMessage struct {
232
232
233
233
const producerMessageOverhead = 26 // the metadata overhead of CRC, flags, etc.
234
234
235
- func (m * ProducerMessage ) byteSize (version int ) int {
235
+ func (m * ProducerMessage ) ByteSize (version int ) int {
236
236
var size int
237
237
if version >= 2 {
238
238
size = maximumRecordOverhead
@@ -366,7 +366,7 @@ func (p *asyncProducer) dispatcher() {
366
366
p .returnError (msg , ConfigurationError ("Producing headers requires Kafka at least v0.11" ))
367
367
continue
368
368
}
369
- if msg .byteSize (version ) > p .conf .Producer .MaxMessageBytes {
369
+ if msg .ByteSize (version ) > p .conf .Producer .MaxMessageBytes {
370
370
p .returnError (msg , ErrMessageSizeTooLarge )
371
371
continue
372
372
}
Original file line number Diff line number Diff line change @@ -235,11 +235,11 @@ func (ps *produceSet) wouldOverflow(msg *ProducerMessage) bool {
235
235
236
236
switch {
237
237
// Would we overflow our maximum possible size-on-the-wire? 10KiB is arbitrary overhead for safety.
238
- case ps .bufferBytes + msg .byteSize (version ) >= int (MaxRequestSize - (10 * 1024 )):
238
+ case ps .bufferBytes + msg .ByteSize (version ) >= int (MaxRequestSize - (10 * 1024 )):
239
239
return true
240
240
// Would we overflow the size-limit of a message-batch for this partition?
241
241
case ps .msgs [msg .Topic ] != nil && ps.msgs [msg.Topic ][msg.Partition ] != nil &&
242
- ps.msgs [msg.Topic ][msg.Partition ].bufferBytes + msg .byteSize (version ) >= ps .parent .conf .Producer .MaxMessageBytes :
242
+ ps.msgs [msg.Topic ][msg.Partition ].bufferBytes + msg .ByteSize (version ) >= ps .parent .conf .Producer .MaxMessageBytes :
243
243
return true
244
244
// Would we overflow simply in number of messages?
245
245
case ps .parent .conf .Producer .Flush .MaxMessages > 0 && ps .bufferCount >= ps .parent .conf .Producer .Flush .MaxMessages :
Original file line number Diff line number Diff line change @@ -73,7 +73,7 @@ func TestProduceSetAddingMessagesOverflowBytesLimit(t *testing.T) {
73
73
74
74
msg := & ProducerMessage {Key : StringEncoder (TestMessage ), Value : StringEncoder (TestMessage )}
75
75
76
- for ps .bufferBytes + msg .byteSize (2 ) < parent .conf .Producer .MaxMessageBytes {
76
+ for ps .bufferBytes + msg .ByteSize (2 ) < parent .conf .Producer .MaxMessageBytes {
77
77
if ps .wouldOverflow (msg ) {
78
78
t .Error ("set shouldn't fill up before 1000 bytes" )
79
79
}
You can’t perform that action at this time.
0 commit comments