MINOR: avoid unnecessary list iteration in ApiVersion.lastVersion
We unnecessarily iterate the versions list each time we lookup
lastVersion, including in the hotpath Log.appendAsFollower.
Given that allVersions is a constant, this is unnecessary.
Reviewers: Chia-Ping Tsai Ismael Juma
@@ -116,7 +116,7 @@ object ApiVersion {
versionMap.getOrElse(key, throw new IllegalArgumentException(s"Version `$versionString` is not a valid version"))
}
- def latestVersion: ApiVersion = allVersions.last
+ val latestVersion: ApiVersion = allVersions.last
/**
* Return the minimum `ApiVersion` that supports `RecordVersion`.
