MySQL 8.4.0
Source Code Documentation
column_filter_inbound_func_indexes.h
Go to the documentation of this file.
1/* Copyright (c) 2022, 2024, 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_INBOUND_FUNC_INDEX_H
25#define CS_COLUMN_FILTER_INBOUND_FUNC_INDEX_H
26
28#include "sql/rpl_utility.h" // table_def
29
30namespace cs {
31namespace util {
32/**
33 @class ColumnFilterInboundFunctionalIndexes
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 Inbound states we are receiving something from the source and filtering
58 that data.
59 */
61 bool filter_column(TABLE const *table, size_t column_index) override;
62 /**
63 @brief Is this filter needed given context passed in the parameters
64
65 @param thd the thread objected associated to filter
66 @param table the table where the columns are being iterated
67 @param tabledef the source table definition if applicable
68 @return true if the filter should be used
69 @return false if the filter is not needed
70 */
71 public:
72 static bool is_filter_needed(THD const &thd, TABLE *table,
73 table_def const *tabledef);
74};
75} // namespace util
76} // namespace cs
77#endif // CS_COLUMN_FILTER_INBOUND_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:36
One use case for filtering relates to hidden generated columns.
Definition: column_filter_inbound_func_indexes.h:60
bool filter_column(TABLE const *table, size_t column_index) override
Definition: column_filter_inbound_func_indexes.cc:26
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:34
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
static PFS_engine_table_share_proxy table
Definition: pfs.cc:61
Definition: commit_order_queue.h:34
Definition: table.h:1405