MySQL 8.3.0
Source Code Documentation
column_filter_factory.h
Go to the documentation of this file.
1/* Copyright (c) 2022, 2023, Oracle and/or its affiliates.
2
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License, version 2.0,
5 as published by the Free Software Foundation.
6
7 This program is also distributed with certain software (including
8 but not limited to OpenSSL) that is licensed under separate terms,
9 as designated in a particular file or component or in included license
10 documentation. The authors of MySQL hereby grant you an additional
11 permission to link the program and your derivative works with the
12 separately licensed software that they have included with MySQL.
13
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License, version 2.0, for more details.
18
19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to the Free Software
21 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
22
23#ifndef CS_COLUMN_FILTER_FACTORY_H
24#define CS_COLUMN_FILTER_FACTORY_H
25
29
30namespace cs {
31namespace util {
32/**
33 @class ColumnFilterFactory
34
35 This class allows the developer to create a filter instance given a type
36 */
38 public:
39 /**
40 @brief The different types of filters for column iteration
41 */
42 enum class ColumnFilterType {
43 outbound_func_index, // filter functional indexes when outputting an event
44 inbound_func_index, // filter functional indexes when receiving an event
45 inbound_gipk // Filter GIPK when only present on the replica
46 };
47
48 /**
49 @brief Create a filter object
50
51 @param filter_type the filter to be created
52 @return a unique pointer to a sub class of ColumnFilter
53 */
54 static std::unique_ptr<ColumnFilter> create_filter(
55 ColumnFilterType filter_type) {
56 switch (filter_type) {
58 return std::make_unique<
61 return std::make_unique<ColumnFilterInboundFunctionalIndexes>();
63 return std::make_unique<ColumnFilterInboundGipk>();
64 default:
65 /* This shall never happen. */
66 assert(0); /* purecov: inspected */
67 break;
68 }
69 return nullptr;
70 }
71
72 /**
73 @brief Returns if a filter is needed given the parameters
74
75 @param thd The thread being used in this context
76 @param table The table being filtered
77 @param tabledef The replicated table context if applicable
78 @param filter_type The filter type being tested
79 @return true if the filter should be used
80 @return false if the filter is not needed
81 */
82 static bool is_filter_needed(THD const &thd, TABLE *table,
83 table_def const *tabledef,
84 ColumnFilterType filter_type) {
85 switch (filter_type) {
88 thd, table, tabledef);
91 thd, table, tabledef);
94 default:
95 /* This shall never happen. */
96 assert(0); /* purecov: inspected */
97 break;
98 }
99 return false;
100 }
101};
102} // namespace util
103} // namespace cs
104#endif // CS_COLUMN_FILTER_FACTORY_H
For each client connection we create a separate thread with THD serving as a thread/connection descri...
Definition: sql_lexer_thd.h:35
This class allows the developer to create a filter instance given a type.
Definition: column_filter_factory.h:37
ColumnFilterType
The different types of filters for column iteration.
Definition: column_filter_factory.h:42
static bool is_filter_needed(THD const &thd, TABLE *table, table_def const *tabledef, ColumnFilterType filter_type)
Returns if a filter is needed given the parameters.
Definition: column_filter_factory.h:82
static std::unique_ptr< ColumnFilter > create_filter(ColumnFilterType filter_type)
Create a filter object.
Definition: column_filter_factory.h:54
static bool is_filter_needed(THD const &thd, TABLE *table, table_def const *tabledef)
Is this filter needed given context passed in the parameters.
Definition: column_filter_inbound_func_indexes.cc:33
static bool is_filter_needed(THD const &thd, TABLE *table, table_def const *tabledef)
Is this filter needed given context passed in the parameters.
Definition: column_filter_inbound_gipk.cc:31
Definition: column_filter_outbound_func_indexes.h:58
static bool is_filter_needed(THD const &thd, TABLE *table, table_def const *tabledef)
Is this filter needed given context passed in the parameters.
Definition: column_filter_outbound_func_indexes.cc:33
A table definition from the master.
Definition: rpl_utility.h:247
static PFS_engine_table_share_proxy table
Definition: pfs.cc:60
Definition: commit_order_queue.h:33
Unique_ptr< T, std::nullptr_t > make_unique(size_t size)
In-place constructs a new unique pointer with no specific allocator and with array type T.
Definition: table.h:1403