MySQL 9.3.0
Source Code Documentation
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages Concepts
member_info.h
Go to the documentation of this file.
1/* Copyright (c) 2014, 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 MEMBER_INFO_INCLUDE
25#define MEMBER_INFO_INCLUDE
26
27/*
28 The file contains declarations relevant to Member state and
29 its identification by the Protocol Client.
30*/
31
32/*
33 Since this file is used on unit tests includes must set here and
34 not through plugin_server_include.h.
35*/
36
37#include <list>
38#include <map>
39#include <set>
40#include <sstream>
41#include <string>
42#include <vector>
43
44#include "my_inttypes.h"
45#include "my_sys.h"
54
55/*
56 Encoding of the group_replication_enforce_update_everywhere_checks
57 config value in the member info structure.
58*/
59#define CNF_ENFORCE_UPDATE_EVERYWHERE_CHECKS_F 0x1
60
61/*
62 Encoding of the group_replication_single_primary_mode config value
63 in the member info structure.
64*/
65#define CNF_SINGLE_PRIMARY_MODE_F 0x2
66
67/*
68 Valid values of lower_case_table_names are 0 - 2.
69 So when member has DEFAULT_NOT_RECEIVED value, it means its
70 lower_case_table_names value is not known.
71*/
72#define DEFAULT_NOT_RECEIVED_LOWER_CASE_TABLE_NAMES 65540
73#ifndef NDEBUG
74#define SKIP_ENCODING_LOWER_CASE_TABLE_NAMES 65541
75#endif
76
77/*
78 @class Group_member_info
79
80 Describes all the properties of a group member
81*/
83 public:
85 // This type should not be used anywhere.
87
88 // Length of the payload item: variable
90
91 // Length of the payload item: 2 bytes
93
94 // Length of the payload item: variable
96
97 // Length of the payload item: variable
99
100 // Length of the payload item: 1 byte
102
103 // Length of the payload item: 4 bytes
105
106 // Length of the payload item: 2 bytes
108
109 // Length of the payload item: variable
111
112 // Length of the payload item: variable
114
115 // Length of the payload item: 8 bytes
117
118 // length of the role item: 1 byte
120
121 // length of the configuration flags: 4 bytes
123
124 // length of the conflict detection enabled: 1 byte
126
127 // Length of the payload item: 2 bytes
129
130 // Length of the payload item: 2 bytes
132
133 // Length of the payload item: 1 bytes
135
136 // Length of the payload item: 1 bytes
138
139 // Length of the payload item: 1 bytes
141
142 // Length of the payload item: variable
144
145 // Length of the payload item: variable
147
148 // Length of the payload item: variable
150
151 // Length of the paylod item: 1 byte
153
154 // Length of the paylod item: variable
156
157 // Length of the paylod item: variable
159
160 // Length of the paylod item: 1 byte
162
163 // Length of the paylod item: 1 byte
165
166 // No valid type codes can appear after this one.
167 PIT_MAX = 27
168 };
169
170 /*
171 @enum Member_recovery_status
172
173 This enumeration describes all the states that a member can assume while in a
174 group.
175 */
176 typedef enum {
182 MEMBER_END // the end of the enum
184
185 /*
186 @enum Group_member_role
187
188 This enumeration describes all the roles a server can have.
189 */
190 typedef enum {
195
196 /*
197 Values of the old transaction_write_set_extraction sysvar.
198 This enum is only used on Group Replication plugin for
199 compatibility purposes.
200 */
205 };
206
207 /*
208 Allocate memory on the heap with instrumented memory allocation, so
209 that memory consumption can be tracked.
210
211 @param[in] size memory size to be allocated
212 @param[in] nothrow When the nothrow constant is passed as second parameter
213 to operator new, operator new returns a null-pointer on
214 failure instead of throwing a bad_alloc exception.
215
216 @return pointer to the allocated memory, or NULL if memory could not
217 be allocated.
218 */
219 void *operator new(size_t size, const std::nothrow_t &) noexcept {
220 /*
221 Call my_malloc() with the MY_WME flag to make sure that it will
222 write an error message if the memory could not be allocated.
223 */
225 }
226
227 /*
228 Deallocate memory on the heap with instrumented memory allocation, so
229 that memory consumption can be tracked.
230
231 @param[in] ptr pointer to the allocated memory
232 @param[in] nothrow When the nothrow constant is passed as second parameter
233 to operator new, operator new returns a null-pointer on
234 failure instead of throwing a bad_alloc exception.
235 */
236 void operator delete(void *ptr, const std::nothrow_t &) noexcept {
237 my_free(ptr);
238 }
239
240 /**
241 Allocate memory on the heap with instrumented memory allocation, so
242 that memory consumption can be tracked.
243
244 @param[in] size memory size to be allocated
245
246 @return pointer to the allocated memory, or NULL if memory could not
247 be allocated.
248 */
249 void *operator new(size_t size) noexcept {
250 /*
251 Call my_malloc() with the MY_WME flag to make sure that it will
252 write an error message if the memory could not be allocated.
253 */
255 }
256
257 /**
258 Deallocate memory on the heap with instrumented memory allocation, so
259 that memory consumption can be tracked.
260
261 @param[in] ptr pointer to the allocated memory
262 */
263 void operator delete(void *ptr) noexcept { my_free(ptr); }
264
265 /**
266 Group_member_info empty constructor
267
268 @param[in] psi_mutex_key_arg mutex key
269 */
270 Group_member_info(PSI_mutex_key psi_mutex_key_arg =
272
273 /**
274 Group_member_info constructor
275
276 @param[in] hostname_arg member hostname
277 @param[in] port_arg member port
278 @param[in] uuid_arg member uuid
279 @param[in] write_set_extraction_algorithm write set extraction
280 algorithm
281 @param[in] gcs_member_id_arg member GCS member
282 identifier
283 @param[in] status_arg member Recovery status
284 @param[in] member_version_arg member version
285 @param[in] gtid_assignment_block_size_arg member gtid assignment
286 block size
287 @param[in] role_arg member role within the
288 group
289 @param[in] in_single_primary_mode is member in single mode
290 @param[in] has_enforces_update_everywhere_checks has member enforce update
291 check
292 @param[in] member_weight_arg member_weight
293 @param[in] lower_case_table_names_arg lower case table names
294 @param[in] default_table_encryption_arg default_table_encryption
295 @param[in] recovery_endpoints_arg recovery endpoints
296 @param[in] view_change_uuid_arg view change uuid
297 advertised
298 @param[in] allow_single_leader flag indicating whether or
299 @param[in] preemptive_garbage_collection member's
300 group_replication_preemptive_garbage_collection value
301 not to use single-leader behavior
302 @param[in] component_primary_election_enabled member's has enabled
303 primary election component
304 @param[in] psi_mutex_key_arg mutex key
305 */
306 Group_member_info(const char *hostname_arg, uint port_arg,
307 const char *uuid_arg, int write_set_extraction_algorithm,
308 const std::string &gcs_member_id_arg,
310 Member_version &member_version_arg,
311 ulonglong gtid_assignment_block_size_arg,
313 bool in_single_primary_mode,
315 uint member_weight_arg, uint lower_case_table_names_arg,
316 bool default_table_encryption_arg,
317 const char *recovery_endpoints_arg,
318 const char *view_change_uuid_arg, bool allow_single_leader,
319 bool preemptive_garbage_collection,
320 bool component_primary_election_enabled,
321 PSI_mutex_key psi_mutex_key_arg =
323
324 /**
325 Copy constructor
326
327 @param other source of the copy
328 */
330
331 /**
332 * Group_member_info raw data constructor
333 *
334 * @param[in] data raw data
335 * @param[in] len raw data length
336 * @param[in] psi_mutex_key_arg mutex key
337 */
338 Group_member_info(const uchar *data, size_t len,
339 PSI_mutex_key psi_mutex_key_arg =
341
342 /**
343 Destructor
344 */
345 ~Group_member_info() override;
346
347 /**
348 Update Group_member_info.
349
350 @param[in] hostname_arg member hostname
351 @param[in] port_arg member port
352 @param[in] uuid_arg member uuid
353 @param[in] write_set_extraction_algorithm write set extraction
354 algorithm
355 @param[in] gcs_member_id_arg member GCS member
356 identifier
357 @param[in] status_arg member Recovery status
358 @param[in] member_version_arg member version
359 @param[in] gtid_assignment_block_size_arg member gtid assignment
360 block size
361 @param[in] role_arg member role within the
362 group
363 @param[in] in_single_primary_mode is member in single mode
364 @param[in] has_enforces_update_everywhere_checks has member enforce update
365 check
366 @param[in] member_weight_arg member_weight
367 @param[in] lower_case_table_names_arg lower case table names
368 @param[in] default_table_encryption_arg default table encryption
369 @param[in] recovery_endpoints_arg recovery endpoints
370 advertised
371 @param[in] view_change_uuid_arg view change uuid
372 @param[in] allow_single_leader flag indicating whether or
373 not to use single-leader behavior
374 @param[in] preemptive_garbage_collection member's
375 group_replication_preemptive_garbage_collection value
376 @param[in] component_primary_election_enabled member's has enabled
377 primary election component
378 */
379 void update(const char *hostname_arg, uint port_arg, const char *uuid_arg,
381 const std::string &gcs_member_id_arg,
383 Member_version &member_version_arg,
384 ulonglong gtid_assignment_block_size_arg,
386 bool in_single_primary_mode,
388 uint member_weight_arg, uint lower_case_table_names_arg,
389 bool default_table_encryption_arg,
390 const char *recovery_endpoints_arg,
391 const char *view_change_uuid_arg, bool allow_single_leader,
392 bool preemptive_garbage_collection,
393 bool component_primary_election_enabled);
394
395 /**
396 Update Group_member_info.
397
398 @param other source of the copy
399 */
400 void update(Group_member_info &other);
401
402 /**
403 @return the member hostname
404 */
405 std::string get_hostname();
406
407 /**
408 @return the member port
409 */
410 uint get_port();
411
412 /**
413 @return the member uuid
414 */
415 std::string get_uuid();
416
417 /**
418 @return the member identifier in the GCS layer
419 */
421
422 /**
423 @return the member recovery status
424 */
426
427 /**
428 @return the member role type code.
429 */
431
432 /**
433 @return the member role type code in string
434 */
435 const char *get_member_role_string();
436
437 /**
438 @return the member plugin version
439 */
441
442 /**
443 @return the member GTID_EXECUTED set
444 */
445 std::string get_gtid_executed();
446
447 /**
448 @return the member GTID_PURGED set
449 */
450 std::string get_gtid_purged();
451
452 /**
453 @return the member GTID_RETRIEVED set for the applier channel
454 */
455 std::string get_gtid_retrieved();
456
457 /**
458 @return the member algorithm for extracting write sets
459 */
461
462 /**
463 @return the member algorithm name for extracting write sets
464 */
466
467 /**
468 @return the member gtid assignment block size
469 */
471
472 /**
473 @return the member configuration flags
474 */
476
477 /**
478 Set the primary flag
479 @param in_primary_mode is the member in primary mode
480 */
482
483 /**
484 Set the enforces_update_everywhere_checks flag
485 @param enforce_everywhere_checks are the update everywhere checks active or
486 not
487 */
489 bool enforce_everywhere_checks);
490
491 /**
492 @return the global-variable lower case table names value
493 */
495
496 /**
497 @return the global-variable lower case table names value
498 */
500
501 /**
502 @return the member state of system variable
503 group_replication_single_primary_mode
504 */
505 bool in_primary_mode();
506
507 /**
508 @return the member state of system variable
509 group_replication_enforce_update_everywhere_checks
510 */
512
513 /**
514 Updates this object recovery status
515
516 @param[in] new_status the status to set
517 */
519
520 /**
521 Updates this object GTID sets
522
523 @param[in] executed_gtids the status to set
524 @param[in] purged_gtids the status to set
525 @param[in] retrieve_gtids the status to set
526 */
527 void update_gtid_sets(std::string &executed_gtids, std::string &purged_gtids,
528 std::string &retrieve_gtids);
529
530 /**
531 Updates this object member role.
532
533 @param[in] new_role the role to set.
534 */
535 void set_role(Group_member_role new_role);
536
537 /**
538 @return the member status as string.
539 */
541
542 /**
543 @return configuration flag as string
544 */
545 static const char *get_configuration_flag_string(
546 const uint32 configuation_flag);
547
548 /**
549 @return the member configuration flags as string
550 */
551 static std::string get_configuration_flags_string(
552 const uint32 configuation_flags);
553
554 /**
555 @return Compare two members using member version
556 */
559
560 /**
561 @return Compare two members using server uuid
562 */
565
566 /**
567 @return Compare two members using member weight
568 @note if the weight is same, the member is sorted in
569 lexicographical order using its uuid.
570 */
573
574 /**
575 Return true if member version is higher than other member version
576 */
578
579 /**
580 Return true if server uuid is lower than other member server uuid
581 */
583
584 /**
585 Return true if member weight is higher than other member weight
586 */
588
589 /**
590 Redefinition of operate ==, which operate upon the uuid
591 */
592 bool operator==(Group_member_info &other);
593
594 /**
595 Sets this member as unreachable.
596 */
597 void set_unreachable();
598
599 /**
600 Sets this member as reachable.
601 */
602 void set_reachable();
603
604 /**
605 Return true if this has been flagged as unreachable.
606 */
607 bool is_unreachable();
608
609 /**
610 Update this member conflict detection to true
611 */
613
614 /**
615 Update this member conflict detection to false
616 */
618
619 /**
620 Return true if conflict detection is enable on this member
621 */
623
624 /**
625 Update member weight
626
627 @param[in] new_member_weight new member_weight to set
628 */
629 void set_member_weight(uint new_member_weight);
630
631 /**
632 Return member weight
633 */
634 uint get_member_weight();
635
636 /**
637 @return is a group action running in this member
638 */
640
641 /**
642 Sets if the member is currently running a group action
643 @param is_running is an action running
644 */
646
647 /**
648 @return is a primary election running in this member
649 */
651
652 /**
653 Sets if the member is currently running a primary election
654 @param is_running is an election running
655 */
657
658 /**
659 List of member advertised recovery endpoints
660 @return recovery endpoints
661 */
662 std::string get_recovery_endpoints();
663
664 /**
665 Save list of member advertised recovery endpoints
666 @param endpoints list of advertised recovery endpoints
667 */
668 void set_recovery_endpoints(const char *endpoints);
669
670 /**
671 Get UID used when logging view change events
672 @return view change uuid or "AUTOMATIC"
673 */
674 std::string get_view_change_uuid();
675
677
678 /**
679 Get group action name if running on the member.
680 Refer group_action_running to check if any action is running.
681 @return group action name if running on the member
682 */
683 const std::string &get_group_action_running_name();
684
685 /**
686 Set group action name if running on the member.
687 Refer group_action_running to check if any action is running.
688 @param group_action_running_name set group action name
689 */
691 const std::string &group_action_running_name);
692
693 /**
694 Get group action description if running on the member.
695 Refer group_action_running to check if any action is running.
696 @return group action description if running on the member
697 */
698 const std::string &get_group_action_running_description();
699
700 /**
701 Set group action description if running on the member.
702 Refer group_action_running to check if any action is running.
703 @param group_action_running_description set group action description
704 */
706 const std::string &group_action_running_description);
707
708 /**
709 Save member view change uuid
710 @param view_change_cnf uuid to be used on change views or "AUTOMATIC"
711 */
712 void set_view_change_uuid(const char *view_change_cnf);
713
714 /**
715 Get the value of 'group_replication_preemptive_garbage_collection'
716 option on this member.
717
718 @return true enabled
719 false disabled
720 */
722
723 /**
724 Get value of variable enabled from component
725 'group_replication_primary_election' on this member.
726
727 @return true enabled
728 false disabled
729 */
731
733
734 protected:
735 void encode_payload(std::vector<unsigned char> *buffer) const override;
736 void decode_payload(const unsigned char *buffer,
737 const unsigned char *) override;
738
739 private:
740 /**
741 Internal method without concurrency control.
742
743 @return the member state of system variable
744 group_replication_single_primary_mode
745 */
747
748 /**
749 Return true if server uuid is lower than other member server uuid
750 Internal method without concurrency control.
751 */
753
755 std::string hostname;
756 uint port;
757 std::string uuid;
761 std::string executed_gtid_set;
762 std::string purged_gtid_set;
782#ifndef NDEBUG
783 public:
786#endif
787 // Allow use copy constructor on unit tests.
789};
790
791typedef std::vector<Group_member_info *, Malloc_allocator<Group_member_info *>>
793typedef Group_member_info_list::iterator Group_member_info_list_iterator;
794
795typedef std::map<
796 std::string, Group_member_info *, std::less<std::string>,
799typedef Group_member_info_map::iterator Group_member_info_map_iterator;
800
801/*
802 @interface Group_member_info_manager_interface
803
804 Defines the set of operations that a Group_member_info_manager should provide.
805 This is a component that lies on top of the GCS, on the application level,
806 providing richer and relevant information to the plugin.
807 */
809 public:
811
812 /**
813 Number of members in the group.
814
815 @return number of members
816 */
817 virtual size_t get_number_of_members() = 0;
818
819 /**
820 Number of ONLINE members in the group.
821 UNREACHABLE members are included.
822
823 @return number of ONLINE members
824 */
825 virtual size_t get_number_of_members_online() = 0;
826
827 /**
828 Is the member present in the group info
829
830 @param[in] uuid uuid to check
831 @return true if present, false otherwise
832 */
833 virtual bool is_member_info_present(const std::string &uuid) = 0;
834
835 /**
836 Retrieves a registered Group member by its uuid
837
838 @param[in] uuid uuid to retrieve
839 @param[out] member_info_arg a member info reference local to the
840 method caller that is updated when the
841 member is found.
842
843 @return true if the member is not found.
844 false if the member is found.
845 */
847 const std::string &uuid, Group_member_info &member_info_arg) = 0;
848
849 /**
850 Retrieves a registered Group member by an index function.
851 One is free to determine the index function. Nevertheless, it should have
852 the same result regardless of the member of the group where it is called
853
854 @param[in] idx the index
855 @param[out] member_info_arg a member info reference local to the
856 method caller that is updated when the
857 member is found.
858
859 @return true if the member is not found.
860 false if the member is found.
861 */
863 int idx, Group_member_info &member_info_arg) = 0;
864
865 /**
866 Return lowest member version.
867
868 @return group lowest version, if used at place where member can be OFFLINE
869 or in ERROR state, version 0xFFFFFF may be returned(not found)
870 */
872
873 /**
874 Retrieves a registered Group member by its backbone GCS identifier.
875
876 @param[in] id the GCS identifier
877 @param[out] member_info_arg a member info reference local to the
878 method caller that is updated when the
879 member is found.
880
881 @return true if the member is not found.
882 false if the member is found.
883 */
885 const Gcs_member_identifier &id, Group_member_info &member_info_arg) = 0;
886
887 /**
888 Returns the member-uuid of the given GCS identifier.
889
890 @param[in] id the GCS identifier
891 @return false if success and the member-uuid
892 true if fails and the member-uuid is empty.
893 */
894 virtual std::pair<bool, std::string> get_group_member_uuid_from_member_id(
895 const Gcs_member_identifier &id) = 0;
896
897 /**
898 Return the status of the member with the given GCS identifier.
899
900 @param[in] id the GCS identifier
901 @return status of the member, Group_member_info::MEMBER_END if
902 the member does not exist.
903 */
906
907 /**
908 Retrieves all Group members managed by this site
909
910 @return a vector with copies to all managed Group_member_info
911 */
913
914 /**
915 Retrieves all ONLINE Group members managed by this site, or
916 NULL if any group member version is from a version lower than
917 #TRANSACTION_WITH_GUARANTEES_VERSION.
918
919 @return list of all ONLINE members, if all members have version
920 equal or greater than #TRANSACTION_WITH_GUARANTEES_VERSION
921 otherwise NULL
922
923 @note the memory allocated for the list ownership belongs to the
924 caller
925 */
926 virtual std::list<Gcs_member_identifier> *get_online_members_with_guarantees(
927 const Gcs_member_identifier &exclude_member) = 0;
928
929 /**
930 Adds a new member to be managed by this Group manager
931
932 @param[in] new_member new group member
933 */
934 virtual void add(Group_member_info *new_member) = 0;
935
936 /**
937 Removes all members of the group and update new local member.
938
939 @param[in] update_local_member new Group member
940 */
941 virtual void update(Group_member_info *update_local_member) = 0;
942
943 /**
944 Updates all members of the group. Typically used after a view change.
945
946 @param[in] new_members new Group members
947 */
948 virtual void update(Group_member_info_list *new_members) = 0;
949
950 /**
951 Updates the status of a single member
952
953 @param[in] uuid member uuid
954 @param[in] new_status status to change to
955 @param[in,out] ctx The notification context to update.
956 */
958 const std::string &uuid,
960 Notification_context &ctx) = 0;
961
962 /**
963 Sets the identified member as unreachable.
964
965 @param[in] uuid member uuid
966 */
967 virtual void set_member_unreachable(const std::string &uuid) = 0;
968
969 /**
970 Sets the identified member as reachable.
971
972 @param[in] uuid member uuid
973 */
974 virtual void set_member_reachable(const std::string &uuid) = 0;
975
976 /**
977 Updates the GTID sets on a single member
978
979
980 @param[in] uuid member uuid
981 @param[in] gtid_executed the member executed GTID set
982 @param[in] purged_gtids the server purged GTID set
983 @param[in] gtid_retrieved the member retrieved GTID set for the applier
984 */
985 virtual void update_gtid_sets(const std::string &uuid,
986 std::string &gtid_executed,
987 std::string &purged_gtids,
988 std::string &gtid_retrieved) = 0;
989 /**
990 Updates the role of a single member
991
992 @param[in] uuid member uuid
993 @param[in] new_role role to change to
994 @param[in,out] ctx The notification context to update.
995 */
996 virtual void update_member_role(const std::string &uuid,
998 Notification_context &ctx) = 0;
999
1000 /**
1001 Updates the primary/secondary roles of the group.
1002 This method allows for all roles to be updated at once in the same method
1003
1004 @param[in] uuid the primary member uuid
1005 @param[in,out] ctx The notification context to update.
1006 */
1007 virtual void update_group_primary_roles(const std::string &uuid,
1008 Notification_context &ctx) = 0;
1009
1010 /**
1011 Updates the weight of a single member
1012
1013 @param[in] uuid member uuid
1014 @param[in] member_weight the new weight
1015*/
1016 virtual void update_member_weight(const std::string &uuid,
1017 uint member_weight) = 0;
1018
1019 /**
1020 Changes the primary flag on all members
1021 @param in_primary_mode is the member in primary mode
1022 */
1023 virtual void update_primary_member_flag(bool in_primary_mode) = 0;
1024
1025 /**
1026 Set the enforces_update_everywhere_checks flag on all members
1027 @param enforce_everywhere are the update everywhere checks active or not
1028 */
1030 bool enforce_everywhere) = 0;
1031
1032 /**
1033 Encodes this object to send via the network
1034
1035 @param[out] to_encode out parameter to receive the encoded data
1036 */
1037 virtual void encode(std::vector<uchar> *to_encode) = 0;
1038
1039 /**
1040 Decodes the raw format of this object
1041
1042 @param[in] to_decode raw encoded data
1043 @param[in] length raw encoded data length
1044 @return a vector of Group_member_info references
1045 */
1046 virtual Group_member_info_list *decode(const uchar *to_decode,
1047 size_t length) = 0;
1048
1049 /**
1050 Check if some member of the group has the conflict detection enable
1051
1052 @return true if at least one member has conflict detection enabled
1053 */
1055
1056 /**
1057 Return the uuid for the for the primary
1058
1059 @param[out] primary_member_uuid the uuid of the primary will be assigned
1060 here.
1061
1062 @note If there is no primary or the member is on error state, the returned
1063 uuid is "UNDEFINED". If not on primary mode it returns an empty string.
1064
1065 @return true if the member is in primary mode, false if it is not.
1066 */
1067 virtual bool get_primary_member_uuid(std::string &primary_member_uuid) = 0;
1068
1069 /**
1070 Return the group member info for the current group primary
1071
1072 @param[out] member_info_arg a member info reference local to the
1073 method caller that is updated when the
1074 member is found.
1075
1076 @return true if the member is not found.
1077 false if the member is found.
1078 */
1080 Group_member_info &member_info_arg) = 0;
1081
1082 /**
1083 Check if majority of the group is unreachable
1084
1085 This approach is optimistic, right after return the majority can be
1086 reestablish or go away.
1087
1088 @return true if majority of the group is unreachable
1089 */
1090 virtual bool is_majority_unreachable() = 0;
1091
1092 /**
1093 Check if an unreachable member exists
1094
1095 This approach is optimistic, right after return a member can be marked as
1096 reachable/unreachable
1097
1098 @return true if an unreachable member exists
1099 */
1101
1102 /**
1103 Check if a member in recovery exists in the group
1104
1105 This approach is optimistic, right after return a member can enter the group
1106
1107 @return true if a member in recovery exists
1108 */
1110
1111 /**
1112 This method returns all ONLINE and RECOVERING members comma separated
1113 host and port in string format.
1114
1115 @return hosts and port of all ONLINE and RECOVERING members
1116 */
1117 virtual std::string get_string_current_view_active_hosts() const = 0;
1118
1119 /**
1120 This method returns the update lock for consistent read of member state.
1121
1122 @return update_lock reference
1123 */
1125
1126 /**
1127 Updates the component primary failover
1128
1129 @param[in] uuid member uuid
1130 @param[in] enabled uptodate election enabled
1131*/
1133 const std::string &uuid, bool enabled) = 0;
1134
1135 /**
1136 All members have component primary election enabled.
1137
1138 @return true all members have component enabled
1139 false otherwise
1140*/
1142
1143 /**
1144 Return last timestamp since epoch when a view change updated the group
1145 members info.
1146
1147 @return timestamp of last view change
1148*/
1149 virtual uint64_t get_timestamp_last_view_change() = 0;
1150};
1151
1152/**
1153 @class Group_member_info_manager
1154
1155 Implementation of the interface Group_member_info_manager_interface
1156 */
1158 public:
1161 PSI_mutex_key psi_mutex_key =
1163
1164 ~Group_member_info_manager() override;
1165
1166 /*
1167 Allocate memory on the heap with instrumented memory allocation, so
1168 that memory consumption can be tracked.
1169
1170 @param[in] size memory size to be allocated
1171 @param[in] nothrow When the nothrow constant is passed as second parameter
1172 to operator new, operator new returns a null-pointer on
1173 failure instead of throwing a bad_alloc exception.
1174
1175 @return pointer to the allocated memory, or NULL if memory could not
1176 be allocated.
1177 */
1178 void *operator new(size_t size, const std::nothrow_t &) noexcept {
1179 /*
1180 Call my_malloc() with the MY_WME flag to make sure that it will
1181 write an error message if the memory could not be allocated.
1182 */
1184 }
1185
1186 /*
1187 Deallocate memory on the heap with instrumented memory allocation, so
1188 that memory consumption can be tracked.
1189
1190 @param[in] ptr pointer to the allocated memory
1191 @param[in] nothrow When the nothrow constant is passed as second parameter
1192 to operator new, operator new returns a null-pointer on
1193 failure instead of throwing a bad_alloc exception.
1194 */
1195 void operator delete(void *ptr, const std::nothrow_t &) noexcept {
1196 my_free(ptr);
1197 }
1198
1199 /**
1200 Allocate memory on the heap with instrumented memory allocation, so
1201 that memory consumption can be tracked.
1202
1203 @param[in] size memory size to be allocated
1204
1205 @return pointer to the allocated memory, or NULL if memory could not
1206 be allocated.
1207 */
1208 void *operator new(size_t size) noexcept {
1209 /*
1210 Call my_malloc() with the MY_WME flag to make sure that it will
1211 write an error message if the memory could not be allocated.
1212 */
1214 }
1215
1216 /**
1217 Deallocate memory on the heap with instrumented memory allocation, so
1218 that memory consumption can be tracked.
1219
1220 @param[in] ptr pointer to the allocated memory
1221 */
1222 void operator delete(void *ptr) noexcept { my_free(ptr); }
1223
1224 size_t get_number_of_members() override;
1225
1226 size_t get_number_of_members_online() override;
1227
1228 bool is_member_info_present(const std::string &uuid) override;
1229
1231 const std::string &uuid, Group_member_info &member_info_arg) override;
1232
1234 int idx, Group_member_info &member_info_arg) override;
1235
1237
1239 const Gcs_member_identifier &id,
1240 Group_member_info &member_info_arg) override;
1241
1242 std::pair<bool, std::string> get_group_member_uuid_from_member_id(
1243 const Gcs_member_identifier &id) override;
1244
1246 const Gcs_member_identifier &id) override;
1247
1249
1250 std::list<Gcs_member_identifier> *get_online_members_with_guarantees(
1251 const Gcs_member_identifier &exclude_member) override;
1252
1253 void add(Group_member_info *new_member) override;
1254
1255 void update(Group_member_info *update_local_member) override;
1256
1257 void update(Group_member_info_list *new_members) override;
1258
1259 void update_member_status(const std::string &uuid,
1261 Notification_context &ctx) override;
1262
1263 void set_member_unreachable(const std::string &uuid) override;
1264
1265 void set_member_reachable(const std::string &uuid) override;
1266
1267 void update_gtid_sets(const std::string &uuid, std::string &gtid_executed,
1268 std::string &purged_gtids,
1269 std::string &gtid_retrieved) override;
1270
1271 void update_member_role(const std::string &uuid,
1273 Notification_context &ctx) override;
1274
1275 void update_group_primary_roles(const std::string &uuid,
1276 Notification_context &ctx) override;
1277
1278 void update_member_weight(const std::string &uuid,
1279 uint member_weight) override;
1280
1281 void update_primary_member_flag(bool in_primary_mode) override;
1282
1283 void update_enforce_everywhere_checks_flag(bool enforce_everywhere) override;
1284
1285 void encode(std::vector<uchar> *to_encode) override;
1286
1287 Group_member_info_list *decode(const uchar *to_decode,
1288 size_t length) override;
1289
1290 bool is_conflict_detection_enabled() override;
1291
1292 bool get_primary_member_uuid(std::string &primary_member_uuid) override;
1293
1295 Group_member_info &member_info_arg) override;
1296
1297 bool is_majority_unreachable() override;
1298
1299 bool is_unreachable_member_present() override;
1300
1301 bool is_recovering_member_present() override;
1302
1303 std::string get_string_current_view_active_hosts() const override;
1304
1306
1307 void update_component_primary_election_enabled(const std::string &uuid,
1308 bool enabled) override;
1309
1311 override;
1312
1313 uint64_t get_timestamp_last_view_change() override;
1314
1315 private:
1316 void clear_members();
1317
1319 const Gcs_member_identifier &id);
1320
1323
1325
1327};
1328
1329/**
1330 This is the Group_member_info_manager message.
1331 It is composed by a fixed header and 1 or more Group_member_info messages.
1332 Each Group_member_info message does have its own fixed header.
1333
1334 The on-the-wire representation of the message is:
1335
1336 +-------------------+-----------+--------------------------------------+
1337 | field | wire size | description |
1338 +===================+===========+======================================+
1339 | version | 4 bytes | protocol version |
1340 | fixed_hdr_len | 2 bytes | length of the fixed header |
1341 | message_len | 8 bytes | length of the message |
1342 | cargo_type | 2 bytes | the cargo type in the payload |
1343 +-------------------+-----------+--------------------------------------+
1344 | payload_item_type | 2 bytes | PIT_MEMBERS_NUMBER |
1345 | payload_item_len | 8 bytes | size of PIT_MEMBERS_NUMBER value |
1346 | payload_item | X bytes | number of members |
1347 +-------------------+-----------+--------------------------------------+
1348 | payload_item_type | 2 bytes | PIT_MEMBER_DATA |
1349 | payload_item_len | 8 bytes | size of CT_MEMBER_INFO_MESSAGE data |
1350 | payload_item | X bytes | CT_MEMBER_INFO_MESSAGE data |
1351 +-------------------+-----------+--------------------------------------+
1352 | payload_item_type | 2 bytes | PIT_MEMBER_ACTIONS |
1353 | payload_item_len | 8 bytes | size of PIT_MEMBER_ACTIONS data |
1354 | payload_item | X bytes | PIT_MEMBER_ACTIONS data |
1355 +-------------------+-----------+--------------------------------------+
1356 | payload_item_type | 2 bytes | PIT_RPL_FAILOVER_CONFIGURATION |
1357 | payload_item_len | 8 bytes | size of |
1358 | | | PIT_RPL_FAILOVER_CONFIGURATION data |
1359 | payload_item | X bytes | PIT_RPL_FAILOVER_CONFIGURATION data |
1360 +-------------------+-----------+--------------------------------------+
1361
1362 The PIT_MEMBER_DATA lines occur the number of times specified on
1363 PIT_MEMBERS_NUMBER.
1364 The PIT_MEMBER_ACTIONS and PIT_RPL_FAILOVER_CONFIGURATION lines will
1365 exist if the member that sent the Group_member_info_manager message
1366 is not joining.
1367*/
1369 public:
1371 // This type should not be used anywhere.
1373
1374 // Length of the payload item: 2 bytes
1376
1377 // Length of the payload item: variable
1379
1380 // Length of the payload item: variable
1382
1383 // Length of the payload item: variable
1385
1386 // No valid type codes can appear after this one.
1387 PIT_MAX = 5
1389
1390 /**
1391 Group_member_info_manager_message constructor.
1392 */
1394
1395 /**
1396 Group_member_info_manager_message constructor.
1397
1398 @param[in] group_info Group_member_info_manager members information
1399 */
1401
1402 /**
1403 Group_member_info_manager_message constructor.
1404
1405 @param[in] member_info Group_member_info one member information
1406 */
1408
1409 /**
1410 Group_member_info_manager_message destructor.
1411 */
1413
1414 /**
1415 Retrieves all Group members on this message.
1416
1417 @return a vector with copies to all members.
1418 */
1420
1421 /**
1422 Adds a already serialized member actions configuration
1423 to the Group_member_info_manager_message content.
1424
1425 @param[in] buffer message buffer
1426 @param[in] member_actions_serialized_configuration
1427 serialized member actions configuration
1428 */
1430 std::vector<unsigned char> *buffer,
1431 const std::string &member_actions_serialized_configuration) const;
1432
1433 /**
1434 Gets the data that belongs to payload_item_type pit.
1435
1436 @param[in] pit the payload_item_type to which the data belongs
1437 @param[in] buffer message buffer
1438 @param[in] length message buffer length
1439 @param[out] pit_data
1440 the data from payload_item_type pit
1441 @param[out] pit_length
1442 the length of the data from payload_item_type pit
1443
1444 @return the operation status
1445 @retval false OK
1446 @retval true member actions do not exist on the message
1447 */
1448 bool get_pit_data(const enum_payload_item_type pit,
1449 const unsigned char *buffer, size_t length,
1450 const unsigned char **pit_data, size_t *pit_length);
1451
1452 /**
1453 Adds a already serialized replication failover channels
1454 configuration to the Group_member_info_manager_message content.
1455
1456 @param[in] buffer message buffer
1457 @param[in] replication_failover_channels_serialized_configuration
1458 serialized failover channels configuration
1459 */
1461 std::vector<unsigned char> *buffer,
1462 const std::string &replication_failover_channels_serialized_configuration)
1463 const;
1464
1465 protected:
1466 void encode_payload(std::vector<unsigned char> *buffer) const override;
1467 void decode_payload(const unsigned char *buffer,
1468 const unsigned char *end) override;
1469
1470 private:
1471 /**
1472 Clear members and its allocated memory.
1473 */
1474 void clear_members();
1475
1477};
1478
1479#endif /* MEMBER_INFO_INCLUDE */
It represents the identity of a group member within a certain group.
Definition: gcs_member_identifier.h:40
Definition: member_info.h:808
virtual mysql_mutex_t * get_update_lock()=0
This method returns the update lock for consistent read of member state.
virtual bool get_primary_member_info(Group_member_info &member_info_arg)=0
Return the group member info for the current group primary.
virtual void update(Group_member_info_list *new_members)=0
Updates all members of the group.
virtual void update_primary_member_flag(bool in_primary_mode)=0
Changes the primary flag on all members.
virtual bool is_unreachable_member_present()=0
Check if an unreachable member exists.
virtual Group_member_info::Group_member_status get_group_member_status_by_member_id(const Gcs_member_identifier &id)=0
Return the status of the member with the given GCS identifier.
virtual bool is_member_info_present(const std::string &uuid)=0
Is the member present in the group info.
virtual std::string get_string_current_view_active_hosts() const =0
This method returns all ONLINE and RECOVERING members comma separated host and port in string format.
virtual void add(Group_member_info *new_member)=0
Adds a new member to be managed by this Group manager.
virtual bool is_majority_unreachable()=0
Check if majority of the group is unreachable.
virtual void update_member_status(const std::string &uuid, Group_member_info::Group_member_status new_status, Notification_context &ctx)=0
Updates the status of a single member.
virtual size_t get_number_of_members_online()=0
Number of ONLINE members in the group.
virtual void update_gtid_sets(const std::string &uuid, std::string &gtid_executed, std::string &purged_gtids, std::string &gtid_retrieved)=0
Updates the GTID sets on a single member.
virtual Group_member_info_list * decode(const uchar *to_decode, size_t length)=0
Decodes the raw format of this object.
virtual bool get_group_member_info_by_index(int idx, Group_member_info &member_info_arg)=0
Retrieves a registered Group member by an index function.
virtual std::pair< bool, std::string > get_group_member_uuid_from_member_id(const Gcs_member_identifier &id)=0
Returns the member-uuid of the given GCS identifier.
virtual void update_member_weight(const std::string &uuid, uint member_weight)=0
Updates the weight of a single member.
virtual void update(Group_member_info *update_local_member)=0
Removes all members of the group and update new local member.
virtual bool get_primary_member_uuid(std::string &primary_member_uuid)=0
Return the uuid for the for the primary.
virtual void set_member_reachable(const std::string &uuid)=0
Sets the identified member as reachable.
virtual bool is_group_replication_elect_prefers_most_updated_enabled()=0
All members have component primary election enabled.
virtual void update_member_role(const std::string &uuid, Group_member_info::Group_member_role new_role, Notification_context &ctx)=0
Updates the role of a single member.
virtual size_t get_number_of_members()=0
Number of members in the group.
virtual uint64_t get_timestamp_last_view_change()=0
Return last timestamp since epoch when a view change updated the group members info.
virtual Member_version get_group_lowest_online_version()=0
Return lowest member version.
virtual void update_component_primary_election_enabled(const std::string &uuid, bool enabled)=0
Updates the component primary failover.
virtual void set_member_unreachable(const std::string &uuid)=0
Sets the identified member as unreachable.
virtual bool get_group_member_info(const std::string &uuid, Group_member_info &member_info_arg)=0
Retrieves a registered Group member by its uuid.
virtual std::list< Gcs_member_identifier > * get_online_members_with_guarantees(const Gcs_member_identifier &exclude_member)=0
Retrieves all ONLINE Group members managed by this site, or NULL if any group member version is from ...
virtual bool is_conflict_detection_enabled()=0
Check if some member of the group has the conflict detection enable.
virtual Group_member_info_list * get_all_members()=0
Retrieves all Group members managed by this site.
virtual void update_enforce_everywhere_checks_flag(bool enforce_everywhere)=0
Set the enforces_update_everywhere_checks flag on all members.
virtual void update_group_primary_roles(const std::string &uuid, Notification_context &ctx)=0
Updates the primary/secondary roles of the group.
virtual ~Group_member_info_manager_interface()=default
virtual void encode(std::vector< uchar > *to_encode)=0
Encodes this object to send via the network.
virtual bool get_group_member_info_by_member_id(const Gcs_member_identifier &id, Group_member_info &member_info_arg)=0
Retrieves a registered Group member by its backbone GCS identifier.
virtual bool is_recovering_member_present()=0
Check if a member in recovery exists in the group.
This is the Group_member_info_manager message.
Definition: member_info.h:1368
Group_member_info_list * members
Definition: member_info.h:1476
void add_member_actions_serialized_configuration(std::vector< unsigned char > *buffer, const std::string &member_actions_serialized_configuration) const
Adds a already serialized member actions configuration to the Group_member_info_manager_message conte...
Definition: member_info.cc:1651
void add_replication_failover_channels_serialized_configuration(std::vector< unsigned char > *buffer, const std::string &replication_failover_channels_serialized_configuration) const
Adds a already serialized replication failover channels configuration to the Group_member_info_manage...
Definition: member_info.cc:1704
void decode_payload(const unsigned char *buffer, const unsigned char *end) override
Decodes the contents of the buffer and sets the payload field values according to the values decoded.
Definition: member_info.cc:1623
void encode_payload(std::vector< unsigned char > *buffer) const override
Encodes the contents of this instance payload into the buffer.
Definition: member_info.cc:1605
enum_payload_item_type
Definition: member_info.h:1370
@ PIT_MAX
Definition: member_info.h:1387
@ PIT_MEMBER_DATA
Definition: member_info.h:1378
@ PIT_RPL_FAILOVER_CONFIGURATION
Definition: member_info.h:1384
@ PIT_MEMBER_ACTIONS
Definition: member_info.h:1381
@ PIT_MEMBERS_NUMBER
Definition: member_info.h:1375
@ PIT_UNKNOWN
Definition: member_info.h:1372
bool get_pit_data(const enum_payload_item_type pit, const unsigned char *buffer, size_t length, const unsigned char **pit_data, size_t *pit_length)
Gets the data that belongs to payload_item_type pit.
Definition: member_info.cc:1663
Group_member_info_manager_message()
Group_member_info_manager_message constructor.
Definition: member_info.cc:1550
~Group_member_info_manager_message() override
Group_member_info_manager_message destructor.
Definition: member_info.cc:1575
Group_member_info_list * get_all_members()
Retrieves all Group members on this message.
Definition: member_info.cc:1590
void clear_members()
Clear members and its allocated memory.
Definition: member_info.cc:1581
Implementation of the interface Group_member_info_manager_interface.
Definition: member_info.h:1157
void add(Group_member_info *new_member) override
Adds a new member to be managed by this Group manager.
Definition: member_info.cc:1179
bool is_majority_unreachable() override
Check if majority of the group is unreachable.
Definition: member_info.cc:1450
uint64_t view_change_timestamp
Definition: member_info.h:1326
Group_member_info::Group_member_status get_group_member_status_by_member_id(const Gcs_member_identifier &id) override
Return the status of the member with the given GCS identifier.
Definition: member_info.cc:1121
void update_component_primary_election_enabled(const std::string &uuid, bool enabled) override
Updates the component primary failover.
Definition: member_info.cc:1521
std::list< Gcs_member_identifier > * get_online_members_with_guarantees(const Gcs_member_identifier &exclude_member) override
Retrieves all ONLINE Group members managed by this site, or NULL if any group member version is from ...
Definition: member_info.cc:1153
bool is_group_replication_elect_prefers_most_updated_enabled() override
All members have component primary election enabled.
Definition: member_info.cc:1535
void update_member_weight(const std::string &uuid, uint member_weight) override
Updates the weight of a single member.
Definition: member_info.cc:1324
void update_primary_member_flag(bool in_primary_mode) override
Changes the primary flag on all members.
Definition: member_info.cc:1339
bool is_recovering_member_present() override
Check if a member in recovery exists in the group.
Definition: member_info.cc:1484
void update_gtid_sets(const std::string &uuid, std::string &gtid_executed, std::string &purged_gtids, std::string &gtid_retrieved) override
Updates the GTID sets on a single member.
Definition: member_info.cc:1263
bool is_member_info_present(const std::string &uuid) override
Is the member present in the group info.
Definition: member_info.cc:1006
void update(Group_member_info *update_local_member) override
Removes all members of the group and update new local member.
Definition: member_info.cc:1187
void update_enforce_everywhere_checks_flag(bool enforce_everywhere) override
Set the enforces_update_everywhere_checks flag on all members.
Definition: member_info.cc:1348
uint64_t get_timestamp_last_view_change() override
Return last timestamp since epoch when a view change updated the group members info.
Definition: member_info.cc:1546
bool get_group_member_info_by_member_id(const Gcs_member_identifier &id, Group_member_info &member_info_arg) override
Retrieves a registered Group member by its backbone GCS identifier.
Definition: member_info.cc:1091
mysql_mutex_t update_lock
Definition: member_info.h:1324
void set_member_unreachable(const std::string &uuid) override
Sets the identified member as unreachable.
Definition: member_info.cc:1244
void clear_members()
Definition: member_info.cc:1358
void encode(std::vector< uchar > *to_encode) override
Encodes this object to send via the network.
Definition: member_info.cc:1387
Group_member_info_list * decode(const uchar *to_decode, size_t length) override
Decodes the raw format of this object.
Definition: member_info.cc:1393
size_t get_number_of_members() override
Number of members in the group.
Definition: member_info.cc:987
bool get_group_member_info(const std::string &uuid, Group_member_info &member_info_arg) override
Retrieves a registered Group member by its uuid.
Definition: member_info.cc:1020
Group_member_info_list * get_all_members() override
Retrieves all Group members managed by this site.
Definition: member_info.cc:1136
bool is_conflict_detection_enabled() override
Check if some member of the group has the conflict detection enable.
Definition: member_info.cc:1371
Group_member_info * get_group_member_info_by_member_id_internal(const Gcs_member_identifier &id)
Definition: member_info.cc:1075
void update_member_role(const std::string &uuid, Group_member_info::Group_member_role new_role, Notification_context &ctx) override
Updates the role of a single member.
Definition: member_info.cc:1282
Group_member_info_manager(Group_member_info *local_member_info, PSI_mutex_key psi_mutex_key=key_GR_LOCK_group_member_info_manager_update_lock)
Definition: member_info.cc:967
mysql_mutex_t * get_update_lock() override
This method returns the update lock for consistent read of member state.
Definition: member_info.h:1305
bool get_primary_member_uuid(std::string &primary_member_uuid) override
Return the uuid for the for the primary.
Definition: member_info.cc:1405
std::string get_string_current_view_active_hosts() const override
This method returns all ONLINE and RECOVERING members comma separated host and port in string format.
Definition: member_info.cc:1501
std::pair< bool, std::string > get_group_member_uuid_from_member_id(const Gcs_member_identifier &id) override
Returns the member-uuid of the given GCS identifier.
Definition: member_info.cc:1105
void update_member_status(const std::string &uuid, Group_member_info::Group_member_status new_status, Notification_context &ctx) override
Updates the status of a single member.
Definition: member_info.cc:1223
~Group_member_info_manager() override
Definition: member_info.cc:981
Group_member_info * local_member_info
Definition: member_info.h:1322
size_t get_number_of_members_online() override
Number of ONLINE members in the group.
Definition: member_info.cc:991
Group_member_info_map * members
Definition: member_info.h:1321
void set_member_reachable(const std::string &uuid) override
Sets the identified member as reachable.
Definition: member_info.cc:1254
bool get_group_member_info_by_index(int idx, Group_member_info &member_info_arg) override
Retrieves a registered Group member by an index function.
Definition: member_info.cc:1033
Member_version get_group_lowest_online_version() override
Return lowest member version.
Definition: member_info.cc:1054
void update_group_primary_roles(const std::string &uuid, Notification_context &ctx) override
Updates the primary/secondary roles of the group.
Definition: member_info.cc:1303
bool get_primary_member_info(Group_member_info &member_info_arg) override
Return the group member info for the current group primary.
Definition: member_info.cc:1433
bool is_unreachable_member_present() override
Check if an unreachable member exists.
Definition: member_info.cc:1467
Definition: member_info.h:82
static bool comparator_group_member_version(Group_member_info *m1, Group_member_info *m2)
Definition: member_info.cc:888
void set_is_group_action_running(bool is_running)
Sets if the member is currently running a group action.
Definition: member_info.cc:797
bool m_preemptive_garbage_collection
Definition: member_info.h:780
uint port
Definition: member_info.h:756
void decode_payload(const unsigned char *buffer, const unsigned char *) override
Decodes the contents of the buffer and sets the payload field values according to the values decoded.
Definition: member_info.cc:414
static std::string get_configuration_flags_string(const uint32 configuation_flags)
Definition: member_info.cc:867
bool unreachable
Definition: member_info.h:766
uint64 gtid_assignment_block_size
Definition: member_info.h:765
std::string get_recovery_endpoints()
List of member advertised recovery endpoints.
Definition: member_info.cc:893
void disable_conflict_detection()
Update this member conflict detection to false.
Definition: member_info.cc:772
uint32 get_configuration_flags()
Definition: member_info.cc:701
std::string recovery_endpoints
Definition: member_info.h:775
bool in_primary_mode()
Definition: member_info.cc:732
const char * get_write_set_extraction_algorithm_name()
Definition: member_info.cc:683
void encode_payload(std::vector< unsigned char > *buffer) const override
Encodes the contents of this instance payload into the buffer.
Definition: member_info.cc:293
bool group_action_running
Definition: member_info.h:773
static const char * get_configuration_flag_string(const uint32 configuation_flag)
Definition: member_info.cc:853
static bool comparator_group_member_uuid(Group_member_info *m1, Group_member_info *m2)
Definition: member_info.cc:933
void set_enforces_update_everywhere_checks_flag(bool enforce_everywhere_checks)
Set the enforces_update_everywhere_checks flag.
Definition: member_info.cc:716
ulonglong get_gtid_assignment_block_size()
Definition: member_info.cc:696
void set_is_primary_election_running(bool is_running)
Sets if the member is currently running a primary election.
Definition: member_info.cc:825
bool has_enforces_update_everywhere_checks()
Definition: member_info.cc:737
const std::string & get_group_action_running_description()
Get group action description if running on the member.
Definition: member_info.cc:811
bool m_allow_single_leader
Definition: member_info.h:777
bool get_allow_single_leader()
Definition: member_info.cc:908
uint member_weight
Definition: member_info.h:770
static bool comparator_group_member_weight(Group_member_info *m1, Group_member_info *m2)
Definition: member_info.cc:938
bool conflict_detection_enable
Definition: member_info.h:769
bool is_conflict_detection_enabled()
Return true if conflict detection is enable on this member.
Definition: member_info.cc:777
Group_member_role role
Definition: member_info.h:767
void set_view_change_uuid(const char *view_change_cnf)
Save member view change uuid.
Definition: member_info.cc:913
bool m_component_primary_election_enabled
Definition: member_info.h:781
uint32 configuration_flags
Definition: member_info.h:768
bool primary_election_running
Definition: member_info.h:774
Member_version * member_version
Definition: member_info.h:760
bool has_greater_weight(Group_member_info *other)
Return true if member weight is higher than other member weight.
Definition: member_info.cc:957
uint get_port()
Definition: member_info.cc:595
bool get_default_table_encryption()
Definition: member_info.cc:752
~Group_member_info() override
Destructor.
Definition: member_info.cc:187
std::string purged_gtid_set
Definition: member_info.h:762
uint write_set_extraction_algorithm
Definition: member_info.h:764
std::string uuid
Definition: member_info.h:757
void enable_conflict_detection()
Update this member conflict detection to true.
Definition: member_info.cc:767
bool is_primary_election_running()
Definition: member_info.cc:820
bool operator==(Group_member_info &other)
Redefinition of operate ==, which operate upon the uuid.
Definition: member_info.cc:830
bool is_group_action_running()
Definition: member_info.cc:792
std::string m_group_action_running_name
Definition: member_info.h:778
Group_member_status get_recovery_status()
Definition: member_info.cc:608
enum_transaction_write_set_hashing_algorithm_compatibility
Definition: member_info.h:201
@ HASH_ALGORITHM_XXHASH64
Definition: member_info.h:204
@ HASH_ALGORITHM_OFF
Definition: member_info.h:202
@ HASH_ALGORITHM_MURMUR32
Definition: member_info.h:203
std::string get_view_change_uuid()
Get UID used when logging view change events.
Definition: member_info.cc:903
static const char * get_member_status_string(Group_member_status status)
Definition: member_info.cc:835
std::string m_group_action_running_description
Definition: member_info.h:779
void update_gtid_sets(std::string &executed_gtids, std::string &purged_gtids, std::string &retrieve_gtids)
Updates this object GTID sets.
Definition: member_info.cc:644
uint lower_case_table_names
Definition: member_info.h:771
Gcs_member_identifier * gcs_member_id
Definition: member_info.h:759
bool in_primary_mode_internal()
Internal method without concurrency control.
Definition: member_info.cc:728
Group_member_role get_role()
Definition: member_info.cc:613
void set_component_primary_election_enabled(bool enabled)
Definition: member_info.cc:928
std::string retrieved_gtid_set
Definition: member_info.h:763
void set_primary_mode_flag(bool in_primary_mode)
Set the primary flag.
Definition: member_info.cc:706
void set_group_action_running_description(const std::string &group_action_running_description)
Set group action description if running on the member.
Definition: member_info.cc:815
bool skip_encode_default_table_encryption
Definition: member_info.h:784
void set_group_action_running_name(const std::string &group_action_running_name)
Set group action name if running on the member.
Definition: member_info.cc:806
bool has_lower_uuid_internal(Group_member_info *other)
Return true if server uuid is lower than other member server uuid Internal method without concurrency...
Definition: member_info.cc:948
Group_member_info(PSI_mutex_key psi_mutex_key_arg=key_GR_LOCK_group_member_info_update_lock)
Group_member_info empty constructor.
Definition: member_info.cc:40
uint get_write_set_extraction_algorithm()
Definition: member_info.cc:678
void update(const char *hostname_arg, uint port_arg, const char *uuid_arg, int write_set_extraction_algorithm, const std::string &gcs_member_id_arg, Group_member_info::Group_member_status status_arg, Member_version &member_version_arg, ulonglong gtid_assignment_block_size_arg, Group_member_info::Group_member_role role_arg, bool in_single_primary_mode, bool has_enforces_update_everywhere_checks, uint member_weight_arg, uint lower_case_table_names_arg, bool default_table_encryption_arg, const char *recovery_endpoints_arg, const char *view_change_uuid_arg, bool allow_single_leader, bool preemptive_garbage_collection, bool component_primary_election_enabled)
Update Group_member_info.
Definition: member_info.cc:193
bool m_skip_encode_view_change_uuid
Definition: member_info.h:785
void set_unreachable()
Sets this member as unreachable.
Definition: member_info.cc:757
void set_role(Group_member_role new_role)
Updates this object member role.
Definition: member_info.cc:653
Gcs_member_identifier get_gcs_member_id()
Definition: member_info.cc:633
std::string get_gtid_purged()
Definition: member_info.cc:668
std::string m_view_change_uuid
Definition: member_info.h:776
Group_member_status status
Definition: member_info.h:758
Member_version get_member_version()
Definition: member_info.cc:658
PSI_mutex_key psi_mutex_key
Definition: member_info.h:788
std::string get_gtid_executed()
Definition: member_info.cc:663
uint get_member_weight()
Return member weight.
Definition: member_info.cc:787
bool get_component_primary_election_enabled()
Get value of variable enabled from component 'group_replication_primary_election' on this member.
Definition: member_info.cc:923
Group_member_role
Definition: member_info.h:190
@ MEMBER_ROLE_PRIMARY
Definition: member_info.h:191
@ MEMBER_ROLE_SECONDARY
Definition: member_info.h:192
@ MEMBER_ROLE_END
Definition: member_info.h:193
uint get_lower_case_table_names()
Definition: member_info.cc:742
std::string executed_gtid_set
Definition: member_info.h:761
const std::string & get_group_action_running_name()
Get group action name if running on the member.
Definition: member_info.cc:802
void set_recovery_endpoints(const char *endpoints)
Save list of member advertised recovery endpoints.
Definition: member_info.cc:898
const char * get_member_role_string()
Definition: member_info.cc:618
Group_member_status
Definition: member_info.h:176
@ MEMBER_ONLINE
Definition: member_info.h:177
@ MEMBER_UNREACHABLE
Definition: member_info.h:181
@ MEMBER_OFFLINE
Definition: member_info.h:178
@ MEMBER_IN_RECOVERY
Definition: member_info.h:179
@ MEMBER_END
Definition: member_info.h:182
@ MEMBER_ERROR
Definition: member_info.h:180
std::string get_uuid()
Definition: member_info.cc:601
mysql_mutex_t update_lock
Definition: member_info.h:754
bool has_greater_version(Group_member_info *other)
Return true if member version is higher than other member version.
Definition: member_info.cc:943
bool default_table_encryption
Definition: member_info.h:772
void set_reachable()
Sets this member as reachable.
Definition: member_info.cc:762
std::string hostname
Definition: member_info.h:755
std::string get_hostname()
Definition: member_info.cc:589
bool is_unreachable()
Return true if this has been flagged as unreachable.
Definition: member_info.cc:747
bool get_preemptive_garbage_collection()
Get the value of 'group_replication_preemptive_garbage_collection' option on this member.
Definition: member_info.cc:918
void set_member_weight(uint new_member_weight)
Update member weight.
Definition: member_info.cc:782
enum_payload_item_type
Definition: member_info.h:84
@ PIT_EXECUTED_GTID
Definition: member_info.h:110
@ PIT_GCS_ID
Definition: member_info.h:98
@ PIT_CONFLICT_DETECTION_ENABLE
Definition: member_info.h:125
@ PIT_PURGED_GTID
Definition: member_info.h:143
@ PIT_RECOVERY_ENDPOINTS
Definition: member_info.h:146
@ PIT_ALLOW_SINGLE_LEADER
Definition: member_info.h:152
@ PIT_LOWER_CASE_TABLE_NAME
Definition: member_info.h:131
@ PIT_GROUP_ACTION_RUNNING
Definition: member_info.h:134
@ PIT_GROUP_ACTION_RUNNING_DESCRIPTION
Definition: member_info.h:158
@ PIT_GTID_ASSIGNMENT_BLOCK_SIZE
Definition: member_info.h:116
@ PIT_MAX
Definition: member_info.h:167
@ PIT_DEFAULT_TABLE_ENCRYPTION
Definition: member_info.h:140
@ PIT_PREEMPTIVE_GARBAGE_COLLECTION
Definition: member_info.h:161
@ PIT_WRITE_SET_EXTRACTION_ALGORITHM
Definition: member_info.h:107
@ PIT_PORT
Definition: member_info.h:92
@ PIT_PRIMARY_ELECTION_RUNNING
Definition: member_info.h:137
@ PIT_MEMBER_ROLE
Definition: member_info.h:119
@ PIT_CONFIGURATION_FLAGS
Definition: member_info.h:122
@ PIT_COMPONENT_PRIMARY_ELECTION_ENABLED
Definition: member_info.h:164
@ PIT_UNKNOWN
Definition: member_info.h:86
@ PIT_UUID
Definition: member_info.h:95
@ PIT_GROUP_ACTION_RUNNING_NAME
Definition: member_info.h:155
@ PIT_VIEW_CHANGE_UUID
Definition: member_info.h:149
@ PIT_MEMBER_WEIGHT
Definition: member_info.h:128
@ PIT_RETRIEVED_GTID
Definition: member_info.h:113
@ PIT_VERSION
Definition: member_info.h:104
@ PIT_STATUS
Definition: member_info.h:101
@ PIT_HOSTNAME
Definition: member_info.h:89
void update_recovery_status(Group_member_status new_status)
Updates this object recovery status.
Definition: member_info.cc:639
bool has_lower_uuid(Group_member_info *other)
Return true if server uuid is lower than other member server uuid.
Definition: member_info.cc:952
std::string get_gtid_retrieved()
Definition: member_info.cc:673
Malloc_allocator is a C++ STL memory allocator based on my_malloc/my_free.
Definition: malloc_allocator.h:63
represent the MySQL version of a Member within the Group Replication group.
Definition: member_version.h:35
A convenience context class used to share information between the event handlers and the notifier.
Definition: notification.h:35
This is the base GCS plugin message.
Definition: gcs_plugin_messages.h:64
#define MY_WME
Definition: my_sys.h:131
unsigned int PSI_mutex_key
Instrumented mutex key.
Definition: psi_mutex_bits.h:52
Group_member_info_map::iterator Group_member_info_map_iterator
Definition: member_info.h:799
Group_member_info_list::iterator Group_member_info_list_iterator
Definition: member_info.h:793
std::map< std::string, Group_member_info *, std::less< std::string >, Malloc_allocator< std::pair< const std::string, Group_member_info * > > > Group_member_info_map
Definition: member_info.h:798
std::vector< Group_member_info *, Malloc_allocator< Group_member_info * > > Group_member_info_list
Definition: member_info.h:792
Some integer typedefs for easier portability.
unsigned long long int ulonglong
Definition: my_inttypes.h:56
unsigned char uchar
Definition: my_inttypes.h:52
#define MYF(v)
Definition: my_inttypes.h:97
uint64_t uint64
Definition: my_inttypes.h:69
uint32_t uint32
Definition: my_inttypes.h:67
void * my_malloc(PSI_memory_key key, size_t size, int flags)
Allocates size bytes of memory.
Definition: my_memory.cc:57
void my_free(void *ptr)
Frees the memory pointed by the ptr.
Definition: my_memory.cc:81
Common header for many mysys elements.
bool length(const dd::Spatial_reference_system *srs, const Geometry *g1, double *length, bool *null) noexcept
Computes the length of linestrings and multilinestrings.
Definition: length.cc:76
bool is_running(const PluginFuncEnv *env) noexcept
Definition: loader.cc:243
size_t size(const char *const c)
Definition: base64.h:46
mutable_buffer buffer(void *p, size_t n) noexcept
Definition: buffer.h:418
Cursor end()
A past-the-end Cursor.
Definition: rules_table_service.cc:192
std::map< Key, Value, Compare, ut::allocator< std::pair< const Key, Value > > > map
Specialization of map which uses ut_allocator.
Definition: ut0new.h:2894
#define NODISCARD
The function attribute [[NODISCARD]] is a replacement for [[nodiscard]] to workaround a gcc bug.
Definition: nodiscard.h:47
static constexpr bool PREEMPTIVE_GARBAGE_COLLECTION_DEFAULT
Definition: plugin_constants.h:98
PSI_memory_key key_group_member_info
Definition: plugin_psi.h:245
PSI_mutex_key key_GR_LOCK_group_member_info_update_lock
Definition: plugin_psi.h:126
PSI_mutex_key key_GR_LOCK_group_member_info_manager_update_lock
Definition: plugin_psi.h:125
required bool enabled
Definition: replication_group_member_actions.proto:33
An instrumented mutex structure.
Definition: mysql_mutex_bits.h:50