Skip to content
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

Enabling global index for MOR #389

Merged
merged 1 commit into from May 16, 2018

Conversation

n3nash
Copy link
Contributor

@n3nash n3nash commented May 2, 2018

@vinothchandar @bvaradar Kept this change in HoodieMergeOnReadTable rollback and not HbaseIndex to avoid multiple fs.listStatus() calls. Will try to add a test case for this.

@bvaradar
Copy link
Contributor

bvaradar commented May 2, 2018

@n3nash: We should address the redundant fs.listStatus calls so that we no longer have to worry about working around it.

As we have MVCC, can we construct FileSystemView only once in the driver and make it available as a spark broadcast read-only object. For FileSystemView lookup, this view should be the correct one.
But for the sake of defining the view in a general sense similar to DB transaction, At any point in ingestion: the real view of the file-system as seen by ingestion process should be the merged view of this broadcast variable (initial view) and a delta-view (from WriteStatus results) which the ingestion itself caused by adding new file-slices or adding new log-files to latest-file-slice.

For the Reader, it should only be the initial file-system-view. For Async ingestion, this is similar to that of ingestion (merged view of this broadcast variable (initial-view) and a delta-view which the compactor itself caused by compacting part of latest file-slice).

@n3nash
Copy link
Contributor Author

n3nash commented May 2, 2018

@bvaradar Thanks for your comments. I agree with you that we have to address fs.listStatus once so we don't have to worry about it all the time. This has been a topic of discussion for a very long time, you can also see a PR made along these lines here : #278. There are different possible approaches and trade-offs which we have discussed internally. Happy to share the approaches and trade-offs offline if you're interested. We also want to add this : #209 when we make that change.
The purpose of this PR might be limited to just global index. We shuld file another task for listStatus() optimizations and prioritize that sometime soon.

@@ -195,17 +195,24 @@ public Partitioner getUpsertPartitioner(WorkloadProfile profile) {

// append rollback blocks for updates
if (commitMetadata.getPartitionToWriteStats().containsKey(partitionPath)) {
// This needs to be done since GlobalIndex at the moment does not store the latest commit time
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From the diff, I think the goal for this change is to correctly identify the base-commit so that we can append a rollback block. In that case, Can't we just get the base-commit from the writeStat all the time (global index or not ) ? The AppendHandle sets the base-commit as the previous commit in the write-stat. I may be missing some context here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the scenario where the write failed, we record old commitTimes in the inflight file.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is specific to the HBaseIndex implementation and not global indexing in general actually..

@vinothchandar
Copy link
Member

can you expand on why this is fixed specifically for rollbacks alone? how does the happy path know the base commit time to append to, if HBaseIndex won't look it up?

@n3nash
Copy link
Contributor Author

n3nash commented May 7, 2018

For the happy path, we do a listStatus to find the latest valid file : https://github.com/uber/hudi/blob/master/hoodie-client/src/main/java/com/uber/hoodie/io/HoodieAppendHandle.java#L97.
@vinothchandar

Long startTime = System.currentTimeMillis();

HoodieIndex hoodieIndex = HoodieIndex.createIndex(config, jsc);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please leave a TODO here to clean this up later once table has reference to the index ..

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@@ -195,17 +195,24 @@ public Partitioner getUpsertPartitioner(WorkloadProfile profile) {

// append rollback blocks for updates
if (commitMetadata.getPartitionToWriteStats().containsKey(partitionPath)) {
// This needs to be done since GlobalIndex at the moment does not store the latest commit time
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is specific to the HBaseIndex implementation and not global indexing in general actually..

@n3nash
Copy link
Contributor Author

n3nash commented May 9, 2018

@vinothchandar Yes, it is specific to HbaseIndex but isGlobal() seemed cleaner so kept that. We can do index instanceOf HbaseIndex but that's again specific to how clients want to use Hbase, may be they allow for updates too. WDYT ?

@vinothchandar
Copy link
Member

Here is a summary from my investigation. We dont use the commitTime in HoodieRecordLocation in a way that matters. That's why it works now .

HBaseIndex could in theory list and find out the commitTime once and we can annotate stuff nicely. But given fast path is already not relying on this. I am willing to concede. Filed an issue to track this

@vinothchandar vinothchandar merged commit 23d5376 into apache:master May 16, 2018
vinishjail97 pushed a commit to vinishjail97/hudi that referenced this pull request Dec 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants