Skip to content
/ server Public
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions mysql-test/main/vector_innodb.result
Original file line number Diff line number Diff line change
Expand Up @@ -376,3 +376,18 @@ Warning 1292 Incorrect vector value: '1' for column `test`.`t1`.`v` at row 1
drop table t1;
set sql_mode=default;
# End of 11.8 tests
# MDEV-35821: vector index sizes are not in information_schema.TABLES nor SHOW TABLE STATUS
CREATE TABLE t_vec (
id INT PRIMARY KEY,
v VECTOR(4) NOT NULL,
VECTOR INDEX (v)
) ENGINE=InnoDB;
INSERT INTO t_vec VALUES (1, VEC_FromText('[1,2,3,4]'));
INSERT INTO t_vec VALUES (2, VEC_FromText('[2,3,4,5]'));
SELECT index_length > 0 AS index_length_is_nonzero
FROM information_schema.TABLES
WHERE table_schema = 'test' AND table_name = 't_vec';
index_length_is_nonzero
1
DROP TABLE t_vec;
# End of 11.9 tests
19 changes: 19 additions & 0 deletions mysql-test/main/vector_innodb.test
Original file line number Diff line number Diff line change
Expand Up @@ -370,3 +370,22 @@ drop table t1;
set sql_mode=default;

--echo # End of 11.8 tests

--echo # MDEV-35821: vector index sizes are not in information_schema.TABLES nor SHOW TABLE STATUS

CREATE TABLE t_vec (
id INT PRIMARY KEY,
v VECTOR(4) NOT NULL,
VECTOR INDEX (v)
) ENGINE=InnoDB;

INSERT INTO t_vec VALUES (1, VEC_FromText('[1,2,3,4]'));
INSERT INTO t_vec VALUES (2, VEC_FromText('[2,3,4,5]'));

SELECT index_length > 0 AS index_length_is_nonzero
FROM information_schema.TABLES
WHERE table_schema = 'test' AND table_name = 't_vec';

DROP TABLE t_vec;

--echo # End of 11.9 tests
19 changes: 19 additions & 0 deletions storage/innobase/handler/ha_innodb.cc
Original file line number Diff line number Diff line change
Expand Up @@ -14917,6 +14917,25 @@ ha_innobase::info_low(
stats.index_file_length
= ulonglong(stat_sum_of_other_index_sizes)
* size;
/* Include hlindex (vector index) size in index_file_length */
if (table->s->hlindexes())
{
char hli_name[FN_REFLEN];
char norm_path[FN_REFLEN];
normalize_table_name(norm_path, sizeof(norm_path),
table->s->normalized_path.str);
my_snprintf(hli_name, sizeof(hli_name),
"%s" HLINDEX_TEMPLATE,
norm_path, table->s->keys);
if (dict_table_t *hli_table= dict_table_open_on_name(hli_name, false,
DICT_ERR_IGNORE_NONE))
{
if (fil_space_t *hli_space= hli_table->space)
stats.index_file_length+=
ulonglong(hli_space->size) * hli_space->physical_size();
dict_table_close(hli_table, m_user_thd, nullptr);
}
}
if (flag & HA_STATUS_VARIABLE_EXTRA) {
space->s_lock();
stats.delete_length = 1024
Expand Down