pulsar-client-go icon indicating copy to clipboard operation
pulsar-client-go copied to clipboard

[issue 447] double check message size when client enable compress

Open cocktail828 opened this issue 3 years ago • 4 comments

Fixes #447

Motivation

Try to fix issue #447.

Modifications

Compress the payload when the payload is too bigger, and check whever the 'compressed payload' is still bigger than expected.

cocktail828 avatar Jul 12 '22 07:07 cocktail828

Hello, I think this problem may be resolved in #805 . https://github.com/apache/pulsar-client-go/pull/805/files#diff-8adb09af2175be5751840343e14df2220a2154ca4bc8de21157ed112be25b6b9L521-L533

image

Gleiphir2769 avatar Jul 14 '22 02:07 Gleiphir2769

Is it possible to add some tests to verify it?

RobertIndie avatar Jul 14 '22 12:07 RobertIndie

Hello, I think this problem may be resolved in #805 . https://github.com/apache/pulsar-client-go/pull/805/files#diff-8adb09af2175be5751840343e14df2220a2154ca4bc8de21157ed112be25b6b9L521-L533

image

Hi @Gleiphir2769, according to the implement of Java-Client, it should also check 'encryptedPayload' not only the payload in 'ProducerMessage'. The valid payload is encapsuled with metaData headers and payloads ([metaDataSize][metaData][payload]....)(refer to https://pulsar.apache.org/docs/developing-binary-protocol) https://github.com/apache/pulsar/blob/24c62c137670fcaff69ae91be30d2b531470ee03/pulsar-client/src/main/java/org/apache/pulsar/client/impl/BatchMessageContainerImpl.java#L201

cocktail828 avatar Jul 16 '22 14:07 cocktail828

Hello, I think this problem may be resolved in #805 . https://github.com/apache/pulsar-client-go/pull/805/files#diff-8adb09af2175be5751840343e14df2220a2154ca4bc8de21157ed112be25b6b9L521-L533 image

Hi @Gleiphir2769, according to the implement of Java-Client, it should also check 'encryptedPayload' not only the payload in 'ProducerMessage'. The valid payload is encapsuled with metaData headers and payloads ([metaDataSize][metaData][payload]....)(refer to https://pulsar.apache.org/docs/developing-binary-protocol) https://github.com/apache/pulsar/blob/24c62c137670fcaff69ae91be30d2b531470ee03/pulsar-client/src/main/java/org/apache/pulsar/client/impl/BatchMessageContainerImpl.java#L201

You are right. In the Java Client it checks "encryptedPayload" in batching. But Java Client only checks the "encryptedPayload" before sending when batching enabled, which means it will not check maxMessageSize in sendAsync. I think the check should be implemented in Flush or somewhere.

Gleiphir2769 avatar Jul 18 '22 10:07 Gleiphir2769