Merge mysql.com:/home/my/mysql-5.0
into mysql.com:/home/my/mysql-5.1
This commit is contained in:
commit
430d215c58
@ -3132,14 +3132,15 @@ void do_connect(struct st_command *command)
|
|||||||
else if (!strncmp(con_options, "COMPRESS", 8))
|
else if (!strncmp(con_options, "COMPRESS", 8))
|
||||||
con_compress= 1;
|
con_compress= 1;
|
||||||
else
|
else
|
||||||
die("Illegal option to connect: %.*s", (int) (end - con_options), con_options);
|
die("Illegal option to connect: %.*s",
|
||||||
|
(int) (end - con_options), con_options);
|
||||||
/* Process next option */
|
/* Process next option */
|
||||||
con_options= end;
|
con_options= end;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (next_con == connections_end)
|
if (next_con == connections_end)
|
||||||
die("Connection limit exhausted, you can have max %ld connections",
|
die("Connection limit exhausted, you can have max %d connections",
|
||||||
(long) (sizeof(connections)/sizeof(struct st_connection)));
|
(int) (sizeof(connections)/sizeof(struct st_connection)));
|
||||||
|
|
||||||
if (find_connection_by_name(ds_connection_name.str))
|
if (find_connection_by_name(ds_connection_name.str))
|
||||||
die("Connection %s already exists", ds_connection_name.str);
|
die("Connection %s already exists", ds_connection_name.str);
|
||||||
|
@ -337,6 +337,7 @@ rl_generic_bind (type, keyseq, data, map)
|
|||||||
KEYMAP_ENTRY k;
|
KEYMAP_ENTRY k;
|
||||||
|
|
||||||
k.function = 0;
|
k.function = 0;
|
||||||
|
k.type= 0;
|
||||||
|
|
||||||
/* If no keys to bind to, exit right away. */
|
/* If no keys to bind to, exit right away. */
|
||||||
if (!keyseq || !*keyseq)
|
if (!keyseq || !*keyseq)
|
||||||
|
@ -1052,8 +1052,8 @@ static int convert_file(REPLACE *rep, my_string name)
|
|||||||
{
|
{
|
||||||
int error;
|
int error;
|
||||||
FILE *in,*out;
|
FILE *in,*out;
|
||||||
char dir_buff[FN_REFLEN], tempname[FN_REFLEN],*org_name = name;
|
char dir_buff[FN_REFLEN], tempname[FN_REFLEN], *org_name = name;
|
||||||
#ifdef HAVE_READLINK
|
#ifdef HAVE_READLINK
|
||||||
char link_name[FN_REFLEN];
|
char link_name[FN_REFLEN];
|
||||||
#endif
|
#endif
|
||||||
File temp_file;
|
File temp_file;
|
||||||
|
@ -51,7 +51,8 @@ typedef struct st_tree_element {
|
|||||||
typedef struct st_tree {
|
typedef struct st_tree {
|
||||||
TREE_ELEMENT *root,null_element;
|
TREE_ELEMENT *root,null_element;
|
||||||
TREE_ELEMENT **parents[MAX_TREE_HEIGHT];
|
TREE_ELEMENT **parents[MAX_TREE_HEIGHT];
|
||||||
uint offset_to_key,elements_in_tree,size_of_element,memory_limit,allocated;
|
uint offset_to_key,elements_in_tree,size_of_element;
|
||||||
|
ulong memory_limit, allocated;
|
||||||
qsort_cmp2 compare;
|
qsort_cmp2 compare;
|
||||||
void *custom_arg;
|
void *custom_arg;
|
||||||
MEM_ROOT mem_root;
|
MEM_ROOT mem_root;
|
||||||
@ -61,7 +62,7 @@ typedef struct st_tree {
|
|||||||
} TREE;
|
} TREE;
|
||||||
|
|
||||||
/* Functions on whole tree */
|
/* Functions on whole tree */
|
||||||
void init_tree(TREE *tree, uint default_alloc_size, uint memory_limit,
|
void init_tree(TREE *tree, ulong default_alloc_size, ulong memory_limit,
|
||||||
int size, qsort_cmp2 compare, my_bool with_delete,
|
int size, qsort_cmp2 compare, my_bool with_delete,
|
||||||
tree_element_free free_element, void *custom_arg);
|
tree_element_free free_element, void *custom_arg);
|
||||||
void delete_tree(TREE*);
|
void delete_tree(TREE*);
|
||||||
|
@ -175,8 +175,10 @@ void STDCALL mysql_server_end()
|
|||||||
#ifdef EMBEDDED_LIBRARY
|
#ifdef EMBEDDED_LIBRARY
|
||||||
end_embedded_server();
|
end_embedded_server();
|
||||||
#endif
|
#endif
|
||||||
/* If library called my_init(), free memory allocated by it */
|
|
||||||
finish_client_errs();
|
finish_client_errs();
|
||||||
|
vio_end();
|
||||||
|
|
||||||
|
/* If library called my_init(), free memory allocated by it */
|
||||||
if (!org_my_init_done)
|
if (!org_my_init_done)
|
||||||
{
|
{
|
||||||
my_end(MY_DONT_FREE_DBUG);
|
my_end(MY_DONT_FREE_DBUG);
|
||||||
@ -184,8 +186,11 @@ void STDCALL mysql_server_end()
|
|||||||
DBUG_POP();
|
DBUG_POP();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
free_charsets();
|
||||||
mysql_thread_end();
|
mysql_thread_end();
|
||||||
vio_end();
|
}
|
||||||
|
|
||||||
mysql_client_init= org_my_init_done= 0;
|
mysql_client_init= org_my_init_done= 0;
|
||||||
#ifdef EMBEDDED_SERVER
|
#ifdef EMBEDDED_SERVER
|
||||||
if (stderror_file)
|
if (stderror_file)
|
||||||
|
@ -42,7 +42,7 @@ base64_needed_encoded_length(int length_of_data)
|
|||||||
int
|
int
|
||||||
base64_needed_decoded_length(int length_of_encoded_data)
|
base64_needed_decoded_length(int length_of_encoded_data)
|
||||||
{
|
{
|
||||||
return (int)ceil(length_of_encoded_data * 3 / 4);
|
return (int) ceil(length_of_encoded_data * 3 / 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -84,7 +84,7 @@ static void rb_delete_fixup(TREE *tree,TREE_ELEMENT ***parent);
|
|||||||
static int test_rb_tree(TREE_ELEMENT *element);
|
static int test_rb_tree(TREE_ELEMENT *element);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void init_tree(TREE *tree, uint default_alloc_size, uint memory_limit,
|
void init_tree(TREE *tree, ulong default_alloc_size, ulong memory_limit,
|
||||||
int size, qsort_cmp2 compare, my_bool with_delete,
|
int size, qsort_cmp2 compare, my_bool with_delete,
|
||||||
tree_element_free free_element, void *custom_arg)
|
tree_element_free free_element, void *custom_arg)
|
||||||
{
|
{
|
||||||
@ -128,7 +128,7 @@ void init_tree(TREE *tree, uint default_alloc_size, uint memory_limit,
|
|||||||
}
|
}
|
||||||
if (!(tree->with_delete=with_delete))
|
if (!(tree->with_delete=with_delete))
|
||||||
{
|
{
|
||||||
init_alloc_root(&tree->mem_root, default_alloc_size,0);
|
init_alloc_root(&tree->mem_root, (uint) default_alloc_size, 0);
|
||||||
tree->mem_root.min_malloc=(sizeof(TREE_ELEMENT)+tree->size_of_element);
|
tree->mem_root.min_malloc=(sizeof(TREE_ELEMENT)+tree->size_of_element);
|
||||||
}
|
}
|
||||||
DBUG_VOID_RETURN;
|
DBUG_VOID_RETURN;
|
||||||
|
@ -15,7 +15,6 @@
|
|||||||
#define snprintf _snprintf
|
#define snprintf _snprintf
|
||||||
|
|
||||||
#define SIGKILL 9
|
#define SIGKILL 9
|
||||||
#define SHUT_RDWR 0x2
|
|
||||||
|
|
||||||
/*TODO: fix this */
|
/*TODO: fix this */
|
||||||
#define PROTOCOL_VERSION 10
|
#define PROTOCOL_VERSION 10
|
||||||
|
22
sql/field.cc
22
sql/field.cc
@ -5528,11 +5528,11 @@ int Field_newdate::store_time(TIME *ltime,timestamp_type type)
|
|||||||
if (type == MYSQL_TIMESTAMP_DATE || type == MYSQL_TIMESTAMP_DATETIME)
|
if (type == MYSQL_TIMESTAMP_DATE || type == MYSQL_TIMESTAMP_DATETIME)
|
||||||
{
|
{
|
||||||
tmp=ltime->year*16*32+ltime->month*32+ltime->day;
|
tmp=ltime->year*16*32+ltime->month*32+ltime->day;
|
||||||
if ((my_bool)check_date(ltime, tmp,
|
if (check_date(ltime, tmp != 0,
|
||||||
(TIME_FUZZY_DATE |
|
(TIME_FUZZY_DATE |
|
||||||
(current_thd->variables.sql_mode &
|
(current_thd->variables.sql_mode &
|
||||||
(MODE_NO_ZERO_IN_DATE | MODE_NO_ZERO_DATE |
|
(MODE_NO_ZERO_IN_DATE | MODE_NO_ZERO_DATE |
|
||||||
MODE_INVALID_DATES))), &error))
|
MODE_INVALID_DATES))), &error))
|
||||||
{
|
{
|
||||||
char buff[12];
|
char buff[12];
|
||||||
String str(buff, sizeof(buff), &my_charset_latin1);
|
String str(buff, sizeof(buff), &my_charset_latin1);
|
||||||
@ -5758,11 +5758,11 @@ int Field_datetime::store_time(TIME *ltime,timestamp_type type)
|
|||||||
{
|
{
|
||||||
tmp=((ltime->year*10000L+ltime->month*100+ltime->day)*LL(1000000)+
|
tmp=((ltime->year*10000L+ltime->month*100+ltime->day)*LL(1000000)+
|
||||||
(ltime->hour*10000L+ltime->minute*100+ltime->second));
|
(ltime->hour*10000L+ltime->minute*100+ltime->second));
|
||||||
if ((my_bool)check_date(ltime, tmp,
|
if (check_date(ltime, tmp != 0,
|
||||||
(TIME_FUZZY_DATE |
|
(TIME_FUZZY_DATE |
|
||||||
(current_thd->variables.sql_mode &
|
(current_thd->variables.sql_mode &
|
||||||
(MODE_NO_ZERO_IN_DATE | MODE_NO_ZERO_DATE |
|
(MODE_NO_ZERO_IN_DATE | MODE_NO_ZERO_DATE |
|
||||||
MODE_INVALID_DATES))), &error))
|
MODE_INVALID_DATES))), &error))
|
||||||
{
|
{
|
||||||
char buff[19];
|
char buff[19];
|
||||||
String str(buff, sizeof(buff), &my_charset_latin1);
|
String str(buff, sizeof(buff), &my_charset_latin1);
|
||||||
@ -8506,7 +8506,7 @@ int Field_bit_as_char::store(const char *from, uint length, CHARSET_INFO *cs)
|
|||||||
{
|
{
|
||||||
ASSERT_COLUMN_MARKED_FOR_WRITE;
|
ASSERT_COLUMN_MARKED_FOR_WRITE;
|
||||||
int delta;
|
int delta;
|
||||||
uchar bits= field_length & 7;
|
uchar bits= (uchar) (field_length & 7);
|
||||||
|
|
||||||
for (; length && !*from; from++, length--); // skip left 0's
|
for (; length && !*from; from++, length--); // skip left 0's
|
||||||
delta= bytes_in_rec - length;
|
delta= bytes_in_rec - length;
|
||||||
|
@ -273,7 +273,6 @@ my_decimal *Item::val_decimal_from_date(my_decimal *decimal_value)
|
|||||||
{
|
{
|
||||||
DBUG_ASSERT(fixed == 1);
|
DBUG_ASSERT(fixed == 1);
|
||||||
TIME ltime;
|
TIME ltime;
|
||||||
longlong date;
|
|
||||||
if (get_date(<ime, TIME_FUZZY_DATE))
|
if (get_date(<ime, TIME_FUZZY_DATE))
|
||||||
{
|
{
|
||||||
my_decimal_set_zero(decimal_value);
|
my_decimal_set_zero(decimal_value);
|
||||||
@ -287,7 +286,6 @@ my_decimal *Item::val_decimal_from_time(my_decimal *decimal_value)
|
|||||||
{
|
{
|
||||||
DBUG_ASSERT(fixed == 1);
|
DBUG_ASSERT(fixed == 1);
|
||||||
TIME ltime;
|
TIME ltime;
|
||||||
longlong date;
|
|
||||||
if (get_time(<ime))
|
if (get_time(<ime))
|
||||||
{
|
{
|
||||||
my_decimal_set_zero(decimal_value);
|
my_decimal_set_zero(decimal_value);
|
||||||
|
@ -3268,4 +3268,3 @@ String *Item_func_uuid::val_str(String *str)
|
|||||||
strmov(s+18, clock_seq_and_node_str);
|
strmov(s+18, clock_seq_and_node_str);
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1044,7 +1044,7 @@ Query_cache::send_result_to_client(THD *thd, char *sql, uint query_length)
|
|||||||
(pre-space is removed in dispatch_command).
|
(pre-space is removed in dispatch_command).
|
||||||
|
|
||||||
First '/' looks like comment before command it is not
|
First '/' looks like comment before command it is not
|
||||||
frequently appeared in real lihe, consequently we can
|
frequently appeared in real life, consequently we can
|
||||||
check all such queries, too.
|
check all such queries, too.
|
||||||
*/
|
*/
|
||||||
if ((my_toupper(system_charset_info, sql[i]) != 'S' ||
|
if ((my_toupper(system_charset_info, sql[i]) != 'S' ||
|
||||||
|
@ -353,7 +353,7 @@ do_rename(THD *thd, TABLE_LIST *ren_table, char *new_db, char *new_table_name,
|
|||||||
static TABLE_LIST *
|
static TABLE_LIST *
|
||||||
rename_tables(THD *thd, TABLE_LIST *table_list, bool skip_error)
|
rename_tables(THD *thd, TABLE_LIST *table_list, bool skip_error)
|
||||||
{
|
{
|
||||||
TABLE_LIST *ren_table,*new_table;
|
TABLE_LIST *ren_table, *new_table;
|
||||||
|
|
||||||
DBUG_ENTER("rename_tables");
|
DBUG_ENTER("rename_tables");
|
||||||
|
|
||||||
|
@ -82,7 +82,7 @@ static store_key *get_store_key(THD *thd,
|
|||||||
static bool make_simple_join(JOIN *join,TABLE *tmp_table);
|
static bool make_simple_join(JOIN *join,TABLE *tmp_table);
|
||||||
static void make_outerjoin_info(JOIN *join);
|
static void make_outerjoin_info(JOIN *join);
|
||||||
static bool make_join_select(JOIN *join,SQL_SELECT *select,COND *item);
|
static bool make_join_select(JOIN *join,SQL_SELECT *select,COND *item);
|
||||||
static void make_join_readinfo(JOIN *join,uint options);
|
static void make_join_readinfo(JOIN *join, ulonglong options);
|
||||||
static bool only_eq_ref_tables(JOIN *join, ORDER *order, table_map tables);
|
static bool only_eq_ref_tables(JOIN *join, ORDER *order, table_map tables);
|
||||||
static void update_depend_map(JOIN *join);
|
static void update_depend_map(JOIN *join);
|
||||||
static void update_depend_map(JOIN *join, ORDER *order);
|
static void update_depend_map(JOIN *join, ORDER *order);
|
||||||
@ -90,7 +90,7 @@ static ORDER *remove_const(JOIN *join,ORDER *first_order,COND *cond,
|
|||||||
bool change_list, bool *simple_order);
|
bool change_list, bool *simple_order);
|
||||||
static int return_zero_rows(JOIN *join, select_result *res,TABLE_LIST *tables,
|
static int return_zero_rows(JOIN *join, select_result *res,TABLE_LIST *tables,
|
||||||
List<Item> &fields, bool send_row,
|
List<Item> &fields, bool send_row,
|
||||||
uint select_options, const char *info,
|
ulonglong select_options, const char *info,
|
||||||
Item *having);
|
Item *having);
|
||||||
static COND *build_equal_items(THD *thd, COND *cond,
|
static COND *build_equal_items(THD *thd, COND *cond,
|
||||||
COND_EQUAL *inherited,
|
COND_EQUAL *inherited,
|
||||||
@ -114,7 +114,7 @@ static bool resolve_nested_join (TABLE_LIST *table);
|
|||||||
static bool const_expression_in_where(COND *conds,Item *item, Item **comp_item);
|
static bool const_expression_in_where(COND *conds,Item *item, Item **comp_item);
|
||||||
static bool open_tmp_table(TABLE *table);
|
static bool open_tmp_table(TABLE *table);
|
||||||
static bool create_myisam_tmp_table(TABLE *table,TMP_TABLE_PARAM *param,
|
static bool create_myisam_tmp_table(TABLE *table,TMP_TABLE_PARAM *param,
|
||||||
ulong options);
|
ulonglong options);
|
||||||
static int do_select(JOIN *join,List<Item> *fields,TABLE *tmp_table,
|
static int do_select(JOIN *join,List<Item> *fields,TABLE *tmp_table,
|
||||||
Procedure *proc);
|
Procedure *proc);
|
||||||
|
|
||||||
@ -5939,7 +5939,7 @@ make_join_select(JOIN *join,SQL_SELECT *select,COND *cond)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
make_join_readinfo(JOIN *join, uint options)
|
make_join_readinfo(JOIN *join, ulonglong options)
|
||||||
{
|
{
|
||||||
uint i;
|
uint i;
|
||||||
bool statistics= test(!(join->select_options & SELECT_DESCRIBE));
|
bool statistics= test(!(join->select_options & SELECT_DESCRIBE));
|
||||||
@ -6596,7 +6596,7 @@ remove_const(JOIN *join,ORDER *first_order, COND *cond,
|
|||||||
|
|
||||||
static int
|
static int
|
||||||
return_zero_rows(JOIN *join, select_result *result,TABLE_LIST *tables,
|
return_zero_rows(JOIN *join, select_result *result,TABLE_LIST *tables,
|
||||||
List<Item> &fields, bool send_row, uint select_options,
|
List<Item> &fields, bool send_row, ulonglong select_options,
|
||||||
const char *info, Item *having)
|
const char *info, Item *having)
|
||||||
{
|
{
|
||||||
DBUG_ENTER("return_zero_rows");
|
DBUG_ENTER("return_zero_rows");
|
||||||
@ -9518,10 +9518,11 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields,
|
|||||||
if (thd->variables.tmp_table_size == ~ (ulonglong) 0) // No limit
|
if (thd->variables.tmp_table_size == ~ (ulonglong) 0) // No limit
|
||||||
share->max_rows= ~(ha_rows) 0;
|
share->max_rows= ~(ha_rows) 0;
|
||||||
else
|
else
|
||||||
share->max_rows= (((share->db_type == heap_hton) ?
|
share->max_rows= (ha_rows) (((share->db_type == heap_hton) ?
|
||||||
min(thd->variables.tmp_table_size,
|
min(thd->variables.tmp_table_size,
|
||||||
thd->variables.max_heap_table_size) :
|
thd->variables.max_heap_table_size) :
|
||||||
thd->variables.tmp_table_size)/ share->reclength);
|
thd->variables.tmp_table_size) /
|
||||||
|
share->reclength);
|
||||||
set_if_bigger(share->max_rows,1); // For dummy start options
|
set_if_bigger(share->max_rows,1); // For dummy start options
|
||||||
/*
|
/*
|
||||||
Push the LIMIT clause to the temporary table creation, so that we
|
Push the LIMIT clause to the temporary table creation, so that we
|
||||||
@ -9833,7 +9834,7 @@ static bool open_tmp_table(TABLE *table)
|
|||||||
|
|
||||||
|
|
||||||
static bool create_myisam_tmp_table(TABLE *table,TMP_TABLE_PARAM *param,
|
static bool create_myisam_tmp_table(TABLE *table,TMP_TABLE_PARAM *param,
|
||||||
ulong options)
|
ulonglong options)
|
||||||
{
|
{
|
||||||
int error;
|
int error;
|
||||||
MI_KEYDEF keydef;
|
MI_KEYDEF keydef;
|
||||||
|
@ -2057,7 +2057,7 @@ tz_load_from_open_tables(const String *tz_name, TABLE_LIST *tz_tables)
|
|||||||
tz_info->timecnt++;
|
tz_info->timecnt++;
|
||||||
|
|
||||||
DBUG_PRINT("info",
|
DBUG_PRINT("info",
|
||||||
("time_zone_transition table: tz_id: %u tt_time:%lu tt_id: %u",
|
("time_zone_transition table: tz_id: %u tt_time: %lu tt_id: %u",
|
||||||
tzid, (ulong) ttime, ttid));
|
tzid, (ulong) ttime, ttid));
|
||||||
|
|
||||||
res= table->file->index_next_same(table->record[0],
|
res= table->file->index_next_same(table->record[0],
|
||||||
|
@ -59,14 +59,15 @@ Unique::Unique(qsort_cmp2 comp_func, void * comp_func_fixed_arg,
|
|||||||
:max_in_memory_size(max_in_memory_size_arg), size(size_arg), elements(0)
|
:max_in_memory_size(max_in_memory_size_arg), size(size_arg), elements(0)
|
||||||
{
|
{
|
||||||
my_b_clear(&file);
|
my_b_clear(&file);
|
||||||
init_tree(&tree, max_in_memory_size / 16, 0, size, comp_func, 0, NULL,
|
init_tree(&tree, (ulong) (max_in_memory_size / 16), 0, size, comp_func, 0,
|
||||||
comp_func_fixed_arg);
|
NULL, comp_func_fixed_arg);
|
||||||
/* If the following fail's the next add will also fail */
|
/* If the following fail's the next add will also fail */
|
||||||
my_init_dynamic_array(&file_ptrs, sizeof(BUFFPEK), 16, 16);
|
my_init_dynamic_array(&file_ptrs, sizeof(BUFFPEK), 16, 16);
|
||||||
/*
|
/*
|
||||||
If you change the following, change it in get_max_elements function, too.
|
If you change the following, change it in get_max_elements function, too.
|
||||||
*/
|
*/
|
||||||
max_elements= max_in_memory_size / ALIGN_SIZE(sizeof(TREE_ELEMENT)+size);
|
max_elements= (ulong) (max_in_memory_size /
|
||||||
|
ALIGN_SIZE(sizeof(TREE_ELEMENT)+size));
|
||||||
VOID(open_cached_file(&file, mysql_tmpdir,TEMP_PREFIX, DISK_BUFFER_SIZE,
|
VOID(open_cached_file(&file, mysql_tmpdir,TEMP_PREFIX, DISK_BUFFER_SIZE,
|
||||||
MYF(MY_WME)));
|
MYF(MY_WME)));
|
||||||
}
|
}
|
||||||
@ -267,8 +268,8 @@ double Unique::get_use_cost(uint *buffer, uint nkeys, uint key_size,
|
|||||||
int n_full_trees; /* number of trees in unique - 1 */
|
int n_full_trees; /* number of trees in unique - 1 */
|
||||||
double result;
|
double result;
|
||||||
|
|
||||||
max_elements_in_tree=
|
max_elements_in_tree= ((ulong) max_in_memory_size /
|
||||||
max_in_memory_size / ALIGN_SIZE(sizeof(TREE_ELEMENT)+key_size);
|
ALIGN_SIZE(sizeof(TREE_ELEMENT)+key_size));
|
||||||
|
|
||||||
n_full_trees= nkeys / max_elements_in_tree;
|
n_full_trees= nkeys / max_elements_in_tree;
|
||||||
last_tree_elems= nkeys % max_elements_in_tree;
|
last_tree_elems= nkeys % max_elements_in_tree;
|
||||||
@ -386,9 +387,11 @@ C_MODE_END
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
DESCRIPTION
|
DESCRIPTION
|
||||||
|
|
||||||
Function is very similar to merge_buffers, but instead of writing sorted
|
Function is very similar to merge_buffers, but instead of writing sorted
|
||||||
unique keys to the output file, it invokes walk_action for each key.
|
unique keys to the output file, it invokes walk_action for each key.
|
||||||
This saves I/O if you need to pass through all unique keys only once.
|
This saves I/O if you need to pass through all unique keys only once.
|
||||||
|
|
||||||
SYNOPSIS
|
SYNOPSIS
|
||||||
merge_walk()
|
merge_walk()
|
||||||
All params are 'IN' (but see comment for begin, end):
|
All params are 'IN' (but see comment for begin, end):
|
||||||
@ -416,7 +419,7 @@ C_MODE_END
|
|||||||
<> 0 error
|
<> 0 error
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static bool merge_walk(uchar *merge_buffer, uint merge_buffer_size,
|
static bool merge_walk(uchar *merge_buffer, ulong merge_buffer_size,
|
||||||
uint key_length, BUFFPEK *begin, BUFFPEK *end,
|
uint key_length, BUFFPEK *begin, BUFFPEK *end,
|
||||||
tree_walk_action walk_action, void *walk_action_arg,
|
tree_walk_action walk_action, void *walk_action_arg,
|
||||||
qsort_cmp2 compare, void *compare_arg,
|
qsort_cmp2 compare, void *compare_arg,
|
||||||
@ -425,14 +428,15 @@ static bool merge_walk(uchar *merge_buffer, uint merge_buffer_size,
|
|||||||
BUFFPEK_COMPARE_CONTEXT compare_context = { compare, compare_arg };
|
BUFFPEK_COMPARE_CONTEXT compare_context = { compare, compare_arg };
|
||||||
QUEUE queue;
|
QUEUE queue;
|
||||||
if (end <= begin ||
|
if (end <= begin ||
|
||||||
merge_buffer_size < key_length * (end - begin + 1) ||
|
merge_buffer_size < (ulong) (key_length * (end - begin + 1)) ||
|
||||||
init_queue(&queue, end - begin, offsetof(BUFFPEK, key), 0,
|
init_queue(&queue, (uint) (end - begin), offsetof(BUFFPEK, key), 0,
|
||||||
buffpek_compare, &compare_context))
|
buffpek_compare, &compare_context))
|
||||||
return 1;
|
return 1;
|
||||||
/* we need space for one key when a piece of merge buffer is re-read */
|
/* we need space for one key when a piece of merge buffer is re-read */
|
||||||
merge_buffer_size-= key_length;
|
merge_buffer_size-= key_length;
|
||||||
uchar *save_key_buff= merge_buffer + merge_buffer_size;
|
uchar *save_key_buff= merge_buffer + merge_buffer_size;
|
||||||
uint max_key_count_per_piece= merge_buffer_size/(end-begin)/key_length;
|
uint max_key_count_per_piece= (uint) (merge_buffer_size/(end-begin) /
|
||||||
|
key_length);
|
||||||
/* if piece_size is aligned reuse_freed_buffer will always hit */
|
/* if piece_size is aligned reuse_freed_buffer will always hit */
|
||||||
uint piece_size= max_key_count_per_piece * key_length;
|
uint piece_size= max_key_count_per_piece * key_length;
|
||||||
uint bytes_read; /* to hold return value of read_to_buffer */
|
uint bytes_read; /* to hold return value of read_to_buffer */
|
||||||
@ -548,6 +552,9 @@ end:
|
|||||||
|
|
||||||
bool Unique::walk(tree_walk_action action, void *walk_action_arg)
|
bool Unique::walk(tree_walk_action action, void *walk_action_arg)
|
||||||
{
|
{
|
||||||
|
int res;
|
||||||
|
uchar *merge_buffer;
|
||||||
|
|
||||||
if (elements == 0) /* the whole tree is in memory */
|
if (elements == 0) /* the whole tree is in memory */
|
||||||
return tree_walk(&tree, action, walk_action_arg, left_root_right);
|
return tree_walk(&tree, action, walk_action_arg, left_root_right);
|
||||||
|
|
||||||
@ -556,15 +563,14 @@ bool Unique::walk(tree_walk_action action, void *walk_action_arg)
|
|||||||
return 1;
|
return 1;
|
||||||
if (flush_io_cache(&file) || reinit_io_cache(&file, READ_CACHE, 0L, 0, 0))
|
if (flush_io_cache(&file) || reinit_io_cache(&file, READ_CACHE, 0L, 0, 0))
|
||||||
return 1;
|
return 1;
|
||||||
uchar *merge_buffer= (uchar *) my_malloc(max_in_memory_size, MYF(0));
|
if (!(merge_buffer= (uchar *) my_malloc((ulong) max_in_memory_size, MYF(0))))
|
||||||
if (merge_buffer == 0)
|
|
||||||
return 1;
|
return 1;
|
||||||
int res= merge_walk(merge_buffer, max_in_memory_size, size,
|
res= merge_walk(merge_buffer, (ulong) max_in_memory_size, size,
|
||||||
(BUFFPEK *) file_ptrs.buffer,
|
(BUFFPEK *) file_ptrs.buffer,
|
||||||
(BUFFPEK *) file_ptrs.buffer + file_ptrs.elements,
|
(BUFFPEK *) file_ptrs.buffer + file_ptrs.elements,
|
||||||
action, walk_action_arg,
|
action, walk_action_arg,
|
||||||
tree.compare, tree.custom_arg, &file);
|
tree.compare, tree.custom_arg, &file);
|
||||||
x_free(merge_buffer);
|
my_free((char*) merge_buffer, MYF(0));
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -615,7 +621,7 @@ bool Unique::get(TABLE *table)
|
|||||||
sort_param.sort_form=table;
|
sort_param.sort_form=table;
|
||||||
sort_param.rec_length= sort_param.sort_length= sort_param.ref_length=
|
sort_param.rec_length= sort_param.sort_length= sort_param.ref_length=
|
||||||
size;
|
size;
|
||||||
sort_param.keys= max_in_memory_size / sort_param.sort_length;
|
sort_param.keys= (uint) (max_in_memory_size / sort_param.sort_length);
|
||||||
sort_param.not_killable=1;
|
sort_param.not_killable=1;
|
||||||
|
|
||||||
if (!(sort_buffer=(uchar*) my_malloc((sort_param.keys+1) *
|
if (!(sort_buffer=(uchar*) my_malloc((sort_param.keys+1) *
|
||||||
|
@ -2020,8 +2020,8 @@ int ha_federated::delete_row(const byte *buf)
|
|||||||
{
|
{
|
||||||
DBUG_RETURN(stash_remote_error());
|
DBUG_RETURN(stash_remote_error());
|
||||||
}
|
}
|
||||||
stats.deleted+= (ha_rows)mysql->affected_rows;
|
deleted+= (ha_rows) mysql->affected_rows;
|
||||||
stats.records-= (ha_rows)mysql->affected_rows;
|
records-= (ha_rows) mysql->affected_rows;
|
||||||
DBUG_PRINT("info",
|
DBUG_PRINT("info",
|
||||||
("rows deleted %ld rows deleted for all time %ld",
|
("rows deleted %ld rows deleted for all time %ld",
|
||||||
(long) mysql->affected_rows, (long) stats.deleted));
|
(long) mysql->affected_rows, (long) stats.deleted));
|
||||||
|
@ -36,7 +36,8 @@ void hp_clear(HP_SHARE *info)
|
|||||||
(byte*) 0));
|
(byte*) 0));
|
||||||
info->block.levels=0;
|
info->block.levels=0;
|
||||||
hp_clear_keys(info);
|
hp_clear_keys(info);
|
||||||
info->records=info->deleted=info->data_length=0;
|
info->records= info->deleted= 0;
|
||||||
|
info->data_length= 0;
|
||||||
info->blength=1;
|
info->blength=1;
|
||||||
info->changed=0;
|
info->changed=0;
|
||||||
info->del_link=0;
|
info->del_link=0;
|
||||||
|
@ -438,9 +438,9 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs,
|
|||||||
block_length= max(block_length, MI_MIN_KEY_BLOCK_LENGTH);
|
block_length= max(block_length, MI_MIN_KEY_BLOCK_LENGTH);
|
||||||
block_length= min(block_length, MI_MAX_KEY_BLOCK_LENGTH);
|
block_length= min(block_length, MI_MAX_KEY_BLOCK_LENGTH);
|
||||||
|
|
||||||
keydef->block_length= MI_BLOCK_SIZE(length-real_length_diff,
|
keydef->block_length= (uint16) MI_BLOCK_SIZE(length-real_length_diff,
|
||||||
pointer,MI_MAX_KEYPTR_SIZE,
|
pointer,MI_MAX_KEYPTR_SIZE,
|
||||||
block_length);
|
block_length);
|
||||||
if (keydef->block_length > MI_MAX_KEY_BLOCK_LENGTH ||
|
if (keydef->block_length > MI_MAX_KEY_BLOCK_LENGTH ||
|
||||||
length >= MI_MAX_KEY_BUFF)
|
length >= MI_MAX_KEY_BUFF)
|
||||||
{
|
{
|
||||||
|
@ -1105,9 +1105,9 @@ static int get_statistic(PACK_MRG_INFO *mrg,HUFF_COUNTS *huff_counts)
|
|||||||
my_off_t total_count;
|
my_off_t total_count;
|
||||||
char llbuf[32];
|
char llbuf[32];
|
||||||
|
|
||||||
DBUG_PRINT("info", ("column: %3u", (uint) (count - huff_counts) + 1));
|
DBUG_PRINT("info", ("column: %3u", (uint) (count - huff_counts + 1)));
|
||||||
if (verbose >= 2)
|
if (verbose >= 2)
|
||||||
VOID(printf("column: %3u\n", (uint) (count - huff_counts) + 1));
|
VOID(printf("column: %3u\n", (uint) (count - huff_counts + 1)));
|
||||||
if (count->tree_buff)
|
if (count->tree_buff)
|
||||||
{
|
{
|
||||||
DBUG_PRINT("info", ("number of distinct values: %u",
|
DBUG_PRINT("info", ("number of distinct values: %u",
|
||||||
@ -2279,8 +2279,7 @@ static my_off_t write_huff_tree(HUFF_TREE *huff_tree, uint trees)
|
|||||||
if (bits > 8 * sizeof(code))
|
if (bits > 8 * sizeof(code))
|
||||||
{
|
{
|
||||||
VOID(fflush(stdout));
|
VOID(fflush(stdout));
|
||||||
VOID(fprintf(stderr, "error: Huffman code too long: %u/%lu\n",
|
bits, (uint) (8 * sizeof(code))));
|
||||||
bits, (ulong) (8 * sizeof(code))));
|
|
||||||
errors++;
|
errors++;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -87,8 +87,8 @@ int myrg_rkey(MYRG_INFO *info,byte *buf,int inx, const byte *key,
|
|||||||
|
|
||||||
mi=(info->current_table=(MYRG_TABLE *)queue_top(&(info->by_key)))->table;
|
mi=(info->current_table=(MYRG_TABLE *)queue_top(&(info->by_key)))->table;
|
||||||
mi->once_flags|= RRND_PRESERVE_LASTINX;
|
mi->once_flags|= RRND_PRESERVE_LASTINX;
|
||||||
DBUG_PRINT("info", ("using table no: %u",
|
DBUG_PRINT("info", ("using table no: %d",
|
||||||
(uint) (info->current_table - info->open_tables) + 1));
|
(int) (info->current_table - info->open_tables + 1)));
|
||||||
DBUG_DUMP("result key", (byte*) mi->lastkey, mi->lastkey_length);
|
DBUG_DUMP("result key", (byte*) mi->lastkey, mi->lastkey_length);
|
||||||
DBUG_RETURN(_myrg_mi_read_record(mi,buf));
|
DBUG_RETURN(_myrg_mi_read_record(mi,buf));
|
||||||
}
|
}
|
||||||
|
@ -184,7 +184,7 @@ ndb_mgm_create_handle()
|
|||||||
h->mgmd_version_minor= -1;
|
h->mgmd_version_minor= -1;
|
||||||
h->mgmd_version_build= -1;
|
h->mgmd_version_build= -1;
|
||||||
|
|
||||||
DBUG_PRINT("info", ("handle: 0x%lx", (ulong) h));
|
DBUG_PRINT("info", ("handle: 0x%lx", (long) h));
|
||||||
DBUG_RETURN(h);
|
DBUG_RETURN(h);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -201,7 +201,7 @@ int
|
|||||||
ndb_mgm_set_connectstring(NdbMgmHandle handle, const char * mgmsrv)
|
ndb_mgm_set_connectstring(NdbMgmHandle handle, const char * mgmsrv)
|
||||||
{
|
{
|
||||||
DBUG_ENTER("ndb_mgm_set_connectstring");
|
DBUG_ENTER("ndb_mgm_set_connectstring");
|
||||||
DBUG_PRINT("info", ("handle: 0x%lx", (ulong) handle));
|
DBUG_PRINT("info", ("handle: 0x%lx", (long) handle));
|
||||||
handle->cfg.~LocalConfig();
|
handle->cfg.~LocalConfig();
|
||||||
new (&(handle->cfg)) LocalConfig;
|
new (&(handle->cfg)) LocalConfig;
|
||||||
if (!handle->cfg.init(mgmsrv, 0) ||
|
if (!handle->cfg.init(mgmsrv, 0) ||
|
||||||
@ -243,7 +243,7 @@ ndb_mgm_destroy_handle(NdbMgmHandle * handle)
|
|||||||
DBUG_ENTER("ndb_mgm_destroy_handle");
|
DBUG_ENTER("ndb_mgm_destroy_handle");
|
||||||
if(!handle)
|
if(!handle)
|
||||||
DBUG_VOID_RETURN;
|
DBUG_VOID_RETURN;
|
||||||
DBUG_PRINT("info", ("handle: 0x%lx", (ulong) (* handle)));
|
DBUG_PRINT("info", ("handle: 0x%lx", (long) (* handle)));
|
||||||
/**
|
/**
|
||||||
* important! only disconnect if connected
|
* important! only disconnect if connected
|
||||||
* other code relies on this
|
* other code relies on this
|
||||||
|
@ -1010,7 +1010,7 @@ void
|
|||||||
NdbTransaction::releaseExecutedScanOperation(NdbIndexScanOperation* cursorOp)
|
NdbTransaction::releaseExecutedScanOperation(NdbIndexScanOperation* cursorOp)
|
||||||
{
|
{
|
||||||
DBUG_ENTER("NdbTransaction::releaseExecutedScanOperation");
|
DBUG_ENTER("NdbTransaction::releaseExecutedScanOperation");
|
||||||
DBUG_PRINT("enter", ("this: 0x%lx op: 0x%lx", (ulong) this, (ulong) cursorOp));
|
DBUG_PRINT("enter", ("this: 0x%lx op: 0x%lx", (long) this, (long) cursorOp));
|
||||||
|
|
||||||
releaseScanOperation(&m_firstExecutedScanOp, 0, cursorOp);
|
releaseScanOperation(&m_firstExecutedScanOp, 0, cursorOp);
|
||||||
|
|
||||||
|
@ -361,7 +361,7 @@ void
|
|||||||
Ndb::releaseScanOperation(NdbIndexScanOperation* aScanOperation)
|
Ndb::releaseScanOperation(NdbIndexScanOperation* aScanOperation)
|
||||||
{
|
{
|
||||||
DBUG_ENTER("Ndb::releaseScanOperation");
|
DBUG_ENTER("Ndb::releaseScanOperation");
|
||||||
DBUG_PRINT("enter", ("op: 0x%lx", (ulong) aScanOperation));
|
DBUG_PRINT("enter", ("op: 0x%lx", (long) aScanOperation));
|
||||||
#ifdef ndb_release_check_dup
|
#ifdef ndb_release_check_dup
|
||||||
{ NdbIndexScanOperation* tOp = theScanOpIdleList;
|
{ NdbIndexScanOperation* tOp = theScanOpIdleList;
|
||||||
while (tOp != NULL) {
|
while (tOp != NULL) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user