1
0
mirror of https://github.com/MariaDB/server.git synced 2025-11-08 00:28:29 +03:00

Add statistics usable for feedback plugin

Following status variables where added:

Feature_vector_index ; Incremented when reading a vector index from
                       a .frm file.
This commit is contained in:
Monty
2025-08-29 16:30:11 +03:00
parent db64d198da
commit da149c7073
5 changed files with 36 additions and 3 deletions

View File

@@ -20,6 +20,7 @@ Feature_subquery 0
Feature_system_versioning 0 Feature_system_versioning 0
Feature_timezone 0 Feature_timezone 0
Feature_trigger 0 Feature_trigger 0
Feature_vector_index 0
Feature_window_functions 0 Feature_window_functions 0
Feature_xml 0 Feature_xml 0
# #
@@ -209,3 +210,18 @@ show status like "feature_into_%";
Variable_name Value Variable_name Value
Feature_into_outfile 4 Feature_into_outfile 4
Feature_into_variable 2 Feature_into_variable 2
#
# Feature vector index
#
create table t1 (id int auto_increment primary key,
u vector(5) not null, vector index (u));
select * from t1;
id u
select * from t1;
id u
select * from t1;
id u
show status like "Feature_vector_index";
Variable_name Value
Feature_vector_index 2
drop table t1;

View File

@@ -166,3 +166,15 @@ drop table t1;
--remove_file $MYSQLTEST_VARDIR/tmp/features_outfile.1 --remove_file $MYSQLTEST_VARDIR/tmp/features_outfile.1
--remove_file $MYSQLTEST_VARDIR/tmp/features_outfile.2 --remove_file $MYSQLTEST_VARDIR/tmp/features_outfile.2
show status like "feature_into_%"; show status like "feature_into_%";
--echo #
--echo # Feature vector index
--echo #
create table t1 (id int auto_increment primary key,
u vector(5) not null, vector index (u));
select * from t1;
select * from t1;
select * from t1;
show status like "Feature_vector_index";
drop table t1;

View File

@@ -7629,6 +7629,7 @@ SHOW_VAR status_vars[]= {
{"Feature_application_time_periods", (char*) offsetof(STATUS_VAR, feature_application_time_periods), SHOW_LONG_STATUS}, {"Feature_application_time_periods", (char*) offsetof(STATUS_VAR, feature_application_time_periods), SHOW_LONG_STATUS},
{"Feature_timezone", (char*) offsetof(STATUS_VAR, feature_timezone), SHOW_LONG_STATUS}, {"Feature_timezone", (char*) offsetof(STATUS_VAR, feature_timezone), SHOW_LONG_STATUS},
{"Feature_trigger", (char*) offsetof(STATUS_VAR, feature_trigger), SHOW_LONG_STATUS}, {"Feature_trigger", (char*) offsetof(STATUS_VAR, feature_trigger), SHOW_LONG_STATUS},
{"Feature_vector_index", (char*) offsetof(STATUS_VAR, feature_vector_index), SHOW_LONG_STATUS},
{"Feature_window_functions", (char*) offsetof(STATUS_VAR, feature_window_functions), SHOW_LONG_STATUS}, {"Feature_window_functions", (char*) offsetof(STATUS_VAR, feature_window_functions), SHOW_LONG_STATUS},
{"Feature_xml", (char*) offsetof(STATUS_VAR, feature_xml), SHOW_LONG_STATUS}, {"Feature_xml", (char*) offsetof(STATUS_VAR, feature_xml), SHOW_LONG_STATUS},
{"Handler_commit", (char*) offsetof(STATUS_VAR, ha_commit_count), SHOW_LONG_STATUS}, {"Handler_commit", (char*) offsetof(STATUS_VAR, ha_commit_count), SHOW_LONG_STATUS},

View File

@@ -1028,6 +1028,7 @@ typedef struct system_status_var
ulong feature_timezone; /* +1 when XPATH is used */ ulong feature_timezone; /* +1 when XPATH is used */
ulong feature_trigger; /* +1 opening a table with triggers */ ulong feature_trigger; /* +1 opening a table with triggers */
ulong feature_xml; /* +1 when XPATH is used */ ulong feature_xml; /* +1 when XPATH is used */
ulong feature_vector_index; /* +1 when open table with vector index */
ulong feature_window_functions; /* +1 when window functions are used */ ulong feature_window_functions; /* +1 when window functions are used */
ulong feature_into_outfile; /* +1 when INTO OUTFILE is used */ ulong feature_into_outfile; /* +1 when INTO OUTFILE is used */
ulong feature_into_variable; /* +1 when INTO VARIABLE is used */ ulong feature_into_variable; /* +1 when INTO VARIABLE is used */

View File

@@ -788,7 +788,8 @@ err_not_open:
DBUG_RETURN(share->error); DBUG_RETURN(share->error);
} }
static bool create_key_infos(const uchar *strpos, const uchar *frm_image_end, static bool create_key_infos(THD *thd, const uchar *strpos,
const uchar *frm_image_end,
uint keys, KEY *keyinfo, uint new_frm_ver, uint keys, KEY *keyinfo, uint new_frm_ver,
uint *ext_key_parts, TABLE_SHARE *share, uint len, uint *ext_key_parts, TABLE_SHARE *share, uint len,
KEY *first_keyinfo, LEX_STRING *keynames) KEY *first_keyinfo, LEX_STRING *keynames)
@@ -845,6 +846,8 @@ static bool create_key_infos(const uchar *strpos, const uchar *frm_image_end,
keyinfo->algorithm= HA_KEY_ALG_UNDEF; keyinfo->algorithm= HA_KEY_ALG_UNDEF;
strpos+=4; strpos+=4;
} }
if (keyinfo->algorithm == HA_KEY_ALG_VECTOR)
thd->status_var.feature_vector_index++;
if (i == 0) if (i == 0)
{ {
@@ -2100,7 +2103,7 @@ int TABLE_SHARE::init_from_binary_frm_image(THD *thd, bool write,
share->set_use_ext_keys_flag(plugin_hton(se_plugin)->flags & share->set_use_ext_keys_flag(plugin_hton(se_plugin)->flags &
HTON_SUPPORTS_EXTENDED_KEYS); HTON_SUPPORTS_EXTENDED_KEYS);
if (create_key_infos(disk_buff + 6, frm_image_end, keys, keyinfo, if (create_key_infos(thd, disk_buff + 6, frm_image_end, keys, keyinfo,
new_frm_ver, &ext_key_parts, new_frm_ver, &ext_key_parts,
share, len, &first_keyinfo, &keynames)) share, len, &first_keyinfo, &keynames))
goto err; goto err;
@@ -2200,7 +2203,7 @@ int TABLE_SHARE::init_from_binary_frm_image(THD *thd, bool write,
} }
else else
{ {
if (create_key_infos(disk_buff + 6, frm_image_end, keys, keyinfo, if (create_key_infos(thd, disk_buff + 6, frm_image_end, keys, keyinfo,
new_frm_ver, &ext_key_parts, new_frm_ver, &ext_key_parts,
share, len, &first_keyinfo, &keynames)) share, len, &first_keyinfo, &keynames))
goto err; goto err;