Skip to content

fix(iota-data-ingestion-core): make file updates atomic #6918

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

Open
wants to merge 5 commits into
base: develop
Choose a base branch
from

Conversation

sergiupopescu199
Copy link
Contributor

@sergiupopescu199 sergiupopescu199 commented May 20, 2025

Description of change

This PR refactors the FileProgressStore to ensure atomic updates when storing watermark data.
It leverages a temporary file to write the new data, and then uses an atomic rename operation to replace the original file with the updated version.

This approach guarantees that the watermark file is never left in a partially written or corrupted state, even in the event of a crash or unexpected shutdown, ensuring data integrity and reliability.

Links to any relevant issues

fixes #6889

Type of change

  • Bug fix (a non-breaking change which fixes an issue)

How the change has been tested

  • Added 2 test cases to verify the results.
cargo test -p iota-data-ingestion-core

Make sure to provide instructions for the maintainer as well as any relevant configurations.

  • Basic tests (linting, compilation, formatting, unit/integration tests)
    • Existing tests passed
  • Patch-specific tests (correctness, functionality coverage)
    • Added 2 tests in the iota-data-ingestion-core crate that verifies the actual patch changes
    • file_progress_store_save_timeout_simulates_crash & file_progress_store

Infrastructure QA (only required for crates that are maintained by @iotaledger/infrastructure)

  • Verification of API backward compatibility.

Note

The other checkboxes were removed since this patch does not directly affect the indexer performance, nevertheless running locally the ingestion framework for checkpoint processing risulted in the same performance as before, not visible regression were spotted.

Change checklist

Tick the boxes that are relevant to your changes, and delete any items that are not.

  • I have followed the contribution guidelines for this project
  • I have performed a self-review of my own code
  • I have added tests that prove my fix is effective or that my feature works
  • I have checked that new and existing unit tests pass locally with my changes

Release Notes

  • Protocol:
  • Nodes (Validators and Full nodes):
  • Indexer:
  • JSON-RPC:
  • GraphQL:
  • CLI:
  • Rust SDK:
  • REST API:

@sergiupopescu199 sergiupopescu199 requested a review from a team as a code owner May 20, 2025 10:56
Copy link

vercel bot commented May 20, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

4 Skipped Deployments
Name Status Preview Comments Updated (UTC)
apps-backend ⬜️ Ignored (Inspect) Visit Preview May 21, 2025 1:57pm
apps-ui-kit ⬜️ Ignored (Inspect) Visit Preview 💬 Add feedback May 21, 2025 1:57pm
rebased-explorer ⬜️ Ignored (Inspect) Visit Preview May 21, 2025 1:57pm
wallet-dashboard ⬜️ Ignored (Inspect) Visit Preview 💬 Add feedback May 21, 2025 1:57pm

@iota-ci iota-ci added infrastructure Issues related to the Infrastructure Team sc-platform Issues related to the Smart Contract Platform group. labels May 20, 2025
Copy link
Contributor

@kodemartin kodemartin left a comment

Choose a reason for hiding this comment

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

looks good with a remark

@sergiupopescu199 sergiupopescu199 force-pushed the sc-platform/issue-6889 branch from 3652ae0 to 36aa17e Compare May 21, 2025 12:36
@sergiupopescu199 sergiupopescu199 requested a review from a team May 21, 2025 12:40
Copy link
Member

@samuel-rufi samuel-rufi left a comment

Choose a reason for hiding this comment

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

Wondering about the need of sync_all, please see below:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
infrastructure Issues related to the Infrastructure Team sc-platform Issues related to the Smart Contract Platform group.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[iota-data-ingestion-core]: FileProgressStore updates are not atomic
4 participants