PATH: //proc/self/root/usr/include/mysql/server/private
FILE_BARU
CREATE
FOLDER_BARU
MKDIR
UPLOAD_FILE
GO
[ .. KEMBALI ]
đ aligned.h
â
X
đ aria_backup.h
â
X
đ assume_aligned.h
â
X
đ atomic/
X
đ authors.h
â
X
đ backup.h
â
X
đ bounded_queue.h
â
X
đ client_settings.h
â
X
đ compat56.h
â
X
đ config.h
â
X
đ contributors.h
â
X
đ create_options.h
â
X
đ create_tmp_table.h
â
X
đ cset_narrowing.h
â
X
đ custom_conf.h
â
X
đ datadict.h
â
X
đ ddl_log.h
â
X
đ debug.h
â
X
đ debug_sync.h
â
X
đ derived_handler.h
â
X
đ derror.h
â
X
đ des_key_file.h
â
X
đ discover.h
â
X
đ dur_prop.h
â
X
đ embedded_priv.h
â
X
đ event_data_objects.h
â
X
đ event_db_repository.h
â
X
đ event_parse_data.h
â
X
đ event_queue.h
â
X
đ event_scheduler.h
â
X
đ events.h
â
X
đ field.h
â
X
đ field_comp.h
â
X
đ filesort.h
â
X
đ filesort_utils.h
â
X
đ ft_global.h
â
X
đ gcalc_slicescan.h
â
X
đ gcalc_tools.h
â
X
đ grant.h
â
X
đ group_by_handler.h
â
X
đ gstream.h
â
X
đ ha_handler_stats.h
â
X
đ ha_partition.h
â
X
đ ha_sequence.h
â
X
đ handle_connections_win.h
â
X
đ handler.h
â
X
đ hash.h
â
X
đ hash_filo.h
â
X
đ heap.h
â
X
đ hostname.h
â
X
đ ilist.h
â
X
đ init.h
â
X
đ innodb_priv.h
â
X
đ item.h
â
X
đ item_cmpfunc.h
â
X
đ item_create.h
â
X
đ item_func.h
â
X
đ item_geofunc.h
â
X
đ item_jsonfunc.h
â
X
đ item_row.h
â
X
đ item_strfunc.h
â
X
đ item_subselect.h
â
X
đ item_sum.h
â
X
đ item_timefunc.h
â
X
đ item_vers.h
â
X
đ item_windowfunc.h
â
X
đ item_xmlfunc.h
â
X
đ json_table.h
â
X
đ key.h
â
X
đ keycaches.h
â
X
đ lex.h
â
X
đ lex_string.h
â
X
đ lex_symbol.h
â
X
đ lf.h
â
X
đ lock.h
â
X
đ log.h
â
X
đ log_event.h
â
X
đ log_event_data_type.h
â
X
đ log_event_old.h
â
X
đ log_slow.h
â
X
đ maria.h
â
X
đ mariadb.h
â
X
đ mdl.h
â
X
đ mem_root_array.h
â
X
đ message.h
â
X
đ multi_range_read.h
â
X
đ my_alarm.h
â
X
đ my_apc.h
â
X
đ my_atomic.h
â
X
đ my_atomic_wrapper.h
â
X
đ my_base.h
â
X
đ my_bit.h
â
X
đ my_bitmap.h
â
X
đ my_check_opt.h
â
X
đ my_compare.h
â
X
đ my_counter.h
â
X
đ my_cpu.h
â
X
đ my_crypt.h
â
X
đ my_decimal.h
â
X
đ my_default.h
â
X
đ my_handler_errors.h
â
X
đ my_json_writer.h
â
X
đ my_libwrap.h
â
X
đ my_md5.h
â
X
đ my_minidump.h
â
X
đ my_nosys.h
â
X
đ my_rdtsc.h
â
X
đ my_rnd.h
â
X
đ my_service_manager.h
â
X
đ my_stack_alloc.h
â
X
đ my_stacktrace.h
â
X
đ my_time.h
â
X
đ my_tree.h
â
X
đ my_uctype.h
â
X
đ my_user.h
â
X
đ myisam.h
â
X
đ myisamchk.h
â
X
đ myisammrg.h
â
X
đ myisampack.h
â
X
đ mysqld.h
â
X
đ mysqld_default_groups.h
â
X
đ mysqld_suffix.h
â
X
đ mysys_err.h
â
X
đ opt_range.h
â
X
đ opt_subselect.h
â
X
đ opt_trace.h
â
X
đ opt_trace_context.h
â
X
đ parse_file.h
â
X
đ partition_element.h
â
X
đ partition_info.h
â
X
đ password.h
â
X
đ pfs_file_provider.h
â
X
đ pfs_idle_provider.h
â
X
đ pfs_memory_provider.h
â
X
đ pfs_metadata_provider.h
â
X
đ pfs_socket_provider.h
â
X
đ pfs_stage_provider.h
â
X
đ pfs_statement_provider.h
â
X
đ pfs_table_provider.h
â
X
đ pfs_thread_provider.h
â
X
đ pfs_transaction_provider.h
â
X
đ privilege.h
â
X
đ probes_mysql.h
â
X
đ probes_mysql_dtrace.h
â
X
đ probes_mysql_nodtrace.h
â
X
đ procedure.h
â
X
đ protocol.h
â
X
đ proxy_protocol.h
â
X
đ queues.h
â
X
đ records.h
â
X
đ repl_failsafe.h
â
X
đ replication.h
â
X
đ rijndael.h
â
X
đ rowid_filter.h
â
X
đ rpl_constants.h
â
X
đ rpl_filter.h
â
X
đ rpl_gtid.h
â
X
đ rpl_injector.h
â
X
đ rpl_mi.h
â
X
đ rpl_parallel.h
â
X
đ rpl_record.h
â
X
đ rpl_record_old.h
â
X
đ rpl_reporting.h
â
X
đ rpl_rli.h
â
X
đ rpl_tblmap.h
â
X
đ rpl_utility.h
â
X
đ scheduler.h
â
X
đ scope.h
â
X
đ select_handler.h
â
X
đ semisync.h
â
X
đ semisync_master.h
â
X
đ semisync_master_ack_receiver.h
â
X
đ semisync_slave.h
â
X
đ service_versions.h
â
X
đ session_tracker.h
â
X
đ set_var.h
â
X
đ slave.h
â
X
đ socketpair.h
â
X
đ source_revision.h
â
X
đ sp.h
â
X
đ sp_cache.h
â
X
đ sp_head.h
â
X
đ sp_pcontext.h
â
X
đ sp_rcontext.h
â
X
đ span.h
â
X
đ spatial.h
â
X
đ sql_acl.h
â
X
đ sql_admin.h
â
X
đ sql_alloc.h
â
X
đ sql_alter.h
â
X
đ sql_analyse.h
â
X
đ sql_analyze_stmt.h
â
X
đ sql_array.h
â
X
đ sql_audit.h
â
X
đ sql_base.h
â
X
đ sql_basic_types.h
â
X
đ sql_binlog.h
â
X
đ sql_bitmap.h
â
X
đ sql_bootstrap.h
â
X
đ sql_cache.h
â
X
đ sql_callback.h
â
X
đ sql_class.h
â
X
đ sql_cmd.h
â
X
đ sql_connect.h
â
X
đ sql_const.h
â
X
đ sql_crypt.h
â
X
đ sql_cte.h
â
X
đ sql_cursor.h
â
X
đ sql_db.h
â
X
đ sql_debug.h
â
X
đ sql_delete.h
â
X
đ sql_derived.h
â
X
đ sql_digest.h
â
X
đ sql_digest_stream.h
â
X
đ sql_do.h
â
X
đ sql_error.h
â
X
đ sql_explain.h
â
X
đ sql_expression_cache.h
â
X
đ sql_get_diagnostics.h
â
X
đ sql_handler.h
â
X
đ sql_help.h
â
X
đ sql_hset.h
â
X
đ sql_i_s.h
â
X
đ sql_insert.h
â
X
đ sql_join_cache.h
â
X
đ sql_lex.h
â
X
đ sql_lifo_buffer.h
â
X
đ sql_limit.h
â
X
đ sql_list.h
â
X
đ sql_load.h
â
X
đ sql_locale.h
â
X
đ sql_manager.h
â
X
đ sql_mode.h
â
X
đ sql_parse.h
â
X
đ sql_partition.h
â
X
đ sql_partition_admin.h
â
X
đ sql_plist.h
â
X
đ sql_plugin.h
â
X
đ sql_plugin_compat.h
â
X
đ sql_prepare.h
â
X
đ sql_priv.h
â
X
đ sql_profile.h
â
X
đ sql_reload.h
â
X
đ sql_rename.h
â
X
đ sql_repl.h
â
X
đ sql_schema.h
â
X
đ sql_select.h
â
X
đ sql_sequence.h
â
X
đ sql_servers.h
â
X
đ sql_show.h
â
X
đ sql_signal.h
â
X
đ sql_sort.h
â
X
đ sql_statistics.h
â
X
đ sql_string.h
â
X
đ sql_table.h
â
X
đ sql_tablespace.h
â
X
đ sql_test.h
â
X
đ sql_time.h
â
X
đ sql_trigger.h
â
X
đ sql_truncate.h
â
X
đ sql_tvc.h
â
X
đ sql_type.h
â
X
đ sql_type_fixedbin.h
â
X
đ sql_type_fixedbin_storage.h
â
X
đ sql_type_geom.h
â
X
đ sql_type_int.h
â
X
đ sql_type_json.h
â
X
đ sql_type_real.h
â
X
đ sql_type_string.h
â
X
đ sql_udf.h
â
X
đ sql_union.h
â
X
đ sql_update.h
â
X
đ sql_view.h
â
X
đ sql_window.h
â
X
đ ssl_compat.h
â
X
đ strfunc.h
â
X
đ structs.h
â
X
đ sys_vars_shared.h
â
X
đ t_ctype.h
â
X
đ table.h
â
X
đ table_cache.h
â
X
đ thr_alarm.h
â
X
đ thr_lock.h
â
X
đ thr_malloc.h
â
X
đ thr_timer.h
â
X
đ thread_cache.h
â
X
đ threadpool.h
â
X
đ threadpool_generic.h
â
X
đ threadpool_winsockets.h
â
X
đ transaction.h
â
X
đ tzfile.h
â
X
đ tztime.h
â
X
đ uniques.h
â
X
đ unireg.h
â
X
đ vers_string.h
â
X
đ violite.h
â
X
đ waiting_threads.h
â
X
đ welcome_copyright_notice.h
â
X
đ win_tzname_data.h
â
X
đ winservice.h
â
X
đ wqueue.h
â
X
đ wsrep.h
â
X
đ wsrep_applier.h
â
X
đ wsrep_binlog.h
â
X
đ wsrep_client_service.h
â
X
đ wsrep_client_state.h
â
X
đ wsrep_condition_variable.h
â
X
đ wsrep_high_priority_service.h
â
X
đ wsrep_mutex.h
â
X
đ wsrep_mysqld.h
â
X
đ wsrep_mysqld_c.h
â
X
đ wsrep_on.h
â
X
đ wsrep_priv.h
â
X
đ wsrep_schema.h
â
X
đ wsrep_server_service.h
â
X
đ wsrep_server_state.h
â
X
đ wsrep_sst.h
â
X
đ wsrep_storage_service.h
â
X
đ wsrep_thd.h
â
X
đ wsrep_trans_observer.h
â
X
đ wsrep_types.h
â
X
đ wsrep_utils.h
â
X
đ wsrep_var.h
â
X
đ wsrep_xid.h
â
X
đ xa.h
â
X
SAVING...
BERHASIL DIUBAH!
EDITING: thread_cache.h
/* Copyright (C) 2020 MariaDB Foundation 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 the Free Software Foundation; version 2 of the License. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ /** MariaDB thread cache for "one thread per connection" scheduler. Thread cache allows to re-use threads (as well as THD objects) for subsequent connections. */ class Thread_cache { mutable mysql_cond_t COND_thread_cache; mutable mysql_cond_t COND_flush_thread_cache; mutable mysql_mutex_t LOCK_thread_cache; /** Queue of new connection requests. */ I_List<CONNECT> list; /** Number of threads parked in the cache. */ ulong cached_thread_count; /** Number of active flush requests. */ uint32_t kill_cached_threads; /** PFS stuff, only used during initialization. Unfortunately needs to survive till destruction. */ PSI_cond_key key_COND_thread_cache, key_COND_flush_thread_cache; PSI_mutex_key key_LOCK_thread_cache; public: void init() { #ifdef HAVE_PSI_INTERFACE PSI_cond_info conds[]= { { &key_COND_thread_cache, "COND_thread_cache", PSI_FLAG_GLOBAL }, { &key_COND_flush_thread_cache, "COND_flush_thread_cache", PSI_FLAG_GLOBAL } }; PSI_mutex_info mutexes[]= { { &key_LOCK_thread_cache, "LOCK_thread_cache", PSI_FLAG_GLOBAL } }; mysql_mutex_register("sql", mutexes, array_elements(mutexes)); mysql_cond_register("sql", conds, array_elements(conds)); #endif mysql_mutex_init(key_LOCK_thread_cache, &LOCK_thread_cache, MY_MUTEX_INIT_FAST); mysql_cond_init(key_COND_thread_cache, &COND_thread_cache, 0); mysql_cond_init(key_COND_flush_thread_cache, &COND_flush_thread_cache, 0); list.empty(); kill_cached_threads= 0; cached_thread_count= 0; } void destroy() { DBUG_ASSERT(cached_thread_count == 0); DBUG_ASSERT(list.is_empty()); mysql_cond_destroy(&COND_flush_thread_cache); mysql_cond_destroy(&COND_thread_cache); mysql_mutex_destroy(&LOCK_thread_cache); } /** Flushes thread cache. Awakes parked threads and requests them to shutdown. Waits until last parked thread leaves the cache. */ void flush() { mysql_mutex_lock(&LOCK_thread_cache); kill_cached_threads++; while (cached_thread_count) { mysql_cond_broadcast(&COND_thread_cache); mysql_cond_wait(&COND_flush_thread_cache, &LOCK_thread_cache); } kill_cached_threads--; mysql_mutex_unlock(&LOCK_thread_cache); } /** Flushes thread cache and forbids threads parking in the cache. This is a pre-shutdown hook. */ void final_flush() { kill_cached_threads++; flush(); } /** Requests parked thread to serve new connection. @return @retval true connection is enqueued and parked thread is about to serve it @retval false thread cache is empty */ bool enqueue(CONNECT *connect) { mysql_mutex_lock(&LOCK_thread_cache); if (cached_thread_count) { list.push_back(connect); cached_thread_count--; mysql_mutex_unlock(&LOCK_thread_cache); mysql_cond_signal(&COND_thread_cache); return true; } mysql_mutex_unlock(&LOCK_thread_cache); return false; } /** Parks thread in the cache. Thread execution is suspended until either of the following occurs: - thread is requested to serve new connection; - thread cache is flushed; - THREAD_CACHE_TIMEOUT elapsed. @return @retval pointer to CONNECT if requested to serve new connection @retval 0 if thread cache is flushed or on timeout */ CONNECT *park() { struct timespec abstime; CONNECT *connect; bool flushed= false; DBUG_ENTER("Thread_cache::park"); set_timespec(abstime, THREAD_CACHE_TIMEOUT); /* Delete the instrumentation for the job that just completed, before parking this pthread in the cache (blocked on COND_thread_cache). */ PSI_CALL_delete_current_thread(); #ifndef DBUG_OFF while (_db_is_pushed_()) _db_pop_(); #endif mysql_mutex_lock(&LOCK_thread_cache); if ((connect= list.get())) cached_thread_count++; else if (cached_thread_count < thread_cache_size && !kill_cached_threads) { /* Don't kill the thread, just put it in cache for reuse */ DBUG_PRINT("info", ("Adding thread to cache")); cached_thread_count++; for (;;) { int error= mysql_cond_timedwait(&COND_thread_cache, &LOCK_thread_cache, &abstime); flushed= kill_cached_threads; if ((connect= list.get())) break; else if (flushed || error == ETIMEDOUT || error == ETIME) { /* If timeout, end thread. If a new thread is requested, we will handle the call, even if we got a timeout (as we are already awake and free) */ cached_thread_count--; break; } } } mysql_mutex_unlock(&LOCK_thread_cache); if (flushed) mysql_cond_signal(&COND_flush_thread_cache); DBUG_RETURN(connect); } /** Returns the number of parked threads. */ ulong size() const { mysql_mutex_lock(&LOCK_thread_cache); ulong r= cached_thread_count; mysql_mutex_unlock(&LOCK_thread_cache); return r; } }; extern Thread_cache thread_cache;
SIMPAN PERUBAHAN