summaryrefslogtreecommitdiff
path: root/storage/perfschema/pfs_instr.h
diff options
context:
space:
mode:
authorSergei Golubchik <sergii@pisem.net>2014-05-07 10:04:30 +0200
committerSergei Golubchik <sergii@pisem.net>2014-05-07 10:04:30 +0200
commit04bce7b569f44f3aca3cb21953d41c2a4a02efe6 (patch)
tree2530ccd90b42afa39b0a60f4454fd5ddb97c95e1 /storage/perfschema/pfs_instr.h
parent7226287c066228a216217c43c48f3a0a833d9909 (diff)
downloadmariadb-git-04bce7b569f44f3aca3cb21953d41c2a4a02efe6.tar.gz
5.6.17
Diffstat (limited to 'storage/perfschema/pfs_instr.h')
-rw-r--r--storage/perfschema/pfs_instr.h109
1 files changed, 84 insertions, 25 deletions
diff --git a/storage/perfschema/pfs_instr.h b/storage/perfschema/pfs_instr.h
index 2ea44830d2b..bd2fe0e4afd 100644
--- a/storage/perfschema/pfs_instr.h
+++ b/storage/perfschema/pfs_instr.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -371,7 +371,13 @@ struct PFS_ALIGNED PFS_thread : PFS_connection_slice
PFS_events_waits *m_events_waits_current;
/** Event ID counter */
ulonglong m_event_id;
- /** Internal lock. */
+ /**
+ Internal lock.
+ This lock is exclusively used to protect against races
+ when creating and destroying PFS_thread.
+ Do not use this lock to protect thread attributes,
+ use one of @c m_stmt_lock or @c m_session_lock instead.
+ */
pfs_lock m_lock;
/** Pins for filename_hash. */
LF_PINS *m_filename_hash_pins;
@@ -460,31 +466,63 @@ struct PFS_ALIGNED PFS_thread : PFS_connection_slice
*/
PFS_events_statements *m_statements_history;
- /** User name. */
+ /**
+ Internal lock, for session attributes.
+ Statement attributes are expected to be updated in frequently,
+ typically per session execution.
+ */
+ pfs_lock m_session_lock;
+ /**
+ User name.
+ Protected by @c m_session_lock.
+ */
char m_username[USERNAME_LENGTH];
- /** Length of @c m_username. */
+ /**
+ Length of @c m_username.
+ Protected by @c m_session_lock.
+ */
uint m_username_length;
- /** Host name. */
+ /**
+ Host name.
+ Protected by @c m_session_lock.
+ */
char m_hostname[HOSTNAME_LENGTH];
- /** Length of @c m_hostname. */
+ /**
+ Length of @c m_hostname.
+ Protected by @c m_session_lock.
+ */
uint m_hostname_length;
- /** Database name. */
+ /**
+ Database name.
+ Protected by @c m_stmt_lock.
+ */
char m_dbname[NAME_LEN];
- /** Length of @c m_dbname. */
+ /**
+ Length of @c m_dbname.
+ Protected by @c m_stmt_lock.
+ */
uint m_dbname_length;
/** Current command. */
int m_command;
/** Start time. */
time_t m_start_time;
- /** Lock for Processlist state, Processlist info. */
- pfs_lock m_processlist_lock;
- /** Processlist state. */
- const char *m_processlist_state_ptr;
- /** Length of @c m_processlist_state_ptr. */
- uint m_processlist_state_length;
- /** Processlist info. */
- const char *m_processlist_info_ptr;
- /** Length of @c m_processlist_info_length. */
+ /**
+ Internal lock, for statement attributes.
+ Statement attributes are expected to be updated frequently,
+ typically per statement execution.
+ */
+ pfs_lock m_stmt_lock;
+ /** Processlist state (derived from stage). */
+ PFS_stage_key m_stage;
+ /**
+ Processlist info.
+ Protected by @c m_stmt_lock.
+ */
+ char m_processlist_info[COL_INFO_SIZE];
+ /**
+ Length of @c m_processlist_info_length.
+ Protected by @c m_stmt_lock.
+ */
uint m_processlist_info_length;
PFS_events_stages m_stage_current;
@@ -500,12 +538,21 @@ struct PFS_ALIGNED PFS_thread : PFS_connection_slice
/** Reset session connect attributes */
void reset_session_connect_attrs();
- /** a buffer for the connection attributes */
+ /**
+ Buffer for the connection attributes.
+ Protected by @c m_session_lock.
+ */
char *m_session_connect_attrs;
- /** length used by @c m_connect_attrs */
+ /**
+ Length used by @c m_connect_attrs.
+ Protected by @c m_session_lock.
+ */
uint m_session_connect_attrs_length;
- /** character set in which @c m_connect_attrs are encoded */
- const CHARSET_INFO *m_session_connect_attrs_cs;
+ /**
+ Character set in which @c m_connect_attrs are encoded.
+ Protected by @c m_session_lock.
+ */
+ uint m_session_connect_attrs_cs_number;
};
extern PFS_stage_stat *global_instr_class_stages_array;
@@ -608,10 +655,22 @@ void aggregate_all_statements(PFS_statement_stat *from_array,
PFS_statement_stat *to_array_1,
PFS_statement_stat *to_array_2);
-void aggregate_thread(PFS_thread *thread);
-void aggregate_thread_waits(PFS_thread *thread);
-void aggregate_thread_stages(PFS_thread *thread);
-void aggregate_thread_statements(PFS_thread *thread);
+void aggregate_thread(PFS_thread *thread,
+ PFS_account *safe_account,
+ PFS_user *safe_user,
+ PFS_host *safe_host);
+void aggregate_thread_waits(PFS_thread *thread,
+ PFS_account *safe_account,
+ PFS_user *safe_user,
+ PFS_host *safe_host);
+void aggregate_thread_stages(PFS_thread *thread,
+ PFS_account *safe_account,
+ PFS_user *safe_user,
+ PFS_host *safe_host);
+void aggregate_thread_statements(PFS_thread *thread,
+ PFS_account *safe_account,
+ PFS_user *safe_user,
+ PFS_host *safe_host);
void clear_thread_account(PFS_thread *thread);
void set_thread_account(PFS_thread *thread);