Commit Graph

5472 Commits

Author SHA1 Message Date
Stanislav Vodetskyi 032042afd2 MINOR: Upgrade ducktape to version 0.7.11 (#9932)
ducktape 0.7.11 fixes a bug where a unicode exception message would cause test runner to hang up and never finish.
This change should be backported to all the branches using ducktape 0.7.10

Reviewers: Konstantine Karantasis <k.karantasis@gmail.com>
2021-01-22 20:38:01 -08:00
Stanislav Vodetskyi 9e404a3075 MINOR: Pin ducktape to version 0.7.10
Ducktape version 0.7.10 pinned paramiko to version 2.3.2 to deal with random SSHExceptions confluent had been seeing since ducktape was updated to a later version of paramiko.

The idea is that we can backport ducktape 0.7.10 change as far back as possible, while 2.7 and trunk can update to 0.8.0 and python3 separately.

Tested:
In progress, but unlikely to affect anything, since the only difference between ducktape 0.7.9 and 0.7.10 is paramiko version downgrade.

Author: Stanislav Vodetskyi <stan@confluent.io>

Reviewers: Manikumar Reddy <manikumar.reddy@gmail.com>

Closes #9490 from stan-confluent/ducktape-710-26

(cherry picked from commit 1cbc4da0c9)
Signed-off-by: Manikumar Reddy <manikumar.reddy@gmail.com>
2020-10-24 22:00:02 +05:30
Alex Diachenko c7e1c3d209 KAFKA-10439: Connect's Values to parse BigInteger as Decimal with zero scale. (#9320)
The `org.apache.kafka.connect.data.Values#parse` method parses integers, which are larger than `Long.MAX_VALUE` as `double` with `Schema.FLOAT64_SCHEMA`.

That means we are losing precision for these larger integers.

For example:
`SchemaAndValue schemaAndValue = Values.parseString("9223372036854775808");`
returns:
`SchemaAndValue{schema=Schema{FLOAT64}, value=9.223372036854776E18}`

Also, this method parses values that can be parsed as `FLOAT32` to `FLOAT64`.

This PR changes parsing logic, to use `FLOAT32`/`FLOAT64` for numbers that don't have fraction part(`decimal.scale()!=0`) only, and use an arbitrary-precision `org.apache.kafka.connect.data.Decimal` otherwise.
Also, it updates the method to parse numbers, that can be represented as `float` to `FLOAT64`.

Added unit tests, that cover parsing `BigInteger`, `Byte`, `Short`, `Integer`, `Long`, `Float`, `Double` types.

Reviewers: Konstantine Karantasis <k.karantasis@gmail.com>
2020-10-05 18:09:26 -07:00
Andrew Egelhofer 59b4ac5c5d MINOR: Use new version of ducktape
ducktape diff: https://github.com/confluentinc/ducktape/compare/v0.7.8...v0.7.9

- bcrypt (a dependency of ducktape) dropped Python2.7 support.
ducktape-0.7.9 now pins bcrypt to a Python2.7-supported version.

Author: Andrew Egelhofer <aegelhofer@confluent.io>

Reviewers: Dhruvil Shah <dhruvil@confluent.io>, Manikumar Reddy <manikumar.reddy@gmail.com>

Closes #9192 from andrewegel/trunk
2020-08-18 07:30:18 +05:30
Ego 8c4d78ee2a MINOR: Upgrade ducktape to 0.7.8 (#8879)
Newer version of ducktape that updates some dependencies and adds some features. You can see that diff here:

https://github.com/confluentinc/ducktape/compare/v0.7.7...v0.7.8

Reviewer: Konstantine Karantasis <konstantine@confluent.io>
2020-06-17 22:01:52 -07:00
Lucas Bradstreet 702c262c84 KAFKA-8499: ensure java is in PATH for ducker system tests (#6898)
Reviewers: Colin P. McCabe <cmccabe@apache.org>
2020-06-01 14:20:48 -05:00
Bruno Cadonna 8bd7715b85 MINOR: Fix Streams EOS system tests by adding clean-up of state dir (#7693)
Recently, system tests test_rebalance_[simple|complex] failed
repeatedly with a verfication error. The cause was most probably
the missing clean-up of a state directory of one of the processors.

A node is cleaned up when a service on that node is started and when
a test is torn down.

If the clean-up flag clean_node_enabled of a EOS Streams service is
unset, the clean-up of the node is skipped.

The clean-up flag of processor1 in the EOS tests should stay set before
its first start, so that the node is cleaned before the service is started.
Afterwards for the multiple restarts of processor1 the cleans-up flag should
be unset to re-use the local state.

After the multiple restarts are done, the clean-up flag of processor1 should
again be set to trigger node clean-up during the test teardown.

A dirty node can lead to test failures when tests from Streams EOS tests are
scheduled on the same node, because the state store would not start empty
since it reads the local state that was not cleaned up.

Reviewers: Matthias J. Sax <mjsax@apache.org>, Andrew Choi <andchoi@linkedin.com>, Bill Bejeck <bbejeck@gmail.com>
2020-06-01 14:05:29 -05:00
Ewen Cheslack-Postava c295cdb477 MINOR: Upgrade ducktape to 0.7.7 (#8487)
This fixes a version pinning issue where a transitive dependency had a
major version upgrade that a dependency did not account for, breaking
the build.

Reviewers: Andrew Egelhofer <aegelhofer@confluent.io>, Matthias J. Sax <matthias@confluent.io>
2020-04-14 16:57:56 -07:00
Svend Vanderveken a11d6a5216 MINOR: Fix error message in exception when records have schemas in Connect's Flatten transformation (#3982)
In case of an error while flattening a record with schema, the Flatten transformation was reporting an error about a record without schema, as follows: 

```
org.apache.kafka.connect.errors.DataException: Flatten transformation does not support ARRAY for record without schemas (for field ...)
```

The expected behaviour would be an error message specifying "with schemas". 

This looks like a simple copy/paste typo from the schemaless equivalent methods, in the same file 

Reviewers: Ewen Cheslack-Postava <me@ewencp.org>, Konstantine Karantasis <konstantine@confluent.io>
2020-03-28 21:30:56 -07:00
Scott bc3062ca8d MINOR: Fix code example reference to SchemaBuilder call in Connect's documentation (#3029)
Simple doc fix in a code snippet in connect.html

Co-authored-by: Scott Ferguson <smferguson@gmail.com>

Reviewers: Ewen Cheslack-Postava <me@ewencp.org>, Konstantine Karantasis <konstantine@confluent.io>
2020-03-28 18:36:40 -07:00
Greg Harris 0519d73024 KAFKA-9707: Fix InsertField.Key should apply to keys of tombstone records (#8280)
* KAFKA-9707: Fix InsertField.Key not applying to tombstone events

* Fix typo that hardcoded .value() instead of abstract operatingValue
* Add test for Key transform that was previously not tested

Signed-off-by: Greg Harris <gregh@confluent.io>

* Add null value assertion to tombstone test

* Remove mis-named function and add test for passing-through a null-keyed record.

Signed-off-by: Greg Harris <gregh@confluent.io>

* Simplify unchanged record assertion

Signed-off-by: Greg Harris <gregh@confluent.io>

* Replace assertEquals with assertSame

Signed-off-by: Greg Harris <gregh@confluent.io>

* Fix checkstyleTest indent issue

Signed-off-by: Greg Harris <gregh@confluent.io>
2020-03-26 11:40:09 -07:00
Brian Bushree 052f658e0e MINOR: Backport kafkatest per-broker overrides and extra JVM args (#8347)
Backport of #7297 and #7715 to allow per-node broker overrides and extra JVM args

Co-authored-by: David Arthur <mumrah@gmail.com>

Reviewers: Konstantine Karantasis <konstantine@confluent.io>
2020-03-25 22:00:29 -07:00
Konstantine Karantasis 7f0735da35 KAFKA-8417: Remove redundant network definition --net=host when starting testing docker containers (#6797)
Reviewers: Colin P. McCabe <cmccabe@apache.org>
2020-03-24 14:46:58 -07:00
Tom Bentley 67ff4776b2 KAFKA-9634: Add note about thread safety in the ConfigProvider interface (#8205)
In Kafka Connect, a ConfigProvider instance can be used concurrently (e.g. via a PUT request to the `/connector-plugins/{connectorType}/config/validate` REST endpoint), but there is no mention of concurrent usage in the Javadocs of the ConfigProvider interface. 

It's worth calling out that implementations need to be thread safe.

Reviewers: Konstantine Karantasis <konstantine@confluent.io>
2020-03-22 13:29:58 -07:00
nicolasguyomar 6f01213390 MINOR: Update Connect error message to point to the correct config validation REST endpoint (#7991)
When incorrect connector configuration is detected, the returned exception message suggests to check the connector's configuration against the `{connectorType}/config/validate` endpoint. 

Changing the error message to refer to the exact REST endpoint which is `/connector-plugins/{connectorType}/config/validate` 

This aligns the exception message with the documentation at: https://kafka.apache.org/documentation/#connect_rest 

Reviewers: Konstantine Karantasis <konstantine@confluent.io>
2020-03-22 13:29:39 -07:00
Chris Egerton 6310496a33 KAFKA-9601: Stop logging raw connector config values (#8165)
Author: Chris Egerton <chrise@confluent.io>
Reviewer: Randall Hauch <rhauch@gmail.com>
2020-02-26 15:53:46 -06:00
huxi 0e7f867041 KAFKA-9254; Overridden topic configs are reset after dynamic default change (#7870)
Currently, when a dynamic change is made to the broker-level default log configuration, existing log configs will be recreated with an empty overridden configs. In such case, when updating dynamic broker configs a second round, the topic-level configs are lost. This can cause unexpected data loss, for example, if the cleanup policy changes from "compact" to "delete."

Reviewers: Rajini Sivaram <rajinisivaram@googlemail.com>, Jason Gustafson <jason@confluent.io>
2020-01-24 17:06:47 -08:00
A. Sophie Blee-Goldman 9482bfe2ce MINOR: add UPGRADE_FROM to 2.0-2.3 config docs (#7831)
Reviewers: Guozhang Wang <guozhang@confluent.io>, Matthias J. Sax <matthias@confluent.io>
2020-01-01 15:27:27 -08:00
A. Sophie Blee-Goldman a38c65475f port paragrpah from CP docs (#7808)
The AK Streams architecture docs should explain how the maximum parallelism is determined
Reviewers: Bill Bejeck <bbejeck@gmail.com>
2019-12-16 11:39:11 -05:00
A. Sophie Blee-Goldman 6c8ad27060 MINOR: clarify node grouping of input topics using pattern subscription (#7793)
Updates the HTML docs and the javadoc.

Reviewers: John Roesler <vvcephei@apache.org>
2019-12-06 23:17:10 -06:00
Randall Hauch 45a6934479 MINOR: Increase the timeout in one of Connect's distributed system tests (#7790)
Author: Randall Hauch <rhauch@gmail.com>
Reviewers: Nigel Liang <nigel@nigelliang.com>, Roesler <john@confluent.io>
2019-12-06 15:37:06 -06:00
Ismael Juma b39aa1205d MINOR: Update to Gradle 4.10.3
Aligns with the 2.1 branch and fixes the
TLS handshake error when executed with
Java 7. This is necessary for the 1.0
and 1.1 branches and we do it in 2.0
too for consistency.
2019-11-21 22:53:39 -08:00
Ismael Juma bcb413dab6 MINOR: Rat should ignore generated directories (#7729)
For some reason, PR builds are failing due to the `rat` license
check even though it should ignore files included in `.gitignore`.

Reviewers: Jason Gustafson <jason@confluent.io>
2019-11-21 15:17:07 -08:00
Ismael Juma 0602a99822 MINOR: Update gradle wrapper 2019-11-21 13:12:49 -08:00
Grant Henke 4401a48937 KAFKA-1714: Fix gradle wrapper bootstrapping (#6031)
Given we need to follow the Apache rule of not checking
any binaries into the source code, Kafka has always had
a bit of a tricky Gradle bootstrap.
Using ./gradlew as users expect doesn’t work and a
local and compatible version of Gradle was required to
generate the wrapper first.

This patch changes the behavior of the wrapper task to
instead generate a gradlew script that can bootstrap the
jar itself. Additionally it adds a license, removes the bat
script, and handles retries.

The documentation in the readme was also updated.

Going forward patches that upgrade gradle should run
`gradle wrapper` before checking in the change.

With this change users using ./gradlew can be sure they
are always building with the correct version of Gradle.

Reviewers: Viktor Somogyi <viktorsomogyi@gmail.com>, Ismael Juma <ismael@juma.me.uk
2019-11-21 08:46:18 -08:00
Chris Egerton b09b8fa242 KAFKA-9051: Prematurely complete source offset read requests for stopped tasks (#7532)
Prematurely complete source offset read requests for stopped tasks, and added unit tests.

Author: Chris Egerton <chrise@confluent.io>
Reviewers: Arjun Satish <arjun@confluent.io>, Nigel Liang <nigel@nigelliang.com>, Jinxin Liu <liukrimhim@gmail.com>, Randall Hauch <rhauch@gmail.com>
2019-11-19 21:22:01 -08:00
Greg Harris 111176da5a KAFKA-8340, KAFKA-8819: Use PluginClassLoader while statically initializing plugins (#7315)
Added plugin isolation unit tests for various scenarios, with a `TestPlugins` class that compiles and builds multiple test plugins without them being on the classpath and verifies that the Plugins and DelegatingClassLoader behave properly. These initially failed for several cases, but now pass since the issues have been fixed.

KAFKA-8340 and KAFKA-8819 are closely related, and this fix corrects the problems reported in both issues.

Author: Greg Harris <gregh@confluent.io>
Reviewers: Chris Egerton <chrise@confluent.io>, Magesh Nandakumar <mageshn@confluent.io>, Konstantine Karantasis <konstantine@confluent.io>, Randall Hauch <rhauch@gmail.com>
2019-10-16 21:04:24 -05:00
Chris Egerton beaabf179d KAFKA-8945/KAFKA-8947 backport (#7533)
Fix bug in Connect REST extension API caused by invalid constructor parameter validation, and update integration test to play nicely with Jenkins

Fix instantiation of TaskState objects by Connect framework.

Author: Chris Egerton <chrise@confluent.io>
Reviewers: Magesh Nandakumar <mageshn@confluent.io>, Randall Hauch <rhauch@gmail.com>
2019-10-16 15:59:47 -05:00
Konstantine Karantasis 548f12e521 KAFKA-9014: Fix AssertionError when SourceTask.poll returns an empty list (#7491)
Author: Konstantine Karantasis <konstantine@confluent.io>
Reviewer: Randall Hauch <rhauch@gmail.com>
2019-10-15 16:41:03 -05:00
Magesh Nandakumar 32b0666da3 KAFKA-8974: Trim whitespaces in topic names in sink connector configs (#7442)
Trim whitespaces in topic names specified in sink connector configs before subscribing to the consumer. Topic names don't allow whitespace characters, so trimming only will eliminate potential problems and will not place additional limits on topics specified in sink connectors.

Author: Magesh Nandakumar <magesh.n.kumar@gmail.com>
Reviewers: Arjun Satish <arjun@confluent.io>, Randall Hauch <rhauch@gmail.com>
2019-10-04 13:13:46 -05:00
Nigel Liang a3f2f4f242 KAFKA-6290: Support casting from logical types in cast transform (#7371)
Adds support for the Connect Cast transforms to cast from Connect logical types, such as DATE, TIME, TIMESTAMP, and DECIMAL. Casting to numeric types will produce the underlying numeric value represented in the desired type. For logical types represented by underlying Java Date class, this means the milliseconds since EPOCH. For Decimal, this means the underlying value. If the value does not fit in the desired target type, it may overflow.

Casting to String from Date, Time, and Timestamp types will produce their ISO 8601 representation. Casting to String from Decimal will result in the value represented as a string. e.g. 1234 -> "1234".

Author: Nigel Liang <nigel@nigelliang.com>
Reviewer: Randall Hauch <rhauch@gmail.com>
2019-10-03 15:28:31 -05:00
Amit Sela 4e41e8d77d KAFKA-6684: Support casting Connect values with bytes schema to string
Allow to cast LogicalType to string by calling the serialized (Java) object's toString().

Added tests for `BigDecimal` and `Date` as whole record and as fields.

Author: Amit Sela <amitsela33@gmail.com>

Reviewers: Randall Hauch <rhauch@gmail.com>, Robert Yokota <rayokota@gmail.com>, Ewen Cheslack-Postava <ewen@confluent.io>

Closes #4820 from amitsela/cast-transform-bytes
2019-10-03 15:28:08 -05:00
Gunnar Morling a4de73358e KAFKA-8523 Enabling InsertField transform to be used with tombstone events (#6914)
* KAFKA-8523 Avoiding raw type usage

* KAFKA-8523 Gracefully handling tombstone events in InsertField SMT
2019-10-03 14:11:54 -05:00
vinoth chandar 440956a55c KAFKA-8913: Document topic based configs & ISR settings for Streams apps (#7346)
Reviewer: Matthias J. Sax <matthias@confluent.io>
2019-09-17 17:39:13 -07:00
Matthias J. Sax e30ae14803 HOTFIX: fix compile error in 2.0 branch (#7329)
Author: Matthias J. Sax <matthias@confluent.io>
Reviewers: Bill Bejeck <bill@confluent.io>, Randall Hauch <rhauch@gmail.com>
2019-09-13 12:15:48 -05:00
cpettitt-confluent 9b35df9523 KAFKA-8816: Make offsets immutable to users of RecordCollector.offsets (#7223)
Make offsets immutable to users of RecordCollector.offsets. Fix up an
existing case where offsets could be modified in this way. Add a simple
test to verify offsets cannot be changed externally.

Reviewers: Bruno Cadonna <bruno@confluent.io>, Guozhang Wang <guozhang@confluent.io>, Matthias J. Sax <matthias@confluent.io>
2019-09-09 16:42:49 -07:00
Chia-Ping Tsai e6eda88180 KAFKA-8861 Fix flaky RegexSourceIntegrationTest.testMultipleConsumersCanReadFromPartitionedTopic (#7281)
similar to https://issues.apache.org/jira/browse/KAFKA-8011 and https://issues.apache.org/jira/browse/KAFKA-8026

Reviewers:  Matthias J. Sax <mjsax@apache.org>,  Bill Bejeck <bbejeck@gmail.com>
2019-09-04 11:24:44 -04:00
Chris Egerton 3aa9f99eef KAFKA-8586: Fail source tasks when producers fail to send records (#6993)
Changed Connect's `WorkerSourceTask` to capture non-retriable exceptions from the `producer.send(...)` (e.g., authentication or authorization errors) and to fail the connector task when such an error is encountered. Modified the existing unit tests to verify this functionality.

Note that most producer errors are retriable, and Connect will (by default) set up each producer with 1 max in-flight message and infinite retries. This change only affects non-retriable errors.
2019-08-25 16:19:41 -05:00
Paul 193016c618 KAFKA-7941: Catch TimeoutException in KafkaBasedLog worker thread (#6283)
When calling readLogToEnd(), the KafkaBasedLog worker thread should catch TimeoutException and log a warning, which can occur if brokers are unavailable, otherwise the worker thread terminates.

Includes an enhancement to MockConsumer that allows simulating exceptions not just when polling but also when querying for offsets, which is necessary for testing the fix.

Author: Paul Whalen <pgwhalen@gmail.com>
Reviewers: Randall Hauch <rhauch@gmail.com>, Arjun Satish <arjun@confluent.io>, Ryanne Dolan <ryannedolan@gmail.com>
2019-08-13 16:57:01 -05:00
Arjun Satish 921937ba3b KAFKA-8774: Regex can be found anywhere in config value (#7197)
Corrected the AbstractHerder to correctly identify task configs that contain variables for externalized secrets. The original method incorrectly used `matcher.matches()` instead of `matcher.find()`. The former method expects the entire string to match the regex, whereas the second one can find a pattern anywhere within the input string (which fits this use case more correctly).

Added unit tests to cover various cases of a config with externalized secrets, and updated system tests to cover case where config value contains additional characters besides secret that requires regex pattern to be found anywhere in the string (as opposed to complete match).

Author: Arjun Satish <arjun@confluent.io>
Reviewer: Randall Hauch <rhauch@gmail.com>
2019-08-13 09:55:52 -05:00
Chris Egerton 77b29effed KAFKA-8550: Fix plugin loading of aliased converters in Connect (#6959)
Connector validation fails if an alias is used for the converter since the validation for that is done via `ConfigDef.validateAll(...)`, which in turn invokes `Class.forName(...)` on the alias. Even though the class is successfully loaded by the DelegatingClassLoader, some Java implementations will refuse to return a class from `Class.forName(...)` whose name differs from the argument provided.

This commit alters `ConfigDef.parseType(...)` to first invoke `ClassLoader.loadClass(...)` on the class using our class loader in order to get a handle on the actual class object to be loaded, then invoke `Class.forName(...)` with the fully-qualified class name of the to-be-loaded class and return the result. The invocation of `Class.forName(...)` is necessary in order to allow static initialization to take place; simply calling `ClassLoader.loadClass(...)` is insufficient.

Also corrected a unit test that relied upon the old behavior.

Author: Chris Egerton <chrise@confluent.io>
Reviewers: Robert Yokota <rayokota@gmail.com>, Randall Hauch <rhauch@gmail.com>
2019-08-11 10:01:26 -05:00
cadonna 79eaddd25f KAFKA-8602: Backport bugfix for standby task creation (#7146)
Reviewers: Bill Bejeck <bill@confluent.io>, Matthias J. Sax <matthias@confluent.io>
2019-08-07 17:05:17 -07:00
mjarvie 57352bb163 KAFKA-8736: Streams performance improvement, use isEmpty() rather than size() == 0 (#7164)
Reviewers: A. Sophie Blee-Goldman <sophie@confluent.io>, Matthias J. Sax <matthias@confluent.io>, Guozhang Wang <guozhang@confluent.io>
2019-08-06 10:32:02 -07:00
Robert Yokota 2e9d140a65 KAFKA-7157: Fix handling of nulls in TimestampConverter (#7070)
Fix handling of nulls in TimestampConverter.

Authors: Valeria Vasylieva <valeria.vasylieva@gmail.com>, Robert Yokota <rayokota@gmail.com>
Reviewers: Arjun Satish <arjun@confluent.io>, Randall Hauch <rhauch@gmail.com>
2019-07-12 12:36:22 -05:00
Michał Borowiecki 842dacda8c KAFKA-6605: Fix NPE in Flatten when optional Struct is null (#5705)
Correct the Flatten SMT to properly handle null key or value `Struct` instances.

Author: Michal Borowiecki <michal.borowiecki@openbet.com>
Reviewers: Arjun Satish <arjun@confluent.io>, Robert Yokota <rayokota@gmail.com>, Randall Hauch <rhauch@gmail.com>
2019-07-12 11:39:32 -05:00
slim 8cc43fa313 Fixes #8198 KStreams testing docs use non-existent method pipe (#6678)
Minor fix of #8198 apache/kafka-site#210

Reviewers: John Roesler <john@confluent.io>, Bill Bejeck <bbejeck@gmail.com>
2019-07-12 11:14:03 -04:00
Konstantine Karantasis ce1d3cd644 MINOR: Split at first occurrence of '=' in kafka.py props parsing (#5549) (#7042)
This is a fix to #5226 to account for config properties that have an
equal char in the value.   Otherwise if there is one
equal char in the value the following error occurs:

dictionary update sequence element #XX has length 3; 2 is required

Reviewers: Colin Patrick McCabe <colin@cmccabe.xyz>, Ismael Juma <ismael@juma.me.uk>
2019-07-08 14:34:47 -07:00
Manikumar Reddy c0c51808af MINOR: Add missing Alter Operation to Topic supported operations list in AclCommand
- Update the AclCommandTest

Author: Manikumar Reddy <manikumar.reddy@gmail.com>

Reviewers: Jun Rao <junrao@gmail.com>

Closes #6263 from omkreddy/aclcommand
2019-06-23 00:45:23 +05:30
Jason Gustafson edc7e029c0
MINOR: Disable scoverage in 2.0 (#6980)
The scoverage plugin is causing the build to fail with recent versions of gradle. I see the following error:
```
* What went wrong:
A problem occurred evaluating root project 'kafka'.
> Failed to apply plugin [id 'org.scoverage']
   > Could not create an instance of type org.scoverage.ScoverageExtension.
      > You can't map a property that does not exist: propertyName=testClassesDir
```
This patch disables the plugin since we are not typically checking coverage for old branches anyway.

Reviewers: Ismael Juma <ismael@juma.me.uk>
2019-06-21 15:57:54 -07:00
Dhruvil Shah 018064d453 KAFKA-8570; Grow buffer to hold down converted records if it was insufficiently sized (#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.

Reviewers: Jason Gustafson <jason@confluent.io>
2019-06-21 09:52:37 -07:00