diff options
author | Monty <monty@mariadb.org> | 2017-05-17 00:34:48 +0300 |
---|---|---|
committer | Monty <monty@mariadb.org> | 2017-05-17 00:34:48 +0300 |
commit | 6378c95ee07cccc2f2187b2caddc4496e14827d9 (patch) | |
tree | 1e7b9066e15288e3471f0c800e5dda820d3d0daf /sql | |
parent | 314350a722e65081472113c53657ad239f3bef72 (diff) | |
download | mariadb-git-6378c95ee07cccc2f2187b2caddc4496e14827d9.tar.gz |
Fix that end_bulk_insert() doesn't write to to-be-deleted files
This affected mainly MyISAM and Aria engines.
Also fixed that end_bulk_insert() detects errors from
internal mi_end_bulk_insert() and ma_end_bulk_insert()
- delete_tree() and delete_tree_element() now has an
extra argument that marks if future calls to
tree->free should be ignored.
- tree->free changed to function returning int, to be
able to signal errors.
- Restored deleting flag in MyISAM that was accidently
disabled in mi_extra(PREPARE_FOR_DROP)
Diffstat (limited to 'sql')
-rw-r--r-- | sql/item_sum.cc | 2 | ||||
-rw-r--r-- | sql/sql_analyse.cc | 23 | ||||
-rw-r--r-- | sql/sql_analyse.h | 4 | ||||
-rw-r--r-- | sql/uniques.cc | 4 |
4 files changed, 17 insertions, 16 deletions
diff --git a/sql/item_sum.cc b/sql/item_sum.cc index 6dccd67316f..77cd20e7386 100644 --- a/sql/item_sum.cc +++ b/sql/item_sum.cc @@ -3290,7 +3290,7 @@ void Item_func_group_concat::cleanup() table= 0; if (tree) { - delete_tree(tree); + delete_tree(tree, 0); tree= 0; } if (unique_filter) diff --git a/sql/sql_analyse.cc b/sql/sql_analyse.cc index d6af0410ad2..1022dde079d 100644 --- a/sql/sql_analyse.cc +++ b/sql/sql_analyse.cc @@ -298,9 +298,10 @@ bool get_ev_num_info(EV_NUM_INFO *ev_info, NUM_INFO *info, const char *num) } // get_ev_num_info -void free_string(String *s) +int free_string(String *s) { s->free(); + return 0; } @@ -374,7 +375,7 @@ void field_str::add() if (!tree_insert(&tree, (void*) &s, 0, tree.custom_arg)) { room_in_tree = 0; // Remove tree, out of RAM ? - delete_tree(&tree); + delete_tree(&tree, 0); } else { @@ -382,7 +383,7 @@ void field_str::add() if ((treemem += length) > pc->max_treemem) { room_in_tree = 0; // Remove tree, too big tree - delete_tree(&tree); + delete_tree(&tree, 0); } } } @@ -441,7 +442,7 @@ void field_real::add() if (!(element = tree_insert(&tree, (void*) &num, 0, tree.custom_arg))) { room_in_tree = 0; // Remove tree, out of RAM ? - delete_tree(&tree); + delete_tree(&tree, 0); } /* if element->count == 1, this element can be found only once from tree @@ -450,7 +451,7 @@ void field_real::add() else if (element->count == 1 && (tree_elements++) >= pc->max_tree_elements) { room_in_tree = 0; // Remove tree, too many elements - delete_tree(&tree); + delete_tree(&tree, 0); } } @@ -507,7 +508,7 @@ void field_decimal::add() if (!(element = tree_insert(&tree, (void*)buf, 0, tree.custom_arg))) { room_in_tree = 0; // Remove tree, out of RAM ? - delete_tree(&tree); + delete_tree(&tree, 0); } /* if element->count == 1, this element can be found only once from tree @@ -516,7 +517,7 @@ void field_decimal::add() else if (element->count == 1 && (tree_elements++) >= pc->max_tree_elements) { room_in_tree = 0; // Remove tree, too many elements - delete_tree(&tree); + delete_tree(&tree, 0); } } @@ -574,7 +575,7 @@ void field_longlong::add() if (!(element = tree_insert(&tree, (void*) &num, 0, tree.custom_arg))) { room_in_tree = 0; // Remove tree, out of RAM ? - delete_tree(&tree); + delete_tree(&tree, 0); } /* if element->count == 1, this element can be found only once from tree @@ -583,7 +584,7 @@ void field_longlong::add() else if (element->count == 1 && (tree_elements++) >= pc->max_tree_elements) { room_in_tree = 0; // Remove tree, too many elements - delete_tree(&tree); + delete_tree(&tree, 0); } } @@ -630,7 +631,7 @@ void field_ulonglong::add() if (!(element = tree_insert(&tree, (void*) &num, 0, tree.custom_arg))) { room_in_tree = 0; // Remove tree, out of RAM ? - delete_tree(&tree); + delete_tree(&tree, 0); } /* if element->count == 1, this element can be found only once from tree @@ -639,7 +640,7 @@ void field_ulonglong::add() else if (element->count == 1 && (tree_elements++) >= pc->max_tree_elements) { room_in_tree = 0; // Remove tree, too many elements - delete_tree(&tree); + delete_tree(&tree, 0); } } diff --git a/sql/sql_analyse.h b/sql/sql_analyse.h index 820877f2a69..6704de4ed6d 100644 --- a/sql/sql_analyse.h +++ b/sql/sql_analyse.h @@ -68,7 +68,7 @@ int compare_ulonglong2(void* cmp_arg __attribute__((unused)), int compare_decimal2(int* len, const char *s, const char *t); Procedure *proc_analyse_init(THD *thd, ORDER *param, select_result *result, List<Item> &field_list); -void free_string(String*); +int free_string(String*); class analyse; class field_info :public Sql_alloc @@ -86,7 +86,7 @@ public: nulls(0), min_length(0), max_length(0), room_in_tree(1), found(0),item(a), pc(b) {}; - virtual ~field_info() { delete_tree(&tree); } + virtual ~field_info() { delete_tree(&tree, 0); } virtual void add() = 0; virtual void get_opt_type(String*, ha_rows) = 0; virtual String *get_min_arg(String *) = 0; diff --git a/sql/uniques.cc b/sql/uniques.cc index f2fa0bf7b1a..da334cc4b8a 100644 --- a/sql/uniques.cc +++ b/sql/uniques.cc @@ -364,7 +364,7 @@ double Unique::get_use_cost(uint *buffer, size_t nkeys, uint key_size, Unique::~Unique() { close_cached_file(&file); - delete_tree(&tree); + delete_tree(&tree, 0); delete_dynamic(&file_ptrs); } @@ -384,7 +384,7 @@ bool Unique::flush() (void*) this, left_root_right) || insert_dynamic(&file_ptrs, (uchar*) &file_ptr)) return 1; - delete_tree(&tree); + delete_tree(&tree, 0); return 0; } |