KAFKA-7210: Add a system test to verify the log compaction #5226
KAFKA-7210: Add a system test to verify the log compaction #5226ijuma merged 10 commits intoapache:trunkfrom
Conversation
|
@ijuma Pls take a look. I have added a system test to verify compaction using this tool. |
3fd4735 to
ae00322
Compare
|
retest this please |
There was a problem hiding this comment.
"kafka.properties" template file contains default config values to populate server.properties.
Now log cleaner is enabled by default. So I have removed this property to enable it by default is tests.
"log.segment.bytes" property configured with sever default value and not updated by any of the test.
For now I reverted this change. if required we can do this cleanup later.
Also updated the logic in kafka.py to cleanup the duplicates between kafka.properties and server_prop_overides. Updated the logic to load the kafka.properties first and then override any server_prop_overides configs.
There was a problem hiding this comment.
I think it's good to enable the cleaner in the system tests. And if the other property is just the default, I agree we should just remove it from here.
There was a problem hiding this comment.
We should a subdirectory of /mnt, not directly inside /mnt
There was a problem hiding this comment.
with "&>>" I am unable to run the command as background job. I will try again.
There was a problem hiding this comment.
It's fine to leave it as-is if bash is being fiddly.
There was a problem hiding this comment.
This should be named LogCompactionTool. It is not a test (it is a service used by tests)
8343549 to
aa2288a
Compare
|
@cmccabe Thanks for the review. Addressed the review comments. Also updated the logic in kafka.py to cleanup the duplicates between kafka.properties and server_prop_overides. We load the kafka.properties first and then override any server_prop_overides configs. Pls take a look. |
744a64f to
d73cce2
Compare
There was a problem hiding this comment.
This should remain in the test directory right? It's similar to MiniKdc.
There was a problem hiding this comment.
It is similar to ReplicaVerificationTool. So i moved to src directory. This will be useful, if we want to test manually with binary distribution.
Also, adding testlibs to minikdc service classpath handled separately. not sure we want do same here.
https://github.com/apache/kafka/blob/trunk/tests/kafkatest/services/security/minikdc.py#L110MiniKdc
There was a problem hiding this comment.
A KIP is needed for adding new user visible tools. Personally, I don't see much value in testing the binary distribution manually.
There was a problem hiding this comment.
Ok.. moved tool class to test directory and retained the original name.
59a529c to
46a6c30
Compare
abbb03a to
0f6b938
Compare
|
@cmccabe, can you please review? |
There was a problem hiding this comment.
The should be --bootstrap-server to match how our tools work. (Some of them use nonstandard synonyms currently, but we want to converge on --bootstrap-server)
There was a problem hiding this comment.
Can we specify in the help text that this is the time in milliseconds?
There was a problem hiding this comment.
Can we use nextLong here to be more certain we won't get a collision?
There was a problem hiding this comment.
We should have a try/catch block here to prevent the AdminClient object from leaking.
There was a problem hiding this comment.
let's have a try/catch block here as well to prevent a leak.
There was a problem hiding this comment.
Now that we're using Java8, you can just use Files.newBufferedWriter here
There was a problem hiding this comment.
can you add parentheses to make this expression clearer
|
LGTM. Thanks, @omkreddy |
|
@ijuma Can you please take a look? |
ijuma
left a comment
There was a problem hiding this comment.
Thanks for the PR, it will be great to have this. I have a few comments.
There was a problem hiding this comment.
Can you please remind me why we need to do this again?
There was a problem hiding this comment.
I am using TestUtils.waitUntilTrue() method in the test tool, which intern depends on clients/test/TestUtils.java. I added this line include client test library to system test dependent libs,
There was a problem hiding this comment.
Why doesn't the following do it?
from (configurations.testRuntime) {
include('*.jar')
}It seems like it should include every runtime dependency jar?
There was a problem hiding this comment.
current "configurations.testRuntime" does not include dependent project (clients) test jar/dependencies.
Updated build.gradle based on below link, to include dependent project test dependencies.
We can decide whether to have this commit (or) previous one line change.
There was a problem hiding this comment.
I'm confused about this message. Shouldn't we explain that arguments are expected or something like that?
There was a problem hiding this comment.
this is part of legacy tool which can be used to dump the log contents (Similar dump log tool). We can remove If we think it is not required.
There was a problem hiding this comment.
Yeah, if we don't have an immediate use, I'd remove it.
There was a problem hiding this comment.
removed the dumpOpt option
There was a problem hiding this comment.
Maybe we can use the f interpolator here https://docs.scala-lang.org/overviews/core/string-interpolation.html
There was a problem hiding this comment.
It would be helpful to know which topics have not been created.
There was a problem hiding this comment.
There's a version that takes a ByteBuffer, so you can simplify more.
There was a problem hiding this comment.
These should probably be parse methods in the companion object (if they are used).
There was a problem hiding this comment.
added companion object. not sure, if this is what you're suggesting. Please take a look.
There was a problem hiding this comment.
default is : 102400, not sure if we can remove this line
There was a problem hiding this comment.
How long does this test usually take? Are we sure that 2 minutes is enough?
There was a problem hiding this comment.
For the configured system test inputs (1million small messages) it will take 60seconds to complete.
There was a problem hiding this comment.
OK, let's make it 180 seconds then.
|
@ijuma Thanks for the review. Updated the review . Pls take one more look. |
|
retest this please |
There was a problem hiding this comment.
Seems like you can do the filter here instead of forall and then the message creation below becomes simpler.
There was a problem hiding this comment.
Nit: you can remove [Array[Byte], Array[Byte]]
There was a problem hiding this comment.
Nit: you can remove [String, String].
There was a problem hiding this comment.
There's a version that takes a ByteBuffer, so you can simplify more.
There was a problem hiding this comment.
The idea was to call this method parse to make it clear that it's parsing the line and can fail.
There was a problem hiding this comment.
Is this used outside of the TestRecord.apply method? If so, I'd move it to the companion object too and give it another name (maybe parseComponents). Otherwise, I'd just inline it.
There was a problem hiding this comment.
Updated the code. Pls take a look.
There was a problem hiding this comment.
I think I'd say something about the fact that no arguments were passed, but some are expected.
There was a problem hiding this comment.
This line used for printing usage. next line checks for required arguments. Same pattern we are using in other tools.
There was a problem hiding this comment.
Why doesn't the following do it?
from (configurations.testRuntime) {
include('*.jar')
}It seems like it should include every runtime dependency jar?
| } | ||
|
|
||
| artifacts { | ||
| testOutput jarTest |
There was a problem hiding this comment.
Interesting. Does this create a new artifact? I think maybe we should go back to your previous solution that is limited to copyDependantTestLibs with a comment explaining why it's needed. We can consider separately whether we should move away from testCompile project(':clients').sourceSets.test.output in favour of the more complete solution across the board (we use test dependencies in multiple modules).
There was a problem hiding this comment.
There's also the option of just using https://plugins.gradle.org/plugin/com.github.hauner.jarTest/1.0, but it's best to discuss that in a separate PR.
There was a problem hiding this comment.
makes sense. reverted the last commit. Will handle this in separate PR.
For now, added a comment to explain the need for previous solution.
ijuma
left a comment
There was a problem hiding this comment.
Thanks for your patience, LGTM.
This is a fix to apache#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 ```
) 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>
* Updated TestLogCleaning tool to use Java consumer and rename as LogCompactionTester. * Enabled the log cleaner in every system test. * Removed configs from "kafka.properties" with default values and `socket.receive.buffer.bytes` as the override did not seem necessary. * Updated `kafka.py` logic to handle duplicates between `kafka.properties` and `server_prop_overrides`. * Updated Gradle build so that classes from `kafka-clients` test jar can be used in system tests. Reviewers: Colin Patrick McCabe <colin@cmccabe.xyz>, Ismael Juma <ismael@juma.me.uk>
…ache#5549) This is a fix to apache#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>
…ache#5549) This is a fix to apache#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>
) (#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>
Uh oh!
There was an error while loading. Please reload this page.