MySQL 8.3.0
Source Code Documentation
mysql_crawler.h
Go to the documentation of this file.
1/*
2 Copyright (c) 2015, 2023, Oracle and/or its affiliates.
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, version 2.0,
6 as published by the Free Software Foundation.
7
8 This program is also distributed with certain software (including
9 but not limited to OpenSSL) that is licensed under separate terms,
10 as designated in a particular file or component or in included license
11 documentation. The authors of MySQL hereby grant you an additional
12 permission to link the program and your derivative works with the
13 separately licensed software that they have included with MySQL.
14
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License, version 2.0, for more details.
19
20 You should have received a copy of the GNU General Public License
21 along with this program; if not, write to the Free Software
22 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
23*/
24
25#ifndef MYSQL_CRAWLER_INCLUDED
26#define MYSQL_CRAWLER_INCLUDED
27
28#include <functional>
29
43#include "client/dump/table.h"
45#include "my_inttypes.h"
47
48namespace Mysql {
49namespace Tools {
50namespace Dump {
51
52/**
53 Searches DB objects using connection to MYSQL server.
54 */
57 public:
59 I_connection_provider *connection_provider,
60 std::function<bool(const Mysql::Tools::Base::Message_data &)>
61 *message_handler,
62 Simple_id_generator *object_id_generator,
66 /**
67 Enumerates all objects it can access, gets chains from all registered
68 chain_maker for each object and then execute each chain.
69 */
70 void enumerate_objects() override;
71
72 // Fix "inherits ... via dominance" warnings
74 I_progress_watcher *new_progress_watcher) override {
76 }
77
78 // Fix "inherits ... via dominance" warnings
79 uint64 get_id() const override { return Abstract_crawler::get_id(); }
80
81 protected:
82 // Fix "inherits ... via dominance" warnings
84 Item_processing_data *item_processed) override {
86 }
87
88 private:
90
91 void enumerate_tables(const Database &db);
92
94 Abstract_dump_task *dependency);
95
97 Abstract_dump_task *dependency);
98
99 void enumerate_views(const Database &db);
100
101 template <typename TObject>
102 void enumerate_functions(const Database &db, std::string type);
103
105
106 void enumerate_users();
107
109
110 /**
111 Rewrite statement, enclosing it with version specific comment and with
112 DEFINER clause enclosed in version-specific comment.
113
114 This function parses any CREATE statement and encloses DEFINER-clause in
115 version-specific comment:
116 input query: CREATE DEFINER=a@b FUNCTION ...
117 rewritten query: / *!50003 CREATE * / / *!50020 DEFINER=a@b * / / *!50003
118 FUNCTION ... * /
119 */
120 std::string get_version_specific_statement(std::string create_string,
121 const std::string &keyword,
122 std::string main_version,
123 std::string definer_version);
124
130};
131
132} // namespace Dump
133} // namespace Tools
134} // namespace Mysql
135
136#endif
Base class for all MySQL client tools.
Definition: abstract_program.h:46
Structure to represent message from server sent after executing query.
Definition: message_data.h:48
Definition: abstract_crawler.h:43
void item_completion_in_child_callback(Item_processing_data *item_processed) override
This callback can be requested to be called by child for any object processing.
Definition: abstract_crawler.h:76
uint64 get_id() const override
Returns an application unique ID of this chain element object.
Definition: abstract_crawler.h:57
void register_progress_watcher(I_progress_watcher *new_progress_watcher) override
Add new Progress Watcher to report to.
Definition: abstract_crawler.h:51
Base class for most individual dump process tasks, not suitable for lightweight dump tasks (e....
Definition: abstract_dump_task.h:43
Definition: abstract_mysql_chain_element_extension.h:49
Definition: database_end_dump_task.h:35
Definition: database_start_dump_task.h:34
Definition: database.h:35
Definition: dump_end_dump_task.h:34
Definition: dump_start_dump_task.h:34
Definition: i_connection_provider.h:37
Definition: i_progress_watcher.h:36
Data structure for objects that are processed in any chain.
Definition: item_processing_data.h:42
Definition: mysql_chain_element_options.h:36
Searches DB objects using connection to MYSQL server.
Definition: mysql_crawler.h:56
Database_start_dump_task * m_current_database_start_dump_task
Definition: mysql_crawler.h:127
void enumerate_database_objects(const Database &db)
Definition: mysql_crawler.cc:174
void enumerate_tables(const Database &db)
Definition: mysql_crawler.cc:201
void enumerate_views(const Database &db)
Definition: mysql_crawler.cc:323
void enumerate_table_triggers(const Table &table, Abstract_dump_task *dependency)
Definition: mysql_crawler.cc:515
Dump_end_dump_task * m_dump_end_task
Definition: mysql_crawler.h:126
void enumerate_column_statistics(const Table &table, Abstract_dump_task *dependency)
Definition: mysql_crawler.cc:556
std::string get_version_specific_statement(std::string create_string, const std::string &keyword, std::string main_version, std::string definer_version)
Rewrite statement, enclosing it with version specific comment and with DEFINER clause enclosed in ver...
Definition: mysql_crawler.cc:607
void enumerate_functions(const Database &db, std::string type)
Definition: mysql_crawler.cc:386
void register_progress_watcher(I_progress_watcher *new_progress_watcher) override
Add new Progress Watcher to report to.
Definition: mysql_crawler.h:73
void enumerate_users()
Definition: mysql_crawler.cc:461
Tables_definition_ready_dump_task * m_tables_definition_ready_dump_task
Definition: mysql_crawler.h:129
Mysqldump_tool_chain_maker_options * m_mysqldump_tool_cmaker_options
Definition: mysql_crawler.h:108
Database_end_dump_task * m_current_database_end_dump_task
Definition: mysql_crawler.h:128
void item_completion_in_child_callback(Item_processing_data *item_processed) override
This callback can be requested to be called by child for any object processing.
Definition: mysql_crawler.h:83
uint64 get_id() const override
Returns an application unique ID of this chain element object.
Definition: mysql_crawler.h:79
void enumerate_event_scheduler_events(const Database &db)
Definition: mysql_crawler.cc:420
void enumerate_objects() override
Enumerates all objects it can access, gets chains from all registered chain_maker for each object and...
Definition: mysql_crawler.cc:64
Mysql_crawler(I_connection_provider *connection_provider, std::function< bool(const Mysql::Tools::Base::Message_data &)> *message_handler, Simple_id_generator *object_id_generator, Mysql_chain_element_options *options, Mysqldump_tool_chain_maker_options *m_mysqldump_tool_cmaker_options, Mysql::Tools::Base::Abstract_program *program)
Definition: mysql_crawler.cc:51
Dump_start_dump_task * m_dump_start_task
Definition: mysql_crawler.h:125
Definition: mysqldump_tool_chain_maker_options.h:43
Definition: simple_id_generator.h:36
Definition: table.h:39
Represents task for additional work once all Table_definition_dump_task are processed.
Definition: tables_definition_ready_dump_task.h:38
Some integer typedefs for easier portability.
uint64_t uint64
Definition: my_inttypes.h:68
static char * create_string
Definition: mysqlslap.cc:200
Definition: abstract_connection_program.h:39
static PFS_engine_table_share_proxy table
Definition: pfs.cc:60
Definition: options.cc:56
required string type
Definition: replication_group_member_actions.proto:33