Skip to content

Commit a0faf88

Browse files
author
Ryan Murray
committed
log store chooses where checkpoitns go (delta-io#6)
1 parent fe68e6c commit a0faf88

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

src/main/scala/org/apache/spark/sql/delta/Checkpoints.scala

+2-1
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,8 @@ object Checkpoints extends DeltaLogging {
229229
val checkpointSize = spark.sparkContext.longAccumulator("checkpointSize")
230230
val numOfFiles = spark.sparkContext.longAccumulator("numOfFiles")
231231
// Use the string in the closure as Path is not Serializable.
232-
val path = checkpointFileSingular(snapshot.path, snapshot.version).toString
232+
val resolvedPath = deltaLog.store.resolveCheckpointPath(snapshot.path)
233+
val path = checkpointFileSingular(resolvedPath, snapshot.version).toString
233234
val base = snapshot.state
234235
.repartition(1)
235236
.map { action =>

src/main/scala/org/apache/spark/sql/delta/storage/LogStore.scala

+12
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,18 @@ trait LogStore {
8383
throw new UnsupportedOperationException()
8484
}
8585

86+
/**
87+
* Let LogStore decide where checkpoints should be stored.
88+
*
89+
* Typically the checkpoint storage path would be the same as for Delta storage.
90+
* This woudl be inside the _delta_log directory. The LogStore impl may wish to control this path
91+
* and should inform the Checkpoints methods accordingly. This is only required for checkpoints
92+
* as they are the only metadata file not directly written by LogStore.
93+
*/
94+
def resolveCheckpointPath(path: Path): Path = {
95+
path
96+
}
97+
8698
/**
8799
* Whether a partial write is visible when writing to `path`.
88100
*

0 commit comments

Comments
 (0)