20 #include "mysqld_error.h"
27 my_init_dynamic_array(&sidno_to_hash,
sizeof(
HASH *), 0, 8);
43 for (
int sidno= 1; sidno <= max_sidno; sidno++)
45 HASH *hash= get_hash(sidno);
49 delete_dynamic(&sidno_to_hash);
57 DBUG_ENTER(
"Owned_gtids::ensure_sidno");
60 if (sidno > max_sidno || get_hash(sidno) == NULL)
62 if (allocate_dynamic(&sidno_to_hash, sidno))
64 for (
int i= max_sidno;
i < sidno;
i++)
66 HASH *hash= (
HASH *)my_malloc(
sizeof(
HASH), MYF(MY_WME));
69 my_hash_init(hash, &my_charset_bin, 20,
70 offsetof(Node, gno),
sizeof(rpl_gno), NULL,
72 set_dynamic(&sidno_to_hash, &hash,
i);
77 BINLOG_ERROR((
"Out of memory."), (ER_OUT_OF_RESOURCES, MYF(0)));
78 RETURN_REPORTED_ERROR;
85 DBUG_ENTER(
"Owned_gtids::add_gtid_owner(Gtid, my_thread_id)");
86 DBUG_ASSERT(!contains_gtid(gtid));
88 Node *
n= (Node *)my_malloc(
sizeof(Node), MYF(MY_WME));
90 RETURN_REPORTED_ERROR;
97 if (my_hash_insert(get_hash(gtid.
sidno), (
const uchar *)n) != 0)
100 BINLOG_ERROR((
"Out of memory."), (ER_OUT_OF_RESOURCES, MYF(0)));
101 RETURN_REPORTED_ERROR;
109 DBUG_ENTER(
"Owned_gtids::remove_gtid(Gtid)");
113 DBUG_ASSERT(hash != NULL);
114 Node *node= get_node(hash, gtid.
gno);
118 my_hash_delete(hash, (uchar *)node);
121 DBUG_ASSERT(my_hash_delete(hash, (uchar *)node) == 0);
130 Node *
n= get_node(gtid);
139 DBUG_ENTER(
"Owned_gtids::is_intersection_nonempty(Gtid_set *)");
140 if (sid_lock != NULL)