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