Skip to content

fix: [2.6] wire up IndexStaticFaced::ConfigCheck dispatch#1573

Merged
sre-ci-robot merged 2 commits into
zilliztech:2.6from
foxspy:issue/static-config-check-dispatch-2.6
Apr 10, 2026
Merged

fix: [2.6] wire up IndexStaticFaced::ConfigCheck dispatch#1573
sre-ci-robot merged 2 commits into
zilliztech:2.6from
foxspy:issue/static-config-check-dispatch-2.6

Conversation

@foxspy

@foxspy foxspy commented Apr 9, 2026

Copy link
Copy Markdown
Collaborator

issue: #1570

Cherry-pick of #1571 to 2.6.

Summary

  • Align InternalConfigCheck signature to take PARAM_TYPE so the SFINAE probe in RegisterStaticFunc actually matches every index's real StaticConfigCheck impl. Previously the probe used IndexVersion (int32_t), which does not implicitly convert to the unscoped PARAM_TYPE enum, so staticConfigCheckMap was permanently empty and IndexStaticFaced::ConfigCheck always fell through to Status::success.
  • Pass PARAM_TYPE::TRAIN at the dispatch site (index_static.cc:60).
  • Companion fix in IvfIndexNode::StaticConfigCheck and HnswIndexNode::StaticConfigCheck: classify the float vs binary metric branch with !std::is_same_v<DataType, knowhere::bin1> instead of KnowhereFloatTypeCheck<DataType>. The latter excludes int8/fp16/bf16, but those are mocked to fp32 at runtime via MockData<>, so they should accept float metrics — without this companion change, fixing the dispatch alone would regress IndexStaticFaced<int8>::ConfigCheck("IVF_FLAT", L2), which tests/ut/test_config.cc::checkBuildConfig already exercises.
  • Add negative + positive cases in tests/ut/test_config.cc that pin the dispatch path: fp32+IVF_FLAT+HAMMINGinvalid_metric_type, bin1+BIN_IVF_FLAT+HAMMINGsuccess, int8+IVF_FLAT+L2success, int8+IVF_FLAT+JACCARDinvalid_metric_type.

Test Plan

  • pre-commit run clean on all 5 changed files
  • The corresponding main-branch PR (fix: wire up IndexStaticFaced::ConfigCheck dispatch #1571) was verified end-to-end locally: buggy reproduction abort at the negative HAMMING CHECK, fixed state passes; this 2.6 cherry-pick applies the same patch on a byte-identical base.

…#1570)

Cherry-pick of the main-branch fix for zilliztech#1570.

The SFINAE probe used to register per-index StaticConfigCheck functions
into staticConfigCheckMap was permanently false because the probe's
function-type template parameter (decltype(InternalConfigCheck)) declared
the second arg as IndexVersion while every real StaticConfigCheck impl
takes PARAM_TYPE. int32_t does not implicitly convert to the unscoped
PARAM_TYPE enum, so has_static_StaticConfigCheck was false for every
index, the if constexpr branch in RegisterStaticFunc never instantiated,
and IndexStaticFaced::ConfigCheck always fell through to Status::success.

Fix:
- Align InternalConfigCheck declaration/definition to take PARAM_TYPE.
- Pass PARAM_TYPE::TRAIN at the dispatch site (ConfigCheck is a build-time
  pre-check; TRAIN is the only paramType the existing impls act on).
- Change the float/binary classification in IvfIndexNode::StaticConfigCheck
  and HnswIndexNode::StaticConfigCheck from KnowhereFloatTypeCheck<DataType>
  to !std::is_same_v<DataType, knowhere::bin1>. KnowhereFloatTypeCheck
  excludes int8/fp16/bf16, but those types are mocked to fp32 at runtime
  via MockData<>::type and should accept float metrics — without this
  companion change, fixing the dispatch alone would regress
  IndexStaticFaced<int8>::ConfigCheck("IVF_FLAT", L2) which the existing
  test_config.cc::checkBuildConfig already exercises.

Add tests/ut/test_config.cc cases that pin the dispatch path:
fp32+IVF_FLAT+HAMMING -> invalid_metric_type, bin1+BIN_IVF_FLAT+HAMMING
-> success, int8+IVF_FLAT+L2 -> success, int8+IVF_FLAT+JACCARD ->
invalid_metric_type.

issue: zilliztech#1570
Signed-off-by: xianliang.li <xianliang.li@zilliz.com>
@foxspy foxspy added the kind/bug This PR is a bug fix label Apr 9, 2026
@mergify mergify Bot added the dco-passed label Apr 9, 2026
@mergify

mergify Bot commented Apr 9, 2026

Copy link
Copy Markdown

@foxspy 🔍 Important: PR Classification Needed!

For efficient project management and a seamless review process, it's essential to classify your PR correctly. Here's how:

  1. If you're fixing a bug, label it as kind/bug.
  2. For small tweaks (less than 20 lines without altering any functionality), please use kind/improvement.
  3. Significant changes that don't modify existing functionalities should be tagged as kind/enhancement.
  4. Adjusting APIs or changing functionality? Go with kind/feature.

For any PR outside the kind/improvement category, ensure you link to the associated issue using the format: “issue: #”.

Thanks for your efforts and contribution to the community!.

…ticConfigCheck

Cherry-pick of the main-branch follow-up to PR zilliztech#1571 addressing
@SpadeA-Tang's review.

With the dispatch wired up by the previous commit, IvfIndexNode/
HnswIndexNode/IndexNodeWithDataViewRefiner's StaticConfigCheck would
now reject compound emb-list metrics like MAX_SIM_IP for indexes whose
registration includes the EMB_LIST feature (IVFFLAT, IVF_FLAT,
IVFFLATCC, IVF_FLAT_CC, SCANN_DVR, etc.). The metric whitelist
{L2, IP, COSINE} / {HAMMING, JACCARD} only matches the base metric
names, but production callers pass MAX_SIM_IP / MAX_SIM_HAMMING /
MAX_SIM_COSINE (etc.) and AddEmbList decomposes them internally via
get_sub_metric_type before handing the base metric to faiss.

Apply the same decomposition in StaticConfigCheck: if the metric is a
known compound (MAX_SIM_*, DTW_*), use its underlying base metric for
the float/binary classification; otherwise fall back to the raw value.

Add positive/negative tests in tests/ut/test_config.cc.

issue: zilliztech#1570
Signed-off-by: xianliang.li <xianliang.li@zilliz.com>
@alexanderguzhva

Copy link
Copy Markdown
Collaborator

wait for #1571

@marcelo-cjl

Copy link
Copy Markdown
Collaborator

/lgtm

@sre-ci-robot

Copy link
Copy Markdown
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: foxspy, marcelo-cjl

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

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.

4 participants