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
DBinterface and implementation of correspondingLevelDBnow,RocksDBimplementation will be involved in the future - Introduce
DBBackendenum and new configSHUFFLE_SERVICE_DB_BACKENDto specify a disk-based store used in shuffle service local db, onlyLEVELDBis supported now,RocksDBimplementation will be involved in the future - Introduce
DBIteratorto traverse the items in theDB, onlyLevelDBIteratoris supported now,RocksDBIteratorimplementation will be involved in the future - Introduce
DBProviderto initializationDB, it is only used to generateLevelDBnow,RocksDBimplementation will be involved in the future - Change
StoreVersionto top-level class, it will be reused byRocksDBimplementation - Replace the directly use of
LevelDBinExternalShuffleBlockResolver,YarnShuffleServiceandRemoteBlockPushResolverwithDB - 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. OnlyLEVELDBis 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 ~