-
Notifications
You must be signed in to change notification settings - Fork 2.5k
[HUDI-839] Introducing support for rollbacks using marker files #1756
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
Merged
Merged
Changes from 13 commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
922b1ef
[HUDI-839] Introducing rollback strategy using marker files
vinothchandar 470842d
Adding unit test for MarkerFiles
vinothchandar 751f2ba
[HUDI-839] Adding unit test for MarkerFiles,RollbackUtils, RollbackAc…
lw309637554 e55ce7c
[HUDI-839] Merge branch 'master'
lw309637554 3724403
[HUDI-839] merge latest master patch , add more test for rollback usi…
lw309637554 97380ea
[HUDI-839] merge latest master
lw309637554 713dd31
[HUDI-839] clean marker file at pre commit for spark retries
lw309637554 9f57d75
[HUDI-839] merge latest master
lw309637554 1354336
[HUDI-839] using fileformat with table.getBaseFileExtension
lw309637554 d77c0e3
Merge branch 'master' into HUDI-839-lw
lw309637554 d66a9ec
[HUDI-839] revert the useless unit tests
lw309637554 f193a11
Adding marker directory cleanup to timeline archival process
vinothchandar a0c4de4
Merge branch 'master' into pull/1756
vinothchandar 551ce84
Fix compilation issue & 1 unit test failure
vinothchandar e7ab8f3
Fix small bug in test utils for casing test file correctly
vinothchandar f36b234
Remove unused method on HoodieWriteConfig
vinothchandar File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -28,7 +28,6 @@ | |
| import org.apache.hudi.common.util.Option; | ||
| import org.apache.hudi.common.util.ReflectionUtils; | ||
| import org.apache.hudi.config.HoodieWriteConfig; | ||
| import org.apache.hudi.exception.HoodieException; | ||
| import org.apache.hudi.exception.HoodieIOException; | ||
| import org.apache.hudi.io.storage.HoodieFileWriter; | ||
| import org.apache.hudi.io.storage.HoodieFileWriterFactory; | ||
|
|
@@ -39,6 +38,7 @@ | |
| import org.apache.avro.generic.IndexedRecord; | ||
| import org.apache.hadoop.fs.FileSystem; | ||
| import org.apache.hadoop.fs.Path; | ||
| import org.apache.hudi.table.MarkerFiles; | ||
| import org.apache.log4j.LogManager; | ||
| import org.apache.log4j.Logger; | ||
|
|
||
|
|
@@ -50,6 +50,7 @@ | |
| public abstract class HoodieWriteHandle<T extends HoodieRecordPayload> extends HoodieIOHandle { | ||
|
|
||
| private static final Logger LOG = LogManager.getLogger(HoodieWriteHandle.class); | ||
|
|
||
| protected final Schema originalSchema; | ||
| protected final Schema writerSchema; | ||
| protected HoodieTimer timer; | ||
|
|
@@ -97,28 +98,9 @@ public Path makeNewPath(String partitionPath) { | |
| * | ||
| * @param partitionPath Partition path | ||
| */ | ||
| protected void createMarkerFile(String partitionPath) { | ||
| Path markerPath = makeNewMarkerPath(partitionPath); | ||
| try { | ||
| LOG.info("Creating Marker Path=" + markerPath); | ||
| fs.create(markerPath, false).close(); | ||
| } catch (IOException e) { | ||
| throw new HoodieException("Failed to create marker file " + markerPath, e); | ||
| } | ||
| } | ||
|
|
||
| /** | ||
| * THe marker path will be <base-path>/.hoodie/.temp/<instant_ts>/2019/04/25/filename. | ||
| */ | ||
| private Path makeNewMarkerPath(String partitionPath) { | ||
|
Member
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. all of this stuff is now encapsulatd into a |
||
| Path markerRootPath = new Path(hoodieTable.getMetaClient().getMarkerFolderPath(instantTime)); | ||
| Path path = FSUtils.getPartitionPath(markerRootPath, partitionPath); | ||
| try { | ||
| fs.mkdirs(path); // create a new partition as needed. | ||
| } catch (IOException e) { | ||
| throw new HoodieIOException("Failed to make dir " + path, e); | ||
| } | ||
| return new Path(path.toString(), FSUtils.makeMarkerFile(instantTime, writeToken, fileId)); | ||
| protected void createMarkerFile(String partitionPath, String dataFileName) { | ||
| MarkerFiles markerFiles = new MarkerFiles(hoodieTable, instantTime); | ||
| markerFiles.create(partitionPath, dataFileName, getIOType()); | ||
| } | ||
|
|
||
| public Schema getWriterSchema() { | ||
|
|
@@ -167,6 +149,8 @@ protected GenericRecord rewriteRecord(GenericRecord record) { | |
|
|
||
| public abstract WriteStatus getWriteStatus(); | ||
|
|
||
| public abstract IOType getIOType(); | ||
|
|
||
| @Override | ||
| protected FileSystem getFileSystem() { | ||
| return hoodieTable.getMetaClient().getFs(); | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| /* | ||
| * Licensed to the Apache Software Foundation (ASF) under one | ||
| * or more contributor license agreements. See the NOTICE file | ||
| * distributed with this work for additional information | ||
| * regarding copyright ownership. The ASF licenses this file | ||
| * to you under the Apache License, Version 2.0 (the | ||
| * "License"); you may not use this file except in compliance | ||
| * with the License. You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
|
|
||
| package org.apache.hudi.io; | ||
|
|
||
| /** | ||
| * Types of lower level I/O operations done on each file slice. | ||
| */ | ||
| public enum IOType { | ||
| MERGE, | ||
| CREATE, | ||
| APPEND | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 PR will change behavior for marker dir deletion, with or without marker based rollback turned on.
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.
Ack.