Skip to content

Commit tracker configuration through atomic checkpoints - #220

Closed
linroid wants to merge 2 commits into
torrent-v2-11-tracker-checkpointfrom
torrent-v2-11-tracker-config-commit
Closed

linroid wants to merge 2 commits into
torrent-v2-11-tracker-checkpointfrom
torrent-v2-11-tracker-config-commit

Conversation

@linroid

@linroid linroid commented Sep 12, 2026

Copy link
Copy Markdown
Owner

Adds a piece-store transaction for tracker configuration replacement using a flushed temporary checkpoint and atomic rename. The old configuration remains current until rename succeeds; ordinary saves read current configuration under the same mutex. Failed rename preserves the old file and state and allows retry.

Cancellation after rename can hide a successful return from the caller. The store publishes committed configuration before leaving the I/O block and exposes it for ownership reconciliation. Callers retain admission while the store uses the configuration.

Stacked on #219; advances #162. Tests cover successful/repeated persistence, injected rename failure, retry, and cancellation precisely after rename. Session edit commands and their retained-owner reconciliation remain separate work.

Validation: 566 JVM and 545 executed iOS simulator tests, zero failures/errors/skips; native-runtime guard and both pinned v1 conformance scenarios passed.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 12, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-12T22:17:48.611007Z 5c78a90 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5c78a9002b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

}
val identity = checkNotNull(ownedFiles[temp])
journal.append(false, TorrentOwnedPath(checkpointPath.toString(), identity))
currentCoroutineContext().ensureActive()

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Remove the staged checkpoint when cancellation wins

If the caller is canceled while the temporary checkpoint is being written or flushed, this check throws after the full snapshot has been created and registered in ownedFiles, but no code deletes it. Retrying on the same store does not rerun initialize()'s stale-temp cleanup, so repeated canceled replacements accumulate potentially multi-megabyte .tmp files and journal entries until the entire session is cleaned up. Delete the staged file by its recorded identity and remove its in-memory ownership entry on this pre-rename cancellation path.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Fixed by cleaning up a failed or canceled staged checkpoint inside the admitted I/O operation. Deletion requires the recorded OS identity to still match; the in-memory temporary entry is removed after cleanup. The original failure is preserved if cleanup also fails. A regression repeatedly cancels before rename on the same store, checks that no temporary files or ownership entries remain, verifies the prior committed bytes/configuration, and retries successfully. It failed before the fix.

@github-actions

github-actions Bot commented Sep 12, 2026 •

Copy link
Copy Markdown
Contributor

Test Results

  737 files  + 5    737 suites  +5   4m 23s ⏱️ +7s
3 080 tests +12  3 080 ✅ +12  0 💤 ±0  0 ❌ ±0 
4 212 runs  +20  4 212 ✅ +20  0 💤 ±0  0 ❌ ±0 

Results for commit 937d18d. ± Comparison against base commit 8824f25.

♻️ This comment has been updated with latest results.

@linroid

linroid commented Sep 20, 2026

Copy link
Copy Markdown
Owner Author

Superseded by #237 (Tracker lifecycle, editing and discovery privacy) in the consolidated eight-PR stack for #162.

The replacement preserves this PR's code and subsequent fixes; its description links the original head and review discussions. The only additional consolidation fix is the CI-discovered listener cancellation regression, documented on the replacement. All eight replacements have passed their required CI checks.

Closing without merging. This branch and its discussions remain available for reference. Review index: #162 (comment)

@linroid linroid closed this Sep 20, 2026
@linroid
linroid deleted the torrent-v2-11-tracker-config-commit branch September 20, 2026 11:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant