MySQL 8.0.30
Source Code Documentation
mysql_page_track_imp.h
Go to the documentation of this file.
1/* Copyright (c) 2018, 2022, Oracle and/or its affiliates.
2
3This program is free software; you can redistribute it and/or modify
4it under the terms of the GNU General Public License as published by
5the Free Software Foundation; version 2 of the License.
6
7This program is distributed in the hope that it will be useful,
8but WITHOUT ANY WARRANTY; without even the implied warranty of
9MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10GNU General Public License for more details.
11
12You should have received a copy of the GNU General Public License
13along with this program; if not, write to the Free Software
14Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
15
16#ifndef MYSQL_PAGE_TRACK_H
17#define MYSQL_PAGE_TRACK_H
18
21
22/**
23 An implementation of page tracking service.
24*/
26 public:
27 /**
28 Service API to start page tracking.
29
30 @param[in] opaque_thd Current thread context.
31 @param[in] se_type SE for which to enable tracking
32 @param[out] start_id SE specific sequence number [LSN for InnoDB]
33 indicating when the tracking was started
34
35 @return Operation status.
36 @retval 0 Success
37 @retval other ER_* mysql error. Get error details from THD.
38 */
39 static DEFINE_METHOD(int, start,
40 (MYSQL_THD opaque_thd, Page_Track_SE se_type,
41 uint64_t *start_id));
42
43 /**
44 Service API to stop page tracking.
45
46 @param[in] opaque_thd Current thread context.
47 @param[in] se_type SE for which to enable tracking
48 @param[out] stop_id SE specific sequence number [LSN for InnoDB]
49 indicating when the tracking was stopped
50
51 @return Operation status.
52 @retval 0 Success
53 @retval other ER_* mysql error. Get error details from THD.
54 */
55 static DEFINE_METHOD(int, stop,
56 (MYSQL_THD opaque_thd, Page_Track_SE se_type,
57 uint64_t *stop_id));
58
59 /**
60 Service API to purge page tracking data.
61
62 @param[in] opaque_thd Current thread context.
63 @param[in] se_type SE for which to enable tracking
64 @param[in,out] purge_id SE specific sequence number [LSN for Innodb]
65 initially indicating till where the data needs to be purged and finally
66 updated to until where it was actually purged
67
68 @return Operation status.
69 @retval 0 Success
70 @retval other ER_* mysql error. Get error details from THD.
71 */
72 static DEFINE_METHOD(int, purge,
73 (MYSQL_THD opaque_thd, Page_Track_SE se_type,
74 uint64_t *purge_id));
75
76 /**
77 Service API to get tracked pages
78
79 @param[in] opaque_thd Current thread context.
80 @param[in] se_type SE for which to enable tracking
81 @param[in,out] start_id SE specific sequence number [LSN for InnoDB]
82 from where the pages tracked would be returned.
83 @note The range might get expanded and the actual start_id used for the
84 querying will be updated.
85 @param[in,out] stop_id SE specific sequence number [LSN for InnoDB]
86 until where the pages tracked would be returned.
87 @note The range might get expanded and the actual stop_id used for the
88 querying will be updated.
89 @param[out] buffer allocated buffer to copy page IDs
90 @param[in] buffer_len length of buffer in bytes
91 @param[in] cbk_func callback function return page IDs
92 @param[in] cbk_ctx caller's context for callback
93
94 @return Operation status.
95 @retval 0 Success
96 @retval other ER_* mysql error. Get error details from THD.
97 */
98 static DEFINE_METHOD(int, get_page_ids,
99 (MYSQL_THD opaque_thd, Page_Track_SE se_type,
100 uint64_t *start_id, uint64_t *stop_id,
101 unsigned char *buffer, size_t buffer_len,
102 Page_Track_Callback cbk_func, void *cbk_ctx));
103
104 /**
105 Service API to get approximate number of pages tracked in the given range.
106
107 @param[in] opaque_thd Current thread context.
108 @param[in] se_type SE for which to enable tracking
109 @param[in,out] start_id SE specific sequence number [LSN for InnoDB]
110 from where the pages tracked would be returned.
111 @note the range might get expanded and the actual start_id used for the
112 querying will be updated.
113 @param[in,out] stop_id SE specific sequence number [LSN for InnoDB]
114 until where the pages tracked would be returned.
115 @note the range might get expanded and the actual stop_id used for the
116 querying will be updated.
117 @param[out] num_pages number of pages tracked
118
119 @return Operation status.
120 @retval 0 Success
121 @retval other ER_* mysql error. Get error details from THD.
122 */
124 (MYSQL_THD opaque_thd, Page_Track_SE se_type,
125 uint64_t *start_id, uint64_t *stop_id,
126 uint64_t *num_pages));
127
128 /**
129 API to check if page tracking is active or not and to return start id if
130 it's active.
131
132 @param[in] opaque_thd Current thread context.
133 @param[in] se_type SE for which to enable tracking
134 @param[out] initial_start_id SE specific sequence number [LSN for
135 Innodb] which denotes the start id at which page tracking was started if
136 it's active
137 @param[out] last_start_id SE specific sequence number [LSN for
138 Innodb] which denotes the start id the last time the start request was
139 issued
140 @return if page tracking is active or not
141 @retval true if page tracking is active
142 @retval false if page tracking is not active
143 */
144 static DEFINE_METHOD(int, get_status,
145 (MYSQL_THD opaque_thd, Page_Track_SE se_type,
146 uint64_t *initial_start_id, uint64_t *last_start_id));
147};
148
149#endif /* MYSQL_PAGE_TRACK_H */
#define MYSQL_THD
Definition: backup_page_tracker.h:37
An implementation of page tracking service.
Definition: mysql_page_track_imp.h:25
static int get_status(THD *opaque_thd, Page_Track_SE se_type, uint64_t *initial_start_id, uint64_t *last_start_id) noexcept
API to check if page tracking is active or not and to return start id if it's active.
Definition: page_track_service.cc:147
static int get_page_ids(THD *opaque_thd, Page_Track_SE se_type, uint64_t *start_id, uint64_t *stop_id, unsigned char *buffer, size_t buffer_len, Page_Track_Callback cbk_func, void *cbk_ctx) noexcept
Service API to get tracked pages.
Definition: page_track_service.cc:102
static int purge(THD *opaque_thd, Page_Track_SE se_type, uint64_t *purge_id) noexcept
Service API to purge page tracking data.
Definition: page_track_service.cc:79
static int stop(THD *opaque_thd, Page_Track_SE se_type, uint64_t *stop_id) noexcept
Service API to stop page tracking.
Definition: page_track_service.cc:57
static int start(THD *opaque_thd, Page_Track_SE se_type, uint64_t *start_id) noexcept
Service API to start page tracking.
Definition: page_track_service.cc:35
static int get_num_page_ids(THD *opaque_thd, Page_Track_SE se_type, uint64_t *start_id, uint64_t *stop_id, uint64_t *num_pages) noexcept
Service API to get approximate number of pages tracked in the given range.
Definition: page_track_service.cc:125
Specifies macros to define Components.
mutable_buffer buffer(void *p, size_t n) noexcept
Definition: buffer.h:391
int(* Page_Track_Callback)(MYSQL_THD thd, const unsigned char *buffer, size_t buf_len, int num_pages, void *user_ctx)
Page tracking callback function.
Definition: page_track_service.h:58
Page_Track_SE
SE for the page tracking.
Definition: page_track_service.h:43
#define DEFINE_METHOD(retval, name, args)
A macro to ensure method implementation has required properties, that is it does not throw exceptions...
Definition: service_implementation.h:78