-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
[HUDI-6528] Fix premature RDD unpersist during index lookup #9188
base: master
Are you sure you want to change the base?
Conversation
@@ -80,7 +81,7 @@ public O updateLocation(O writeStatuses, HoodieEngineContext context, | |||
@PublicAPIMethod(maturity = ApiMaturityLevel.EVOLVING) | |||
public abstract <R> HoodieData<HoodieRecord<R>> tagLocation( | |||
HoodieData<HoodieRecord<R>> records, HoodieEngineContext context, | |||
HoodieTable hoodieTable) throws HoodieIndexException; | |||
HoodieTable hoodieTable, Option<String> instantTime) throws HoodieIndexException; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is a public api. we might have to deprecate and add a new one if we wish to change the signature
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the api is marked as "Evolving" so changes are expected in major release
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I get it. we do the same for key generation and other public interfaces. lets add a new method w/o breaking any existing users.
records.persist(new HoodieConfig(config.getProps()) | ||
.getString(HoodieIndexConfig.BLOOM_INDEX_INPUT_STORAGE_LEVEL_VALUE)); | ||
if (config.getBloomIndexUseCaching() && instantTime.isPresent()) { | ||
String storageLevel = config.getString(HoodieIndexConfig.BLOOM_INDEX_INPUT_STORAGE_LEVEL_VALUE); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we move this to constructor and use it everywhere instead of parsing multiple times?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sounds good
@@ -103,11 +102,6 @@ record -> new ImmutablePair<>(record.getPartitionPath(), record.getRecordKey())) | |||
// Step 3: Tag the incoming records, as inserts or updates, by joining with existing record keys | |||
HoodieData<HoodieRecord<R>> taggedRecords = tagLocationBacktoRecords(keyFilenamePairs, records, hoodieTable); | |||
|
|||
if (config.getBloomIndexUseCaching()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess this was intentional. After this, taggedRecords is what is getting used. and we do cache that in BaseSparkCommitActionExecutor.execute
@Override
public HoodieWriteMetadata<HoodieData<WriteStatus>> execute(HoodieData<HoodieRecord<T>> inputRecords) {
// Cache the tagged records, so we don't end up computing both
JavaRDD<HoodieRecord<T>> inputRDD = HoodieJavaRDD.getJavaRDD(inputRecords);
if (inputRDD.getStorageLevel() == StorageLevel.NONE()) {
HoodieJavaRDD.of(inputRDD).persist(config.getTaggedRecordStorageLevel(),
context, HoodieDataCacheKey.of(config.getBasePath(), instantTime));
} else {
LOG.info("RDD PreppedRecords was persisted at: " + inputRDD.getStorageLevel());
}
.
.
So, not sure if we want to keep the persistance until the very end for these rdds which may not be used only.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the main purpose of this PR is about fixing premature un-persisting like this example here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lets do a manual verification that both Rdds are persisted and is not unpersisted until the release resources is invoked.
LGTM otherwise
@@ -80,7 +81,7 @@ public O updateLocation(O writeStatuses, HoodieEngineContext context, | |||
@PublicAPIMethod(maturity = ApiMaturityLevel.EVOLVING) | |||
public abstract <R> HoodieData<HoodieRecord<R>> tagLocation( | |||
HoodieData<HoodieRecord<R>> records, HoodieEngineContext context, | |||
HoodieTable hoodieTable) throws HoodieIndexException; | |||
HoodieTable hoodieTable, Option<String> instantTime) throws HoodieIndexException; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I get it. we do the same for key generation and other public interfaces. lets add a new method w/o breaking any existing users.
Change Logs
Currently when bloom/simple index tag locations for input records, incoming RDDs are supposed to be cached (by default), but
rdd.unpersist()
was invoked prematurely to make caching ineffective. This PR fixes the behavior by marking caching RDD for uncaching atSparkRDDWriteClient#releaseResources
stage.Impact
Indexing performance
Risk level
Medium
Documentation Update
NA
Contributor's checklist