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

Method clone

sql/ha_sequence.cc:144–176  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

142*/
143
144handler *ha_sequence::clone(const char *name, MEM_ROOT *mem_root)
145{
146 ha_sequence *new_handler;
147 DBUG_ENTER("ha_sequence::clone");
148 if (!(new_handler= new (mem_root) ha_sequence(ht, table_share)))
149 DBUG_RETURN(NULL);
150
151 /*
152 Allocate new_handler->ref here because otherwise ha_open will allocate it
153 on this->table->mem_root and we will not be able to reclaim that memory
154 when the clone handler object is destroyed.
155 */
156
157 if (!(new_handler->ref= (uchar*) alloc_root(mem_root,
158 ALIGN_SIZE(ref_length)*2)))
159 goto err;
160
161 if (new_handler->ha_open(table, name,
162 table->db_stat,
163 HA_OPEN_IGNORE_IF_LOCKED | HA_OPEN_NO_PSI_CALL))
164 goto err;
165
166 /* Reuse original storage engine data for duplicate key reference */
167 new_handler->ref= file->ref;
168 new_handler->ref_length= file->ref_length;
169 new_handler->dup_ref= file->dup_ref;
170
171 DBUG_RETURN((handler*) new_handler);
172
173err:
174 delete new_handler;
175 DBUG_RETURN(NULL);
176}
177
178
179/*

Callers

nothing calls this directly

Calls 2

alloc_rootFunction · 0.85
ha_openMethod · 0.80

Tested by

no test coverage detected