Skip to content

[MINOR] avoid repeated write behavior in ut#11755

Merged
danny0405 merged 1 commit intoapache:masterfrom
TheR1sing3un:fix_ut_0
Aug 13, 2024
Merged

[MINOR] avoid repeated write behavior in ut#11755
danny0405 merged 1 commit intoapache:masterfrom
TheR1sing3un:fix_ut_0

Conversation

@TheR1sing3un
Copy link
Member

case

When I run a ut in TestHoodieCompactor, I found that every compaction will write a same merged file 2 times.
image

reason

  1. WriteStatus::collect is called after compaction.
image 2. `collect` will cause RDD computation again. 3. But RDD cache about this RDD id has been removed when compaction is completed. image image
  1. So it will cause computation again from this stage. HoodieCompactor::compact
image

Change Logs

Describe context and summary for this change. Highlight if any code was copied.

  1. set stats in metadata after compaction
  2. fix wrong usage about HoodieWriteMetadata which cause the repeated write behavior in ut

Impact

Describe any public API or user-facing feature change or any performance impact.
none

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

Describe any necessary documentation update if there is any new feature, config, or user-facing change. If not, put "none".

  • The config description must be updated if new configs are added or the default value of the configs are changed
  • Any new feature or user-facing change requires updating the Hudi website. Please create a Jira ticket, attach the
    ticket number here and follow the instruction to make
    changes to the website.

Contributor's checklist

  • Read through contributor's guide
  • Change Logs and Impact were stated clearly
  • Adequate tests were added if applicable
  • CI passed

1. set stats in metadata after compaction
2. fix wrong usage about HoodieWriteMetadata which cause the repeated write behavior in ut

Signed-off-by: ther1sing3un <ther1sing3un@163.com>
@github-actions github-actions bot added the size:S PR with lines of changes in (10, 100] label Aug 12, 2024
compactionMetadata.setWriteStatuses(statuses);
compactionMetadata.setCommitted(false);
compactionMetadata.setCommitMetadata(Option.of(metadata));
compactionMetadata.setWriteStats(updateStatusMap);
Copy link
Contributor

Choose a reason for hiding this comment

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

Does line 116 already set up the write stat?

Copy link
Member Author

Choose a reason for hiding this comment

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

Does line 116 already set up the write stat?

Yes, same stats value, but line 166 set up it in HoodieCommitMetadata but not in HoodieWriteMetadata. I think we should also set it in HoodieWriteMetadata.

@TheR1sing3un TheR1sing3un requested a review from danny0405 August 12, 2024 08:37
@hudi-bot
Copy link
Collaborator

CI report:

Bot commands @hudi-bot supports the following commands:
  • @hudi-bot run azure re-run the last Azure build

Copy link
Contributor

@KnightChess KnightChess left a comment

Choose a reason for hiding this comment

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

how about disable release cache data in compact ut?

@TheR1sing3un
Copy link
Member Author

how about disable release cache data in compact ut?

Yes, it is also a great solution! But the cache-release logic is related to auto-commit.

@danny0405 danny0405 merged commit ae40574 into apache:master Aug 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:S PR with lines of changes in (10, 100]

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants