spark
spark copied to clipboard
[SPARK-38909][CORE][YARN] Encapsulate `LevelDB` used to store remote/external shuffle state as `DB`
What changes were proposed in this pull request?
ExternalShuffleBlockResolver
, YarnShuffleService
and RemoteBlockPushResolver
use LevelDB
directly, this is not conducive to extending the use of RocksDB
in this scenario. This pr is encapsulated for expansibility. It will be the pre-work of SPARK-38888, the main change as follows:
- Introduce
DB
interface and implementation of correspondingLevelDB
now,RocksDB
implementation will be involved in the future - Introduce
DBBackend
enum and new configSHUFFLE_SERVICE_DB_BACKEND
to specify a disk-based store used in shuffle service local db, onlyLEVELDB
is supported now,RocksDB
implementation will be involved in the future - Introduce
DBIterator
to traverse the items in theDB
, onlyLevelDBIterator
is supported now,RocksDBIterator
implementation will be involved in the future - Introduce
DBProvider
to initializationDB
, it is only used to generateLevelDB
now,RocksDB
implementation will be involved in the future - Change
StoreVersion
to top-level class, it will be reused byRocksDB
implementation - Replace the directly use of
LevelDB
inExternalShuffleBlockResolver
,YarnShuffleService
andRemoteBlockPushResolver
withDB
- fix corresponding UTs and test tools
Why are the changes needed?
This is pre work of SPARK-38888
Does this PR introduce any user-facing change?
- Add new config
SHUFFLE_SERVICE_DB_BACKEND(spark.shuffle.service.db.backend)
, the new config use to use to specify a disk-based store used in shuffle service local db. OnlyLEVELDB
is supported after this pr.
How was this patch tested?
Pass GA
Although I couldn't take a look at this, you can ask YARN committers' help if you want to make this proceed, @LuciferYang .
thanks @dongjoon-hyun
I found RemoteBlockPushResolver
begin to use LevelDB
, more refactor work is required before reopen this pr
Got it. That's bad.
This is a recent change, to add missing functionality for preserving merge data across restarts. Please tag me when you have an updated PR @LuciferYang, will help review it.
Merge with master and re-trigger GA
This is a recent change, to add missing functionality for preserving merge data across restarts. Please tag me when you have an updated PR @LuciferYang, will help review it.
@dongjoon-hyun @mridulm Conflict is resolved and GA passed. But I think we should make sure that SPARK-38888 is worth to do before reviewing, because this pr is the pre-work of SPARK-38888.
@dongjoon-hyun @mridulm Conflict is resolved and GA passed. But I think we should make sure that SPARK-38888 is worth to do before reviewing, because this pr is the pre-work of SPARK-38888.
I agree with @dongjoon-hyun's assessment in the jira, and I dont have strong opinion. If rest of the codebase is moving towards an abstraction for db, I would prefer we did the same for yarn shuffle as well though from a consistency point of view.
Actually, instead of providing wrapper layer, the final goal is the removal of LevelDB in favor of RocksDB.
@dongjoon-hyun
Actually, instead of providing wrapper layer, the final goal is the removal of LevelDB in favor of RocksDB.
I am sure in future, we might have another SPIP to remove RocksDB in favor of something else :-) If we can abstract it away, the future evolution might be easier !
nit: Btw, from a completeness point of view, DB.get makes sense to include :-)
nit: Btw, from a completeness point of view, DB.get makes sense to include :-)
OK ~
Also cc @tgravescs do you have time to help review this pr? Thanks ~
changes look fine to me
Merged to master. Thanks for working on this @LuciferYang ! Thanks for reviews @dongjoon-hyun, @zhouyejoe and @tgravescs :-)
Thanks @mridulm @tgravescs @zhouyejoe @dongjoon-hyun !!! I will do the RocksDB related work next week due to some other work needs to be completed this week ~