MySQL 8.0.42
Source Code Documentation
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
column_filter_outbound_func_indexes.h
Go to the documentation of this file.
1/* Copyright (c) 2022, 2025, 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 designed to work 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 either included with
13 the program or referenced in the documentation.
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#ifndef CS_COLUMN_FILTER_OUTBOUND_FUNC_INDEX_H
25#define CS_COLUMN_FILTER_OUTBOUND_FUNC_INDEX_H
26
28#include "sql/rpl_utility.h" // table_def
29
30namespace cs {
31namespace util {
32/**
33 @class Column_filter_outbound_func_indexes
34
35 One use case for filtering relates to hidden generated columns. These type
36 of columns are used to support functional indexes and are not meant to be
37 replicated nor included in the serialization/deserialization of binlog
38 events. Moreover, since hidden generated columns are always placed at the
39 end of the field set, replication would break for cases where replicas have
40 extra columns, if they were not excluded from replication:
41
42 SOURCE TABLE `t` REPLICA TABLE `t`
43 +----+----+----+------+------+ +----+----+----+-----+------+------+
44 | C1 | C2 | C3 | HGC1 | HGC2 | | C1 | C2 | C3 | EC1 | HGC1 | HGC2 |
45 +----+----+----+------+------+ +----+----+----+-----+------+------+
46
47 In the above example, the extra column `EC1` in the replica will be paired
48 with the hidden generated column `HGC1` of the source, if hidden generated
49 columns were to be replicated. With filtering enabled for hidden generated
50 columns, applier will observe the columns as follows:
51
52 SOURCE TABLE `t` REPLICA TABLE `t`
53 +----+----+----+ +----+----+----+-----+
54 | C1 | C2 | C3 | | C1 | C2 | C3 | EC1 |
55 +----+----+----+ +----+----+----+-----+
56
57 Outbound states we are encoding something to be transmitted.
58 */
60 bool filter_column(TABLE const *table, size_t column_index) override;
61 /**
62 @brief Is this filter needed given context passed in the parameters
63
64 @param thd the thread objected associated to filter
65 @param table the table where the columns are being iterated
66 @param tabledef the source table definition if applicable
67 @return true if the filter should be used
68 @return false if the filter is not needed
69 */
70 public:
71 static bool is_filter_needed(THD const &thd, TABLE *table,
72 table_def const *tabledef);
73};
74} // namespace util
75} // namespace cs
76#endif // CS_COLUMN_FILTER_OUTBOUND_FUNC_INDEX_H
For each client connection we create a separate thread with THD serving as a thread/connection descri...
Definition: sql_lexer_thd.h:34
Definition: column_filter_outbound_func_indexes.h:59
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:34
bool filter_column(TABLE const *table, size_t column_index) override
Definition: column_filter_outbound_func_indexes.cc:26
When iterating the table fields for sometimes you want to skip some columns.
Definition: column_filter.h:45
A table definition from the master.
Definition: rpl_utility.h:248
Definition: commit_order_queue.h:34
Definition: table.h:1400