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