Skip to content

Conversation

@inv-jishnu
Copy link
Contributor

@inv-jishnu inv-jishnu commented May 27, 2025

Description

This PR ensures that the distributed storage and distributed transaction manager objects are properly closed once the import process is completed.
These changes address the feedback provided in the following comments from PR #2618:

Discussion 1

Discussion 2

Related issues and/or PRs

NA

Changes made

  • Updated the core logic to ensure the distributed storage or distributed transaction manager object is closed after the import process completes.
  • Added the close method call to the onAllDataChunksCompleted method of the import manager, which is invoked at the end of the import process.
  • Included additional changes based on AI-generated suggestions, specifically around improved exception handling.
  • Depending on the configured ScalarDB mode, only one of the two objects (storage or transaction) will be initialized; the other will be set to null.

Checklist

The following is a best-effort checklist. If any items in this checklist are not applicable to this PR or are dependent on other, unmerged PRs, please still mark the checkboxes after you have read and understood each item.

  • I have commented my code, particularly in hard-to-understand areas.
  • I have updated the documentation to reflect the changes.
  • I have considered whether similar issues could occur in other products, components, or modules if this PR is for bug fixes.
  • Any remaining open issues linked to this PR are documented and up-to-date (Jira, GitHub, etc.).
  • Tests (unit, integration, etc.) have been added for the changes.
  • My changes generate no new warnings.
  • Any dependent changes in other PRs have been merged and published.

Additional notes (optional)

NA

Release notes

NA

@inv-jishnu inv-jishnu self-assigned this May 27, 2025
@inv-jishnu inv-jishnu marked this pull request as draft May 27, 2025 11:17
@ypeckstadt ypeckstadt marked this pull request as ready for review May 29, 2025 01:21
@ypeckstadt ypeckstadt requested review from a team, Torch3333, brfrn169, Copilot, feeblefakie, komamitsu and ypeckstadt and removed request for a team May 29, 2025 01:21
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR ensures that the distributed storage and distributed transaction manager objects are properly closed after the import process completes. Key changes include:

  • Adding the closeResources() method to handle resource closure.
  • Wrapping listener notifications and resource closure in try-catch blocks with exception suppression.
  • Improving exception handling to propagate any errors encountered during the process.

/** {@inheritDoc} Forwards the event to all registered listeners. */
@Override
public void onAllDataChunksCompleted() {
Throwable firstException = null;
Copy link

Copilot AI May 29, 2025

Choose a reason for hiding this comment

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

Catching Throwable may inadvertently capture critical errors (e.g., OutOfMemoryError). Consider catching Exception to handle only recoverable errors.

Copilot uses AI. Check for mistakes.

/** Close resources properly once the process is completed */
public void closeResources() {
try {
Copy link

Copilot AI May 29, 2025

Choose a reason for hiding this comment

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

Catching Throwable in the closeResources method might hide serious errors. Consider catching Exception instead to avoid masking unrecoverable issues.

Copilot uses AI. Check for mistakes.
Copy link
Contributor

@komamitsu komamitsu left a comment

Choose a reason for hiding this comment

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

LGTM! 👍

Copy link
Collaborator

@brfrn169 brfrn169 left a comment

Choose a reason for hiding this comment

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

@inv-jishnu Don't we need to update the unit tests?

@inv-jishnu
Copy link
Contributor Author

@brfrn169 san,
I have added unit tests for the change.
Please take a look at it again when you get a chance.
Thank you.

@inv-jishnu inv-jishnu requested a review from brfrn169 May 30, 2025 09:04
Copy link
Collaborator

@brfrn169 brfrn169 left a comment

Choose a reason for hiding this comment

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

LGTM! Thank you!

Copy link
Contributor

@ypeckstadt ypeckstadt left a comment

Choose a reason for hiding this comment

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

LGTM. Thank you.

Copy link
Contributor

@Torch3333 Torch3333 left a comment

Choose a reason for hiding this comment

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

LGTM, thank you!

@ypeckstadt ypeckstadt merged commit dad6075 into master Jun 2, 2025
55 checks passed
@ypeckstadt ypeckstadt deleted the jishnu/data-loader/storage-trn-close branch June 2, 2025 03:09
feeblefakie pushed a commit that referenced this pull request Jun 2, 2025
feeblefakie pushed a commit that referenced this pull request Jun 2, 2025
feeblefakie pushed a commit that referenced this pull request Jun 2, 2025
feeblefakie pushed a commit that referenced this pull request Jun 2, 2025
feeblefakie pushed a commit that referenced this pull request Jun 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants