Skip to content

feat: add scalar index V3 diagnostic scanner - #514

Open
congqixia wants to merge 1 commit into
milvus-io:mainfrom
congqixia:feat/scan_v3_index
Open

feat: add scalar index V3 diagnostic scanner#514
congqixia wants to merge 1 commit into
milvus-io:mainfrom
congqixia:feat/scan_v3_index

Conversation

@congqixia

Copy link
Copy Markdown
Collaborator

Add scan-v3-index to inspect packed scalar index V3 objects with range reads and correlate them with SegmentIndex metadata and collection schemas.

  • detect loader type mismatches, invalid paths, malformed metadata, CRC failures, row-count inconsistencies, and encrypted indexes
  • support build-rooted and collection-rooted storage layouts
  • resolve effective JSON types from cast metadata and validate JSON path loader formats
  • detect string and numeric STLSORT mismatches with JSON-specific diagnostics
  • add parser and scanner coverage plus object-store range-read support

@sre-ci-robot

Copy link
Copy Markdown
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: congqixia

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@mergify

mergify Bot commented Aug 11, 2026

Copy link
Copy Markdown

Tick the box to add this pull request to the merge queue (same as @mergifyio queue).

  • Queue this pull request

Copilot AI 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.

Pull request overview

Adds a new scan-v3-index diagnostic command and supporting V3 packed scalar index parsing utilities so Birdwatcher can range-read .v3 objects from object storage, decode/validate directory + __meta__, and correlate on-disk index structure with Milvus SegmentIndex/collection schema metadata.

Changes:

  • Introduces a V3 index inspector/parser (inspectV3Index) with directory + meta decoding, CRC verification, encryption detection, and physical index type classification.
  • Adds ScanV3IndexCommand to enumerate .v3 objects in index_files/ and index_v1/, correlate with etcd metadata, and emit findings in table/plain/JSON formats.
  • Extends object-store listing/stat metadata (ETag, LastModified, VersionID) to detect mid-scan object changes.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
states/v3_index_parser.go Implements V3 index range-read inspection, directory/meta decoding, and classification helpers.
states/scan_v3_index.go Adds the scan-v3-index command, object discovery, metadata correlation, and diagnostics.
states/scan_v3_index_test.go Adds unit coverage for V3 parsing/classification and scan helpers.
oss/object_store.go Enriches listed/stat’d object metadata (ETag/LastModified/VersionID).
models/fs_stat.go Extends FsStat to carry object metadata returned by Stat.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread states/scan_v3_index.go
Comment on lines +517 to +535
unique := make(map[string]struct{})
matching := make([]*indexpb.SegmentIndex, 0, len(candidates))
for _, candidate := range candidates {
signature := fmt.Sprintf("%d/%d/%d/%d/%d", candidate.GetCollectionID(), candidate.GetPartitionID(), candidate.GetSegmentID(), candidate.GetIndexID(), candidate.GetIndexVersion())
unique[signature] = struct{}{}
matches := candidate.GetPartitionID() == objectPath.partitionID &&
candidate.GetSegmentID() == objectPath.segmentID &&
candidate.GetIndexVersion() == objectPath.indexVersion
if objectPath.layout == "COLLECTION_ROOTED" {
matches = matches && candidate.GetCollectionID() == objectPath.collectionID
}
if matches {
matching = append(matching, candidate)
}
}
if len(matching) == 1 {
return matching[0], len(unique) > 1
}
return candidates[0], len(unique) > 1
Comment thread states/scan_v3_index.go
Comment on lines +230 to +232
jobs := make(chan oss.ObjectInfo)
results := make(chan scanResult, len(objects))
var wg sync.WaitGroup
Comment thread states/v3_index_parser.go
Comment on lines +122 to +131
inspection.FormatVersion = binary.LittleEndian.Uint16(footer[0:2])
metaSize := int64(binary.LittleEndian.Uint32(footer[24:28]))
directorySize := int64(binary.LittleEndian.Uint32(footer[28:32]))
if inspection.FormatVersion != 3 {
return inspection, []V3IndexFinding{{
Rule: "V3_FOOTER_INVALID",
Severity: v3SeverityCritical,
Message: fmt.Sprintf("unsupported V3 footer format version %d", inspection.FormatVersion),
}}
}
Add scan-v3-index to inspect packed scalar index V3 objects with range reads and correlate them with SegmentIndex metadata and collection schemas.

- detect loader type mismatches, invalid paths, malformed metadata, CRC failures, row-count inconsistencies, and encrypted indexes
- support build-rooted and collection-rooted storage layouts
- resolve effective JSON types from cast metadata and validate JSON path loader formats
- detect string and numeric STLSORT mismatches with JSON-specific diagnostics
- add parser and scanner coverage plus object-store range-read support

Signed-off-by: Congqi Xia <congqi.xia@zilliz.com>
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.

3 participants