-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[SPARK] Don't cache failed future result in LazyCheckpointProvider
Don't cache failed future result in LazyCheckpointProvider. Currently we define LazyCheckpointProvider as following: ``` def createCheckpointProvider(): CheckpointProvider = { ... val v2Actions = ThreadUtils.wait(readActionsFuture) CheckpointProvider(v2Actions, ...) } lazy val underlyingCheckpointProvider = createCheckpointProvider() ``` If the future here fails, then the `createCheckpointProvider()` will fail and whoever is accessing the `underlyingCheckpointProvider` will also get exception. The `underlyingCheckpointProvider` is accessed by Snapshot class - so snapshot class will get some error and query will fail. But a user might run the same query again in some time - since the snapshot is cached under deltalog, the snapshot will again invoke methods on checkpointProvider, which will invoke lazyCheckpointProvider.underlyingCheckpointProvider. Due to this, it will again fail as future has already failed once in the beginning due to some intermittent failure. The solution here is to not use the future and instead invoke real readV2Actions method in the subsequent invocation of `createCheckpointProvider()`. If the `createCheckpointProvider()` has already succeeded in first attempt, then the checkpointProvider will be cached under `lazy val underlyingCheckpointProvider`. But if it failed in first attempt, then next time we should not use future result for getting v2 actions and we should do I/O and read v2 actions again. GitOrigin-RevId: a5631e91a15ec7b991bf5c7ba213a59a465b1d1a
- Loading branch information
1 parent
4e7cb5f
commit bbf19c3
Showing
3 changed files
with
117 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters