Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add new test to check compatibility with LogInfo from v2.4
  • Loading branch information
HeartSaVioR committed Oct 5, 2019
commit f00654257bcb83a95ad6f9178b1906d58e670abb
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ import org.apache.spark.scheduler._
import org.apache.spark.scheduler.cluster.ExecutorInfo
import org.apache.spark.security.GroupMappingServiceProvider
import org.apache.spark.status.AppStatusStore
import org.apache.spark.status.KVUtils.KVStoreScalaSerializer
import org.apache.spark.status.api.v1.{ApplicationAttemptInfo, ApplicationInfo}
import org.apache.spark.util.{Clock, JsonProtocol, ManualClock, Utils}
import org.apache.spark.util.logging.DriverLogger
Expand Down Expand Up @@ -1252,6 +1253,36 @@ class FsHistoryProviderSuite extends SparkFunSuite with Matchers with Logging {
}
}

test("read old format of LogInfo in Spark 2.4") {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"backwards compatibility with LogInfo from Spark 2.4"

case class LogInfoV24(
logPath: String,
lastProcessed: Long,
appId: Option[String],
attemptId: Option[String],
fileSize: Long)

val oldObj = LogInfoV24("dummy", System.currentTimeMillis(), Some("hello"),
Some("attempt1"), 100)

val serializer = new KVStoreScalaSerializer()
val serializedOldObj = serializer.serialize(oldObj)
val deserializedOldObj = serializer.deserialize(serializedOldObj, classOf[LogInfo])
assert(deserializedOldObj.logPath === oldObj.logPath)
assert(deserializedOldObj.lastProcessed === oldObj.lastProcessed)
assert(deserializedOldObj.appId === oldObj.appId)
assert(deserializedOldObj.attemptId === oldObj.attemptId)
assert(deserializedOldObj.fileSize === oldObj.fileSize)

// SPARK-25118: added logType: LogType.Value - expected 'null' on old format
assert(deserializedOldObj.logType === null)

// SPARK-28869: added lastIndex: Option[Long], isComplete: Boolean - expected 'None' and
// 'false' on old format. The default value for isComplete is wrong value for completed app,
// but the value will be corrected once checkForLogs is called.
assert(deserializedOldObj.lastIndex === None)
assert(deserializedOldObj.isComplete === false)
}

/**
* Asks the provider to check for logs and calls a function to perform checks on the updated
* app list. Example:
Expand Down