Skip to content

Commit

Permalink
MDEV-32751 sys schema view session_ssl_status is empty
Browse files Browse the repository at this point in the history
* treat FUNC/ARRAY variables as SESSION (otherwise they won't be shown)
* allow SHOW_SIMPLE_FUNC everywhere where SHOW_FUNC is
* increase row buffer size to avoid "too short" assert
  • Loading branch information
vuvova committed Dec 12, 2023
1 parent 4231cf6 commit d9cb1a2
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 5 deletions.
18 changes: 18 additions & 0 deletions mysql-test/main/ssl.result
Original file line number Diff line number Diff line change
@@ -1,4 +1,22 @@
connect ssl_con,localhost,root,,,,,SSL;
select variable_name from performance_schema.status_by_thread where VARIABLE_NAME LIKE 'Ssl%';
variable_name
Ssl_cipher
Ssl_cipher_list
Ssl_default_timeout
Ssl_server_not_after
Ssl_server_not_before
Ssl_verify_depth
Ssl_verify_mode
Ssl_version
Ssl_cipher
Ssl_cipher_list
Ssl_default_timeout
Ssl_server_not_after
Ssl_server_not_before
Ssl_verify_depth
Ssl_verify_mode
Ssl_version
SELECT (VARIABLE_VALUE <> '') AS have_ssl FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME='Ssl_cipher';
have_ssl
1
Expand Down
2 changes: 2 additions & 0 deletions mysql-test/main/ssl.test
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@

connect (ssl_con,localhost,root,,,,,SSL);

select variable_name from performance_schema.status_by_thread where VARIABLE_NAME LIKE 'Ssl%';

# Check ssl turned on
SELECT (VARIABLE_VALUE <> '') AS have_ssl FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME='Ssl_cipher';

Expand Down
12 changes: 8 additions & 4 deletions storage/perfschema/pfs_variable.cc
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ static inline SHOW_SCOPE show_scope_from_type(enum enum_mysql_show_type type)
case SHOW_SIMPLE_FUNC:
case SHOW_UNDEF:
default:
return SHOW_SCOPE_UNDEF;
return SHOW_SCOPE_ALL;
}
return SHOW_SCOPE_UNDEF;
}
Expand Down Expand Up @@ -716,6 +716,7 @@ bool PFS_status_variable_cache::can_aggregate(enum_mysql_show_type variable_type
case SHOW_CHAR_PTR:
case SHOW_ARRAY:
case SHOW_FUNC:
case SHOW_SIMPLE_FUNC:
case SHOW_INT:
case SHOW_LONG:
case SHOW_LONGLONG:
Expand Down Expand Up @@ -1152,16 +1153,19 @@ void PFS_status_variable_cache::manifest(THD *thd, const SHOW_VAR *show_var_arra
reevaluate the new SHOW_TYPE and value. Handle nested case where
SHOW_FUNC resolves to another SHOW_FUNC.
*/
if (show_var_ptr->type == SHOW_FUNC)
if (show_var_ptr->type == SHOW_FUNC || show_var_ptr->type == SHOW_SIMPLE_FUNC)
{
show_var_tmp= *show_var_ptr;
/*
Execute the function reference in show_var_tmp->value, which returns
show_var_tmp with a new type and new value.
*/
for (const SHOW_VAR *var= show_var_ptr; var->type == SHOW_FUNC; var= &show_var_tmp)
for (const SHOW_VAR *var= show_var_ptr;
var->type == SHOW_FUNC || var->type == SHOW_SIMPLE_FUNC;
var= &show_var_tmp)
{
((mysql_show_var_func)(var->value))(thd, &show_var_tmp, value_buf.data, NULL, m_query_scope);
((mysql_show_var_func)(var->value))(thd, &show_var_tmp, value_buf.data,
&thd->status_var, m_query_scope);
}
show_var_ptr= &show_var_tmp;
}
Expand Down
2 changes: 1 addition & 1 deletion storage/perfschema/table_helper.h
Original file line number Diff line number Diff line change
Expand Up @@ -659,7 +659,7 @@ struct PFS_variable_value_row
private:
void make_row(const CHARSET_INFO *cs, const char* str, size_t length);

char m_str[1024];
char m_str[2048];
uint m_length;
const CHARSET_INFO *m_charset;
};
Expand Down

0 comments on commit d9cb1a2

Please sign in to comment.