[jira] [Commented] (KAFKA-8570) Downconversion could fail when log contains out of order message formats
[ https://issues.apache.org/jira/browse/KAFKA-8570?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16884010#comment-16884010 ] ASF GitHub Bot commented on KAFKA-8570: --- hachikuji commented on pull request #7071: KAFKA-8570: Grow buffer to hold down converted records if it was insufficiently sized URL: https://github.com/apache/kafka/pull/7071 This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Downconversion could fail when log contains out of order message formats > > > Key: KAFKA-8570 > URL: https://issues.apache.org/jira/browse/KAFKA-8570 > Project: Kafka > Issue Type: Bug >Reporter: Dhruvil Shah >Assignee: Dhruvil Shah >Priority: Major > Fix For: 2.0.2, 2.1.2, 2.2.2, 2.3.1 > > > When the log contains out of order message formats (for example a v2 message > followed by a v1 message), it is possible for down-conversion to fail in > certain scenarios where batches compressed and greater than 1kB in size. > Down-conversion fails with a stack like the following: > java.lang.IllegalArgumentException > at java.nio.Buffer.limit(Buffer.java:275) > at > org.apache.kafka.common.record.FileLogInputStream$FileChannelRecordBatch.writeTo(FileLogInputStream.java:176) > at > org.apache.kafka.common.record.AbstractRecords.downConvert(AbstractRecords.java:107) > at > org.apache.kafka.common.record.FileRecords.downConvert(FileRecords.java:242) -- This message was sent by Atlassian JIRA (v7.6.14#76016)
[jira] [Commented] (KAFKA-8570) Downconversion could fail when log contains out of order message formats
[ https://issues.apache.org/jira/browse/KAFKA-8570?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16882488#comment-16882488 ] ASF GitHub Bot commented on KAFKA-8570: --- dhruvilshah3 commented on pull request #7071: KAFKA-8570: Grow buffer to hold down converted records if it was insufficiently sized URL: https://github.com/apache/kafka/pull/7071 Backport https://github.com/apache/kafka/pull/6974 to 1.1 When the log contains out of order message formats (for example v2 message followed by v1 message) and consists of compressed batches typically greater than 1kB in size, it is possible for down-conversion to fail. With compressed batches, we estimate the size of down-converted batches using: ``` private static int estimateCompressedSizeInBytes(int size, CompressionType compressionType) { return compressionType == CompressionType.NONE ? size : Math.min(Math.max(size / 2, 1024), 1 << 16); } ``` This almost always underestimates size of down-converted records if the batch is between 1kB-64kB in size. In general, this means we may under estimate the total size required for compressed batches. Because of an implicit assumption in the code that messages with a lower message format appear before any with a higher message format, we do not grow the buffer we copy the down converted records into when we see a message <= the target message format. This assumption becomes incorrect when the log contains out of order message formats, for example because of leaders flapping while upgrading the message format. This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Downconversion could fail when log contains out of order message formats > > > Key: KAFKA-8570 > URL: https://issues.apache.org/jira/browse/KAFKA-8570 > Project: Kafka > Issue Type: Bug >Reporter: Dhruvil Shah >Assignee: Dhruvil Shah >Priority: Major > Fix For: 2.0.2, 2.1.2, 2.2.2, 2.3.1 > > > When the log contains out of order message formats (for example a v2 message > followed by a v1 message), it is possible for down-conversion to fail in > certain scenarios where batches compressed and greater than 1kB in size. > Down-conversion fails with a stack like the following: > java.lang.IllegalArgumentException > at java.nio.Buffer.limit(Buffer.java:275) > at > org.apache.kafka.common.record.FileLogInputStream$FileChannelRecordBatch.writeTo(FileLogInputStream.java:176) > at > org.apache.kafka.common.record.AbstractRecords.downConvert(AbstractRecords.java:107) > at > org.apache.kafka.common.record.FileRecords.downConvert(FileRecords.java:242) -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (KAFKA-8570) Downconversion could fail when log contains out of order message formats
[ https://issues.apache.org/jira/browse/KAFKA-8570?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16869657#comment-16869657 ] ASF GitHub Bot commented on KAFKA-8570: --- hachikuji commented on pull request #6974: KAFKA-8570: Grow buffer to hold down converted records if it was insufficiently sized URL: https://github.com/apache/kafka/pull/6974 This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Downconversion could fail when log contains out of order message formats > > > Key: KAFKA-8570 > URL: https://issues.apache.org/jira/browse/KAFKA-8570 > Project: Kafka > Issue Type: Bug >Reporter: Dhruvil Shah >Assignee: Dhruvil Shah >Priority: Major > > When the log contains out of order message formats (for example a v2 message > followed by a v1 message), it is possible for down-conversion to fail in > certain scenarios where batches compressed and greater than 1kB in size. > Down-conversion fails with a stack like the following: > java.lang.IllegalArgumentException > at java.nio.Buffer.limit(Buffer.java:275) > at > org.apache.kafka.common.record.FileLogInputStream$FileChannelRecordBatch.writeTo(FileLogInputStream.java:176) > at > org.apache.kafka.common.record.AbstractRecords.downConvert(AbstractRecords.java:107) > at > org.apache.kafka.common.record.FileRecords.downConvert(FileRecords.java:242) -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (KAFKA-8570) Downconversion could fail when log contains out of order message formats
[ https://issues.apache.org/jira/browse/KAFKA-8570?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16868139#comment-16868139 ] ASF GitHub Bot commented on KAFKA-8570: --- dhruvilshah3 commented on pull request #6974: KAFKA-8570: Grow buffer to hold down converted records if it was insufficiently sized URL: https://github.com/apache/kafka/pull/6974 When the log contains out of order message formats (for example v2 message followed by v1 message) and consists of compressed batches typically greater than 1kB in size, it is possible for down-conversion to fail. With compressed batches, we estimate the size of down-converted batches using: ``` private static int estimateCompressedSizeInBytes(int size, CompressionType compressionType) { return compressionType == CompressionType.NONE ? size : Math.min(Math.max(size / 2, 1024), 1 << 16); } ``` This almost always underestimates size of down-converted records if the batch is between 1kB-64kB in size. In general, this means we may under estimate the total size required for compressed batches. Because of an implicit assumption in the code that messages with a lower message format appear before any with a higher message format, we do not grow the buffer we copy the down converted records into when we see a message <= the target message format. This assumption becomes incorrect when the log contains out of order message formats, for example because of leaders flapping while upgrading the message format. This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Downconversion could fail when log contains out of order message formats > > > Key: KAFKA-8570 > URL: https://issues.apache.org/jira/browse/KAFKA-8570 > Project: Kafka > Issue Type: Bug >Reporter: Dhruvil Shah >Assignee: Dhruvil Shah >Priority: Major > > When the log contains out of order message formats (for example a v2 message > followed by a v1 message), it is possible for down-conversion to fail in > certain scenarios where batches compressed and greater than 1kB in size. > Down-conversion fails with a stack like the following: > java.lang.IllegalArgumentException > at java.nio.Buffer.limit(Buffer.java:275) > at > org.apache.kafka.common.record.FileLogInputStream$FileChannelRecordBatch.writeTo(FileLogInputStream.java:176) > at > org.apache.kafka.common.record.AbstractRecords.downConvert(AbstractRecords.java:107) > at > org.apache.kafka.common.record.FileRecords.downConvert(FileRecords.java:242) -- This message was sent by Atlassian JIRA (v7.6.3#76005)