资讯专栏INFORMATION COLUMN

MySQL内核技术之"线程操作"

XiNGRZ / 2699人阅读

摘要:开始用创建,最后用销毁。中间是对进行赋值。和当前线程有关的是。然后把需要的内容取出来并赋值给主要是对三个变量赋值,,。因为是,所以其本身对执行并没有影响,我们可以把子线程的设置为。

预处理

当一个新的连接进来时,MySQL会创建对应的thread(pfs.cc):

</>复制代码

  1. /**
  2. Implementation of the thread instrumentation interface.
  3. @sa PSI_v1::spawn_thread.
  4. */
  5. int pfs_spawn_thread_v1(PSI_thread_key key,
  6. my_thread_handle *thread, const my_thread_attr_t *attr,
  7. void *(*start_routine)(void*), void *arg)
  8. {
  9. PFS_spawn_thread_arg *psi_arg;
  10. PFS_thread *parent;
  11. /* psi_arg can not be global, and can not be a local variable. */
  12. psi_arg= (PFS_spawn_thread_arg*) my_malloc(PSI_NOT_INSTRUMENTED,
  13. sizeof(PFS_spawn_thread_arg),
  14. MYF(MY_WME));
  15. if (unlikely(psi_arg == NULL))
  16. return EAGAIN;
  17. psi_arg->m_child_key= key;
  18. psi_arg->m_child_identity= (arg ? arg : thread);
  19. psi_arg->m_user_start_routine= start_routine;
  20. psi_arg->m_user_arg= arg;
  21. parent= my_thread_get_THR_PFS();
  22. if (parent != NULL)
  23. {
  24. /*
  25. Make a copy of the parent attributes.
  26. This is required, because instrumentation for this thread (the parent)
  27. may be destroyed before the child thread instrumentation is created.
  28. */
  29. psi_arg->m_thread_internal_id= parent->m_thread_internal_id;
  30. memcpy(psi_arg->m_username, parent->m_username, sizeof(psi_arg->m_username));
  31. psi_arg->m_username_length= parent->m_username_length;
  32. memcpy(psi_arg->m_hostname, parent->m_hostname, sizeof(psi_arg->m_hostname));
  33. psi_arg->m_hostname_length= parent->m_hostname_length;
  34. }
  35. else
  36. {
  37. psi_arg->m_thread_internal_id= 0;
  38. psi_arg->m_username_length= 0;
  39. psi_arg->m_hostname_length= 0;
  40. }
  41. int result= my_thread_create(thread, attr, pfs_spawn_thread, psi_arg);
  42. if (unlikely(result != 0))
  43. my_free(psi_arg);
  44. return result;
  45. }

注意上面代码中最后的位置: my_thread_create(thread, attr, pfs_spawn_thread, psi_arg);这个函数直接调用pthread_create(&thread->thread, attr, func, arg)创建pthead。

这里最重要的事情是把当前thread的执行环境传到新的thread。所以上面代码前半部分都是在做这个事情。让我们看一下都需要传入哪些上下文。参数psi_arg就是要传入的上下文。开始用my_malloc创建,最后用my_free销毁。中间是对psi_arg进行赋值。

和当前线程有关的是parent= my_thread_get_THR_PFS()。然后把需要的parent内容取出来并赋值给psi_arg

</>复制代码

  1. /*
  2. Make a copy of the parent attributes.
  3. This is required, because instrumentation for this thread (the parent)
  4. may be destroyed before the child thread instrumentation is created.
  5. */
  6. psi_arg->m_thread_internal_id= parent->m_thread_internal_id;
  7. memcpy(psi_arg->m_username, parent->m_username, sizeof(psi_arg->m_username));
  8. psi_arg->m_username_length= parent->m_username_length;
  9. memcpy(psi_arg->m_hostname, parent->m_hostname, sizeof(psi_arg->m_hostname));
  10. psi_arg->m_hostname_length= parent->m_hostname_length;

主要是对三个变量赋值:m_thread_internal_idm_usernamem_hostname

生成PFS_thread

从上面可以看到,生成的thread具体执行的pfs_spawn_thread函数,其内容如下:

</>复制代码

  1. extern "C" void* pfs_spawn_thread(void *arg)
  2. {
  3. PFS_spawn_thread_arg *typed_arg= (PFS_spawn_thread_arg*) arg;
  4. void *user_arg;
  5. void *(*user_start_routine)(void*);
  6. PFS_thread *pfs;
  7. /* First, attach instrumentation to this newly created pthread. */
  8. PFS_thread_class *klass= find_thread_class(typed_arg->m_child_key);
  9. if (likely(klass != NULL))
  10. {
  11. pfs= create_thread(klass, typed_arg->m_child_identity, 0);
  12. if (likely(pfs != NULL))
  13. {
  14. pfs->m_thread_os_id= my_thread_os_id();
  15. clear_thread_account(pfs);
  16. pfs->m_parent_thread_internal_id= typed_arg->m_thread_internal_id;
  17. memcpy(pfs->m_username, typed_arg->m_username, sizeof(pfs->m_username));
  18. pfs->m_username_length= typed_arg->m_username_length;
  19. memcpy(pfs->m_hostname, typed_arg->m_hostname, sizeof(pfs->m_hostname));
  20. pfs->m_hostname_length= typed_arg->m_hostname_length;
  21. set_thread_account(pfs);
  22. }
  23. }
  24. else
  25. {
  26. pfs= NULL;
  27. }
  28. std::cout << "my_thread_set_THR_PFS in pfs_spawn_thread, value: " << pfs << std::endl;
  29. my_thread_set_THR_PFS(pfs);
  30. /*
  31. Secondly, free the memory allocated in spawn_thread_v1().
  32. It is preferable to do this before invoking the user
  33. routine, to avoid memory leaks at shutdown, in case
  34. the server exits without waiting for this thread.
  35. */
  36. user_start_routine= typed_arg->m_user_start_routine;
  37. user_arg= typed_arg->m_user_arg;
  38. my_free(typed_arg);
  39. /* Then, execute the user code for this thread. */
  40. (*user_start_routine)(user_arg);
  41. return NULL;
  42. }
代码改动

由于开发原因,我加入了一个boost线程池,那么从原始线程产生任务塞入boost线程池中的时候,需要做类似的操作,即要传入一个psi_arg参数。因为PSI是performance schema,所以其本身对执行并没有影响,我们可以把子线程的PSI设置为NULL。在psi.h中,我们可以看到:

</>复制代码

  1. /**
  2. Instrumented thread key.
  3. To instrument a thread, a thread key must be obtained
  4. using @c register_thread.
  5. Using a zero key always disable the instrumentation.
  6. */
  7. typedef unsigned int PSI_thread_key;

获取当前的pfs:

</>复制代码

  1. /**
  2. Implementation of the thread instrumentation interface.
  3. @sa PSI_v1::get_thread_id.
  4. */
  5. PSI_thread*
  6. pfs_get_thread_v1(void)
  7. {
  8. PFS_thread *pfs= my_thread_get_THR_PFS();
  9. return reinterpret_cast (pfs);
  10. }

注意,不能直接用my_thread_get_THR_PFS()获取,因为其为static函数,只能用于本文件使用。同理设置pfs:

</>复制代码

  1. /**
  2. Implementation of the thread instrumentation interface.
  3. @sa PSI_v1::set_thread.
  4. */
  5. void pfs_set_thread_v1(PSI_thread* thread)
  6. {
  7. PFS_thread *pfs= reinterpret_cast (thread);
  8. my_thread_set_THR_PFS(pfs);
  9. std::cout << "my_thread_set_THR_PFS in pfs_set_thread_v1, value: "<< pfs << std::endl;
  10. }

附录:
定义的PSI结构(psi.h):

</>复制代码

  1. /**
  2. Performance Schema Interface, version 1.
  3. @since PSI_VERSION_1
  4. */
  5. struct PSI_v1
  6. {
  7. /** @sa register_mutex_v1_t. */
  8. register_mutex_v1_t register_mutex;
  9. /** @sa register_rwlock_v1_t. */
  10. register_rwlock_v1_t register_rwlock;
  11. /** @sa register_cond_v1_t. */
  12. register_cond_v1_t register_cond;
  13. /** @sa register_thread_v1_t. */
  14. register_thread_v1_t register_thread;
  15. /** @sa register_file_v1_t. */
  16. register_file_v1_t register_file;
  17. /** @sa register_stage_v1_t. */
  18. register_stage_v1_t register_stage;
  19. /** @sa register_statement_v1_t. */
  20. register_statement_v1_t register_statement;
  21. /** @sa register_socket_v1_t. */
  22. register_socket_v1_t register_socket;
  23. /** @sa init_mutex_v1_t. */
  24. init_mutex_v1_t init_mutex;
  25. /** @sa destroy_mutex_v1_t. */
  26. destroy_mutex_v1_t destroy_mutex;
  27. /** @sa init_rwlock_v1_t. */
  28. init_rwlock_v1_t init_rwlock;
  29. /** @sa destroy_rwlock_v1_t. */
  30. destroy_rwlock_v1_t destroy_rwlock;
  31. /** @sa init_cond_v1_t. */
  32. init_cond_v1_t init_cond;
  33. /** @sa destroy_cond_v1_t. */
  34. destroy_cond_v1_t destroy_cond;
  35. /** @sa init_socket_v1_t. */
  36. init_socket_v1_t init_socket;
  37. /** @sa destroy_socket_v1_t. */
  38. destroy_socket_v1_t destroy_socket;
  39. /** @sa get_table_share_v1_t. */
  40. get_table_share_v1_t get_table_share;
  41. /** @sa release_table_share_v1_t. */
  42. release_table_share_v1_t release_table_share;
  43. /** @sa drop_table_share_v1_t. */
  44. drop_table_share_v1_t drop_table_share;
  45. /** @sa open_table_v1_t. */
  46. open_table_v1_t open_table;
  47. /** @sa unbind_table_v1_t. */
  48. unbind_table_v1_t unbind_table;
  49. /** @sa rebind_table_v1_t. */
  50. rebind_table_v1_t rebind_table;
  51. /** @sa close_table_v1_t. */
  52. close_table_v1_t close_table;
  53. /** @sa create_file_v1_t. */
  54. create_file_v1_t create_file;
  55. /** @sa spawn_thread_v1_t. */
  56. spawn_thread_v1_t spawn_thread;
  57. /** @sa new_thread_v1_t. */
  58. new_thread_v1_t new_thread;
  59. /** @sa set_thread_id_v1_t. */
  60. set_thread_id_v1_t set_thread_id;
  61. /** @sa set_thread_THD_v1_t. */
  62. set_thread_THD_v1_t set_thread_THD;
  63. /** @sa set_thread_os_id_v1_t. */
  64. set_thread_os_id_v1_t set_thread_os_id;
  65. /** @sa get_thread_v1_t. */
  66. get_thread_v1_t get_thread;
  67. /** @sa set_thread_user_v1_t. */
  68. set_thread_user_v1_t set_thread_user;
  69. /** @sa set_thread_account_v1_t. */
  70. set_thread_account_v1_t set_thread_account;
  71. /** @sa set_thread_db_v1_t. */
  72. set_thread_db_v1_t set_thread_db;
  73. /** @sa set_thread_command_v1_t. */
  74. set_thread_command_v1_t set_thread_command;
  75. /** @sa set_connection_type_v1_t. */
  76. set_connection_type_v1_t set_connection_type;
  77. /** @sa set_thread_start_time_v1_t. */
  78. set_thread_start_time_v1_t set_thread_start_time;
  79. /** @sa set_thread_state_v1_t. */
  80. set_thread_state_v1_t set_thread_state;
  81. /** @sa set_thread_info_v1_t. */
  82. set_thread_info_v1_t set_thread_info;
  83. /** @sa set_thread_v1_t. */
  84. set_thread_v1_t set_thread;
  85. /** @sa delete_current_thread_v1_t. */
  86. delete_current_thread_v1_t delete_current_thread;
  87. /** @sa delete_thread_v1_t. */
  88. delete_thread_v1_t delete_thread;
  89. /** @sa get_thread_file_name_locker_v1_t. */
  90. get_thread_file_name_locker_v1_t get_thread_file_name_locker;
  91. /** @sa get_thread_file_stream_locker_v1_t. */
  92. get_thread_file_stream_locker_v1_t get_thread_file_stream_locker;
  93. /** @sa get_thread_file_descriptor_locker_v1_t. */
  94. get_thread_file_descriptor_locker_v1_t get_thread_file_descriptor_locker;
  95. /** @sa unlock_mutex_v1_t. */
  96. unlock_mutex_v1_t unlock_mutex;
  97. /** @sa unlock_rwlock_v1_t. */
  98. unlock_rwlock_v1_t unlock_rwlock;
  99. /** @sa signal_cond_v1_t. */
  100. signal_cond_v1_t signal_cond;
  101. /** @sa broadcast_cond_v1_t. */
  102. broadcast_cond_v1_t broadcast_cond;
  103. /** @sa start_idle_wait_v1_t. */
  104. start_idle_wait_v1_t start_idle_wait;
  105. /** @sa end_idle_wait_v1_t. */
  106. end_idle_wait_v1_t end_idle_wait;
  107. /** @sa start_mutex_wait_v1_t. */
  108. start_mutex_wait_v1_t start_mutex_wait;
  109. /** @sa end_mutex_wait_v1_t. */
  110. end_mutex_wait_v1_t end_mutex_wait;
  111. /** @sa start_rwlock_rdwait_v1_t. */
  112. start_rwlock_rdwait_v1_t start_rwlock_rdwait;
  113. /** @sa end_rwlock_rdwait_v1_t. */
  114. end_rwlock_rdwait_v1_t end_rwlock_rdwait;
  115. /** @sa start_rwlock_wrwait_v1_t. */
  116. start_rwlock_wrwait_v1_t start_rwlock_wrwait;
  117. /** @sa end_rwlock_wrwait_v1_t. */
  118. end_rwlock_wrwait_v1_t end_rwlock_wrwait;
  119. /** @sa start_cond_wait_v1_t. */
  120. start_cond_wait_v1_t start_cond_wait;
  121. /** @sa end_cond_wait_v1_t. */
  122. end_cond_wait_v1_t end_cond_wait;
  123. /** @sa start_table_io_wait_v1_t. */
  124. start_table_io_wait_v1_t start_table_io_wait;
  125. /** @sa end_table_io_wait_v1_t. */
  126. end_table_io_wait_v1_t end_table_io_wait;
  127. /** @sa start_table_lock_wait_v1_t. */
  128. start_table_lock_wait_v1_t start_table_lock_wait;
  129. /** @sa end_table_lock_wait_v1_t. */
  130. end_table_lock_wait_v1_t end_table_lock_wait;
  131. /** @sa start_file_open_wait_v1_t. */
  132. start_file_open_wait_v1_t start_file_open_wait;
  133. /** @sa end_file_open_wait_v1_t. */
  134. end_file_open_wait_v1_t end_file_open_wait;
  135. /** @sa end_file_open_wait_and_bind_to_descriptor_v1_t. */
  136. end_file_open_wait_and_bind_to_descriptor_v1_t
  137. end_file_open_wait_and_bind_to_descriptor;
  138. /** @sa end_temp_file_open_wait_and_bind_to_descriptor_v1_t. */
  139. end_temp_file_open_wait_and_bind_to_descriptor_v1_t
  140. end_temp_file_open_wait_and_bind_to_descriptor;
  141. /** @sa start_file_wait_v1_t. */
  142. start_file_wait_v1_t start_file_wait;
  143. /** @sa end_file_wait_v1_t. */
  144. end_file_wait_v1_t end_file_wait;
  145. /** @sa start_file_close_wait_v1_t. */
  146. start_file_close_wait_v1_t start_file_close_wait;
  147. /** @sa end_file_close_wait_v1_t. */
  148. end_file_close_wait_v1_t end_file_close_wait;
  149. /** @sa start_stage_v1_t. */
  150. start_stage_v1_t start_stage;
  151. /** @sa get_current_stage_progress_v1_t. */
  152. get_current_stage_progress_v1_t get_current_stage_progress;
  153. /** @sa end_stage_v1_t. */
  154. end_stage_v1_t end_stage;
  155. /** @sa get_thread_statement_locker_v1_t. */
  156. get_thread_statement_locker_v1_t get_thread_statement_locker;
  157. /** @sa refine_statement_v1_t. */
  158. refine_statement_v1_t refine_statement;
  159. /** @sa start_statement_v1_t. */
  160. start_statement_v1_t start_statement;
  161. /** @sa set_statement_text_v1_t. */
  162. set_statement_text_v1_t set_statement_text;
  163. /** @sa set_statement_lock_time_t. */
  164. set_statement_lock_time_t set_statement_lock_time;
  165. /** @sa set_statement_rows_sent_t. */
  166. set_statement_rows_sent_t set_statement_rows_sent;
  167. /** @sa set_statement_rows_examined_t. */
  168. set_statement_rows_examined_t set_statement_rows_examined;
  169. /** @sa inc_statement_created_tmp_disk_tables. */
  170. inc_statement_created_tmp_disk_tables_t inc_statement_created_tmp_disk_tables;
  171. /** @sa inc_statement_created_tmp_tables. */
  172. inc_statement_created_tmp_tables_t inc_statement_created_tmp_tables;
  173. /** @sa inc_statement_select_full_join. */
  174. inc_statement_select_full_join_t inc_statement_select_full_join;
  175. /** @sa inc_statement_select_full_range_join. */
  176. inc_statement_select_full_range_join_t inc_statement_select_full_range_join;
  177. /** @sa inc_statement_select_range. */
  178. inc_statement_select_range_t inc_statement_select_range;
  179. /** @sa inc_statement_select_range_check. */
  180. inc_statement_select_range_check_t inc_statement_select_range_check;
  181. /** @sa inc_statement_select_scan. */
  182. inc_statement_select_scan_t inc_statement_select_scan;
  183. /** @sa inc_statement_sort_merge_passes. */
  184. inc_statement_sort_merge_passes_t inc_statement_sort_merge_passes;
  185. /** @sa inc_statement_sort_range. */
  186. inc_statement_sort_range_t inc_statement_sort_range;
  187. /** @sa inc_statement_sort_rows. */
  188. inc_statement_sort_rows_t inc_statement_sort_rows;
  189. /** @sa inc_statement_sort_scan. */
  190. inc_statement_sort_scan_t inc_statement_sort_scan;
  191. /** @sa set_statement_no_index_used. */
  192. set_statement_no_index_used_t set_statement_no_index_used;
  193. /** @sa set_statement_no_good_index_used. */
  194. set_statement_no_good_index_used_t set_statement_no_good_index_used;
  195. /** @sa end_statement_v1_t. */
  196. end_statement_v1_t end_statement;
  197. /** @sa get_thread_transaction_locker_v1_t. */
  198. get_thread_transaction_locker_v1_t get_thread_transaction_locker;
  199. /** @sa start_transaction_v1_t. */
  200. start_transaction_v1_t start_transaction;
  201. /** @sa set_transaction_xid_v1_t. */
  202. set_transaction_xid_v1_t set_transaction_xid;
  203. /** @sa set_transaction_xa_state_v1_t. */
  204. set_transaction_xa_state_v1_t set_transaction_xa_state;
  205. /** @sa set_transaction_gtid_v1_t. */
  206. set_transaction_gtid_v1_t set_transaction_gtid;
  207. /** @sa set_transaction_trxid_v1_t. */
  208. set_transaction_trxid_v1_t set_transaction_trxid;
  209. /** @sa inc_transaction_savepoints_v1_t. */
  210. inc_transaction_savepoints_v1_t inc_transaction_savepoints;
  211. /** @sa inc_transaction_rollback_to_savepoint_v1_t. */
  212. inc_transaction_rollback_to_savepoint_v1_t inc_transaction_rollback_to_savepoint;
  213. /** @sa inc_transaction_release_savepoint_v1_t. */
  214. inc_transaction_release_savepoint_v1_t inc_transaction_release_savepoint;
  215. /** @sa end_transaction_v1_t. */
  216. end_transaction_v1_t end_transaction;
  217. /** @sa start_socket_wait_v1_t. */
  218. start_socket_wait_v1_t start_socket_wait;
  219. /** @sa end_socket_wait_v1_t. */
  220. end_socket_wait_v1_t end_socket_wait;
  221. /** @sa set_socket_state_v1_t. */
  222. set_socket_state_v1_t set_socket_state;
  223. /** @sa set_socket_info_v1_t. */
  224. set_socket_info_v1_t set_socket_info;
  225. /** @sa set_socket_thread_owner_v1_t. */
  226. set_socket_thread_owner_v1_t set_socket_thread_owner;
  227. /** @sa create_prepared_stmt_v1_t. */
  228. create_prepared_stmt_v1_t create_prepared_stmt;
  229. /** @sa destroy_prepared_stmt_v1_t. */
  230. destroy_prepared_stmt_v1_t destroy_prepared_stmt;
  231. /** @sa reprepare_prepared_stmt_v1_t. */
  232. reprepare_prepared_stmt_v1_t reprepare_prepared_stmt;
  233. /** @sa execute_prepared_stmt_v1_t. */
  234. execute_prepared_stmt_v1_t execute_prepared_stmt;
  235. /** @sa digest_start_v1_t. */
  236. digest_start_v1_t digest_start;
  237. /** @sa digest_end_v1_t. */
  238. digest_end_v1_t digest_end;
  239. /** @sa set_thread_connect_attrs_v1_t. */
  240. set_thread_connect_attrs_v1_t set_thread_connect_attrs;
  241. /** @sa start_sp_v1_t. */
  242. start_sp_v1_t start_sp;
  243. /** @sa start_sp_v1_t. */
  244. end_sp_v1_t end_sp;
  245. /** @sa drop_sp_v1_t. */
  246. drop_sp_v1_t drop_sp;
  247. /** @sa get_sp_share_v1_t. */
  248. get_sp_share_v1_t get_sp_share;
  249. /** @sa release_sp_share_v1_t. */
  250. release_sp_share_v1_t release_sp_share;
  251. /** @sa register_memory_v1_t. */
  252. register_memory_v1_t register_memory;
  253. /** @sa memory_alloc_v1_t. */
  254. memory_alloc_v1_t memory_alloc;
  255. /** @sa memory_realloc_v1_t. */
  256. memory_realloc_v1_t memory_realloc;
  257. /** @sa memory_claim_v1_t. */
  258. memory_claim_v1_t memory_claim;
  259. /** @sa memory_free_v1_t. */
  260. memory_free_v1_t memory_free;
  261. unlock_table_v1_t unlock_table;
  262. create_metadata_lock_v1_t create_metadata_lock;
  263. set_metadata_lock_status_v1_t set_metadata_lock_status;
  264. destroy_metadata_lock_v1_t destroy_metadata_lock;
  265. start_metadata_wait_v1_t start_metadata_wait;
  266. end_metadata_wait_v1_t end_metadata_wait;
  267. };

该结构在psi.cc被赋值:

</>复制代码

  1. /**
  2. Implementation of the instrumentation interface.
  3. @sa PSI_v1.
  4. */
  5. PSI_v1 PFS_v1=
  6. {
  7. pfs_register_mutex_v1,
  8. pfs_register_rwlock_v1,
  9. pfs_register_cond_v1,
  10. pfs_register_thread_v1,
  11. pfs_register_file_v1,
  12. pfs_register_stage_v1,
  13. pfs_register_statement_v1,
  14. pfs_register_socket_v1,
  15. pfs_init_mutex_v1,
  16. pfs_destroy_mutex_v1,
  17. pfs_init_rwlock_v1,
  18. pfs_destroy_rwlock_v1,
  19. pfs_init_cond_v1,
  20. pfs_destroy_cond_v1,
  21. pfs_init_socket_v1,
  22. pfs_destroy_socket_v1,
  23. pfs_get_table_share_v1,
  24. pfs_release_table_share_v1,
  25. pfs_drop_table_share_v1,
  26. pfs_open_table_v1,
  27. pfs_unbind_table_v1,
  28. pfs_rebind_table_v1,
  29. pfs_close_table_v1,
  30. pfs_create_file_v1,
  31. pfs_spawn_thread_v1,
  32. pfs_new_thread_v1,
  33. pfs_set_thread_id_v1,
  34. pfs_set_thread_THD_v1,
  35. pfs_set_thread_os_id_v1,
  36. pfs_get_thread_v1,
  37. pfs_set_thread_user_v1,
  38. pfs_set_thread_account_v1,
  39. pfs_set_thread_db_v1,
  40. pfs_set_thread_command_v1,
  41. pfs_set_connection_type_v1,
  42. pfs_set_thread_start_time_v1,
  43. pfs_set_thread_state_v1,
  44. pfs_set_thread_info_v1,
  45. pfs_set_thread_v1,
  46. pfs_delete_current_thread_v1,
  47. pfs_delete_thread_v1,
  48. pfs_get_thread_file_name_locker_v1,
  49. pfs_get_thread_file_stream_locker_v1,
  50. pfs_get_thread_file_descriptor_locker_v1,
  51. pfs_unlock_mutex_v1,
  52. pfs_unlock_rwlock_v1,
  53. pfs_signal_cond_v1,
  54. pfs_broadcast_cond_v1,
  55. pfs_start_idle_wait_v1,
  56. pfs_end_idle_wait_v1,
  57. pfs_start_mutex_wait_v1,
  58. pfs_end_mutex_wait_v1,
  59. pfs_start_rwlock_rdwait_v1,
  60. pfs_end_rwlock_rdwait_v1,
  61. pfs_start_rwlock_wrwait_v1,
  62. pfs_end_rwlock_wrwait_v1,
  63. pfs_start_cond_wait_v1,
  64. pfs_end_cond_wait_v1,
  65. pfs_start_table_io_wait_v1,
  66. pfs_end_table_io_wait_v1,
  67. pfs_start_table_lock_wait_v1,
  68. pfs_end_table_lock_wait_v1,
  69. pfs_start_file_open_wait_v1,
  70. pfs_end_file_open_wait_v1,
  71. pfs_end_file_open_wait_and_bind_to_descriptor_v1,
  72. pfs_end_temp_file_open_wait_and_bind_to_descriptor_v1,
  73. pfs_start_file_wait_v1,
  74. pfs_end_file_wait_v1,
  75. pfs_start_file_close_wait_v1,
  76. pfs_end_file_close_wait_v1,
  77. pfs_start_stage_v1,
  78. pfs_get_current_stage_progress_v1,
  79. pfs_end_stage_v1,
  80. pfs_get_thread_statement_locker_v1,
  81. pfs_refine_statement_v1,
  82. pfs_start_statement_v1,
  83. pfs_set_statement_text_v1,
  84. pfs_set_statement_lock_time_v1,
  85. pfs_set_statement_rows_sent_v1,
  86. pfs_set_statement_rows_examined_v1,
  87. pfs_inc_statement_created_tmp_disk_tables_v1,
  88. pfs_inc_statement_created_tmp_tables_v1,
  89. pfs_inc_statement_select_full_join_v1,
  90. pfs_inc_statement_select_full_range_join_v1,
  91. pfs_inc_statement_select_range_v1,
  92. pfs_inc_statement_select_range_check_v1,
  93. pfs_inc_statement_select_scan_v1,
  94. pfs_inc_statement_sort_merge_passes_v1,
  95. pfs_inc_statement_sort_range_v1,
  96. pfs_inc_statement_sort_rows_v1,
  97. pfs_inc_statement_sort_scan_v1,
  98. pfs_set_statement_no_index_used_v1,
  99. pfs_set_statement_no_good_index_used_v1,
  100. pfs_end_statement_v1,
  101. pfs_get_thread_transaction_locker_v1,
  102. pfs_start_transaction_v1,
  103. pfs_set_transaction_xid_v1,
  104. pfs_set_transaction_xa_state_v1,
  105. pfs_set_transaction_gtid_v1,
  106. pfs_set_transaction_trxid_v1,
  107. pfs_inc_transaction_savepoints_v1,
  108. pfs_inc_transaction_rollback_to_savepoint_v1,
  109. pfs_inc_transaction_release_savepoint_v1,
  110. pfs_end_transaction_v1,
  111. pfs_start_socket_wait_v1,
  112. pfs_end_socket_wait_v1,
  113. pfs_set_socket_state_v1,
  114. pfs_set_socket_info_v1,
  115. pfs_set_socket_thread_owner_v1,
  116. pfs_create_prepared_stmt_v1,
  117. pfs_destroy_prepared_stmt_v1,
  118. pfs_reprepare_prepared_stmt_v1,
  119. pfs_execute_prepared_stmt_v1,
  120. pfs_digest_start_v1,
  121. pfs_digest_end_v1,
  122. pfs_set_thread_connect_attrs_v1,
  123. pfs_start_sp_v1,
  124. pfs_end_sp_v1,
  125. pfs_drop_sp_v1,
  126. pfs_get_sp_share_v1,
  127. pfs_release_sp_share_v1,
  128. pfs_register_memory_v1,
  129. pfs_memory_alloc_v1,
  130. pfs_memory_realloc_v1,
  131. pfs_memory_claim_v1,
  132. pfs_memory_free_v1,
  133. pfs_unlock_table_v1,
  134. pfs_create_metadata_lock_v1,
  135. pfs_set_metadata_lock_status_v1,
  136. pfs_destroy_metadata_lock_v1,
  137. pfs_start_metadata_wait_v1,
  138. pfs_end_metadata_wait_v1
  139. };

每一个值都是一个函数。感兴趣的可以去看对应实现。

文章版权归作者所有,未经允许请勿转载,若此文章存在违规行为,您可以联系管理员删除。

转载请注明本文地址:https://www.ucloud.cn/yun/17620.html

相关文章

  • 如何&quot;有计划,高效率,优简历&quot;应对面试

    摘要:虽然有了十全的计划,但如何高效率去记住上面那么多东西是一个大问题,看看我是怎么做的。 前言 前一篇文章讲述了我在三月份毫无准备就去面试的后果,一开始心态真的爆炸,但是又不服气,一想到每次回来后家人朋友问我面试结果的期待脸,越觉得必须付出的行动来证明自己了。 面经传送门:一个1年工作经验的PHP程序员是如何被面试官虐的? 下面是我花费两个星期做的准备,主要分三部分: 有计划——计划好...

    gyl_coder 评论0 收藏0

发表评论

0条评论

最新活动
阅读需要支付1元查看
<