MySQL 8.0.37
Source Code Documentation
member_info.h
Go to the documentation of this file.
1/* Copyright (c) 2014, 2024, Oracle and/or its affiliates.
2
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License, version 2.0,
5 as published by the Free Software Foundation.
6
7 This program is designed to work with certain software (including
8 but not limited to OpenSSL) that is licensed under separate terms,
9 as designated in a particular file or component or in included license
10 documentation. The authors of MySQL hereby grant you an additional
11 permission to link the program and your derivative works with the
12 separately licensed software that they have either included with
13 the program or referenced in the documentation.
14
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License, version 2.0, for more details.
19
20 You should have received a copy of the GNU General Public License
21 along with this program; if not, write to the Free Software
22 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
23
24#ifndef 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
45#include "my_inttypes.h"
46#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 // No valid type codes can appear after this one.
160 PIT_MAX = 25
161 };
162
163 /*
164 @enum Member_recovery_status
165
166 This enumeration describes all the states that a member can assume while in a
167 group.
168 */
169 typedef enum {
175 MEMBER_END // the end of the enum
177
178 /*
179 @enum Group_member_role
180
181 This enumeration describes all the roles a server can have.
182 */
183 typedef enum {
188
189 /*
190 Allocate memory on the heap with instrumented memory allocation, so
191 that memory consumption can be tracked.
192
193 @param[in] size memory size to be allocated
194 @param[in] nothrow When the nothrow constant is passed as second parameter
195 to operator new, operator new returns a null-pointer on
196 failure instead of throwing a bad_alloc exception.
197
198 @return pointer to the allocated memory, or NULL if memory could not
199 be allocated.
200 */
201 void *operator new(size_t size, const std::nothrow_t &) noexcept {
202 /*
203 Call my_malloc() with the MY_WME flag to make sure that it will
204 write an error message if the memory could not be allocated.
205 */
207 }
208
209 /*
210 Deallocate memory on the heap with instrumented memory allocation, so
211 that memory consumption can be tracked.
212
213 @param[in] ptr pointer to the allocated memory
214 @param[in] nothrow When the nothrow constant is passed as second parameter
215 to operator new, operator new returns a null-pointer on
216 failure instead of throwing a bad_alloc exception.
217 */
218 void operator delete(void *ptr, const std::nothrow_t &) noexcept {
219 my_free(ptr);
220 }
221
222 /**
223 Allocate memory on the heap with instrumented memory allocation, so
224 that memory consumption can be tracked.
225
226 @param[in] size memory size to be allocated
227
228 @return pointer to the allocated memory, or NULL if memory could not
229 be allocated.
230 */
231 void *operator new(size_t size) noexcept {
232 /*
233 Call my_malloc() with the MY_WME flag to make sure that it will
234 write an error message if the memory could not be allocated.
235 */
237 }
238
239 /**
240 Deallocate memory on the heap with instrumented memory allocation, so
241 that memory consumption can be tracked.
242
243 @param[in] ptr pointer to the allocated memory
244 */
245 void operator delete(void *ptr) noexcept { my_free(ptr); }
246
247 /**
248 Group_member_info empty constructor
249
250 @param[in] psi_mutex_key_arg mutex key
251 */
252 Group_member_info(PSI_mutex_key psi_mutex_key_arg =
254
255 /**
256 Group_member_info constructor
257
258 @param[in] hostname_arg member hostname
259 @param[in] port_arg member port
260 @param[in] uuid_arg member uuid
261 @param[in] write_set_extraction_algorithm write set extraction
262 algorithm
263 @param[in] gcs_member_id_arg member GCS member
264 identifier
265 @param[in] status_arg member Recovery status
266 @param[in] member_version_arg member version
267 @param[in] gtid_assignment_block_size_arg member gtid assignment
268 block size
269 @param[in] role_arg member role within the
270 group
271 @param[in] in_single_primary_mode is member in single mode
272 @param[in] has_enforces_update_everywhere_checks has member enforce update
273 check
274 @param[in] member_weight_arg member_weight
275 @param[in] lower_case_table_names_arg lower case table names
276 @param[in] default_table_encryption_arg default_table_encryption
277 @param[in] recovery_endpoints_arg recovery endpoints
278 @param[in] view_change_uuid_arg view change uuid
279 advertised
280 @param[in] allow_single_leader flag indicating whether or
281 not to use single-leader behavior
282 @param[in] psi_mutex_key_arg mutex key
283 */
284 Group_member_info(const char *hostname_arg, uint port_arg,
285 const char *uuid_arg, int write_set_extraction_algorithm,
286 const std::string &gcs_member_id_arg,
288 Member_version &member_version_arg,
289 ulonglong gtid_assignment_block_size_arg,
291 bool in_single_primary_mode,
293 uint member_weight_arg, uint lower_case_table_names_arg,
294 bool default_table_encryption_arg,
295 const char *recovery_endpoints_arg,
296 const char *view_change_uuid_arg, bool allow_single_leader,
297 PSI_mutex_key psi_mutex_key_arg =
299
300 /**
301 Copy constructor
302
303 @param other source of the copy
304 */
306
307 /**
308 * Group_member_info raw data constructor
309 *
310 * @param[in] data raw data
311 * @param[in] len raw data length
312 * @param[in] psi_mutex_key_arg mutex key
313 */
314 Group_member_info(const uchar *data, size_t len,
315 PSI_mutex_key psi_mutex_key_arg =
317
318 /**
319 Destructor
320 */
321 ~Group_member_info() override;
322
323 /**
324 Update Group_member_info.
325
326 @param[in] hostname_arg member hostname
327 @param[in] port_arg member port
328 @param[in] uuid_arg member uuid
329 @param[in] write_set_extraction_algorithm write set extraction
330 algorithm
331 @param[in] gcs_member_id_arg member GCS member
332 identifier
333 @param[in] status_arg member Recovery status
334 @param[in] member_version_arg member version
335 @param[in] gtid_assignment_block_size_arg member gtid assignment
336 block size
337 @param[in] role_arg member role within the
338 group
339 @param[in] in_single_primary_mode is member in single mode
340 @param[in] has_enforces_update_everywhere_checks has member enforce update
341 check
342 @param[in] member_weight_arg member_weight
343 @param[in] lower_case_table_names_arg lower case table names
344 @param[in] default_table_encryption_arg default table encryption
345 @param[in] recovery_endpoints_arg recovery endpoints
346 advertised
347 @param[in] view_change_uuid_arg view change uuid
348 @param[in] allow_single_leader flag indicating whether or
349 not to use single-leader behavior
350 */
351 void update(const char *hostname_arg, uint port_arg, const char *uuid_arg,
353 const std::string &gcs_member_id_arg,
355 Member_version &member_version_arg,
356 ulonglong gtid_assignment_block_size_arg,
358 bool in_single_primary_mode,
360 uint member_weight_arg, uint lower_case_table_names_arg,
361 bool default_table_encryption_arg,
362 const char *recovery_endpoints_arg,
363 const char *view_change_uuid_arg, bool allow_single_leader);
364
365 /**
366 Update Group_member_info.
367
368 @param other source of the copy
369 */
370 void update(Group_member_info &other);
371
372 /**
373 @return the member hostname
374 */
375 std::string get_hostname();
376
377 /**
378 @return the member port
379 */
380 uint get_port();
381
382 /**
383 @return the member uuid
384 */
385 std::string get_uuid();
386
387 /**
388 @return the member identifier in the GCS layer
389 */
391
392 /**
393 @return the member recovery status
394 */
396
397 /**
398 @return the member role type code.
399 */
401
402 /**
403 @return the member role type code in string
404 */
405 const char *get_member_role_string();
406
407 /**
408 @return the member plugin version
409 */
411
412 /**
413 @return the member GTID_EXECUTED set
414 */
415 std::string get_gtid_executed();
416
417 /**
418 @return the member GTID_PURGED set
419 */
420 std::string get_gtid_purged();
421
422 /**
423 @return the member GTID_RETRIEVED set for the applier channel
424 */
425 std::string get_gtid_retrieved();
426
427 /**
428 @return the member algorithm for extracting write sets
429 */
431
432 /**
433 @return the member gtid assignment block size
434 */
436
437 /**
438 @return the member configuration flags
439 */
441
442 /**
443 Set the primary flag
444 @param in_primary_mode is the member in primary mode
445 */
447
448 /**
449 Set the enforces_update_everywhere_checks flag
450 @param enforce_everywhere_checks are the update everywhere checks active or
451 not
452 */
454 bool enforce_everywhere_checks);
455
456 /**
457 @return the global-variable lower case table names value
458 */
460
461 /**
462 @return the global-variable lower case table names value
463 */
465
466 /**
467 @return the member state of system variable
468 group_replication_single_primary_mode
469 */
470 bool in_primary_mode();
471
472 /**
473 @return the member state of system variable
474 group_replication_enforce_update_everywhere_checks
475 */
477
478 /**
479 Updates this object recovery status
480
481 @param[in] new_status the status to set
482 */
484
485 /**
486 Updates this object GTID sets
487
488 @param[in] executed_gtids the status to set
489 @param[in] purged_gtids the status to set
490 @param[in] retrieve_gtids the status to set
491 */
492 void update_gtid_sets(std::string &executed_gtids, std::string &purged_gtids,
493 std::string &retrieve_gtids);
494
495 /**
496 Updates this object member role.
497
498 @param[in] new_role the role to set.
499 */
500 void set_role(Group_member_role new_role);
501
502 /**
503 @return the member status as string.
504 */
506
507 /**
508 @return configuration flag as string
509 */
510 static const char *get_configuration_flag_string(
511 const uint32 configuation_flag);
512
513 /**
514 @return the member configuration flags as string
515 */
516 static std::string get_configuration_flags_string(
517 const uint32 configuation_flags);
518
519 /**
520 @return Compare two members using member version
521 */
524
525 /**
526 @return Compare two members using server uuid
527 */
530
531 /**
532 @return Compare two members using member weight
533 @note if the weight is same, the member is sorted in
534 lexicographical order using its uuid.
535 */
538
539 /**
540 Return true if member version is higher than other member version
541 */
543
544 /**
545 Return true if server uuid is lower than other member server uuid
546 */
548
549 /**
550 Return true if member weight is higher than other member weight
551 */
553
554 /**
555 Redefinition of operate ==, which operate upon the uuid
556 */
557 bool operator==(Group_member_info &other);
558
559 /**
560 Sets this member as unreachable.
561 */
562 void set_unreachable();
563
564 /**
565 Sets this member as reachable.
566 */
567 void set_reachable();
568
569 /**
570 Return true if this has been flagged as unreachable.
571 */
572 bool is_unreachable();
573
574 /**
575 Update this member conflict detection to true
576 */
578
579 /**
580 Update this member conflict detection to false
581 */
583
584 /**
585 Return true if conflict detection is enable on this member
586 */
588
589 /**
590 Update member weight
591
592 @param[in] new_member_weight new member_weight to set
593 */
594 void set_member_weight(uint new_member_weight);
595
596 /**
597 Return member weight
598 */
600
601 /**
602 @return is a group action running in this member
603 */
605
606 /**
607 Sets if the member is currently running a group action
608 @param is_running is an action running
609 */
611
612 /**
613 @return is a primary election running in this member
614 */
616
617 /**
618 Sets if the member is currently running a primary election
619 @param is_running is an election running
620 */
622
623 /**
624 List of member advertised recovery endpoints
625 @return recovery endpoints
626 */
627 std::string get_recovery_endpoints();
628
629 /**
630 Save list of member advertised recovery endpoints
631 @param endpoints list of advertised recovery endpoints
632 */
633 void set_recovery_endpoints(const char *endpoints);
634
635 /**
636 Get UID used when logging view change events
637 @return view change uuid or "AUTOMATIC"
638 */
639 std::string get_view_change_uuid();
640
642
643 /**
644 Get group action name if running on the member.
645 Refer group_action_running to check if any action is running.
646 @return group action name if running on the member
647 */
648 const std::string &get_group_action_running_name();
649
650 /**
651 Set group action name if running on the member.
652 Refer group_action_running to check if any action is running.
653 @param group_action_running_name set group action name
654 */
656 const std::string &group_action_running_name);
657
658 /**
659 Get group action description if running on the member.
660 Refer group_action_running to check if any action is running.
661 @return group action description if running on the member
662 */
663 const std::string &get_group_action_running_description();
664
665 /**
666 Set group action description if running on the member.
667 Refer group_action_running to check if any action is running.
668 @param group_action_running_description set group action description
669 */
671 const std::string &group_action_running_description);
672
673 /**
674 Save member view change uuid
675 @param view_change_cnf uuid to be used on change views or "AUTOMATIC"
676 */
677 void set_view_change_uuid(const char *view_change_cnf);
678
679 protected:
680 void encode_payload(std::vector<unsigned char> *buffer) const override;
681 void decode_payload(const unsigned char *buffer,
682 const unsigned char *) override;
683
684 private:
685 /**
686 Internal method without concurrency control.
687
688 @return the member state of system variable
689 group_replication_single_primary_mode
690 */
692
693 /**
694 Return true if server uuid is lower than other member server uuid
695 Internal method without concurrency control.
696 */
698
700 std::string hostname;
702 std::string uuid;
706 std::string executed_gtid_set;
707 std::string purged_gtid_set;
725#ifndef NDEBUG
726 public:
729#endif
730 // Allow use copy constructor on unit tests.
732};
733
734typedef std::vector<Group_member_info *, Malloc_allocator<Group_member_info *>>
736typedef Group_member_info_list::iterator Group_member_info_list_iterator;
737
738typedef std::map<
739 std::string, Group_member_info *, std::less<std::string>,
742typedef Group_member_info_map::iterator Group_member_info_map_iterator;
743
744/*
745 @interface Group_member_info_manager_interface
746
747 Defines the set of operations that a Group_member_info_manager should provide.
748 This is a component that lies on top of the GCS, on the application level,
749 providing richer and relevant information to the plugin.
750 */
752 public:
754
755 /**
756 Number of members in the group.
757
758 @return number of members
759 */
760 virtual size_t get_number_of_members() = 0;
761
762 /**
763 Number of ONLINE members in the group.
764 UNREACHABLE members are included.
765
766 @return number of ONLINE members
767 */
768 virtual size_t get_number_of_members_online() = 0;
769
770 /**
771 Is the member present in the group info
772
773 @param[in] uuid uuid to check
774 @return true if present, false otherwise
775 */
776 virtual bool is_member_info_present(const std::string &uuid) = 0;
777
778 /**
779 Retrieves a registered Group member by its uuid
780
781 @param[in] uuid uuid to retrieve
782 @param[out] member_info_arg a member info reference local to the
783 method caller that is updated when the
784 member is found.
785
786 @return true if the member is not found.
787 false if the member is found.
788 */
790 const std::string &uuid, Group_member_info &member_info_arg) = 0;
791
792 /**
793 Retrieves a registered Group member by an index function.
794 One is free to determine the index function. Nevertheless, it should have
795 the same result regardless of the member of the group where it is called
796
797 @param[in] idx the index
798 @param[out] member_info_arg a member info reference local to the
799 method caller that is updated when the
800 member is found.
801
802 @return true if the member is not found.
803 false if the member is found.
804 */
806 int idx, Group_member_info &member_info_arg) = 0;
807
808 /**
809 Return lowest member version.
810
811 @return group lowest version, if used at place where member can be OFFLINE
812 or in ERROR state, version 0xFFFFFF may be returned(not found)
813 */
815
816 /**
817 Retrieves a registered Group member by its backbone GCS identifier.
818
819 @param[in] id the GCS identifier
820 @param[out] member_info_arg a member info reference local to the
821 method caller that is updated when the
822 member is found.
823
824 @return true if the member is not found.
825 false if the member is found.
826 */
828 const Gcs_member_identifier &id, Group_member_info &member_info_arg) = 0;
829
830 /**
831 Return the status of the member with the given GCS identifier.
832
833 @param[in] id the GCS identifier
834 @return status of the member, Group_member_info::MEMBER_END if
835 the member does not exist.
836 */
839
840 /**
841 Retrieves all Group members managed by this site
842
843 @return a vector with copies to all managed Group_member_info
844 */
846
847 /**
848 Retrieves all ONLINE Group members managed by this site, or
849 NULL if any group member version is from a version lower than
850 #TRANSACTION_WITH_GUARANTEES_VERSION.
851
852 @return list of all ONLINE members, if all members have version
853 equal or greater than #TRANSACTION_WITH_GUARANTEES_VERSION
854 otherwise NULL
855
856 @note the memory allocated for the list ownership belongs to the
857 caller
858 */
859 virtual std::list<Gcs_member_identifier> *get_online_members_with_guarantees(
860 const Gcs_member_identifier &exclude_member) = 0;
861
862 /**
863 Adds a new member to be managed by this Group manager
864
865 @param[in] new_member new group member
866 */
867 virtual void add(Group_member_info *new_member) = 0;
868
869 /**
870 Removes all members of the group and update new local member.
871
872 @param[in] update_local_member new Group member
873 */
874 virtual void update(Group_member_info *update_local_member) = 0;
875
876 /**
877 Updates all members of the group. Typically used after a view change.
878
879 @param[in] new_members new Group members
880 */
881 virtual void update(Group_member_info_list *new_members) = 0;
882
883 /**
884 Updates the status of a single member
885
886 @param[in] uuid member uuid
887 @param[in] new_status status to change to
888 @param[in,out] ctx The notification context to update.
889 */
891 const std::string &uuid,
893 Notification_context &ctx) = 0;
894
895 /**
896 Sets the identified member as unreachable.
897
898 @param[in] uuid member uuid
899 */
900 virtual void set_member_unreachable(const std::string &uuid) = 0;
901
902 /**
903 Sets the identified member as reachable.
904
905 @param[in] uuid member uuid
906 */
907 virtual void set_member_reachable(const std::string &uuid) = 0;
908
909 /**
910 Updates the GTID sets on a single member
911
912
913 @param[in] uuid member uuid
914 @param[in] gtid_executed the member executed GTID set
915 @param[in] purged_gtids the server purged GTID set
916 @param[in] gtid_retrieved the member retrieved GTID set for the applier
917 */
918 virtual void update_gtid_sets(const std::string &uuid,
919 std::string &gtid_executed,
920 std::string &purged_gtids,
921 std::string &gtid_retrieved) = 0;
922 /**
923 Updates the role of a single member
924
925 @param[in] uuid member uuid
926 @param[in] new_role role to change to
927 @param[in,out] ctx The notification context to update.
928 */
929 virtual void update_member_role(const std::string &uuid,
931 Notification_context &ctx) = 0;
932
933 /**
934 Updates the primary/secondary roles of the group.
935 This method allows for all roles to be updated at once in the same method
936
937 @param[in] uuid the primary member uuid
938 @param[in,out] ctx The notification context to update.
939 */
940 virtual void update_group_primary_roles(const std::string &uuid,
941 Notification_context &ctx) = 0;
942
943 /**
944 Updates the weight of a single member
945
946 @param[in] uuid member uuid
947 @param[in] member_weight the new weight
948*/
949 virtual void update_member_weight(const std::string &uuid,
950 uint member_weight) = 0;
951
952 /**
953 Changes the primary flag on all members
954 @param in_primary_mode is the member in primary mode
955 */
956 virtual void update_primary_member_flag(bool in_primary_mode) = 0;
957
958 /**
959 Set the enforces_update_everywhere_checks flag on all members
960 @param enforce_everywhere are the update everywhere checks active or not
961 */
963 bool enforce_everywhere) = 0;
964
965 /**
966 Encodes this object to send via the network
967
968 @param[out] to_encode out parameter to receive the encoded data
969 */
970 virtual void encode(std::vector<uchar> *to_encode) = 0;
971
972 /**
973 Decodes the raw format of this object
974
975 @param[in] to_decode raw encoded data
976 @param[in] length raw encoded data length
977 @return a vector of Group_member_info references
978 */
979 virtual Group_member_info_list *decode(const uchar *to_decode,
980 size_t length) = 0;
981
982 /**
983 Check if some member of the group has the conflict detection enable
984
985 @return true if at least one member has conflict detection enabled
986 */
988
989 /**
990 Return the uuid for the for the primary
991
992 @param[out] primary_member_uuid the uuid of the primary will be assigned
993 here.
994
995 @note If there is no primary or the member is on error state, the returned
996 uuid is "UNDEFINED". If not on primary mode it returns an empty string.
997
998 @return true if the member is in primary mode, false if it is not.
999 */
1000 virtual bool get_primary_member_uuid(std::string &primary_member_uuid) = 0;
1001
1002 /**
1003 Return the group member info for the current group primary
1004
1005 @param[out] member_info_arg a member info reference local to the
1006 method caller that is updated when the
1007 member is found.
1008
1009 @return true if the member is not found.
1010 false if the member is found.
1011 */
1013 Group_member_info &member_info_arg) = 0;
1014
1015 /**
1016 Check if majority of the group is unreachable
1017
1018 This approach is optimistic, right after return the majority can be
1019 reestablish or go away.
1020
1021 @return true if majority of the group is unreachable
1022 */
1023 virtual bool is_majority_unreachable() = 0;
1024
1025 /**
1026 Check if an unreachable member exists
1027
1028 This approach is optimistic, right after return a member can be marked as
1029 reachable/unreachable
1030
1031 @return true if an unreachable member exists
1032 */
1034
1035 /**
1036 Check if a member in recovery exists in the group
1037
1038 This approach is optimistic, right after return a member can enter the group
1039
1040 @return true if a member in recovery exists
1041 */
1043
1044 /**
1045 This method returns all ONLINE and RECOVERING members comma separated
1046 host and port in string format.
1047
1048 @return hosts and port of all ONLINE and RECOVERING members
1049 */
1050 virtual std::string get_string_current_view_active_hosts() const = 0;
1051
1052 /**
1053 This method returns the update lock for consistent read of member state.
1054
1055 @return update_lock reference
1056 */
1058};
1059
1060/**
1061 @class Group_member_info_manager
1062
1063 Implementation of the interface Group_member_info_manager_interface
1064 */
1066 public:
1069 PSI_mutex_key psi_mutex_key =
1071
1072 ~Group_member_info_manager() override;
1073
1074 /*
1075 Allocate memory on the heap with instrumented memory allocation, so
1076 that memory consumption can be tracked.
1077
1078 @param[in] size memory size to be allocated
1079 @param[in] nothrow When the nothrow constant is passed as second parameter
1080 to operator new, operator new returns a null-pointer on
1081 failure instead of throwing a bad_alloc exception.
1082
1083 @return pointer to the allocated memory, or NULL if memory could not
1084 be allocated.
1085 */
1086 void *operator new(size_t size, const std::nothrow_t &) noexcept {
1087 /*
1088 Call my_malloc() with the MY_WME flag to make sure that it will
1089 write an error message if the memory could not be allocated.
1090 */
1091 return my_malloc(key_group_member_info, size, MYF(MY_WME));
1092 }
1093
1094 /*
1095 Deallocate memory on the heap with instrumented memory allocation, so
1096 that memory consumption can be tracked.
1097
1098 @param[in] ptr pointer to the allocated memory
1099 @param[in] nothrow When the nothrow constant is passed as second parameter
1100 to operator new, operator new returns a null-pointer on
1101 failure instead of throwing a bad_alloc exception.
1102 */
1103 void operator delete(void *ptr, const std::nothrow_t &) noexcept {
1104 my_free(ptr);
1105 }
1106
1107 /**
1108 Allocate memory on the heap with instrumented memory allocation, so
1109 that memory consumption can be tracked.
1110
1111 @param[in] size memory size to be allocated
1112
1113 @return pointer to the allocated memory, or NULL if memory could not
1114 be allocated.
1115 */
1116 void *operator new(size_t size) noexcept {
1117 /*
1118 Call my_malloc() with the MY_WME flag to make sure that it will
1119 write an error message if the memory could not be allocated.
1120 */
1121 return my_malloc(key_group_member_info, size, MYF(MY_WME));
1122 }
1123
1124 /**
1125 Deallocate memory on the heap with instrumented memory allocation, so
1126 that memory consumption can be tracked.
1127
1128 @param[in] ptr pointer to the allocated memory
1129 */
1130 void operator delete(void *ptr) noexcept { my_free(ptr); }
1131
1132 size_t get_number_of_members() override;
1133
1134 size_t get_number_of_members_online() override;
1135
1136 bool is_member_info_present(const std::string &uuid) override;
1137
1139 const std::string &uuid, Group_member_info &member_info_arg) override;
1140
1142 int idx, Group_member_info &member_info_arg) override;
1143
1145
1147 const Gcs_member_identifier &id,
1148 Group_member_info &member_info_arg) override;
1149
1151 const Gcs_member_identifier &id) override;
1152
1154
1155 std::list<Gcs_member_identifier> *get_online_members_with_guarantees(
1156 const Gcs_member_identifier &exclude_member) override;
1157
1158 void add(Group_member_info *new_member) override;
1159
1160 void update(Group_member_info *update_local_member) override;
1161
1162 void update(Group_member_info_list *new_members) override;
1163
1164 void update_member_status(const std::string &uuid,
1166 Notification_context &ctx) override;
1167
1168 void set_member_unreachable(const std::string &uuid) override;
1169
1170 void set_member_reachable(const std::string &uuid) override;
1171
1172 void update_gtid_sets(const std::string &uuid, std::string &gtid_executed,
1173 std::string &purged_gtids,
1174 std::string &gtid_retrieved) override;
1175
1176 void update_member_role(const std::string &uuid,
1178 Notification_context &ctx) override;
1179
1180 void update_group_primary_roles(const std::string &uuid,
1181 Notification_context &ctx) override;
1182
1183 void update_member_weight(const std::string &uuid,
1184 uint member_weight) override;
1185
1186 void update_primary_member_flag(bool in_primary_mode) override;
1187
1188 void update_enforce_everywhere_checks_flag(bool enforce_everywhere) override;
1189
1190 void encode(std::vector<uchar> *to_encode) override;
1191
1192 Group_member_info_list *decode(const uchar *to_decode,
1193 size_t length) override;
1194
1195 bool is_conflict_detection_enabled() override;
1196
1197 bool get_primary_member_uuid(std::string &primary_member_uuid) override;
1198
1200 Group_member_info &member_info_arg) override;
1201
1202 bool is_majority_unreachable() override;
1203
1204 bool is_unreachable_member_present() override;
1205
1206 bool is_recovering_member_present() override;
1207
1208 std::string get_string_current_view_active_hosts() const override;
1209
1211
1212 private:
1213 void clear_members();
1214
1216 const Gcs_member_identifier &id);
1217
1220
1222};
1223
1224/**
1225 This is the Group_member_info_manager message.
1226 It is composed by a fixed header and 1 or more Group_member_info messages.
1227 Each Group_member_info message does have its own fixed header.
1228
1229 The on-the-wire representation of the message is:
1230
1231 +-------------------+-----------+--------------------------------------+
1232 | field | wire size | description |
1233 +===================+===========+======================================+
1234 | version | 4 bytes | protocol version |
1235 | fixed_hdr_len | 2 bytes | length of the fixed header |
1236 | message_len | 8 bytes | length of the message |
1237 | cargo_type | 2 bytes | the cargo type in the payload |
1238 +-------------------+-----------+--------------------------------------+
1239 | payload_item_type | 2 bytes | PIT_MEMBERS_NUMBER |
1240 | payload_item_len | 8 bytes | size of PIT_MEMBERS_NUMBER value |
1241 | payload_item | X bytes | number of members |
1242 +-------------------+-----------+--------------------------------------+
1243 | payload_item_type | 2 bytes | PIT_MEMBER_DATA |
1244 | payload_item_len | 8 bytes | size of CT_MEMBER_INFO_MESSAGE data |
1245 | payload_item | X bytes | CT_MEMBER_INFO_MESSAGE data |
1246 +-------------------+-----------+--------------------------------------+
1247 | payload_item_type | 2 bytes | PIT_MEMBER_ACTIONS |
1248 | payload_item_len | 8 bytes | size of PIT_MEMBER_ACTIONS data |
1249 | payload_item | X bytes | PIT_MEMBER_ACTIONS data |
1250 +-------------------+-----------+--------------------------------------+
1251 | payload_item_type | 2 bytes | PIT_RPL_FAILOVER_CONFIGURATION |
1252 | payload_item_len | 8 bytes | size of |
1253 | | | PIT_RPL_FAILOVER_CONFIGURATION data |
1254 | payload_item | X bytes | PIT_RPL_FAILOVER_CONFIGURATION data |
1255 +-------------------+-----------+--------------------------------------+
1256
1257 The PIT_MEMBER_DATA lines occur the number of times specified on
1258 PIT_MEMBERS_NUMBER.
1259 The PIT_MEMBER_ACTIONS and PIT_RPL_FAILOVER_CONFIGURATION lines will
1260 exist if the member that sent the Group_member_info_manager message
1261 is not joining.
1262*/
1264 public:
1266 // This type should not be used anywhere.
1268
1269 // Length of the payload item: 2 bytes
1271
1272 // Length of the payload item: variable
1274
1275 // Length of the payload item: variable
1277
1278 // Length of the payload item: variable
1280
1281 // No valid type codes can appear after this one.
1282 PIT_MAX = 5
1284
1285 /**
1286 Group_member_info_manager_message constructor.
1287 */
1289
1290 /**
1291 Group_member_info_manager_message constructor.
1292
1293 @param[in] group_info Group_member_info_manager members information
1294 */
1296
1297 /**
1298 Group_member_info_manager_message constructor.
1299
1300 @param[in] member_info Group_member_info one member information
1301 */
1303
1304 /**
1305 Group_member_info_manager_message destructor.
1306 */
1308
1309 /**
1310 Retrieves all Group members on this message.
1311
1312 @return a vector with copies to all members.
1313 */
1315
1316 /**
1317 Adds a already serialized member actions configuration
1318 to the Group_member_info_manager_message content.
1319
1320 @param[in] buffer message buffer
1321 @param[in] member_actions_serialized_configuration
1322 serialized member actions configuration
1323 */
1325 std::vector<unsigned char> *buffer,
1326 const std::string &member_actions_serialized_configuration) const;
1327
1328 /**
1329 Gets the data that belongs to payload_item_type pit.
1330
1331 @param[in] pit the payload_item_type to which the data belongs
1332 @param[in] buffer message buffer
1333 @param[in] length message buffer length
1334 @param[out] pit_data
1335 the data from payload_item_type pit
1336 @param[out] pit_length
1337 the length of the data from payload_item_type pit
1338
1339 @return the operation status
1340 @retval false OK
1341 @retval true member actions do not exist on the message
1342 */
1343 bool get_pit_data(const enum_payload_item_type pit,
1344 const unsigned char *buffer, size_t length,
1345 const unsigned char **pit_data, size_t *pit_length);
1346
1347 /**
1348 Adds a already serialized replication failover channels
1349 configuration to the Group_member_info_manager_message content.
1350
1351 @param[in] buffer message buffer
1352 @param[in] replication_failover_channels_serialized_configuration
1353 serialized failover channels configuration
1354 */
1356 std::vector<unsigned char> *buffer,
1357 const std::string &replication_failover_channels_serialized_configuration)
1358 const;
1359
1360 protected:
1361 void encode_payload(std::vector<unsigned char> *buffer) const override;
1362 void decode_payload(const unsigned char *buffer,
1363 const unsigned char *end) override;
1364
1365 private:
1366 /**
1367 Clear members and its allocated memory.
1368 */
1369 void clear_members();
1370
1372};
1373
1374#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:751
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 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 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 Member_version get_group_lowest_online_version()=0
Return lowest member version.
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:1263
Group_member_info_list * members
Definition: member_info.h:1371
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:1557
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:1610
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:1528
void encode_payload(std::vector< unsigned char > *buffer) const override
Encodes the contents of this instance payload into the buffer.
Definition: member_info.cc:1510
enum_payload_item_type
Definition: member_info.h:1265
@ PIT_MAX
Definition: member_info.h:1282
@ PIT_MEMBER_DATA
Definition: member_info.h:1273
@ PIT_RPL_FAILOVER_CONFIGURATION
Definition: member_info.h:1279
@ PIT_MEMBER_ACTIONS
Definition: member_info.h:1276
@ PIT_MEMBERS_NUMBER
Definition: member_info.h:1270
@ PIT_UNKNOWN
Definition: member_info.h:1267
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:1569
Group_member_info_manager_message()
Group_member_info_manager_message constructor.
Definition: member_info.cc:1454
~Group_member_info_manager_message() override
Group_member_info_manager_message destructor.
Definition: member_info.cc:1479
Group_member_info_list * get_all_members()
Retrieves all Group members on this message.
Definition: member_info.cc:1494
void clear_members()
Clear members and its allocated memory.
Definition: member_info.cc:1485
Implementation of the interface Group_member_info_manager_interface.
Definition: member_info.h:1065
void add(Group_member_info *new_member) override
Adds a new member to be managed by this Group manager.
Definition: member_info.cc:1113
bool is_majority_unreachable() override
Check if majority of the group is unreachable.
Definition: member_info.cc:1383
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:1052
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:1085
void update_member_weight(const std::string &uuid, uint member_weight) override
Updates the weight of a single member.
Definition: member_info.cc:1255
void update_primary_member_flag(bool in_primary_mode) override
Changes the primary flag on all members.
Definition: member_info.cc:1270
bool is_recovering_member_present() override
Check if a member in recovery exists in the group.
Definition: member_info.cc:1417
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:1197
bool is_member_info_present(const std::string &uuid) override
Is the member present in the group info.
Definition: member_info.cc:953
void update(Group_member_info *update_local_member) override
Removes all members of the group and update new local member.
Definition: member_info.cc:1121
void update_enforce_everywhere_checks_flag(bool enforce_everywhere) override
Set the enforces_update_everywhere_checks flag on all members.
Definition: member_info.cc:1279
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:1038
mysql_mutex_t update_lock
Definition: member_info.h:1221
void set_member_unreachable(const std::string &uuid) override
Sets the identified member as unreachable.
Definition: member_info.cc:1178
void clear_members()
Definition: member_info.cc:1289
void encode(std::vector< uchar > *to_encode) override
Encodes this object to send via the network.
Definition: member_info.cc:1318
Group_member_info_list * decode(const uchar *to_decode, size_t length) override
Decodes the raw format of this object.
Definition: member_info.cc:1325
size_t get_number_of_members() override
Number of members in the group.
Definition: member_info.cc:934
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:967
Group_member_info_list * get_all_members() override
Retrieves all Group members managed by this site.
Definition: member_info.cc:1067
bool is_conflict_detection_enabled() override
Check if some member of the group has the conflict detection enable.
Definition: member_info.cc:1302
Group_member_info * get_group_member_info_by_member_id_internal(const Gcs_member_identifier &id)
Definition: member_info.cc:1022
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:1214
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:914
mysql_mutex_t * get_update_lock() override
This method returns the update lock for consistent read of member state.
Definition: member_info.h:1210
bool get_primary_member_uuid(std::string &primary_member_uuid) override
Return the uuid for the for the primary.
Definition: member_info.cc:1338
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:1434
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:1157
~Group_member_info_manager() override
Definition: member_info.cc:928
Group_member_info * local_member_info
Definition: member_info.h:1219
size_t get_number_of_members_online() override
Number of ONLINE members in the group.
Definition: member_info.cc:938
Group_member_info_map * members
Definition: member_info.h:1218
void set_member_reachable(const std::string &uuid) override
Sets the identified member as reachable.
Definition: member_info.cc:1188
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:980
Member_version get_group_lowest_online_version() override
Return lowest member version.
Definition: member_info.cc:1001
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:1234
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:1366
bool is_unreachable_member_present() override
Check if an unreachable member exists.
Definition: member_info.cc:1400
Definition: member_info.h:81
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)
Update Group_member_info.
Definition: member_info.cc:182
static bool comparator_group_member_version(Group_member_info *m1, Group_member_info *m2)
Definition: member_info.cc:848
void set_is_group_action_running(bool is_running)
Sets if the member is currently running a group action.
Definition: member_info.cc:757
uint port
Definition: member_info.h:701
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:386
static std::string get_configuration_flags_string(const uint32 configuation_flags)
Definition: member_info.cc:827
bool unreachable
Definition: member_info.h:711
uint64 gtid_assignment_block_size
Definition: member_info.h:710
std::string get_recovery_endpoints()
List of member advertised recovery endpoints.
Definition: member_info.cc:853
void disable_conflict_detection()
Update this member conflict detection to false.
Definition: member_info.cc:732
uint32 get_configuration_flags()
Definition: member_info.cc:661
std::string recovery_endpoints
Definition: member_info.h:720
bool in_primary_mode()
Definition: member_info.cc:692
void encode_payload(std::vector< unsigned char > *buffer) const override
Encodes the contents of this instance payload into the buffer.
Definition: member_info.cc:276
bool group_action_running
Definition: member_info.h:718
static const char * get_configuration_flag_string(const uint32 configuation_flag)
Definition: member_info.cc:813
static bool comparator_group_member_uuid(Group_member_info *m1, Group_member_info *m2)
Definition: member_info.cc:878
void set_enforces_update_everywhere_checks_flag(bool enforce_everywhere_checks)
Set the enforces_update_everywhere_checks flag.
Definition: member_info.cc:676
ulonglong get_gtid_assignment_block_size()
Definition: member_info.cc:656
void set_is_primary_election_running(bool is_running)
Sets if the member is currently running a primary election.
Definition: member_info.cc:785
bool has_enforces_update_everywhere_checks()
Definition: member_info.cc:697
const std::string & get_group_action_running_description()
Get group action description if running on the member.
Definition: member_info.cc:771
bool m_allow_single_leader
Definition: member_info.h:722
bool get_allow_single_leader()
Definition: member_info.cc:868
uint member_weight
Definition: member_info.h:715
static bool comparator_group_member_weight(Group_member_info *m1, Group_member_info *m2)
Definition: member_info.cc:883
bool conflict_detection_enable
Definition: member_info.h:714
bool is_conflict_detection_enabled()
Return true if conflict detection is enable on this member.
Definition: member_info.cc:737
Group_member_role role
Definition: member_info.h:712
void set_view_change_uuid(const char *view_change_cnf)
Save member view change uuid.
Definition: member_info.cc:873
uint32 configuration_flags
Definition: member_info.h:713
bool primary_election_running
Definition: member_info.h:719
Member_version * member_version
Definition: member_info.h:705
bool has_greater_weight(Group_member_info *other)
Return true if member weight is higher than other member weight.
Definition: member_info.cc:904
uint get_port()
Definition: member_info.cc:566
bool get_default_table_encryption()
Definition: member_info.cc:712
~Group_member_info() override
Destructor.
Definition: member_info.cc:176
std::string purged_gtid_set
Definition: member_info.h:707
uint write_set_extraction_algorithm
Definition: member_info.h:709
std::string uuid
Definition: member_info.h:702
void enable_conflict_detection()
Update this member conflict detection to true.
Definition: member_info.cc:727
bool is_primary_election_running()
Definition: member_info.cc:780
bool operator==(Group_member_info &other)
Redefinition of operate ==, which operate upon the uuid.
Definition: member_info.cc:790
bool is_group_action_running()
Definition: member_info.cc:752
std::string m_group_action_running_name
Definition: member_info.h:723
Group_member_status get_recovery_status()
Definition: member_info.cc:579
std::string get_view_change_uuid()
Get UID used when logging view change events.
Definition: member_info.cc:863
static const char * get_member_status_string(Group_member_status status)
Definition: member_info.cc:795
std::string m_group_action_running_description
Definition: member_info.h:724
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:617
uint lower_case_table_names
Definition: member_info.h:716
Gcs_member_identifier * gcs_member_id
Definition: member_info.h:704
bool in_primary_mode_internal()
Internal method without concurrency control.
Definition: member_info.cc:688
Group_member_role get_role()
Definition: member_info.cc:584
std::string retrieved_gtid_set
Definition: member_info.h:708
void set_primary_mode_flag(bool in_primary_mode)
Set the primary flag.
Definition: member_info.cc:666
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:775
bool skip_encode_default_table_encryption
Definition: member_info.h:727
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:766
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:895
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:38
uint get_write_set_extraction_algorithm()
Definition: member_info.cc:651
bool m_skip_encode_view_change_uuid
Definition: member_info.h:728
void set_unreachable()
Sets this member as unreachable.
Definition: member_info.cc:717
void set_role(Group_member_role new_role)
Updates this object member role.
Definition: member_info.cc:626
Gcs_member_identifier get_gcs_member_id()
Definition: member_info.cc:606
std::string get_gtid_purged()
Definition: member_info.cc:641
std::string m_view_change_uuid
Definition: member_info.h:721
Group_member_status status
Definition: member_info.h:703
Member_version get_member_version()
Definition: member_info.cc:631
PSI_mutex_key psi_mutex_key
Definition: member_info.h:731
std::string get_gtid_executed()
Definition: member_info.cc:636
uint get_member_weight()
Return member weight.
Definition: member_info.cc:747
Group_member_role
Definition: member_info.h:183
@ MEMBER_ROLE_PRIMARY
Definition: member_info.h:184
@ MEMBER_ROLE_SECONDARY
Definition: member_info.h:185
@ MEMBER_ROLE_END
Definition: member_info.h:186
uint get_lower_case_table_names()
Definition: member_info.cc:702
std::string executed_gtid_set
Definition: member_info.h:706
const std::string & get_group_action_running_name()
Get group action name if running on the member.
Definition: member_info.cc:762
void set_recovery_endpoints(const char *endpoints)
Save list of member advertised recovery endpoints.
Definition: member_info.cc:858
const char * get_member_role_string()
Definition: member_info.cc:589
Group_member_status
Definition: member_info.h:169
@ MEMBER_ONLINE
Definition: member_info.h:170
@ MEMBER_UNREACHABLE
Definition: member_info.h:174
@ MEMBER_OFFLINE
Definition: member_info.h:171
@ MEMBER_IN_RECOVERY
Definition: member_info.h:172
@ MEMBER_END
Definition: member_info.h:175
@ MEMBER_ERROR
Definition: member_info.h:173
std::string get_uuid()
Definition: member_info.cc:572
mysql_mutex_t update_lock
Definition: member_info.h:699
bool has_greater_version(Group_member_info *other)
Return true if member version is higher than other member version.
Definition: member_info.cc:888
bool default_table_encryption
Definition: member_info.h:717
void set_reachable()
Sets this member as reachable.
Definition: member_info.cc:722
std::string hostname
Definition: member_info.h:700
std::string get_hostname()
Definition: member_info.cc:560
bool is_unreachable()
Return true if this has been flagged as unreachable.
Definition: member_info.cc:707
void set_member_weight(uint new_member_weight)
Update member weight.
Definition: member_info.cc:742
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:160
@ PIT_DEFAULT_TABLE_ENCRYPTION
Definition: member_info.h:139
@ 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_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:612
bool has_lower_uuid(Group_member_info *other)
Return true if server uuid is lower than other member server uuid.
Definition: member_info.cc:899
std::string get_gtid_retrieved()
Definition: member_info.cc:646
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:123
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:742
Group_member_info_list::iterator Group_member_info_list_iterator
Definition: member_info.h:736
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:741
std::vector< Group_member_info *, Malloc_allocator< Group_member_info * > > Group_member_info_list
Definition: member_info.h:735
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:202
mutable_buffer buffer(void *p, size_t n) noexcept
Definition: buffer.h:420
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:2892
#define NODISCARD
The function attribute [[NODISCARD]] is a replacement for [[nodiscard]] to workaround a gcc bug.
Definition: nodiscard.h:47
PSI_memory_key key_group_member_info
Definition: plugin_psi.h:243
PSI_mutex_key key_GR_LOCK_group_member_info_update_lock
Definition: plugin_psi.h:125
PSI_mutex_key key_GR_LOCK_group_member_info_manager_update_lock
Definition: plugin_psi.h:124
An instrumented mutex structure.
Definition: mysql_mutex_bits.h:50
unsigned int uint
Definition: uca9-dump.cc:75