1 | /* -*- mode: C++; c-basic-offset: 4; indent-tabs-mode: nil -*- */ |
2 | #ident "$Id$" |
3 | /*====== |
4 | This file is part of PerconaFT. |
5 | |
6 | |
7 | Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved. |
8 | |
9 | PerconaFT is free software: you can redistribute it and/or modify |
10 | it under the terms of the GNU General Public License, version 2, |
11 | as published by the Free Software Foundation. |
12 | |
13 | PerconaFT is distributed in the hope that it will be useful, |
14 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16 | GNU General Public License for more details. |
17 | |
18 | You should have received a copy of the GNU General Public License |
19 | along with PerconaFT. If not, see <http://www.gnu.org/licenses/>. |
20 | |
21 | ---------------------------------------- |
22 | |
23 | PerconaFT is free software: you can redistribute it and/or modify |
24 | it under the terms of the GNU Affero General Public License, version 3, |
25 | as published by the Free Software Foundation. |
26 | |
27 | PerconaFT is distributed in the hope that it will be useful, |
28 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
29 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
30 | GNU Affero General Public License for more details. |
31 | |
32 | You should have received a copy of the GNU Affero General Public License |
33 | along with PerconaFT. If not, see <http://www.gnu.org/licenses/>. |
34 | ======= */ |
35 | |
36 | #ident "Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved." |
37 | |
38 | #include <map> |
39 | #include <memory> |
40 | #include <string> |
41 | |
42 | #include <db.h> |
43 | |
44 | #include "db_env.hpp" |
45 | |
46 | namespace ftcxx { |
47 | |
48 | void DBEnv::get_status(DBEnv::Status &status, fs_redzone_state &redzone_state, uint64_t &env_panic, std::string &panic_string) const{ |
49 | uint64_t num_rows; |
50 | int r = _env->get_engine_status_num_rows(_env, &num_rows); |
51 | handle_ft_retval(r); |
52 | |
53 | std::unique_ptr<TOKU_ENGINE_STATUS_ROW_S[]> buf(new TOKU_ENGINE_STATUS_ROW_S[num_rows]); |
54 | char panic_string_buf[1<<12]; |
55 | panic_string_buf[0] = '\0'; |
56 | |
57 | r = _env->get_engine_status(_env, buf.get(), num_rows, &num_rows, |
58 | &redzone_state, |
59 | &env_panic, panic_string_buf, sizeof panic_string_buf, |
60 | toku_engine_status_include_type(TOKU_ENGINE_STATUS | TOKU_GLOBAL_STATUS)); |
61 | handle_ft_retval(r); |
62 | |
63 | panic_string = std::string(panic_string_buf); |
64 | |
65 | for (uint64_t i = 0; i < num_rows; ++i) { |
66 | status[buf[i].keyname] = buf[i]; |
67 | } |
68 | } |
69 | |
70 | } // namespace ftcxx |
71 | |