MySQL  8.0.18
Source Code Documentation
gcs_view_modification_notifier.h
Go to the documentation of this file.
1 /* Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
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 GCS_VIEW_MODIFICATION_NOTIFIER_INCLUDE
24 #define GCS_VIEW_MODIFICATION_NOTIFIER_INCLUDE
25 
28 
29 /*
30  @class Plugin_gcs_view_modification_notifier
31 
32  This class is used with the purpose of issuing a view changing event
33  and wait for its completion.
34  */
36  public:
39 
40  /**
41  Signals that a view modification is about to start
42  */
44 
45  /**
46  Checks if there is a view modification ongoing.
47 
48  @return
49  @retval true there is a view modification ongoing
50  @retval false otherwise
51  */
53 
54  /**
55  Signals that a view modification has ended
56  */
57  void end_view_modification();
58 
59  /**
60  Signals that a view modification has been cancelled
61 
62  @param[in] errnr error that did cause the view modification to
63  be cancelled
64  */
67 
68  /**
69  Check if view modification was cancelled.
70  This method must only be called after view modification is complete.
71 
72  @return
73  @retval true view modification was cancelled
74  @retval false otherwise
75  */
76  bool is_cancelled();
77 
78  /**
79  Method in which one waits for the view modification to end
80 
81  @param[in] timeout how long one wants to wait, in seconds
82 
83  @return Operation status
84  @retval false OK
85  @retval true error (timeout or view modification cancelled)
86  */
88 
89  /**
90  Get the error number that did happen on view modification.
91  This method must only be called after view modification is complete.
92 
93  @return Operation
94  @retval 0 OK (no error)
95  @retval >0 error number
96  */
97  int get_error();
98 
99  private:
102  int error;
103 
106 };
107 
108 #endif /* GCS_VIEW_MODIFICATION_NOTIFIER_INCLUDE */
#define VIEW_MODIFICATION_TIMEOUT
Definition: plugin_constants.h:47
Plugin_gcs_view_modification_notifier()
Definition: gcs_view_modification_notifier.cc:32
An instrumented cond structure.
Definition: mysql_cond_bits.h:49
int error
Definition: gcs_view_modification_notifier.h:102
mysql_mutex_t wait_for_view_mutex
Definition: gcs_view_modification_notifier.h:105
bool is_view_modification_ongoing()
Checks if there is a view modification ongoing.
Definition: gcs_view_modification_notifier.cc:53
virtual ~Plugin_gcs_view_modification_notifier()
Definition: gcs_view_modification_notifier.cc:40
mysql_cond_t wait_for_view_cond
Definition: gcs_view_modification_notifier.h:104
bool wait_for_view_modification(long timeout=VIEW_MODIFICATION_TIMEOUT)
Method in which one waits for the view modification to end.
Definition: gcs_view_modification_notifier.cc:82
bool cancelled_view_change
Definition: gcs_view_modification_notifier.h:101
void end_view_modification()
Signals that a view modification has ended.
Definition: gcs_view_modification_notifier.cc:60
void start_view_modification()
Signals that a view modification is about to start.
Definition: gcs_view_modification_notifier.cc:45
bool view_changing
Definition: gcs_view_modification_notifier.h:100
An instrumented mutex structure.
Definition: mysql_mutex_bits.h:49
void cancel_view_modification(int errnr=GROUP_REPLICATION_CONFIGURATION_ERROR)
Signals that a view modification has been cancelled.
Definition: gcs_view_modification_notifier.cc:67
Definition: gcs_view_modification_notifier.h:35
bool is_cancelled()
Check if view modification was cancelled.
Definition: gcs_view_modification_notifier.cc:77
#define GROUP_REPLICATION_CONFIGURATION_ERROR
Definition: plugin_constants.h:36
int get_error()
Get the error number that did happen on view modification.
Definition: gcs_view_modification_notifier.cc:113