Skip to content

refactor(inner_index): change ErrorType to NO_ENOUGH_MEMORY for bad_alloc#1741

Merged
inabao merged 3 commits into0.16from
cp-1558-to-0.16
Mar 26, 2026
Merged

refactor(inner_index): change ErrorType to NO_ENOUGH_MEMORY for bad_alloc#1741
inabao merged 3 commits into0.16from
cp-1558-to-0.16

Conversation

@inabao
Copy link
Copy Markdown
Collaborator

@inabao inabao commented Mar 23, 2026

Summary

Cherry-pick of PR #1558 to 0.16 branch.

Changes

  • Change READ_ERROR to NO_ENOUGH_MEMORY in InnerIndexInterface::Deserialize methods when catching std::bad_alloc
  • Change INTERNAL_ERROR to NO_ENOUGH_MEMORY in FP16Quantizer::ProcessQueryImpl

Note

The thread pool creation logic changes from PR #1558 are already present in 0.16 branch:

  • hgraph.cpp (line 96-99): already checks build_thread_count_ > 1 before creating default thread pool
  • ivf.cpp (line 235-238): already checks thread_count > 1 before creating default thread pool
  • brute_force.cpp: the SearchWithRequest parallel search code does not exist in 0.16 branch

Original PR: #1558

Co-Authored-By: Claude <noreply@anthropic.com>
Signed-off-by: jinjiabao.jjb <jinjiabao.jjb@antgroup.com>
@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request refactors error handling by changing specific error types to NO_ENOUGH_MEMORY when std::bad_alloc exceptions are caught. This change ensures more accurate error reporting related to memory allocation failures. It is a backport of changes from the main branch to the 0.16 release branch.

Highlights

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@inabao inabao self-assigned this Mar 23, 2026
@inabao inabao added kind/improvement Code improvements (variable/function renaming, refactoring, etc. ) version/0.16 labels Mar 23, 2026
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

The pull request refines error handling by changing the VsagException error type from READ_ERROR or INTERNAL_ERROR to NO_ENOUGH_MEMORY when a std::bad_alloc exception is caught during deserialization in inner_index_interface.cpp and during buffer initialization in fp16_quantizer.cpp, providing more accurate error reporting.

@codecov
Copy link
Copy Markdown

codecov bot commented Mar 23, 2026

Codecov Report

❌ Patch coverage is 0% with 2 lines in your changes missing coverage. Please review.

❌ Your patch status has failed because the patch coverage (0.00%) is below the target coverage (80.00%). You can increase the patch coverage or adjust the target coverage.

@@            Coverage Diff             @@
##             0.16    #1741      +/-   ##
==========================================
+ Coverage   92.22%   92.30%   +0.08%     
==========================================
  Files         295      295              
  Lines       15708    15708              
==========================================
+ Hits        14486    14500      +14     
+ Misses       1222     1208      -14     
Flag Coverage Δ
cpp 92.30% <0.00%> (+0.08%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
common 92.62% <ø> (ø)
datacell 92.24% <0.00%> (-0.18%) ⬇️
index 91.46% <0.00%> (+0.26%) ⬆️
simd 100.00% <ø> (ø)

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update fd60a62...1e28473. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

inabao added 2 commits March 26, 2026 11:29
…lloc

Cherry-pick of PR #1558 to 0.16 branch.
- Change READ_ERROR to NO_ENOUGH_MEMORY in Deserialize methods
- Change INTERNAL_ERROR to NO_ENOUGH_MEMORY in FP16Quantizer

Note: The thread pool creation logic changes from PR #1558 are already
present in 0.16 branch (hgraph.cpp, ivf.cpp check build_thread_count
before creating default thread pool).

Signed-off-by: jinjiabao.jjb <jinjiabao.jjb@antgroup.com>
Copy link
Copy Markdown
Collaborator

@wxyucs wxyucs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

Copy link
Copy Markdown
Collaborator

@LHT129 LHT129 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@inabao inabao merged commit 681e944 into 0.16 Mar 26, 2026
22 of 23 checks passed
@inabao inabao deleted the cp-1558-to-0.16 branch March 26, 2026 10:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/improvement Code improvements (variable/function renaming, refactoring, etc. ) size/XS version/0.16

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants