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