Fixed wrong initializations of Dynamic_array
Other things: - Added size() function to Dynamic_array()
This commit is contained in:
parent
8f33f49ebe
commit
cccc96d66c
@ -3022,7 +3022,7 @@ bool Item_exists_subselect::exists2in_processor(void *opt_arg)
|
||||
Query_arena *arena= NULL, backup;
|
||||
int res= FALSE;
|
||||
List<Item> outer;
|
||||
Dynamic_array<EQ_FIELD_OUTER> eqs(5, 5);
|
||||
Dynamic_array<EQ_FIELD_OUTER> eqs(PSI_INSTRUMENT_MEM, 5, 5);
|
||||
bool will_be_correlated;
|
||||
DBUG_ENTER("Item_exists_subselect::exists2in_processor");
|
||||
|
||||
|
@ -8027,7 +8027,7 @@ SEL_TREE *Item_func_in::get_func_row_mm_tree(RANGE_OPT_PARAM *param,
|
||||
table_map param_comp= ~(param->prev_tables | param->read_tables |
|
||||
param->current_table);
|
||||
uint row_cols= key_row->cols();
|
||||
Dynamic_array <Key_col_info> key_cols_info(row_cols);
|
||||
Dynamic_array <Key_col_info> key_cols_info(PSI_INSTRUMENT_MEM,row_cols);
|
||||
cmp_item_row *row_cmp_item;
|
||||
|
||||
if (array)
|
||||
|
@ -311,7 +311,8 @@ public:
|
||||
|
||||
bool alloc()
|
||||
{
|
||||
array= new Dynamic_array<char> (elem_size * max_elements,
|
||||
array= new Dynamic_array<char> (PSI_INSTRUMENT_MEM,
|
||||
elem_size * max_elements,
|
||||
elem_size * max_elements/sizeof(char) + 1);
|
||||
return array == NULL;
|
||||
}
|
||||
|
@ -1710,7 +1710,8 @@ scan_all_gtid_slave_pos_table(THD *thd, int (*cb)(THD *, LEX_CSTRING *, void *),
|
||||
else
|
||||
{
|
||||
size_t i;
|
||||
Dynamic_array<LEX_CSTRING*> files(dirp->number_of_files);
|
||||
Dynamic_array<LEX_CSTRING*> files(PSI_INSTRUMENT_MEM,
|
||||
dirp->number_of_files);
|
||||
Discovered_table_list tl(thd, &files);
|
||||
int err;
|
||||
|
||||
|
@ -655,7 +655,7 @@ bool ROLE_GRANT_PAIR::init(MEM_ROOT *mem, const char *username,
|
||||
#define ROLE_OPENED (1L << 3)
|
||||
|
||||
static DYNAMIC_ARRAY acl_hosts, acl_users, acl_proxy_users;
|
||||
static Dynamic_array<ACL_DB> acl_dbs(PSI_INSTRUMENT_MEM, 0U, 50U);
|
||||
static Dynamic_array<ACL_DB> acl_dbs(PSI_INSTRUMENT_MEM, 0, 50);
|
||||
typedef Dynamic_array<ACL_DB>::CMP_FUNC acl_dbs_cmp;
|
||||
static HASH acl_roles;
|
||||
/*
|
||||
@ -2786,7 +2786,7 @@ void acl_free(bool end)
|
||||
bool acl_reload(THD *thd)
|
||||
{
|
||||
DYNAMIC_ARRAY old_acl_hosts, old_acl_users, old_acl_proxy_users;
|
||||
Dynamic_array<ACL_DB> old_acl_dbs(0U,0U);
|
||||
Dynamic_array<ACL_DB> old_acl_dbs(PSI_INSTRUMENT_MEM, 0, 0);
|
||||
HASH old_acl_roles, old_acl_roles_mappings;
|
||||
MEM_ROOT old_mem;
|
||||
int result;
|
||||
@ -6170,8 +6170,8 @@ static int traverse_role_graph_impl(ACL_USER_BASE *user, void *context,
|
||||
It uses a Dynamic_array to reduce the number of
|
||||
malloc calls to a minimum
|
||||
*/
|
||||
Dynamic_array<NODE_STATE> stack(20,50);
|
||||
Dynamic_array<ACL_USER_BASE *> to_clear(20,50);
|
||||
Dynamic_array<NODE_STATE> stack(PSI_INSTRUMENT_MEM, 20,50);
|
||||
Dynamic_array<ACL_USER_BASE *> to_clear(PSI_INSTRUMENT_MEM, 20, 50);
|
||||
NODE_STATE state; /* variable used to insert elements in the stack */
|
||||
int result= 0;
|
||||
|
||||
|
@ -112,7 +112,7 @@ private:
|
||||
|
||||
template <class Elem> class Dynamic_array
|
||||
{
|
||||
DYNAMIC_ARRAY array;
|
||||
DYNAMIC_ARRAY array;
|
||||
public:
|
||||
Dynamic_array(PSI_memory_key psi_key, uint prealloc=16, uint increment=16)
|
||||
{
|
||||
@ -170,6 +170,8 @@ public:
|
||||
return ((const Elem*)array.buffer) + array.elements - 1;
|
||||
}
|
||||
|
||||
size_t size() const { return array.elements; }
|
||||
|
||||
const Elem *end() const
|
||||
{
|
||||
return back() + 1;
|
||||
|
@ -1228,7 +1228,7 @@ static bool find_db_tables_and_rm_known_files(THD *thd, MY_DIR *dirp,
|
||||
DBUG_PRINT("enter",("path: %s", path));
|
||||
|
||||
/* first, get the list of tables */
|
||||
Dynamic_array<LEX_CSTRING*> files(dirp->number_of_files);
|
||||
Dynamic_array<LEX_CSTRING*> files(PSI_INSTRUMENT_MEM, dirp->number_of_files);
|
||||
Discovered_table_list tl(thd, &files);
|
||||
if (ha_discover_table_names(thd, &db, dirp, &tl, true))
|
||||
DBUG_RETURN(1);
|
||||
|
Loading…
x
Reference in New Issue
Block a user