Skip to content

Commit

Permalink
Reset some longlong global variables as part of FLUSH STATUS
Browse files Browse the repository at this point in the history
Added SHOW_LONGLONG_NOFLUSH to mark the variables that should not be
flushed.

New variables cleared as part of SHOW STATUS:
- Rpl_semi_sync_master_request_ack
- Rpl_semi_sync_master_get_ac
- Rpl_semi_sync_slave_send_ack
- Slave_skipped_error
  • Loading branch information
montywi authored and vuvova committed May 27, 2024
1 parent d7bc28e commit d2b39a2
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 3 deletions.
4 changes: 2 additions & 2 deletions sql/mysqld.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7499,7 +7499,7 @@ SHOW_VAR status_vars[]= {
{"Max_used_connections", (char*) &max_used_connections, SHOW_LONG},
{"Max_used_connections_time",(char*) &show_max_used_connections_time, SHOW_SIMPLE_FUNC},
{"Memory_used", (char*) &show_memory_used, SHOW_SIMPLE_FUNC},
{"Memory_used_initial", (char*) &start_memory_used, SHOW_LONGLONG},
{"Memory_used_initial", (char*) &start_memory_used, SHOW_LONGLONG_NOFLUSH},
{"Resultset_metadata_skipped", (char *) offsetof(STATUS_VAR, skip_metadata_count),SHOW_LONG_STATUS},
{"Not_flushed_delayed_rows", (char*) &delayed_rows_in_use, SHOW_LONG_NOFLUSH},
{"Open_files", (char*) &my_file_opened, SHOW_SINT},
Expand Down Expand Up @@ -7640,7 +7640,7 @@ SHOW_VAR status_vars[]= {
{"wsrep_connected", (char*) &wsrep_connected, SHOW_BOOL},
{"wsrep_ready", (char*) &wsrep_show_ready, SHOW_FUNC},
{"wsrep_cluster_state_uuid",(char*) &wsrep_cluster_state_uuid,SHOW_CHAR_PTR},
{"wsrep_cluster_conf_id", (char*) &wsrep_cluster_conf_id, SHOW_LONGLONG},
{"wsrep_cluster_conf_id", (char*) &wsrep_cluster_conf_id, SHOW_LONGLONG_NOFLUSH},
{"wsrep_cluster_status", (char*) &wsrep_cluster_status, SHOW_CHAR_PTR},
{"wsrep_cluster_size", (char*) &wsrep_cluster_size, SHOW_LONG_NOFLUSH},
{"wsrep_local_index", (char*) &wsrep_local_index, SHOW_LONG_NOFLUSH},
Expand Down
3 changes: 2 additions & 1 deletion sql/sql_plugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
*/
#define SHOW_always_last SHOW_KEY_CACHE_LONG, \
SHOW_HAVE, SHOW_MY_BOOL, SHOW_HA_ROWS, SHOW_SYS, \
SHOW_LONG_NOFLUSH, SHOW_LEX_STRING, SHOW_ATOMIC_COUNTER_UINT32_T, \
SHOW_LONG_NOFLUSH, SHOW_LONGLONG_NOFLUSH, SHOW_LEX_STRING, \
SHOW_ATOMIC_COUNTER_UINT32_T, \
/* SHOW_*_STATUS must be at the end, SHOW_LONG_STATUS being first */ \
SHOW_LONG_STATUS, SHOW_DOUBLE_STATUS, SHOW_LONGLONG_STATUS, \
SHOW_UINT32_STATUS
Expand Down
3 changes: 3 additions & 0 deletions sql/sql_show.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3582,6 +3582,8 @@ void reset_status_vars()
/* Note that SHOW_LONG_NOFLUSH variables are not reset */
if (ptr->type == SHOW_LONG)
*(ulong*) ptr->value= 0;
if (ptr->type == SHOW_LONGLONG)
*(ulonglong*) ptr->value= 0;
}
}

Expand Down Expand Up @@ -3780,6 +3782,7 @@ const char* get_one_variable(THD *thd,
case SHOW_SLONG:
end= int10_to_str(*value.as_long, buff, -10);
break;
case SHOW_LONGLONG_NOFLUSH: // the difference lies in refresh_status()
case SHOW_SLONGLONG:
end= longlong10_to_str(*value.as_longlong, buff, -10);
break;
Expand Down
2 changes: 2 additions & 0 deletions storage/perfschema/pfs_variable.cc
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ static inline SHOW_SCOPE show_scope_from_type(enum enum_mysql_show_type type)
case SHOW_UINT:
case SHOW_ULONG:
case SHOW_ULONGLONG:
case SHOW_LONGLONG_NOFLUSH:
return SHOW_SCOPE_GLOBAL;

case SHOW_DOUBLE_STATUS:
Expand Down Expand Up @@ -734,6 +735,7 @@ bool PFS_status_variable_cache::can_aggregate(enum_mysql_show_type variable_type
case SHOW_DOUBLE_STATUS:
case SHOW_HA_ROWS:
case SHOW_LONG_NOFLUSH:
case SHOW_LONGLONG_NOFLUSH:
case SHOW_SLONG:
default:
return false;
Expand Down

0 comments on commit d2b39a2

Please sign in to comment.