Skip to content

IndexStaticFaced::ConfigCheck dispatch silently broken since #888 — staticConfigCheckMap is never populated #1570

@foxspy

Description

@foxspy

Description

IndexStaticFaced::ConfigCheck (introduced in #888) is supposed to dispatch to per-index StaticConfigCheck implementations to validate (indexType, config) combinations before building. The dispatch has been silently dead since the feature merged: staticConfigCheckMap is never populated for any registered index, so the per-index checks never run.

Root cause is a type mismatch in the SFINAE probe that gates registration:

  • IndexStaticFaced::InternalConfigCheck is declared with (const BaseConfig&, const IndexVersion&, std::string&) (include/knowhere/index/index_static.h:134).
  • All real StaticConfigCheck implementations take (const Config&, PARAM_TYPE, std::string&) (e.g. src/index/ivf/ivf.cc:138, src/index/hnsw/hnsw.h:94).

PARAM_TYPE is an unscoped enum, and int32_t (IndexVersion) does not implicitly convert to it, so has_static_StaticConfigCheck<...>::value evaluates to false for every index. The if constexpr block in RegisterStaticFunc (index_static.h:114-117) is therefore dead code, staticConfigCheckMap stays empty, and ConfigCheck always falls through to return Status::success at index_static.cc:63.

Expected Behavior

IndexStaticFaced<fp32>::ConfigCheck("IVF_FLAT", version, {"metric_type":"HAMMING","nlist":128}, msg) should return Status::invalid_metric_type (since IVF float indexes only accept L2/IP/COSINE).

Actual Behavior

Returns Status::success. The metric/data-type validation defined in IvfIndexNode::StaticConfigCheck and HnswIndexNode::StaticConfigCheck never executes. Build-time pre-check is a no-op for any caller.

Impact

  • All callers (e.g. Milvus pre-build validation) get false-positive success on invalid config combinations. The non-fatal layers downstream still catch most cases at build time, but later and with worse error messages.
  • The tests/ut/test_config.cc::checkBuildConfig helper only asserts Status::success, so the bug never surfaced in CI.
  • Bug has been silent since enhance: provide a static checking method for index config #888 (2024-10-15).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions