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