mirror of
https://github.com/MariaDB/server.git
synced 2025-01-16 03:52:35 +01:00
Fix for bug #809849 spatial operations must be KILL-able.
Checks for thd->killed state added to the long loops in geometry calculations. per-file comments: sql/gcalc_slicescan.cc Fix for bug #809849 spatial operations must be KILL-able. checks for TERMINATED_STATE added. sql/gcalc_slicescan.h Fix for bug #809849 spatial operations must be KILL-able. defines added to include checks for termination in the library. sql/gcalc_tools.cc Fix for bug #809849 spatial operations must be KILL-able. checks for TERMINATED_STATE added. sql/gcalc_tools.h Fix for bug #809849 spatial operations must be KILL-able. TERMINATED_STATE pointers added. sql/item_geofunc.cc Fix for bug #809849 spatial operations must be KILL-able. sql/item_geofunc.h Fix for bug #809849 spatial operations must be KILL-able.
This commit is contained in:
parent
8ea398292e
commit
5a4c91003a
6 changed files with 17 additions and 5 deletions
|
@ -1078,6 +1078,7 @@ void Gcalc_scan_iterator::init(Gcalc_heap *points)
|
|||
#ifndef GCALC_DBUG_OFF
|
||||
m_cur_thread= 0;
|
||||
#endif /*GCALC_DBUG_OFF*/
|
||||
GCALC_SET_TERMINATED(killed, 0);
|
||||
}
|
||||
|
||||
void Gcalc_scan_iterator::reset()
|
||||
|
@ -1263,6 +1264,9 @@ int Gcalc_scan_iterator::step()
|
|||
GCALC_DBUG_ENTER("Gcalc_scan_iterator::step");
|
||||
GCALC_DBUG_ASSERT(more_points());
|
||||
|
||||
if (GCALC_TERMINATED(killed))
|
||||
GCALC_DBUG_RETURN(0xFFFF);
|
||||
|
||||
/* Clear the old event marks. */
|
||||
if (m_bottom_points)
|
||||
{
|
||||
|
|
|
@ -38,6 +38,11 @@
|
|||
#define GCALC_DBUG_ASSERT(r) do {} while(0)
|
||||
#endif /*GCALC_DBUG_OFF*/
|
||||
|
||||
#define GCALC_TERMINATED(state_var) (state_var && (*state_var))
|
||||
#define GCALC_SET_TERMINATED(state_var, val) state_var= val
|
||||
#define GCALC_DECL_TERMINATED_STATE(varname) \
|
||||
volatile int *varname;
|
||||
|
||||
/*
|
||||
Gcalc_dyn_list class designed to manage long lists of same-size objects
|
||||
with the possible efficiency.
|
||||
|
@ -448,6 +453,8 @@ public:
|
|||
public:
|
||||
Gcalc_scan_iterator(size_t blk_size= 8192);
|
||||
|
||||
GCALC_DECL_TERMINATED_STATE(killed)
|
||||
|
||||
void init(Gcalc_heap *points); /* Iterator can be reused */
|
||||
void reset();
|
||||
int step();
|
||||
|
|
|
@ -637,6 +637,7 @@ void Gcalc_operation_reducer::init(Gcalc_function *fn, modes mode)
|
|||
m_lines_hook= (Gcalc_dyn_list::Item **) &m_lines;
|
||||
m_poly_borders= NULL;
|
||||
m_poly_borders_hook= (Gcalc_dyn_list::Item **) &m_poly_borders;
|
||||
GCALC_SET_TERMINATED(killed, 0);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1218,6 +1219,7 @@ int Gcalc_operation_reducer::count_all(Gcalc_heap *hp)
|
|||
Gcalc_scan_iterator si;
|
||||
GCALC_DBUG_ENTER("Gcalc_operation_reducer::count_all");
|
||||
si.init(hp);
|
||||
GCALC_SET_TERMINATED(si.killed, killed);
|
||||
while (si.more_points())
|
||||
{
|
||||
if (si.step())
|
||||
|
|
|
@ -218,6 +218,7 @@ public:
|
|||
void init(Gcalc_function *fn, modes mode= default_mode);
|
||||
Gcalc_operation_reducer(Gcalc_function *fn, modes mode= default_mode,
|
||||
size_t blk_size=8192);
|
||||
GCALC_DECL_TERMINATED_STATE(killed)
|
||||
int count_slice(Gcalc_scan_iterator *si);
|
||||
int count_all(Gcalc_heap *hp);
|
||||
int get_result(Gcalc_result_receiver *storage);
|
||||
|
|
|
@ -896,6 +896,8 @@ longlong Item_func_spatial_rel::val_int()
|
|||
|
||||
collector.prepare_operation();
|
||||
scan_it.init(&collector);
|
||||
scan_it.killed= (int *) &(current_thd->killed);
|
||||
|
||||
#ifdef TMP_BLOCK
|
||||
if (spatial_rel == SP_EQUALS_FUNC)
|
||||
{
|
||||
|
@ -950,7 +952,6 @@ String *Item_func_spatial_operation::val_str(String *str_value)
|
|||
|
||||
|
||||
collector.prepare_operation();
|
||||
scan_it.init(&collector);
|
||||
if (func.alloc_states())
|
||||
goto exit;
|
||||
|
||||
|
@ -973,7 +974,6 @@ String *Item_func_spatial_operation::val_str(String *str_value)
|
|||
exit:
|
||||
collector.reset();
|
||||
func.reset();
|
||||
scan_it.reset();
|
||||
res_receiver.reset();
|
||||
DBUG_RETURN(str_value);
|
||||
}
|
||||
|
@ -1399,6 +1399,7 @@ String *Item_func_buffer::val_str(String *str_value)
|
|||
if (func.alloc_states())
|
||||
goto mem_error;
|
||||
operation.init(&func);
|
||||
operation.killed= (int *) &(current_thd->killed);
|
||||
|
||||
if (operation.count_all(&collector) ||
|
||||
operation.get_result(&res_receiver))
|
||||
|
@ -1419,7 +1420,6 @@ String *Item_func_buffer::val_str(String *str_value)
|
|||
mem_error:
|
||||
collector.reset();
|
||||
func.reset();
|
||||
scan_it.reset();
|
||||
res_receiver.reset();
|
||||
DBUG_RETURN(str_result);
|
||||
}
|
||||
|
|
|
@ -266,7 +266,6 @@ public:
|
|||
Gcalc_function::op_type spatial_op;
|
||||
Gcalc_heap collector;
|
||||
Gcalc_function func;
|
||||
Gcalc_scan_iterator scan_it;
|
||||
|
||||
Gcalc_result_receiver res_receiver;
|
||||
Gcalc_operation_reducer operation;
|
||||
|
@ -323,7 +322,6 @@ protected:
|
|||
};
|
||||
Gcalc_heap collector;
|
||||
Gcalc_function func;
|
||||
Gcalc_scan_iterator scan_it;
|
||||
|
||||
Gcalc_result_receiver res_receiver;
|
||||
Gcalc_operation_reducer operation;
|
||||
|
|
Loading…
Reference in a new issue