MCPcopy Create free account
hub / github.com/MariaDB/server / insert_setup_object

Function insert_setup_object

storage/perfschema/pfs_setup_object.cc:146–191  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

144}
145
146int insert_setup_object(enum_object_type object_type, const String *schema,
147 const String *object, bool enabled, bool timed)
148{
149 PFS_thread *thread= PFS_thread::get_current_thread();
150 if (unlikely(thread == NULL))
151 return HA_ERR_OUT_OF_MEM;
152
153 LF_PINS* pins= get_setup_object_hash_pins(thread);
154 if (unlikely(pins == NULL))
155 return HA_ERR_OUT_OF_MEM;
156
157 PFS_setup_object *pfs;
158 pfs_dirty_state dirty_state;
159
160 pfs= global_setup_object_container.allocate(& dirty_state);
161 if (pfs != NULL)
162 {
163 set_setup_object_key(&pfs->m_key, object_type,
164 schema->ptr(), schema->length(),
165 object->ptr(), object->length());
166 pfs->m_schema_name= &pfs->m_key.m_hash_key[1];
167 pfs->m_schema_name_length= schema->length();
168 pfs->m_object_name= pfs->m_schema_name + pfs->m_schema_name_length + 1;
169 pfs->m_object_name_length= object->length();
170 pfs->m_enabled= enabled;
171 pfs->m_timed= timed;
172
173 int res;
174 pfs->m_lock.dirty_to_allocated(& dirty_state);
175 res= lf_hash_insert(&setup_object_hash, pins, &pfs);
176 if (likely(res == 0))
177 {
178 setup_objects_version++;
179 return 0;
180 }
181
182 global_setup_object_container.deallocate(pfs);
183
184 if (res > 0)
185 return HA_ERR_FOUND_DUPP_KEY;
186 /* OOM in lf_hash_insert */
187 return HA_ERR_OUT_OF_MEM;
188 }
189
190 return HA_ERR_RECORD_FILE_FULL;
191}
192
193int delete_setup_object(enum_object_type object_type, const String *schema,
194 const String *object)

Callers 2

install_default_setupFunction · 0.85
write_rowMethod · 0.85

Calls 8

set_setup_object_keyFunction · 0.85
lf_hash_insertFunction · 0.85
dirty_to_allocatedMethod · 0.80
allocateMethod · 0.45
ptrMethod · 0.45
lengthMethod · 0.45
deallocateMethod · 0.45

Tested by

no test coverage detected