Skip to content

Add optional automatic gaps filling feature for append-only databases#476

Open
konard wants to merge 3 commits into
mainfrom
issue-172-3a6bb3a5
Open

Add optional automatic gaps filling feature for append-only databases#476
konard wants to merge 3 commits into
mainfrom
issue-172-3a6bb3a5

Conversation

@konard
Copy link
Copy Markdown
Member

@konard konard commented Sep 13, 2025

Summary

This PR implements the solution for issue #172 by adding an optional automatic gaps filling feature that can be disabled for databases that do not delete data (all changes archived).

Changes Made:

  1. Added _enableAutomaticGapsFilling field to UnitedMemoryLinksBase to control runtime existence checks
  2. Extended constructor overloads across both UnitedMemoryLinksBase and UnitedMemoryLinks to accept the enableAutomaticGapsFilling parameter
  3. Modified the Each method to conditionally skip Exists() checks when gaps filling is disabled
  4. Added comprehensive tests to verify both enabled and disabled modes work correctly

Performance Benefits:

For append-only databases (databases that never delete data), disabling automatic gaps filling eliminates runtime Exists() checks, improving performance during link iteration.

API Usage:

// For append-only databases - improved performance
var links = new UnitedMemoryLinks<ulong>(memory, reservationStep, enableAutomaticGapsFilling: false);

// Default behavior (backward compatible)
var links = new UnitedMemoryLinks<ulong>(memory, reservationStep); // enableAutomaticGapsFilling defaults to true

Test Plan:

  • ✅ All existing tests pass (22/22, 1 skipped)
  • ✅ Added AutomaticGapsFillingDisabledTest to verify skip behavior
  • ✅ Added AutomaticGapsFillingEnabledTest to verify default behavior
  • ✅ Build succeeds with no breaking changes

This implementation maintains full backward compatibility while providing the requested performance optimization for append-only database scenarios.

🤖 Generated with Claude Code


Resolves #172

Adding CLAUDE.md with task information for AI processing.
This file will be removed when the task is complete.

Issue: #172
@konard konard self-assigned this Sep 13, 2025
For databases that do not delete data (all changes archived), the automatic gaps filling feature can now be disabled to improve performance by skipping runtime existence checks during link iteration.

Changes:
- Add _enableAutomaticGapsFilling field to UnitedMemoryLinksBase
- Add new constructor overloads to support the enableAutomaticGapsFilling parameter
- Modify Each method to conditionally skip Exists checks when gaps filling is disabled
- Add comprehensive tests for both enabled and disabled modes

This addresses the performance concern raised in issue #172 for append-only database scenarios.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
@konard konard changed the title [WIP] For databases that do not delete data (all changes archived) automatic gaps filling feature can be optional (no need to check at runtime at allow) Add optional automatic gaps filling feature for append-only databases Sep 13, 2025
@konard konard marked this pull request as ready for review September 13, 2025 20:24
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.

For databases that do not delete data (all changes archived) automatic gaps filling feature can be optional (no need to check at runtime at allow)

1 participant