-
Notifications
You must be signed in to change notification settings - Fork 2.5k
[HUDI-6040]Stop writing and reading compaction plans from .aux folder #8385
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
Conversation
danny0405
left a comment
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.
+1, nice catch ~
| public void saveToCompactionRequested(HoodieInstant instant, Option<byte[]> content, boolean overwrite) { | ||
| ValidationUtils.checkArgument(instant.getAction().equals(HoodieTimeline.COMPACTION_ACTION)); | ||
| // Write workload to auxiliary folder | ||
| createFileInAuxiliaryFolder(instant, content); |
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.
cc @bvaradar for taking over this, generally looks good.
|
@bvaradar Hi, could u take the time to review this pr, Is there anything I need to modify? |
bvaradar
left a comment
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.
@Mulavar : This requires a table version change also as we need to create .aux files when we downgrade to older version. Can you add relevant UpgradeDowngrade handlers for this.
|
@bvaradar Thanks for your review. I think your suggestion is very valuable, and I need to read that piece of code first because I'm not very familiar with the code of table version downgrade. |
|
@bvaradar hi bvaradar, could u take some time to review the pr again? |
bvaradar
left a comment
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.
Realized there are more places to cleanup. Please take a look.
.../hudi-client-common/src/main/java/org/apache/hudi/table/upgrade/FiveToSixUpgradeHandler.java
Show resolved
Hide resolved
| compactionTimeline.getInstants().stream().forEach(instant -> { | ||
| String fileName = instant.getFileName(); | ||
| try { | ||
| metaClient.getFs().delete(new Path(metaClient.getMetaAuxiliaryPath(), fileName)); |
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.
@Mulavar : We need to basically look at all caller of metaClient.getMetaAuxiliaryPath() and remove the usage of metaAuxiliaryPath since we should not no longer write to them. Also in HoodieTableMetaClient.initTableAndGetMetaClient, can you remove the creation of .aux folder
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 found that some other feature like bootstrap index also use the .aux folder, refer to org.apache.hudi.common.table.HoodieTableMetaClient#BOOTSTRAP_INDEX_ROOT_FOLDER_PATH and we can not just remove the creation of .aux folder. Maybe we should remove the caller of metaClient.getMetaAuxiliaryPath() related to compaction logic?
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.
Yes, Good point. We should only cleanup compaction plans in .aux folder and remove compaction only callers
54fbf42 to
6fd073a
Compare
...-client/hudi-client-common/src/main/java/org/apache/hudi/table/upgrade/UpgradeDowngrade.java
Show resolved
Hide resolved
| compactionTimeline.getInstants().stream().forEach(instant -> { | ||
| String fileName = instant.getFileName(); | ||
| try { | ||
| metaClient.getFs().delete(new Path(metaClient.getMetaAuxiliaryPath(), fileName)); |
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.
Yes, Good point. We should only cleanup compaction plans in .aux folder and remove compaction only callers
bvaradar
left a comment
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.
@Mulavar : Thanks for cleaning this. Functionality wise, it looks good to me. Can you add detailed tests for TestFiveSixUpgradeDowngrader. We need to cover cases when (a) aux folder is empty (b) aux folder is non-empty with incomplete compactions and (c) case b along with metadata bootstrap done. In all 3 cases, can you run subsequent compaction and check compaction succeeded followed by a write-schedule_compaction-run_compaction. Similar cases needed for downgrade. This should cover all cases.
@danny0405 : There is some cleanup in Flink related code. Can you kindly take a look and give a thumbs up if it looks good.
|
@bvaradar Yeah bvaradar, I agreed with you that we need to add some test cases to verify the upgrader/downgrader, but I'm not sure if there's a need to run subsequent compaction, cause we do not change anything about the compaction plan content, so maybe we should better verify if we can still read the compaction plan from .hoodie folder when after deleting compaction.requested from .aux folder. Since the upgrade verification has been covered by org.apache.hudi.common.table.timeline.TestHoodieActiveTimeline#testLoadingInstantsFromFiles and we could add some tests to verify SixToFiveDowngradeHandler. WDYT? |
ddb5108 to
1cd0db6
Compare
|
@hudi-bot run azure |
|
@Mulavar : W.r.t running compaction after upgrade/downgrade, this will help prove that the upgrade will be safer if we can ensure compaction did not fail in any place after upgrade/downgrade. |
|
@bvaradar Yeah, but I'm not very familiar with the compaction test, could you give me some tips on which example should I look at? |
|
@hudi-bot run azure |
9149994 to
9659d42
Compare
...source/hudi-flink/src/test/java/org/apache/hudi/sink/compact/ITTestHoodieFlinkCompactor.java
Show resolved
Hide resolved
...source/hudi-flink/src/test/java/org/apache/hudi/sink/compact/ITTestHoodieFlinkCompactor.java
Outdated
Show resolved
Hide resolved
nsivabalan
left a comment
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.
Should we completely remove all usages of "aux" folder with this patch?

I don't see any other usages after this patch.
Also, @bvaradar : can you help me understand what will happen in this case.
if a compaction plan was written to aux but failed to add to ".hoodie" just before upgrade.
after upgrade, if we delete the entire "aux" folder, we should be good right. there won't be any other traces of that failed compaction schedule ?
.../hudi-client-common/src/main/java/org/apache/hudi/table/upgrade/FiveToSixUpgradeHandler.java
Show resolved
Hide resolved
| HoodieTableMetaClient metaClient = table.getMetaClient(); | ||
| // delete compaction file from .aux | ||
| HoodieTimeline compactionTimeline = metaClient.getActiveTimeline().filterPendingCompactionTimeline() | ||
| .filter(instant -> instant.getState() == HoodieInstant.State.REQUESTED); |
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 checked the usages of aux folder and its used only incase of compaction plans and may be flink clustering.
why can't we delete entire aux folder ?
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 found that some other features like bootstrap index also use the .aux folder, refer to org.apache.hudi.common.table.HoodieTableMetaClient#BOOTSTRAP_INDEX_ROOT_FOLDER_PATH and we can not just remove the creation of .aux folder. Maybe we should remove the caller of metaClient.getMetaAuxiliaryPath() related to compaction logic?"
This patch only cares about the compaction, and there is some other file/folder in the .aux folder, we should only remove the files about compaction. If we want to confirm if the entire .aux folder could be deleted, maybe better if we should open another issue to discuss it.
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.
sg.
| HoodieTable table = upgradeDowngradeHelper.getTable(config, context); | ||
| HoodieTableMetaClient metaClient = table.getMetaClient(); | ||
| // sync compaction requested file to .aux | ||
| HoodieTimeline compactionTimeline = metaClient.getActiveTimeline().filterPendingCompactionTimeline() |
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 could return instants either in inflight or in requested. if its inflight, we need to fetch the filename by constructing the requested instant as well
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 code snippet has been followed by the filter which does the thing you said.
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.
what I meant is, for a compaction that has both requested and inflight in ".hoodie", only INFLIGHT will be returned with this call (metaClient.getActiveTimeline().filterPendingCompactionTimeline()) and in subsequent like you are filtering only for requested and hence we might miss.
can you check please.
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.
Thanks, nice catch! fixed.
|
we should also https://issues.apache.org/jira/browse/HUDI-546 along with 6040. |
@nsivabalan : It is still used for bootstrap. Bootstrap folder is under aux |
Flink actually uses the .aux folder for some configurations like 1. fs view storage conf and 2. checkpoint metadata, so we may need to keep this folder, just drop the file creation for compaction should be fine. |
|
@nsivabalan Hi nsivabalan, I've fixed the comment, could u check this patch again~ |
|
@nsivabalan : Are you ok with this change ? If so, can you approve it ? |
Change Logs
Stop writing and reading compaction plans from .aux folder
Describe context and summary for this change. Highlight if any code was copied.
Impact
Reduce I/O when schedule compaction from 2 to 1.
Describe any public API or user-facing feature change or any performance impact.
Risk level (write none, low medium or high below)
None.
If medium or high, explain what verification was done to mitigate the risks.
Documentation Update
None
Describe any necessary documentation update if there is any new feature, config, or user-facing change
ticket number here and follow the instruction to make
changes to the website.
Contributor's checklist