MDEV-34805 provide various information about vector indexes - #4955
MDEV-34805 provide various information about vector indexes#4955shabbann wants to merge 2 commits into
Conversation
2591dd6 to
da6f17d
Compare
There was a problem hiding this comment.
Pull request overview
Adds an INFORMATION_SCHEMA.VECTOR_INDEXES table to expose runtime/disk statistics for MHNSW vector indexes, implemented as a MYSQL_INFORMATION_SCHEMA_PLUGIN registered alongside the existing mhnsw daemon plugin.
Changes:
- Add
INFORMATION_SCHEMA.VECTOR_INDEXESschema-table plugin and row population logic insql/vector_mhnsw.cc. - Track MHNSW cache overflow events and expose cache memory/node statistics.
- Add MTR coverage for the new I_S table and update expected outputs.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| sql/vector_mhnsw.cc | Adds I_S plugin/table definition + row filler; tracks cache overflows and exposes cache stats. |
| mysql-test/main/vector.test | Adds end-to-end test coverage for INFORMATION_SCHEMA.VECTOR_INDEXES. |
| mysql-test/main/vector.result | Captures expected output for the new test section. |
| mysql-test/main/information_schema.result | Updates global I_S table list expectations to include VECTOR_INDEXES. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| } | ||
| size_t cache_mem_size() | ||
| { | ||
| return root_size(&root); |
There was a problem hiding this comment.
but to avoid taking the lock twice, I'd introduce a method, like info() that takes a lock, reads all values you need, and releases the lock. once.
gkodinov
left a comment
There was a problem hiding this comment.
Thank you for your contribution! This is a preliminary review.
Please:
- squash the commits into a single commit and have it have a commit message according to the MariaDB condig standards. There's 2 commits currently.
- make sure the build-bot tests are passing (or at least, not failing because of your changes). Right now there's at least 2 test failures that are related.
Hi George, Sergei actually asked me (in Zulip) to keep the commits separate to make reviewing easier. I will squash at the end
I'm working on it |
gkodinov
left a comment
There was a problem hiding this comment.
LGTM. Please keep working with Serg on the final review.
vuvova
left a comment
There was a problem hiding this comment.
See comments below. If you'd let me, I can apply these changes myself so that you could concentrate on your GSoC project. This way we'll have this ready in time for a 13.1 preview, there're only few days left.
| } | ||
| size_t cache_mem_size() | ||
| { | ||
| return root_size(&root); |
There was a problem hiding this comment.
but to avoid taking the lock twice, I'd introduce a method, like info() that takes a lock, reads all values you need, and releases the lock. once.
|
@vuvova I tried to fix them quickly. Feel free to ask me for any edits, or you can do it yourself if it will be quicker. |
gkodinov
left a comment
There was a problem hiding this comment.
Please consider rebasing your PR on top of the main branch and resolving the conflicts mentioned.
2f39416 to
d0e8c40
Compare
|
|
|
Thanks! I've squashed your commits and added post-review commit on top with my (hopefully not controversial) fixes. I intentionally kept it separate to keep your changes clean. Did not rebase on top of main though |
vuvova
left a comment
There was a problem hiding this comment.
looks good to me, but needs to be rebased on top of main
|
I'll do the merge. hang on. |
7e6ed9b to
5dae70e
Compare
|
sorry I couldn't do the rebase yesterday because I was busy with my graduation project. I will check the build issues |
|
The test |
yes, this is a know unstable test. I've restarted it. |
0e0e88d to
b9d7dd0
Compare
|
@vuvova if you aren't going to do any more changes I could pull and '--record' the tests to fix the buildbot issues |
|
FYI: According to our development cycle all testing of features must be completed before 30 Apr, 30 Jul, 30 Nov and 31 Jan (approximate release dates). You might get comments from the tester before that date or your feature will be approved as is and merged. But it'll all likely happen closer to the release date, not right now. |
0a0c3e0 to
994c3bd
Compare
Adds INFORMATION_SCHEMA.VECTOR_INDEXES table exposing statistics for MHNSW vector indexes via a MYSQL_INFORMATION_SCHEMA_PLUGIN registered alongside the existing mhnsw daemon plugin. columns covered: (TABLE_SCHEMA, TABLE_NAME, INDEX_NAME, VECTOR_DIMENSIONS, SUBDIST_ENABLED, INDEX_SIZE, TOTAL_NODES, DELETED_ROWS, MEMORY_SIZE, CACHE_OVERFLOWS).
* keep `vec_len >= subdist_part * 2` logic in one place only * keep "distance-greater-than" mode logic in one place only * simplify VECTOR_DIMENSIONS (no need to have a special ctx->vec_len path if the other one always works) * new plugin = maturity beta * remove redundant casts, etc * moved vector_indexes_fields_enum to the global scope to use it for setting schema->idx_field1/schema->idx_field2 * open the hlindex graph table, if needed, otherwise most values are unknown unless a user did vector search before * added TABLE_CATALOG column * remove CACHE_OVERFLOWS column, doesn't work as implemented, the fix is complex and isn't worth it in the test: * prefer query_vertical for readability * select all columns at least once * select INDEX_SIZE even if engine-dependent, use rdiff files * test how get_all_tables only open one specific table, and even only .frm file, if possible
994c3bd to
7a32192
Compare
Adds INFORMATION_SCHEMA.VECTOR_INDEXES table exposing statistics for MHNSW vector indexes via a MYSQL_INFORMATION_SCHEMA_PLUGIN registered alongside the existing mhnsw daemon plugin. columns covered: (TABLE_SCHEMA, TABLE_NAME, INDEX_NAME, VECTOR_DIMENSIONS, SUBDIST_ENABLED, INDEX_SIZE, TOTAL_NODES, DELETED_ROWS, MEMORY_SIZE, CACHE_OVERFLOWS).