Browse Source

KAFKA-6317; Maven artifact for kafka should not depend on log4j

It should only depend on slf4j-api (like kafka-clients). The
release tarball still includes log4j and slf4j-log4j12.

Manually verified that there are no duplicate dependencies
in the release tarball and `./gradlew core:dependencies`
looks good.

Author: Ismael Juma <ismael@juma.me.uk>

Reviewers: Rajini Sivaram <rajinisivaram@googlemail.com>

Closes #4297 from ijuma/kafka-6317-kafka-slf4j-api-only
pull/4297/merge
Ismael Juma 7 years ago
parent
commit
88c2b6849a
  1. 31
      build.gradle
  2. 59
      docs/upgrade.html

31
build.gradle

@ -549,11 +549,18 @@ project(':core') { @@ -549,11 +549,18 @@ project(':core') {
compile libs.joptSimple
compile libs.metrics
compile libs.scala
compile libs.slf4jApi
compile libs.slf4jlog4j
compile libs.scalaLogging
compile libs.zkclient
compile libs.zookeeper
compile libs.slf4jApi
compile(libs.zkclient) {
exclude module: 'zookeeper'
}
compile(libs.zookeeper) {
exclude module: 'slf4j-log4j12'
exclude module: 'log4j'
exclude module: 'netty'
}
compileOnly libs.log4j
testCompile project(':clients').sourceSets.test.output
testCompile libs.bcpkix
@ -571,6 +578,7 @@ project(':core') { @@ -571,6 +578,7 @@ project(':core') {
testCompile libs.apachedsJdbmPartition
testCompile libs.junit
testCompile libs.scalatest
testCompile libs.slf4jlog4j
testCompile libs.jfreechart
scoverage libs.scoveragePlugin
@ -595,7 +603,6 @@ project(':core') { @@ -595,7 +603,6 @@ project(':core') {
compile.exclude module: 'jmxri'
compile.exclude module: 'jmxtools'
compile.exclude module: 'mail'
compile.exclude module: 'netty'
// To prevent a UniqueResourceException due the same resource existing in both
// org.apache.directory.api/api-all and org.apache.directory.api/api-ldap-schema-data
testCompile.exclude module: 'api-ldap-schema-data'
@ -604,6 +611,7 @@ project(':core') { @@ -604,6 +611,7 @@ project(':core') {
tasks.create(name: "copyDependantLibs", type: Copy) {
from (configurations.testRuntime) {
include('slf4j-log4j12*')
include('log4j*jar')
}
from (configurations.runtime) {
exclude('kafka-clients*')
@ -853,7 +861,7 @@ project(':tools') { @@ -853,7 +861,7 @@ project(':tools') {
compile project(':log4j-appender')
compile libs.argparse4j
compile libs.jacksonDatabind
compile libs.slf4jlog4j
compile libs.slf4jApi
compile libs.jacksonJaxrsJsonProvider
compile libs.jerseyContainerServlet
@ -867,6 +875,8 @@ project(':tools') { @@ -867,6 +875,8 @@ project(':tools') {
testCompile libs.easymock
testCompile libs.powermockJunit4
testCompile libs.powermockEasymock
testRuntime libs.slf4jlog4j
}
javadoc {
@ -876,6 +886,7 @@ project(':tools') { @@ -876,6 +886,7 @@ project(':tools') {
tasks.create(name: "copyDependantLibs", type: Copy) {
from (configurations.testRuntime) {
include('slf4j-log4j12*')
include('log4j*jar')
}
from (configurations.runtime) {
exclude('kafka-clients*')
@ -916,6 +927,7 @@ project(':streams') { @@ -916,6 +927,7 @@ project(':streams') {
tasks.create(name: "copyDependantLibs", type: Copy) {
from (configurations.testRuntime) {
include('slf4j-log4j12*')
include('log4j*jar')
}
from (configurations.runtime) {
exclude('kafka-clients*')
@ -946,7 +958,7 @@ project(':streams:examples') { @@ -946,7 +958,7 @@ project(':streams:examples') {
dependencies {
compile project(':streams')
compile project(':connect:json') // this dependency should be removed after we unify data API
compile libs.slf4jlog4j // this dependency should be removed after KIP-4
compile libs.slf4jlog4j
}
javadoc {
@ -1046,6 +1058,7 @@ project(':connect:api') { @@ -1046,6 +1058,7 @@ project(':connect:api') {
tasks.create(name: "copyDependantLibs", type: Copy) {
from (configurations.testRuntime) {
include('slf4j-log4j12*')
include('log4j*jar')
}
from (configurations.runtime) {
exclude('kafka-clients*')
@ -1083,6 +1096,7 @@ project(':connect:transforms') { @@ -1083,6 +1096,7 @@ project(':connect:transforms') {
tasks.create(name: "copyDependantLibs", type: Copy) {
from (configurations.testRuntime) {
include('slf4j-log4j12*')
include('log4j*jar')
}
from (configurations.runtime) {
exclude('kafka-clients*')
@ -1121,6 +1135,7 @@ project(':connect:json') { @@ -1121,6 +1135,7 @@ project(':connect:json') {
tasks.create(name: "copyDependantLibs", type: Copy) {
from (configurations.testRuntime) {
include('slf4j-log4j12*')
include('log4j*jar')
}
from (configurations.runtime) {
exclude('kafka-clients*')
@ -1172,6 +1187,7 @@ project(':connect:runtime') { @@ -1172,6 +1187,7 @@ project(':connect:runtime') {
tasks.create(name: "copyDependantLibs", type: Copy) {
from (configurations.testRuntime) {
include('slf4j-log4j12*')
include('log4j*jar')
}
from (configurations.runtime) {
exclude('kafka-clients*')
@ -1231,6 +1247,7 @@ project(':connect:file') { @@ -1231,6 +1247,7 @@ project(':connect:file') {
tasks.create(name: "copyDependantLibs", type: Copy) {
from (configurations.testRuntime) {
include('slf4j-log4j12*')
include('log4j*jar')
}
from (configurations.runtime) {
exclude('kafka-clients*')

59
docs/upgrade.html

@ -19,6 +19,65 @@ @@ -19,6 +19,65 @@
<script id="upgrade-template" type="text/x-handlebars-template">
<h4><a id="upgrade_1_1_0" href="#upgrade_1_1_0">Upgrading from 0.8.x, 0.9.x, 0.10.0.x, 0.10.1.x, 0.10.2.x, 0.11.0.x or 1.0.x to 1.1.x</a></h4>
<p>Kafka 1.1.0 introduces wire protocol changes. By following the recommended rolling upgrade plan below,
you guarantee no downtime during the upgrade. However, please review the <a href="#upgrade_110_notable">notable changes in 1.1.0</a> before upgrading.
</p>
<p><b>For a rolling upgrade:</b></p>
<ol>
<li> Update server.properties on all brokers and add the following properties. CURRENT_KAFKA_VERSION refers to the version you
are upgrading from. CURRENT_MESSAGE_FORMAT_VERSION refers to the message format version currently in use. If you have previously
overridden the message format version, you should keep its current value. Alternatively, if you are upgrading from a version prior
to 0.11.0.x, then CURRENT_MESSAGE_FORMAT_VERSION should be set to match CURRENT_KAFKA_VERSION.
<ul>
<li>inter.broker.protocol.version=CURRENT_KAFKA_VERSION (e.g. 0.8.2, 0.9.0, 0.10.0, 0.10.1, 0.10.2, 0.11.0, 1.0).</li>
<li>log.message.format.version=CURRENT_MESSAGE_FORMAT_VERSION (See <a href="#upgrade_10_performance_impact">potential performance impact
following the upgrade</a> for the details on what this configuration does.)</li>
</ul>
If you are upgrading from 0.11.0.x and you have not overridden the message format, then you only need to override
the inter-broker protocol format.
<ul>
<li>inter.broker.protocol.version=CURRENT_KAFKA_VERSION (e.g. 0.8.2, 0.9.0, 0.10.0, 0.10.1, 0.10.2, 0.11.0, 1.0).</li>
</ul>
</li>
<li> Upgrade the brokers one at a time: shut down the broker, update the code, and restart it. </li>
<li> Once the entire cluster is upgraded, bump the protocol version by editing <code>inter.broker.protocol.version</code> and setting it to 1.1.
<li> Restart the brokers one by one for the new protocol version to take effect. </li>
<li> If you have overridden the message format version as instructed above, then you need to do one more rolling restart to
upgrade it to its latest version. Once all (or most) consumers have been upgraded to 0.11.0 or later,
change log.message.format.version to 1.1 on each broker and restart them one by one. Note that the older Scala consumer
does not support the new message format introduced in 0.11, so to avoid the performance cost of down-conversion (or to
take advantage of <a href="#upgrade_11_exactly_once_semantics">exactly once semantics</a>), the newer Java consumer must be used.</li>
</ol>
<p><b>Additional Upgrade Notes:</b></p>
<ol>
<li>If you are willing to accept downtime, you can simply take all the brokers down, update the code and start them back up. They will start
with the new protocol by default.</li>
<li>Bumping the protocol version and restarting can be done any time after the brokers are upgraded. It does not have to be immediately after.
Similarly for the message format version.</li>
</ol>
<h5><a id="upgrade_110_notable" href="#upgrade_110_notable">Notable changes in 1.1.0</a></h5>
<ul>
<li>The kafka artifact in Maven no longer depends on log4j or slf4j-log4j12. Similarly to the kafka-clients artifact, users
can now choose the logging back-end by including the appropriate slf4j module (slf4j-log4j12, logback, etc.). The release
tarball still includes log4j and slf4j-log4j12.</li>
</ul>
<h5><a id="upgrade_110_new_protocols" href="#upgrade_110_new_protocols">New Protocol Versions</a></h5>
<ul></ul>
<h5><a id="upgrade_110_streams" href="#upgrade_110_streams">Upgrading a 1.1.0 Kafka Streams Application</a></h5>
<ul>
<li> Upgrading your Streams application from 1.0.0 to 1.1.0 does not require a broker upgrade.
A Kafka Streams 1.1.0 application can connect to 1.0, 0.11.0, 0.10.2 and 0.10.1 brokers (it is not possible to connect to 0.10.0 brokers though). </li>
<li> See <a href="/{{version}}/documentation/streams/upgrade-guide#streams_api_changes_110">Streams API changes in 1.1.0</a> for more details. </li>
</ul>
<h4><a id="upgrade_1_0_0" href="#upgrade_1_0_0">Upgrading from 0.8.x, 0.9.x, 0.10.0.x, 0.10.1.x, 0.10.2.x or 0.11.0.x to 1.0.0</a></h4>
<p>Kafka 1.0.0 introduces wire protocol changes. By following the recommended rolling upgrade plan below,
you guarantee no downtime during the upgrade. However, please review the <a href="#upgrade_100_notable">notable changes in 1.0.0</a> before upgrading.

Loading…
Cancel
Save