Skip to content

Commit

Permalink
MINOR: Update to Scala 2.13.12 (apache#14430)
Browse files Browse the repository at this point in the history
It offers a quickfix action for certain errors, includes a number of bug fixes and it
introduces a new warning by default (scala/scala#10462).

In addition to the scala version bump, we also fix the new compiler warnings and
bump the scalafmt version (the previous version failed with the new scala version).

Release notes: https://github.com/scala/scala/releases/tag/v2.13.12

Reviewers: Divij Vaidya <[email protected]>, Satish Duggana <[email protected]>
  • Loading branch information
ijuma authored Sep 24, 2023
1 parent d1ad1d7 commit 7ba6d7a
Show file tree
Hide file tree
Showing 12 changed files with 25 additions and 26 deletions.
4 changes: 2 additions & 2 deletions LICENSE-binary
Original file line number Diff line number Diff line change
Expand Up @@ -255,9 +255,9 @@ reflections-0.10.2
reload4j-1.2.25
rocksdbjni-7.9.2
scala-collection-compat_2.13-2.10.0
scala-library-2.13.11
scala-library-2.13.12
scala-logging_2.13-3.9.4
scala-reflect-2.13.11
scala-reflect-2.13.12
scala-java8-compat_2.13-1.0.2
snappy-java-1.1.10.3
swagger-annotations-2.2.8
Expand Down
2 changes: 1 addition & 1 deletion bin/kafka-run-class.sh
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ should_include_file() {
base_dir=$(dirname $0)/..

if [ -z "$SCALA_VERSION" ]; then
SCALA_VERSION=2.13.11
SCALA_VERSION=2.13.12
if [[ -f "$base_dir/gradle.properties" ]]; then
SCALA_VERSION=`grep "^scalaVersion=" "$base_dir/gradle.properties" | cut -d= -f 2`
fi
Expand Down
2 changes: 1 addition & 1 deletion bin/windows/kafka-run-class.bat
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ set BASE_DIR=%CD%
popd

IF ["%SCALA_VERSION%"] EQU [""] (
set SCALA_VERSION=2.13.11
set SCALA_VERSION=2.13.12
)

IF ["%SCALA_BINARY_VERSION%"] EQU [""] (
Expand Down
4 changes: 2 additions & 2 deletions checkstyle/.scalafmt.conf
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
version = 3.5.9
version = 3.7.14
runner.dialect = scala213
docstrings.style = Asterisk
docstrings.wrap = false
maxColumn = 120
continuationIndent.defnSite = 2
assumeStandardLibraryStripMargin = true
rewrite.rules = [SortImports, RedundantBraces, RedundantParens, SortModifiers]
rewrite.rules = [SortImports, RedundantBraces, RedundantParens, SortModifiers]
4 changes: 2 additions & 2 deletions core/src/main/scala/kafka/log/LogCleaner.scala
Original file line number Diff line number Diff line change
Expand Up @@ -747,7 +747,7 @@ private[log] class Cleaner(val id: Int,
val canDiscardBatch = shouldDiscardBatch(batch, transactionMetadata)

if (batch.isControlBatch)
discardBatchRecords = canDiscardBatch && batch.deleteHorizonMs().isPresent && batch.deleteHorizonMs().getAsLong <= currentTime
discardBatchRecords = canDiscardBatch && batch.deleteHorizonMs().isPresent && batch.deleteHorizonMs().getAsLong <= this.currentTime
else
discardBatchRecords = canDiscardBatch

Expand Down Expand Up @@ -784,7 +784,7 @@ private[log] class Cleaner(val id: Int,
else if (batch.isControlBatch)
true
else
Cleaner.this.shouldRetainRecord(map, retainLegacyDeletesAndTxnMarkers, batch, record, stats, currentTime = currentTime)
Cleaner.this.shouldRetainRecord(map, retainLegacyDeletesAndTxnMarkers, batch, record, stats, currentTime = this.currentTime)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -326,10 +326,9 @@ object ReplicationQuotasTestRig {

def append(message: String): Unit = {
val stream = Files.newOutputStream(log.toPath, StandardOpenOption.CREATE, StandardOpenOption.APPEND)
new PrintWriter(stream) {
append(message)
close
}
val writer = new PrintWriter(stream)
writer.append(message)
writer.close()
}

def path(): String = {
Expand Down
4 changes: 2 additions & 2 deletions core/src/test/scala/unit/kafka/log/LogLoaderTest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ class LogLoaderTest {
val segments = new LogSegments(topicPartition)
val leaderEpochCache = UnifiedLog.maybeCreateLeaderEpochCache(logDir, topicPartition, logDirFailureChannel, config.recordVersion, "")
val producerStateManager = new ProducerStateManager(topicPartition, logDir,
maxTransactionTimeoutMs, producerStateManagerConfig, time)
this.maxTransactionTimeoutMs, this.producerStateManagerConfig, time)
val logLoader = new LogLoader(logDir, topicPartition, config, time.scheduler, time,
logDirFailureChannel, hadCleanShutdown, segments, logStartOffset, logRecoveryPoint,
leaderEpochCache, producerStateManager)
Expand All @@ -158,7 +158,7 @@ class LogLoaderTest {
offsets.nextOffsetMetadata, mockTime.scheduler, mockTime, topicPartition,
logDirFailureChannel)
new UnifiedLog(offsets.logStartOffset, localLog, brokerTopicStats,
producerIdExpirationCheckIntervalMs, leaderEpochCache,
this.producerIdExpirationCheckIntervalMs, leaderEpochCache,
producerStateManager, None, true)
}
}
Expand Down
2 changes: 1 addition & 1 deletion core/src/test/scala/unit/kafka/log/TimeIndexTest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ class TimeIndexTest {
idx = new TimeIndex(idx.file, baseOffset, maxEntries * 12) {
override def lastEntry = {
val superLastEntry = super.lastEntry
val offset = if (shouldCorruptOffset) baseOffset - 1 else superLastEntry.offset
val offset = if (shouldCorruptOffset) this.baseOffset - 1 else superLastEntry.offset
val timestamp = if (shouldCorruptTimestamp) firstEntry.timestamp - 1 else superLastEntry.timestamp
new TimestampOffset(timestamp, offset)
}
Expand Down
4 changes: 2 additions & 2 deletions core/src/test/scala/unit/kafka/network/SocketServerTest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -889,7 +889,7 @@ class SocketServerTest {
// except the Acceptor overriding a method to inject the exception
override protected def createDataPlaneAcceptor(endPoint: EndPoint, isPrivilegedListener: Boolean, requestChannel: RequestChannel): DataPlaneAcceptor = {

new DataPlaneAcceptor(this, endPoint, config, nodeId, connectionQuotas, time, false, requestChannel, serverMetrics, credentialProvider, new LogContext(), MemoryPool.NONE, apiVersionManager) {
new DataPlaneAcceptor(this, endPoint, this.config, nodeId, connectionQuotas, time, false, requestChannel, serverMetrics, this.credentialProvider, new LogContext(), MemoryPool.NONE, this.apiVersionManager) {
override protected def configureAcceptedSocketChannel(socketChannel: SocketChannel): Unit = {
assertEquals(1, connectionQuotas.get(socketChannel.socket.getInetAddress))
throw new IOException("test injected IOException")
Expand Down Expand Up @@ -2149,7 +2149,7 @@ class SocketServerTest {
) {

override def createDataPlaneAcceptor(endPoint: EndPoint, isPrivilegedListener: Boolean, requestChannel: RequestChannel) : DataPlaneAcceptor = {
new TestableAcceptor(this, endPoint, config, 0, connectionQuotas, time, isPrivilegedListener, requestChannel, metrics, credentialProvider, new LogContext, MemoryPool.NONE, apiVersionManager, connectionQueueSize)
new TestableAcceptor(this, endPoint, this.config, 0, connectionQuotas, time, isPrivilegedListener, requestChannel, this.metrics, this.credentialProvider, new LogContext, MemoryPool.NONE, this.apiVersionManager, connectionQueueSize)
}

def testableSelector: TestableSelector =
Expand Down
12 changes: 6 additions & 6 deletions core/src/test/scala/unit/kafka/server/ReplicaManagerTest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2800,16 +2800,16 @@ class ReplicaManagerTest {
threadNamePrefix: Option[String],
replicationQuotaManager: ReplicationQuotaManager): ReplicaFetcherManager = {
val rm = this
new ReplicaFetcherManager(config, rm, metrics, time, threadNamePrefix, replicationQuotaManager, () => metadataCache.metadataVersion(), () => 1) {
new ReplicaFetcherManager(this.config, rm, metrics, time, threadNamePrefix, replicationQuotaManager, () => this.metadataCache.metadataVersion(), () => 1) {

override def createFetcherThread(fetcherId: Int, sourceBroker: BrokerEndPoint): ReplicaFetcherThread = {
val logContext = new LogContext(s"[ReplicaFetcher replicaId=${config.brokerId}, leaderId=${sourceBroker.id}, " +
val logContext = new LogContext(s"[ReplicaFetcher replicaId=${rm.config.brokerId}, leaderId=${sourceBroker.id}, " +
s"fetcherId=$fetcherId] ")
val fetchSessionHandler = new FetchSessionHandler(logContext, sourceBroker.id)
val leader = new RemoteLeaderEndPoint(logContext.logPrefix, blockingSend, fetchSessionHandler, config,
rm, quotaManager.follower, () => config.interBrokerProtocolVersion, () => 1)
new ReplicaFetcherThread(s"ReplicaFetcherThread-$fetcherId", leader, config, failedPartitions, rm,
quotaManager.follower, logContext.logPrefix, () => config.interBrokerProtocolVersion) {
val leader = new RemoteLeaderEndPoint(logContext.logPrefix, blockingSend, fetchSessionHandler, rm.config,
rm, quotaManager.follower, () => rm.config.interBrokerProtocolVersion, () => 1)
new ReplicaFetcherThread(s"ReplicaFetcherThread-$fetcherId", leader, rm.config, failedPartitions, rm,
quotaManager.follower, logContext.logPrefix, () => rm.config.interBrokerProtocolVersion) {
override def doWork(): Unit = {
// In case the thread starts before the partition is added by AbstractFetcherManager,
// add it here (it's a no-op if already added)
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ group=org.apache.kafka
# - streams/quickstart/java/src/main/resources/archetype-resources/pom.xml
# - streams/quickstart/java/pom.xml
version=3.7.0-SNAPSHOT
scalaVersion=2.13.11
scalaVersion=2.13.12
task=build
org.gradle.jvmargs=-Xmx2g -Xss4m -XX:+UseParallelGC
org.gradle.parallel=true
4 changes: 2 additions & 2 deletions gradle/dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ ext {

// Add Scala version
def defaultScala212Version = '2.12.18'
def defaultScala213Version = '2.13.11'
def defaultScala213Version = '2.13.12'
if (hasProperty('scalaVersion')) {
if (scalaVersion == '2.12') {
versions["scala"] = defaultScala212Version
Expand Down Expand Up @@ -152,7 +152,7 @@ versions += [
// When updating the scalafmt version please also update the version field in checkstyle/.scalafmt.conf. scalafmt now
// has the version field as mandatory in its configuration, see
// https://github.com/scalameta/scalafmt/releases/tag/v3.1.0.
scalafmt: "3.5.9",
scalafmt: "3.7.14",
scalaJava8Compat : "1.0.2",
scoverage: "1.9.3",
slf4j: "1.7.36",
Expand Down

0 comments on commit 7ba6d7a

Please sign in to comment.