Skip to content

[SPARK-53105][Structured Streaming] Fix tests for checkpoint v2 in RocksDBSuite #51834

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ trait RocksDBStateStoreChangelogCheckpointingTestUtil {
case Array(version) => version.toLong
}
.sorted
.distinct
.toImmutableArraySeq
}

Expand Down Expand Up @@ -274,7 +275,7 @@ trait AlsoTestWithRocksDBFeatures
Seq(true, false).foreach { enableStateStoreCheckpointIds =>
val newTestName = s"$testName - with enableStateStoreCheckpointIds = " +
s"$enableStateStoreCheckpointIds"
test(newTestName, testTags: _*) { enableStateStoreCheckpointIds =>
test(newTestName, testTags: _*) {
testBody(enableStateStoreCheckpointIds)
}
}
Expand All @@ -287,8 +288,8 @@ trait AlsoTestWithRocksDBFeatures
Seq(true, false).foreach { enableStateStoreCheckpointIds =>
val newTestName = s"$testName - with enableStateStoreCheckpointIds = " +
s"$enableStateStoreCheckpointIds"
testWithChangelogCheckpointingDisabled(newTestName, testTags: _*) {
enableStateStoreCheckpointIds => testBody(enableStateStoreCheckpointIds)
testWithChangelogCheckpointingEnabled(newTestName, testTags: _*) {
testBody(enableStateStoreCheckpointIds)
}
}
}
Expand Down Expand Up @@ -2813,7 +2814,10 @@ class RocksDBSuite extends AlsoTestWithRocksDBFeatures with SharedSparkSession
// upload snapshot 4.zip
db.doMaintenance()
}
withDB(remoteDir, version = 4, conf = conf) { db =>
withDB(remoteDir, version = 4, conf = conf,
enableStateStoreCheckpointIds = enableStateStoreCheckpointIds,
versionToUniqueId = versionToUniqueId
) { db =>
}
})
}
Expand Down Expand Up @@ -2842,7 +2846,10 @@ class RocksDBSuite extends AlsoTestWithRocksDBFeatures with SharedSparkSession
db.doMaintenance()
}

withDB(remoteDir, version = 4, conf = conf) { db =>
withDB(remoteDir, version = 4, conf = conf,
enableStateStoreCheckpointIds = enableStateStoreCheckpointIds,
versionToUniqueId = versionToUniqueId
) { db =>
}
}

Expand Down Expand Up @@ -2872,8 +2879,10 @@ class RocksDBSuite extends AlsoTestWithRocksDBFeatures with SharedSparkSession
}

// reload version 2 - should succeed
withDB(remoteDir, version = 2, conf = conf) { db =>
}
withDB(remoteDir, version = 2, conf = conf,
enableStateStoreCheckpointIds = enableStateStoreCheckpointIds,
versionToUniqueId = versionToUniqueId
) { db => }
}

testWithStateStoreCheckpointIdsAndChangelogEnabled("time travel 5 - validate successful " +
Expand Down Expand Up @@ -2906,16 +2915,19 @@ class RocksDBSuite extends AlsoTestWithRocksDBFeatures with SharedSparkSession
db.commit() // create snapshot again

// load version 1 - should succeed
withDB(remoteDir, version = 1, conf = conf, hadoopConf = hadoopConf) { db =>
withDB(remoteDir, version = 1, conf = conf, hadoopConf = hadoopConf,
enableStateStoreCheckpointIds = enableStateStoreCheckpointIds,
versionToUniqueId = versionToUniqueId) { db =>
}

// upload recently created snapshot
db.doMaintenance()
assert(snapshotVersionsPresent(remoteDir) == Seq(1))

// load version 1 again - should succeed
withDB(remoteDir, version = 1, conf = conf, hadoopConf = hadoopConf) { db =>
}
withDB(remoteDir, version = 1, conf = conf, hadoopConf = hadoopConf,
enableStateStoreCheckpointIds = enableStateStoreCheckpointIds,
versionToUniqueId = versionToUniqueId) { db => }
}
}
}
Expand Down Expand Up @@ -3025,7 +3037,7 @@ class RocksDBSuite extends AlsoTestWithRocksDBFeatures with SharedSparkSession
versionToUniqueId = versionToUniqueId) { db2 =>
val random = new Random(randomSeed)
var curVer: Int = 0
for (i <- 1 to 100) {
for (i <- 1 to 10) {
db.load(curVer, versionToUniqueId.get(curVer))
db.put("foo", "bar")
db.commit()
Expand Down