Skip to content

Add unit tests for RangeIndexHandler version-change detection and index lifecycle#19044

Open
Akanksha-kedia wants to merge 3 commits into
apache:masterfrom
Akanksha-kedia:feat/range-index-handler-test
Open

Add unit tests for RangeIndexHandler version-change detection and index lifecycle#19044
Akanksha-kedia wants to merge 3 commits into
apache:masterfrom
Akanksha-kedia:feat/range-index-handler-test

Conversation

@Akanksha-kedia

Copy link
Copy Markdown
Contributor

Description

Adds unit tests for RangeIndexHandler, closing the coverage gap for the FST/range index handler family.

Test cases covered:

  • Version change detection: v1 → v2 triggers rebuild
  • Version change detection: v2 → v1 (downgrade) triggers rebuild
  • No rebuild when on-disk version matches configured version
  • Index removal when column is dropped from config (updateIndices verifies removeIndex is called)
  • New index creation for unsorted column added to config
  • Sorted columns are skipped even when range index is configured

This is part of the same series as:

Test plan

  • RangeIndexHandlerTest passes locally
  • No production code changes — test-only PR

Akanksha-kedia and others added 3 commits July 10, 2026 11:15
RangeIndexHandler.existingRangeIndexVersionDiffers() detects v1↔v2
on-disk version mismatches that require an index rebuild, but this
logic had no test coverage. Adds RangeIndexHandlerTest covering:
- v1→v2 and v2→v1 version changes trigger rebuild
- Matching versions produce no rebuild
- Columns removed from config trigger index removal
- New unsorted columns trigger index creation
- Sorted columns are skipped even when range index is configured

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
…ndler preconditions

Stub getTotalDocs()→1 and getAllColumns()→TreeSet in all SegmentMetadataImpl
mocks so the BaseIndexHandler constructor precondition check does not throw.
@Akanksha-kedia

Copy link
Copy Markdown
Contributor Author

cc @Jackie-Jiang @richardstartin — would appreciate a review when you get a chance!

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