Debian Codegraph @

storage/rocksdb/rdb_io_watchdog.h

raw symbols SCIP
1 /*
2 Copyright (c) 2017, Facebook, Inc.
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; version 2 of the License.
7
8 This program is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 GNU General Public License for more details.
12
13 You should have received a copy of the GNU General Public License
14 along with this program; if not, write to the Free Software
15 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
16
17 #pragma once
18
19 /* C++ standard header files */
20 #include <signal.h>
21 #include <stdlib.h>
22 #include <string.h>
23 #include <time.h>
24 #include <atomic>
25 #include <string>
26 #include <vector>
27
28 /* MySQL header files */
29 #include "./my_global.h"cxx . . $ `<file>/include/my_global.h`/
30 #include "./my_stacktrace.h"cxx . . $ `<file>/include/my_stacktrace.h`/
31
32 /* MyRocks header files */
33 #include "./rdb_utils.h"cxx . . $ `<file>/storage/rocksdb/rdb_utils.h`/
34
35 namespace myrockscxx . . $ myrocks/ {
36
37 // Rdb_io_watchdog does not support Windows ATM.
38 #ifdef HAVE_TIMER_DELETEcxx . . $ `<built-in>:456:9`!
39
40 class Rdb_io_watchdogcxx . . $ myrocks/Rdb_io_watchdog# {
41 const int RDB_IO_WRITE_BUFFER_SIZEcxx . . $ myrocks/Rdb_io_watchdog#RDB_IO_WRITE_BUFFER_SIZE. = 4096;
42 const char *const RDB_IO_DUMMY_FILE_NAMEcxx . . $ myrocks/Rdb_io_watchdog#RDB_IO_DUMMY_FILE_NAME. = "myrocks_io_watchdog_write_file";
43
44 private:
45 timer_tcxx . . $ timer_t# m_io_check_timercxx . . $ myrocks/Rdb_io_watchdog#m_io_check_timer., m_io_check_watchdog_timercxx . . $ myrocks/Rdb_io_watchdog#m_io_check_watchdog_timer.;
46 stdcxx . . $ std/::atomiccxx . . $ std/atomic#<bool> m_io_in_progresscxx . . $ myrocks/Rdb_io_watchdog#m_io_in_progress.;
47 stdcxx . . $ std/::vectorcxx . . $ std/vector#<stdcxx . . $ std/::stringcxx . . $ std/string#> m_dirs_to_checkcxx . . $ myrocks/Rdb_io_watchdog#m_dirs_to_check.;
48 uint32_tcxx . . $ `<built-in>:471:9`! m_write_timeoutcxx . . $ myrocks/Rdb_io_watchdog#m_write_timeout.;
49 mysql_mutex_t m_reset_mutexcxx . . $ myrocks/Rdb_io_watchdog#m_reset_mutex.;
50 char *m_bufcxx . . $ myrocks/Rdb_io_watchdog#m_buf.;
51
52 int check_write_accesscxx . . $ myrocks/Rdb_io_watchdog#check_write_access(22cc3a531165f6b0).(const stdcxx . . $ std/::stringcxx . . $ std/string# &dirname) const;
53 void io_check_callbackcxx . . $ myrocks/Rdb_io_watchdog#io_check_callback(89e4f96bed708957).(union sigval timer_data);
54 void expire_io_callbackcxx . . $ myrocks/Rdb_io_watchdog#expire_io_callback(89e4f96bed708957).(union sigval timer_data);
55
56 int stop_timerscxx . . $ myrocks/Rdb_io_watchdog#stop_timers(b126dc7c1de90089).() {
57 int ret = 0;
58
59 if (m_io_check_watchdog_timercxx . . $ myrocks/Rdb_io_watchdog#m_io_check_watchdog_timer.) {
60 ret = timer_delete(m_io_check_watchdog_timercxx . . $ myrocks/Rdb_io_watchdog#m_io_check_watchdog_timer.);
61
62 if (!ret) {
63 m_io_check_watchdog_timercxx . . $ myrocks/Rdb_io_watchdog#m_io_check_watchdog_timer. = nullptr;
64 }
65 }
66
67 if (m_io_check_timercxx . . $ myrocks/Rdb_io_watchdog#m_io_check_timer. && !ret) {
68 ret = timer_delete(m_io_check_timercxx . . $ myrocks/Rdb_io_watchdog#m_io_check_timer.);
69
70 if (!ret) {
71 m_io_check_timercxx . . $ myrocks/Rdb_io_watchdog#m_io_check_timer. = nullptr;
72 }
73 }
74
75 return ret;
76 }
77
78 static void io_check_callback_wrappercxx . . $ myrocks/Rdb_io_watchdog#io_check_callback_wrapper(89e4f96bed708957).(union sigval timer_data) {
79 Rdb_io_watchdogcxx . . $ myrocks/Rdb_io_watchdog# *io_watchdog =
80 static_cast<Rdb_io_watchdogcxx . . $ myrocks/Rdb_io_watchdog# *>(timer_data.sival_ptr);
81 DBUG_ASSERTcxx . . $ `include/my_dbug.h:207:9`!(io_watchdog != nullptr);
82
83 io_watchdog->io_check_callbackcxx . . $ myrocks/Rdb_io_watchdog#io_check_callback(89e4f96bed708957).(timer_data);
84 }
85
86 static void expire_io_callback_wrappercxx . . $ myrocks/Rdb_io_watchdog#expire_io_callback_wrapper(89e4f96bed708957).(union sigval timer_data) {
87 Rdb_io_watchdogcxx . . $ myrocks/Rdb_io_watchdog# *io_watchdog =
88 static_cast<Rdb_io_watchdogcxx . . $ myrocks/Rdb_io_watchdog# *>(timer_data.sival_ptr);
89 DBUG_ASSERTcxx . . $ `include/my_dbug.h:207:9`!(io_watchdog != nullptr);
90
91 io_watchdog->expire_io_callbackcxx . . $ myrocks/Rdb_io_watchdog#expire_io_callback(89e4f96bed708957).(timer_data);
92 }
93
94 public:
95 explicit Rdb_io_watchdogcxx . . $ myrocks/Rdb_io_watchdog#Rdb_io_watchdog(35e7ded037dc5a53).(stdcxx . . $ std/::vectorcxx . . $ std/vector#<stdcxx . . $ std/::stringcxx . . $ std/string#> &&directories)
96 : m_io_check_timercxx . . $ myrocks/Rdb_io_watchdog#m_io_check_timer.(nullptr),
97 m_io_check_watchdog_timercxx . . $ myrocks/Rdb_io_watchdog#m_io_check_watchdog_timer.(nullptr),
98 m_io_in_progresscxx . . $ std/atomic#atomic(b45ddcbc8423892c).(false),
99 m_dirs_to_checkcxx . . $ myrocks/Rdb_io_watchdog#m_dirs_to_check.(stdcxx . . $ std/::movecxx . . $ std/move(e7c6c0c8363dcc46).(directories)),
100 m_bufcxx . . $ myrocks/Rdb_io_watchdog#m_buf.(nullptr) {
101 DBUG_ASSERTcxx . . $ `include/my_dbug.h:207:9`!(m_dirs_to_check.size() > 0);
102 mysql_mutex_initcxx . . $ `include/mysql/psi/mysql_thread.h:325:13`!(0, &m_reset_mutex, MY_MUTEX_INIT_FASTcxx . . $ `include/my_pthread.h:602:9`!);
103 }
104
105 ~cxx . . $ myrocks/Rdb_io_watchdog#`~Rdb_io_watchdog`(49f6e7a06ebc5aa8).Rdb_io_watchdogcxx . . $ myrocks/Rdb_io_watchdog#() {
106 // We're shutting down. Ignore errors possibly coming from timer deletion.
107 static_cast<void>(stop_timerscxx . . $ myrocks/Rdb_io_watchdog#stop_timers(b126dc7c1de90089).());
108 mysql_mutex_destroycxx . . $ myrocks/Rdb_io_watchdog#m_reset_mutex.(&m_reset_mutex);
109 freecxx . . $ free(5d22bdacc48458e8).(m_bufcxx . . $ myrocks/Rdb_io_watchdog#m_buf.);
110 }
111
112 int reset_timeoutcxx . . $ myrocks/Rdb_io_watchdog#reset_timeout(4c679297bf94b9eb).(const uint32_tcxx . . $ `<built-in>:471:9`! write_timeout);
113
114 Rdb_io_watchdogcxx . . $ myrocks/Rdb_io_watchdog#Rdb_io_watchdog(6cd3216f3a59bf6a).(const Rdb_io_watchdogcxx . . $ myrocks/Rdb_io_watchdog# &) = delete;
115 Rdb_io_watchdogcxx . . $ myrocks/Rdb_io_watchdog# &operatorcxx . . $ myrocks/Rdb_io_watchdog#`operator=`(531a416b19fe5268).=(const Rdb_io_watchdogcxx . . $ myrocks/Rdb_io_watchdog# &) = delete;
116 };
117
118 #endif
119 } // namespace myrocks