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

[HUDI-7921] Making HoodieTable closeable #11494

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

nsivabalan
Copy link
Contributor

@nsivabalan nsivabalan commented Jun 24, 2024

Change Logs

Making HoodieTable Closeable. We have few resources initialized in HoodieTable file FileSysteViewManager and metadata. So introducing close in HoodieTable and closing out all resources instantiated.

Impact

Avoids memory leaks with WriteClients.

Risk level (write none, low medium or high below)

low.

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

@github-actions github-actions bot added the size:L PR with lines of changes in (300, 1000] label Jun 24, 2024
@nsivabalan nsivabalan marked this pull request as ready for review June 24, 2024 04:41
@nsivabalan nsivabalan changed the title [HUDI-7921][DNM] Making HoodieTable closeable [HUDI-7921] Making HoodieTable closeable Jun 24, 2024
@nsivabalan nsivabalan changed the title [HUDI-7921] Making HoodieTable closeable [HUDI-7921][DNM] Making HoodieTable closeable Jun 24, 2024
@github-actions github-actions bot added size:XL PR with lines of changes > 1000 and removed size:L PR with lines of changes in (300, 1000] labels Jun 24, 2024
@nsivabalan nsivabalan changed the title [HUDI-7921][DNM] Making HoodieTable closeable [HUDI-7921] Making HoodieTable closeable Jun 24, 2024
@hudi-bot
Copy link

CI report:

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

throw new HoodieLogCompactException(String.format("Cannot log compact since a compaction instant with greater "
+ "timestamp exists. Instant details %s", compactionInstantWithGreaterTimestamp.get()));
}
try {
Copy link
Contributor Author

@nsivabalan nsivabalan Jun 27, 2024

Choose a reason for hiding this comment

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

NTR: only change in this code block is the closing of HoodieTable.

HoodieTable table = createTable(config, hadoopConf);
resolveWriteConflict(table, metadata, this.pendingInflightAndRequestedInstants);
HoodieTable<?, I, ?, T> table = createTable(config, hadoopConf);
try {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

NTR: Even though HoodieTable implements AutoCloseable, I could not use try with resources construct. I wanna throw something specific if close of HoodieTable fails vs something fails within try block. hence had to take this route.

if (shouldComplete && compactionMetadata.getCommitMetadata().isPresent()) {
completeCompaction(compactionMetadata.getCommitMetadata().get(), table, compactionInstantTime);
try {
HoodieTimeline pendingCompactionTimeline = table.getActiveTimeline().filterPendingCompactionTimeline();
Copy link
Contributor Author

Choose a reason for hiding this comment

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

NTR: only change in this code block is the closing of HoodieTable.

} else {
throw new HoodieClusteringException("Non clustering replace-commit inflight at timestamp " + clusteringInstant);
try {
HoodieTimeline pendingClusteringTimeline = table.getActiveTimeline().filterPendingReplaceTimeline();
Copy link
Contributor Author

Choose a reason for hiding this comment

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

NTR: only change in this code block is the closing of HoodieTable.

table.getMetaClient().reloadActiveTimeline();
return true;
try {
HoodieTimeline pendingClusteringTimeline = table.getActiveTimeline().filterPendingReplaceTimeline();
Copy link
Contributor Author

Choose a reason for hiding this comment

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

NTR: entire set of changes in this patch is about closing HoodieTables

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size:XL PR with lines of changes > 1000
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants