-
Notifications
You must be signed in to change notification settings - Fork 2.5k
[HUDI-2468] Metadata table support for rolling back the first commit #3843
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -18,6 +18,7 @@ | |
|
|
||
| package org.apache.hudi.table; | ||
|
|
||
| import org.apache.avro.specific.SpecificRecordBase; | ||
| import org.apache.hudi.avro.HoodieAvroUtils; | ||
| import org.apache.hudi.avro.model.HoodieCleanMetadata; | ||
| import org.apache.hudi.avro.model.HoodieCleanerPlan; | ||
|
|
@@ -706,11 +707,23 @@ public HoodieEngineContext getContext() { | |
| } | ||
|
|
||
| /** | ||
| * Fetch instance of {@link HoodieTableMetadataWriter}. | ||
| * Get Table metadata writer. | ||
| * | ||
| * @return instance of {@link HoodieTableMetadataWriter | ||
| */ | ||
| public final Option<HoodieTableMetadataWriter> getMetadataWriter() { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. one minor question. should we pass actionMetadata only for rollback ? If we are going to pass for every operation, may I know why do we need this method?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Except for CommitMetadata all other actions are extending SpecificRecordBase and are good to be moved. So, getMetadataWriter() version has to stay around till the CommitMetadata is solved. I can file a new ticket to take this on if you are ok.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Created following tickets to track related tasks |
||
| return getMetadataWriter(Option.empty()); | ||
| } | ||
|
|
||
| /** | ||
| * Get Table metadata writer. | ||
| * | ||
| * @return instance of {@link HoodieTableMetadataWriter} | ||
| */ | ||
| public Option<HoodieTableMetadataWriter> getMetadataWriter() { | ||
| // Each engine is expected to override this and provide the actual metadata writer if enabled. | ||
| public <T extends SpecificRecordBase> Option<HoodieTableMetadataWriter> getMetadataWriter(Option<T> actionMetadata) { | ||
| // Each engine is expected to override this and | ||
| // provide the actual metadata writer, if enabled. | ||
| return Option.empty(); | ||
| } | ||
|
|
||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -18,6 +18,7 @@ | |
|
|
||
| package org.apache.hudi.table; | ||
|
|
||
| import org.apache.avro.specific.SpecificRecordBase; | ||
| import org.apache.hudi.client.WriteStatus; | ||
| import org.apache.hudi.client.common.HoodieFlinkEngineContext; | ||
| import org.apache.hudi.common.engine.HoodieEngineContext; | ||
|
|
@@ -98,11 +99,11 @@ protected HoodieIndex<T, List<HoodieRecord<T>>, List<HoodieKey>, List<WriteStatu | |
| * @return instance of {@link HoodieTableMetadataWriter} | ||
| */ | ||
| @Override | ||
| public Option<HoodieTableMetadataWriter> getMetadataWriter() { | ||
| public <T extends SpecificRecordBase> Option<HoodieTableMetadataWriter> getMetadataWriter(Option<T> actionMetadata) { | ||
| synchronized (this) { | ||
| if (!isMetadataAvailabilityUpdated) { | ||
| // this code assumes that if metadata availability is updated once it will not change. please revisit this logic if that's not the case. | ||
| // this is done to avoid repeated calls to fs.exists(). | ||
| // This code assumes that if metadata availability is updated once it will not change. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Where does the passed in |
||
| // Please revisit this logic if that's not the case. This is done to avoid repeated calls to fs.exists(). | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Where does the passed in |
||
| try { | ||
| isMetadataTableAvailable = config.isMetadataTableEnabled() | ||
| && metaClient.getFs().exists(new Path(HoodieTableMetadata.getMetadataTableBasePath(metaClient.getBasePath()))); | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.