mirror of
https://github.com/MariaDB/server.git
synced 2025-01-15 19:42:28 +01:00
9f80e3fbb7
support SQL semantics for SELECT ... WHERE ... ORDER BY ... LIMIT * switch from returning k nearest neighbors to returning as many as needed, in k-neighbor chunks, with increasing distance * make search_layer() skips nodes that are closer than a threshold * read_next keeps a search context - list of k found nodes, threshold, ctx, etc. * when the list of found nodes is exhausted, it repeats the search starting from last found nodes and a threshold * search context kepts ctx->refcount incremented, so ctx won't go away * but commit_lock is unlocked between calls, so InnoDB can modify the table * use ctx version to detect that, switch to MHNSW_Trx when it happens bugfix: * use the correct lock in ha_external_lock() for the graph table * InnoDB didn't reset locks on ha_external_lock(F_UNLCK) and previous LOCK_X leaked into the next statement
39 lines
1.5 KiB
C
39 lines
1.5 KiB
C
/*
|
|
Copyright (c) 2024, MariaDB plc
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
it under the terms of the GNU General Public License as published by
|
|
the Free Software Foundation; version 2 of the License.
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
GNU General Public License for more details.
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
along with this program; if not, write to the Free Software
|
|
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA
|
|
*/
|
|
|
|
#include <my_global.h>
|
|
#include "item.h"
|
|
#include "m_string.h"
|
|
#include "structs.h"
|
|
#include "table.h"
|
|
|
|
/*
|
|
This will become a vector index plugin API, or, perhaps,
|
|
a hlindex plugin API. When we'll have more than one implementation.
|
|
*/
|
|
const LEX_CSTRING mhnsw_hlindex_table_def(THD *thd, uint ref_length);
|
|
int mhnsw_insert(TABLE *table, KEY *keyinfo);
|
|
int mhnsw_read_first(TABLE *table, KEY *keyinfo, Item *dist, ulonglong limit);
|
|
int mhnsw_read_next(TABLE *table);
|
|
int mhnsw_read_end(TABLE *table);
|
|
int mhnsw_invalidate(TABLE *table, const uchar *rec, KEY *keyinfo);
|
|
int mhnsw_delete_all(TABLE *table, KEY *keyinfo, bool truncate);
|
|
void mhnsw_free(TABLE_SHARE *share);
|
|
bool mhnsw_uses_distance(const TABLE *table, KEY *keyinfo, const Item *dist);
|
|
|
|
extern ha_create_table_option mhnsw_index_options[];
|
|
extern st_plugin_int *mhnsw_plugin;
|