Skip to content

Commit

Permalink
global_query_id: my_atomic to Atomic_counter
Browse files Browse the repository at this point in the history
  • Loading branch information
Sergey Vojtovich committed Mar 21, 2020
1 parent 6268780 commit 6acddd5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
2 changes: 1 addition & 1 deletion sql/mysqld.cc
Expand Up @@ -483,7 +483,7 @@ ulonglong test_flags;
ulonglong query_cache_size=0;
ulong query_cache_limit=0;
ulong executed_events=0;
query_id_t global_query_id;
Atomic_counter<query_id_t> global_query_id;
ulong aborted_threads, aborted_connects, aborted_connects_preauth;
ulong delayed_insert_timeout, delayed_insert_limit, delayed_queue_size;
ulong delayed_insert_threads, delayed_insert_writes, delayed_rows_in_use;
Expand Down
7 changes: 3 additions & 4 deletions sql/mysqld.h
Expand Up @@ -23,7 +23,6 @@
#include "sql_bitmap.h" /* Bitmap */
#include "my_decimal.h" /* my_decimal */
#include "mysql_com.h" /* SERVER_VERSION_LENGTH */
#include "my_atomic.h"
#include "my_counter.h"
#include "mysql/psi/mysql_file.h" /* MYSQL_FILE */
#include "mysql/psi/mysql_socket.h" /* MYSQL_SOCKET */
Expand Down Expand Up @@ -763,17 +762,17 @@ enum enum_query_type


/* query_id */
extern query_id_t global_query_id;
extern Atomic_counter<query_id_t> global_query_id;

/* increment query_id and return it. */
inline __attribute__((warn_unused_result)) query_id_t next_query_id()
{
return my_atomic_add64_explicit(&global_query_id, 1, MY_MEMORY_ORDER_RELAXED);
return global_query_id++;
}

inline query_id_t get_query_id()
{
return my_atomic_load64_explicit(&global_query_id, MY_MEMORY_ORDER_RELAXED);
return global_query_id;
}

/* increment global_thread_id and return it. */
Expand Down

0 comments on commit 6acddd5

Please sign in to comment.