MySQL 8.4.0
Source Code Documentation
ut0stage.h
Go to the documentation of this file.
1/*****************************************************************************
2
3Copyright (c) 2014, 2024, Oracle and/or its affiliates.
4
5This program is free software; you can redistribute it and/or modify it under
6the terms of the GNU General Public License, version 2.0, as published by the
7Free Software Foundation.
8
9This program is designed to work with certain software (including
10but not limited to OpenSSL) that is licensed under separate terms,
11as designated in a particular file or component or in included license
12documentation. The authors of MySQL hereby grant you an additional
13permission to link the program and your derivative works with the
14separately licensed software that they have either included with
15the program or referenced in the documentation.
16
17This program is distributed in the hope that it will be useful, but WITHOUT
18ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
19FOR A PARTICULAR PURPOSE. See the GNU General Public License, version 2.0,
20for more details.
21
22You should have received a copy of the GNU General Public License along with
23this program; if not, write to the Free Software Foundation, Inc.,
2451 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25
26*****************************************************************************/
27
28/** @file include/ut0stage.h
29 Supplementary code to performance schema stage instrumentation.
30
31 Created Nov 12, 2014 Vasil Dimov
32 *******************************************************/
33
34#ifndef ut0stage_h
35#define ut0stage_h
36
37#include <math.h>
38#include <algorithm>
39
40#include "dict0mem.h" /* dict_index_t */
41#include "mysql/psi/mysql_stage.h" /* mysql_stage_inc_work_completed */
42#include "row0log.h" /* row_log_estimate_work() */
43#include "srv0srv.h" /* Alter_stage */
44
45// Forward declaration.
46class Alter_stage;
47using Alter_stages = std::vector<Alter_stage *, ut::allocator<Alter_stage *>>;
48
49#ifdef HAVE_PSI_STAGE_INTERFACE
50
51/** Class used to report ALTER TABLE progress via performance_schema.
52The only user of this class is the ALTER TABLE code and it calls the methods
53in the following order
54constructor
55begin_phase_read_pk()
56 multiple times:
57 n_pk_recs_inc() // once per record read
58 inc() // once per page read
59end_phase_read_pk()
60if any new indexes are being added, for each one:
61 begin_phase_sort()
62 multiple times:
63 inc() // once per record sorted
64 begin_phase_insert()
65 multiple times:
66 inc() // once per record inserted
67 being_phase_log_index()
68 multiple times:
69 inc() // once per log-block applied
70begin_phase_flush()
71 multiple times:
72 inc() // once per page flushed
73begin_phase_log_table()
74 multiple times:
75 inc() // once per log-block applied
76begin_phase_end()
77destructor
78
79This class knows the specifics of each phase and tries to increment the
80progress in an even manner across the entire ALTER TABLE lifetime. */
82 public:
83 /** Constructor.
84 @param[in] pk primary key of the old table */
85 explicit Alter_stage(const dict_index_t *pk) noexcept
86 : m_pk(pk), m_cur_phase(NOT_STARTED) {}
87
88 /** Copy constructor. "Inherits" the current state of rhs.
89 @param[in] rhs Instance to copy current state from. */
90 explicit Alter_stage(const Alter_stage &rhs) noexcept;
91
92 /** Destructor. */
94
95 /** Flag an ALTER TABLE start (read primary key phase).
96 @param[in] n_sort_indexes number of indexes that will be sorted
97 during ALTER TABLE, used for estimating the total work to be done */
98 void begin_phase_read_pk(size_t n_sort_indexes);
99
100 /** Increment the number of records in PK (table) with 1.
101 This is used to get more accurate estimate about the number of
102 records per page which is needed because some phases work on
103 per-page basis while some work on per-record basis and we want
104 to get the progress as even as possible. */
105 void n_pk_recs_inc();
106
107 /** See simple increment version above.
108 @param[in] n Number fo records read so far. */
109 void n_pk_recs_inc(uint64_t n);
110
111 /** Flag either one record or one page processed, depending on the
112 current phase.
113 @param[in] inc_val flag this many units processed at once */
114 void inc(uint64_t inc_val);
115
116 /** Flag the end of reading of the primary key.
117 Here we know the exact number of pages and records and calculate
118 the number of records per page and refresh the estimate. */
119 void end_phase_read_pk();
120
121 /** Flag the beginning of the sort phase.
122 @param[in] sort_multi_factor since merge sort processes
123 one page more than once we only update the estimate once per this
124 many pages processed. */
125 void begin_phase_sort(double sort_multi_factor);
126
127 /** Flag the beginning of the insert phase. */
128 void begin_phase_insert();
129
130 /** Flag the beginning of the flush phase.
131 @param[in] n_flush_pages this many pages are going to be
132 flushed */
133 void begin_phase_flush(page_no_t n_flush_pages);
134
135 /** Flag the beginning of the log index phase. */
137
138 /** Flag the beginning of the log table phase. */
140
141 /** Flag the beginning of the end phase. */
142 void begin_phase_end();
143
144 /** Aggregate the results of the build from the sub builds.
145 @param[in] alter_stages Sub stages to aggregate. */
146 void aggregate(const Alter_stages &alter_stages) noexcept;
147
148 private:
149 /** Update the estimate of total work to be done. */
150 void reestimate();
151
152 /** Change the current phase.
153 @param[in] new_stage pointer to the new stage to change to */
154 void change_phase(const PSI_stage_info *new_stage);
155
156 private:
157 using Counter = std::pair<uint64_t, uint64_t>;
158 using Progress = std::pair<PSI_stage_progress *, Counter>;
159 using Stage = std::pair<const PSI_stage_info *, Progress>;
160 using Stages = std::vector<Stage, ut::allocator<Stage>>;
161
162 /** Progress counters for the various stages. */
164
165 /** Collection of previous stages. */
167
168 /** Old table PK. Used for calculating the estimate. */
170
171 /** Number of records in the primary key (table), including delete
172 marked records. */
173 std::atomic<uint64_t> m_n_pk_recs{};
174
175 /** Number of leaf pages in the primary key. */
177
178 /** Estimated number of records per page in the primary key. */
180
181 /** Number of indexes that are being added. */
183
184 /** During the sort phase, increment the counter once per this
185 many pages processed. This is because sort processes one page more
186 than once. */
188
189 /** Number of records processed during sort & insert phases. We
190 need to increment the counter only once page, or once per
191 recs-per-page records. */
192 uint64_t m_n_inserted{};
193
194 /** Number of pages to flush. */
196
197 /** Current phase. */
198 enum {
199 /** Init phase. */
201
202 /** Scan phase. */
204
205 /** Sort phase. */
206 SORT = 2,
207
208 /** Bulk load/insert phase. */
210
211 /** Flush non-redo logged pages phase. */
212 FLUSH = 4,
213
214 /** Apply entries from the row log to the index after creation. */
216
217 /** Apply entries from the row log to the table after the build. */
219
220 /** End/Stop. */
221 END = 7,
222 } m_cur_phase{NOT_STARTED};
223};
224
225inline Alter_stage::Alter_stage(const Alter_stage &rhs) noexcept
226 : m_pk(rhs.m_pk), m_cur_phase(NOT_STARTED) {}
227
229 auto progress = m_stage.second.first;
230
231 if (progress == nullptr) {
232 return;
233 }
234
235 /* Set completed = estimated before we quit. */
238
240}
241
242inline void Alter_stage::n_pk_recs_inc(uint64_t n) {
243 m_n_pk_recs.fetch_add(n, std::memory_order_relaxed);
244}
245
247
248inline void Alter_stage::inc(uint64_t inc_val) {
249 if (m_stages.empty()) {
250 return;
251 }
252
253 uint64_t multi_factor{1};
254 bool should_proceed{true};
255
256 switch (m_cur_phase) {
257 case NOT_STARTED:
258 ut_error;
259 case READ_PK:
260 ++m_n_pk_pages;
261 ut_ad(inc_val == 1);
262 /* Overall the read pk phase will read all the pages from the
263 PK and will do work, proportional to the number of added
264 indexes, thus when this is called once per read page we
265 increment with 1 + m_n_sort_indexes */
266 inc_val = 1 + m_n_sort_indexes;
267 break;
268 case SORT:
269 multi_factor = m_sort_multi_factor;
270 [[fallthrough]];
271 case INSERT: {
272 /* Increment the progress every nth record. During
273 sort and insert phases, this method is called once per
274 record processed. We need fractional point numbers here
275 because "records per page" is such a number naturally and
276 to avoid rounding skew we want, for example: if there are
277 (double) N records per page, then the work_completed
278 should be incremented on the inc() calls round(k*N),
279 for k=1,2,3... */
280 const double every_nth = m_n_recs_per_page * multi_factor;
281 const uint64_t k = static_cast<uint64_t>(round(m_n_inserted / every_nth));
282 const uint64_t nth = static_cast<uint64_t>(round(k * every_nth));
283
284 should_proceed = m_n_inserted == nth;
285
286 ++m_n_inserted;
287 break;
288 }
289 case FLUSH:
290 case LOG_INDEX:
291 case LOG_TABLE:
292 case END:
293 break;
294 }
295
296 if (should_proceed) {
297 auto progress = m_stages.back().second.first;
298 mysql_stage_inc_work_completed(progress, inc_val);
299 reestimate();
300 }
301}
302
303inline void Alter_stage::begin_phase_read_pk(size_t n_sort_indexes) {
304 m_cur_phase = READ_PK;
305
306 m_n_sort_indexes = n_sort_indexes;
307
308 Stage stage{};
309
311 stage.second.first = mysql_set_stage(stage.first->m_key);
312
313 if (stage.second.first != nullptr) {
314 m_stages.push_back(stage);
315
316 auto progress = stage.second.first;
318
319 reestimate();
320 }
321}
322
324 reestimate();
325
326 if (m_n_pk_pages == 0) {
327 /* The number of pages in the PK could be 0 if the tree is
328 empty. In this case we set m_n_recs_per_page to 1 to avoid
329 division by zero later. */
330 m_n_recs_per_page = 1.0;
331 } else {
332 m_n_recs_per_page = std::max(
333 static_cast<double>(m_n_pk_recs.load(std::memory_order_relaxed)) /
335 1.0);
336 }
337}
338
339inline void Alter_stage::begin_phase_sort(double sort_multi_factor) {
340 if (sort_multi_factor <= 1.0) {
342 } else {
343 m_sort_multi_factor = static_cast<uint64_t>(round(sort_multi_factor));
344 }
345
347}
348
351}
352
353inline void Alter_stage::begin_phase_flush(page_no_t n_flush_pages) {
354 m_n_flush_pages = n_flush_pages;
355
356 reestimate();
357
359}
360
363}
364
367}
368
371}
372
374 if (m_stages.empty()) {
375 return;
376 }
377
378 /* During the log table phase we calculate the estimate as
379 work done so far + log size remaining. */
380 if (m_cur_phase == LOG_TABLE) {
381 auto progress = m_stages.back().second.first;
382
384 progress,
386
387 return;
388 }
389
390 /* During the other phases we use a formula, regardless of
391 how much work has been done so far. */
392
393 /* For number of pages in the PK - if the PK has not been
394 read yet, use stat_n_leaf_pages (approximate), otherwise
395 use the exact number we gathered. */
396 const page_no_t n_pk_pages =
397 m_cur_phase != READ_PK ? m_n_pk_pages : m_pk->stat_n_leaf_pages;
398
399 /* If flush phase has not started yet and we do not know how
400 many pages are to be flushed, then use a wild guess - the
401 number of pages in the PK / 2. */
402 if (m_n_flush_pages == 0) {
403 m_n_flush_pages = n_pk_pages / 2;
404 }
405
406 uint64_t estimate =
407 n_pk_pages *
408 (1 /* read PK */
409 + m_n_sort_indexes /* row_merge_buf_sort() inside the
410 read PK per created index */
411 + m_n_sort_indexes * 2 /* sort & insert per created index */) +
413
414 auto progress = m_stages.back().second.first;
415 const auto completed = (uint64_t)mysql_stage_get_work_completed(progress);
416
417 /* Prevent estimate < completed */
418 mysql_stage_set_work_estimated(progress, std::max(estimate, completed));
419}
420
421inline void Alter_stage::change_phase(const PSI_stage_info *new_stage) {
422 if (m_stages.empty()) {
423 return;
424 }
425
427
428 if (new_stage == &srv_stage_alter_table_merge_sort) {
429 m_cur_phase = SORT;
430 } else if (new_stage == &srv_stage_alter_table_insert) {
431 m_cur_phase = INSERT;
432 } else if (new_stage == &srv_stage_alter_table_flush) {
433 m_cur_phase = FLUSH;
434 } else if (new_stage == &srv_stage_alter_table_log_index) {
435 m_cur_phase = LOG_INDEX;
436 } else if (new_stage == &srv_stage_alter_table_log_table) {
437 m_cur_phase = LOG_TABLE;
438 } else if (new_stage == &srv_stage_alter_table_end) {
439 m_cur_phase = END;
440 } else {
441 ut_error;
442 }
443
444 auto progress = m_stages.back().second.first;
445
446 const auto c = mysql_stage_get_work_completed(progress);
447 const auto e = mysql_stage_get_work_estimated(progress);
448
449 Stage stage{new_stage, {mysql_set_stage(new_stage->m_key), {}}};
450
451 if (stage.second.first != nullptr) {
452 m_stages.push_back(stage);
453
454 auto &counter = m_stages.back().second.second;
455
456 counter.first = c;
457 counter.second = e;
458
459 mysql_stage_set_work_completed(stage.second.first, c);
460 mysql_stage_set_work_estimated(stage.second.first, e);
461 }
462}
463
464inline void Alter_stage::aggregate(const Alter_stages &alter_stages) noexcept {
465 if (alter_stages.empty()) {
466 return;
467 }
468
469 ut_a(m_cur_phase == NOT_STARTED);
470
471 Stage cur_stage{};
472
473 for (auto alter_stage : alter_stages) {
474 alter_stage->begin_phase_end();
475
476 for (auto stage : alter_stage->m_stages) {
477 if (stage.first == &srv_stage_alter_table_end) {
478 continue;
479 }
480 auto progress = mysql_set_stage(stage.first->m_key);
481
482 if (progress == nullptr) {
483 /* The user can disable the instrument clas and that can return
484 nullptr. That forces us to skip and will break the state transitions
485 and counts.*/
486 return;
487 }
488
489 auto c = mysql_stage_get_work_completed(progress);
490 auto e = mysql_stage_get_work_estimated(progress);
491
492 const auto &counter = stage.second.second;
493
494 c += counter.first;
495 e += counter.second;
496
499
501 if ((int)m_cur_phase < (int)READ_PK) {
502 m_cur_phase = READ_PK;
503 cur_stage.first = stage.first;
504 cur_stage.second.first = progress;
505 }
506 } else if (stage.first == &srv_stage_alter_table_merge_sort) {
507 if ((int)m_cur_phase < (int)NOT_STARTED) {
508 m_cur_phase = SORT;
509 cur_stage.first = stage.first;
510 cur_stage.second.first = progress;
511 }
512 } else if (stage.first == &srv_stage_alter_table_insert) {
513 if ((int)m_cur_phase < (int)SORT) {
514 m_cur_phase = INSERT;
515 cur_stage.first = stage.first;
516 cur_stage.second.first = progress;
517 }
518 } else if (stage.first == &srv_stage_alter_table_log_index) {
519 if ((int)m_cur_phase < (int)LOG_INDEX) {
520 m_cur_phase = LOG_INDEX;
521 cur_stage.first = stage.first;
522 cur_stage.second.first = progress;
523 }
524 }
525
526 ut_a(stage.first != &srv_stage_alter_table_flush);
527 ut_a(stage.first != &srv_stage_alter_table_log_table);
528 }
529 }
530
531 if (cur_stage.first != nullptr) {
532 ut_a(cur_stage.second.first != nullptr);
533 m_stages.push_back(cur_stage);
534 }
535}
536
537/** class to monitor the progress of 'ALTER TABLESPACE ENCRYPTION' in terms
538of number of pages operated upon. */
540 public:
541 /** Constructor. */
545 m_work_done(0),
547
548 /** Destructor. */
550 if (m_progress == nullptr) {
551 return;
552 }
554 }
555
556 /** Initialize.
557 @param[in] key PFS key. */
558 void init(int key) {
559 ut_ad(key != -1);
561
562 m_progress = nullptr;
564 m_work_done = 0;
565
567 /* Change phase to INITIATED */
568 change_phase();
569 }
570
571 /** Set estimate.
572 @param[in] units Units. */
573 void set_estimate(uint64_t units) {
574 if (m_progress == nullptr) {
575 return;
576 }
577
581 /* Change phase to WORK_ESTIMATED */
582 change_phase();
583 }
584
585 /** Update the progress.
586 @param[in] units Update delta. */
587 void update_work(uint64_t units) {
588 if (m_progress == nullptr) {
589 return;
590 }
591
593
597
599 /* Change phase to WORK_COMPLETED */
600 change_phase();
601 }
602 }
603
604 /** Change phase. */
606 if (m_progress == nullptr) {
608 return;
609 }
610
611 switch (m_cur_phase) {
612 case NOT_STARTED:
614 break;
615 case INITIATED:
617 break;
618 case WORK_ESTIMATED:
620 break;
621 case WORK_COMPLETED:
622 default:
623 ut_error;
624 }
625 }
626
628 if (m_progress == nullptr) {
629 return true;
630 } else {
631 return (m_cur_phase == WORK_COMPLETED);
632 }
633 }
634
635 private:
636 /** Performance schema accounting object. */
638
639 /** Number of pages to be (un)encrypted . */
641
642 /** Number of pages already (un)encrypted . */
644
645 /** Current phase. */
646 enum {
647 /** Not open phase. */
649
650 /** Initialised. */
652
653 /** Work estimated phase. */
655
656 /** Work completed phase. */
659};
660
661#else /* HAVE_PSI_STAGE_INTERFACE */
662
663/** Dummy alter stage. */
664class Alter_stage {
665 public:
666 /** Constructor. */
667 explicit Alter_stage(const dict_index_t *pk) {}
668
669 /** Setup the number of indexes to read.
670 @param[in] n_sort_indexes Number of indexe.s */
671 void begin_phase_read_pk(size_t n_sort_indexes) {}
672
673 /** Increments the number of rows read so far. */
674 void n_pk_recs_inc() {}
675
676 /** Increments the number of rows read so far. */
677 void n_pk_recs_inc(uint64_t) {}
678
679 /** Increment depending on stage. */
680 void inc(uint64_t inc_val = 1) {}
681
682 /** End scan phase. */
683 void end_phase_read_pk() {}
684
685 /** Begin merge sort phase. */
686 void begin_phase_sort(double sort_multi_factor) {}
687
688 /** Begin insert phase. */
689 void begin_phase_insert() {}
690
691 /** Begin flushing of non-redo logged pages.
692 @param[in] n_flush_pages Number of pages to flush. */
693 void begin_phase_flush(page_no_t n_flush_pages) {}
694
695 /** Begin row log apply phase to the index. */
696 void begin_phase_log_index() {}
697
698 /** Begin row log apply phase to the table. */
699 void begin_phase_log_table() {}
700
701 /** Build end phase. */
702 void begin_phase_end() {}
703
704 /** Aggregate the sub stages..
705 @param[in] stages Stages to aggregate. */
706 void aggregate(const Alter_stages &alter_stages) noexcept {}
707};
708
709class Alter_stage_ts {
710 public:
711 /** Constructor. */
712 Alter_stage_ts() {}
713
714 /** Destructor. */
715 inline ~Alter_stage_ts() {}
716
717 /** Initialize.
718 @param[in] key PFS key. */
719 void init(int key) {}
720
721 /** Set estimate.
722 @param[in] units Units. */
723 void set_estimate(uint units) {}
724
725 /** Update the progress.
726 @param[in] units Update delta. */
727 void update_work(uint units) {}
728
729 /** Change phase. */
730 void change_phase() {}
731};
732#endif /* HAVE_PSI_STAGE_INTERFACE */
733
734#endif /* ut0stage_h */
uint32_t page_no_t
Page number.
Definition: api0api.h:45
Kerberos Client Authentication nullptr
Definition: auth_kerberos_client_plugin.cc:251
class to monitor the progress of 'ALTER TABLESPACE ENCRYPTION' in terms of number of pages operated u...
Definition: ut0stage.h:539
void set_estimate(uint64_t units)
Set estimate.
Definition: ut0stage.h:573
page_no_t m_work_done
Number of pages already (un)encrypted .
Definition: ut0stage.h:643
enum Alter_stage_ts::@205 m_cur_phase
Current phase.
void change_phase()
Change phase.
Definition: ut0stage.h:605
void update_work(uint64_t units)
Update the progress.
Definition: ut0stage.h:587
Alter_stage_ts()
Constructor.
Definition: ut0stage.h:542
void init(int key)
Initialize.
Definition: ut0stage.h:558
PSI_stage_progress * m_progress
Performance schema accounting object.
Definition: ut0stage.h:637
page_no_t m_work_estimated
Number of pages to be (un)encrypted .
Definition: ut0stage.h:640
@ INITIATED
Initialised.
Definition: ut0stage.h:651
@ WORK_ESTIMATED
Work estimated phase.
Definition: ut0stage.h:654
@ WORK_COMPLETED
Work completed phase.
Definition: ut0stage.h:657
@ NOT_STARTED
Not open phase.
Definition: ut0stage.h:648
~Alter_stage_ts()
Destructor.
Definition: ut0stage.h:549
bool is_completed()
Definition: ut0stage.h:627
Class used to report ALTER TABLE progress via performance_schema.
Definition: ut0stage.h:81
void change_phase(const PSI_stage_info *new_stage)
Change the current phase.
Definition: ut0stage.h:421
page_no_t m_n_flush_pages
Number of pages to flush.
Definition: ut0stage.h:195
void begin_phase_end()
Flag the beginning of the end phase.
Definition: ut0stage.h:369
void begin_phase_sort(double sort_multi_factor)
Flag the beginning of the sort phase.
Definition: ut0stage.h:339
void n_pk_recs_inc()
Increment the number of records in PK (table) with 1.
Definition: ut0stage.h:246
void begin_phase_read_pk(size_t n_sort_indexes)
Flag an ALTER TABLE start (read primary key phase).
Definition: ut0stage.h:303
enum Alter_stage::@204 NOT_STARTED
Current phase.
uint64_t m_n_inserted
Number of records processed during sort & insert phases.
Definition: ut0stage.h:192
std::pair< PSI_stage_progress *, Counter > Progress
Definition: ut0stage.h:158
size_t m_n_sort_indexes
Number of indexes that are being added.
Definition: ut0stage.h:182
double m_n_recs_per_page
Estimated number of records per page in the primary key.
Definition: ut0stage.h:179
void begin_phase_flush(page_no_t n_flush_pages)
Flag the beginning of the flush phase.
Definition: ut0stage.h:353
void aggregate(const Alter_stages &alter_stages) noexcept
Aggregate the results of the build from the sub builds.
Definition: ut0stage.h:464
Stages m_stages
Collection of previous stages.
Definition: ut0stage.h:166
void reestimate()
Update the estimate of total work to be done.
Definition: ut0stage.h:373
uint64_t m_sort_multi_factor
During the sort phase, increment the counter once per this many pages processed.
Definition: ut0stage.h:187
const dict_index_t * m_pk
Old table PK.
Definition: ut0stage.h:169
void end_phase_read_pk()
Flag the end of reading of the primary key.
Definition: ut0stage.h:323
void begin_phase_log_table()
Flag the beginning of the log table phase.
Definition: ut0stage.h:365
page_no_t m_n_pk_pages
Number of leaf pages in the primary key.
Definition: ut0stage.h:176
Stage m_stage
Progress counters for the various stages.
Definition: ut0stage.h:163
void begin_phase_insert()
Flag the beginning of the insert phase.
Definition: ut0stage.h:349
std::atomic< uint64_t > m_n_pk_recs
Number of records in the primary key (table), including delete marked records.
Definition: ut0stage.h:173
@ FLUSH
Flush non-redo logged pages phase.
Definition: ut0stage.h:212
@ END
End/Stop.
Definition: ut0stage.h:221
@ READ_PK
Scan phase.
Definition: ut0stage.h:203
@ LOG_TABLE
Apply entries from the row log to the table after the build.
Definition: ut0stage.h:218
@ SORT
Sort phase.
Definition: ut0stage.h:206
@ INSERT
Bulk load/insert phase.
Definition: ut0stage.h:209
@ LOG_INDEX
Apply entries from the row log to the index after creation.
Definition: ut0stage.h:215
void begin_phase_log_index()
Flag the beginning of the log index phase.
Definition: ut0stage.h:361
Alter_stage(const dict_index_t *pk) noexcept
Constructor.
Definition: ut0stage.h:85
std::vector< Stage, ut::allocator< Stage > > Stages
Definition: ut0stage.h:160
void inc(uint64_t inc_val)
Flag either one record or one page processed, depending on the current phase.
Definition: ut0stage.h:248
std::pair< const PSI_stage_info *, Progress > Stage
Definition: ut0stage.h:159
~Alter_stage()
Destructor.
Definition: ut0stage.h:228
Data dictionary memory object creation.
#define mysql_set_stage(K)
Set the current stage.
Definition: mysql_stage.h:80
#define mysql_stage_inc_work_completed(P1, P2)
Definition: mysql_stage.h:131
#define mysql_end_stage
End the last stage.
Definition: mysql_stage.h:86
#define mysql_stage_get_work_completed(P1)
Definition: mysql_stage.h:118
#define mysql_stage_set_work_completed(P1, P2)
Definition: mysql_stage.h:115
#define mysql_stage_get_work_estimated(P1)
Definition: mysql_stage.h:143
#define mysql_stage_set_work_estimated(P1, P2)
Definition: mysql_stage.h:140
Instrumentation helpers for stages.
uint counter
Definition: mysqlimport.cc:58
Sharded atomic counter.
Definition: ut0counter.h:221
collation_unordered_map< std::string, Unit > units()
A function to obtaint the supported units for the gis module.
Definition: st_units_of_measure.cc:29
required string key
Definition: replication_asynchronous_connection_failover.proto:60
Modification log for online index creation and online table rebuild.
ulint row_log_estimate_work(const dict_index_t *index)
Estimate how much work is to be done by the log apply phase of an ALTER TABLE for this index.
Definition: row0log.cc:2700
The server main program.
PSI_stage_info srv_stage_alter_table_log_table
Performance schema stage event for monitoring ALTER TABLE progress row_log_table_apply().
Definition: srv0srv.cc:828
PSI_stage_info srv_stage_alter_table_flush
Performance schema stage event for monitoring ALTER TABLE progress log_make_latest_checkpoint().
Definition: srv0srv.cc:813
PSI_stage_info srv_stage_alter_table_end
Performance schema stage event for monitoring ALTER TABLE progress everything after flush log_make_la...
Definition: srv0srv.cc:808
PSI_stage_info srv_stage_alter_table_read_pk_internal_sort
Performance schema stage event for monitoring ALTER TABLE progress row_merge_read_clustered_index().
Definition: srv0srv.cc:837
PSI_stage_info srv_stage_alter_table_insert
Performance schema stage event for monitoring ALTER TABLE progress row_merge_insert_index_tuples().
Definition: srv0srv.cc:817
PSI_stage_info srv_stage_alter_table_merge_sort
Performance schema stage event for monitoring ALTER TABLE progress row_merge_sort().
Definition: srv0srv.cc:833
PSI_stage_info srv_stage_alter_table_log_index
Performance schema stage event for monitoring ALTER TABLE progress row_log_apply().
Definition: srv0srv.cc:822
Stage instrument information.
Definition: psi_stage_bits.h:74
PSI_stage_key m_key
The registered stage key.
Definition: psi_stage_bits.h:76
Interface for an instrumented stage progress.
Definition: psi_stage_bits.h:63
Data structure for an index.
Definition: dict0mem.h:1046
ulint stat_n_leaf_pages
approximate number of leaf pages in the index tree
Definition: dict0mem.h:1211
#define ut_error
Abort execution.
Definition: ut0dbg.h:101
#define ut_ad(EXPR)
Debug assertion.
Definition: ut0dbg.h:105
#define ut_a(EXPR)
Abort execution if EXPR does not evaluate to nonzero.
Definition: ut0dbg.h:93
std::vector< Alter_stage *, ut::allocator< Alter_stage * > > Alter_stages
Definition: ut0stage.h:47
int n
Definition: xcom_base.cc:509