mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 23:21:59 +00:00
add cancel test
This commit is contained in:
parent
980528ed75
commit
4fe0dda453
@ -108,7 +108,7 @@ BlockInputStreamPtr FormatFactory::getInput(
|
||||
const Settings & settings = context.getSettingsRef();
|
||||
const auto & file_segmentation_engine = getCreators(name).file_segmentation_engine;
|
||||
|
||||
if (name != "Values" && settings.input_format_parallel_parsing && file_segmentation_engine)
|
||||
if (settings.input_format_parallel_parsing && file_segmentation_engine)
|
||||
{
|
||||
const auto & input_getter = getCreators(name).input_processor_creator;
|
||||
if (!input_getter)
|
||||
@ -125,8 +125,6 @@ BlockInputStreamPtr FormatFactory::getInput(
|
||||
row_input_format_params.timeout_overflow_mode = settings.timeout_overflow_mode;
|
||||
|
||||
size_t max_threads_to_use = settings.max_threads_for_parallel_parsing;
|
||||
if (!max_threads_to_use)
|
||||
max_threads_to_use = settings.max_threads;
|
||||
|
||||
auto params = ParallelParsingBlockInputStream::InputCreatorParams{sample, context, row_input_format_params, format_settings};
|
||||
ParallelParsingBlockInputStream::Builder builder{buf, input_getter, params, file_segmentation_engine, max_threads_to_use, settings.min_chunk_size_for_parallel_parsing};
|
||||
|
@ -916,6 +916,6 @@ void skipToUnescapedNextLineOrEOF(ReadBuffer & buf);
|
||||
* If there is no pending data in buffer or it was explicitly asked
|
||||
* save current state to memory.
|
||||
*/
|
||||
bool eofWithSavingBufferState(ReadBuffer & buf, DB::Memory<> & memory, size_t & used_size, char * & begin_pos, bool save_buffer_state = false);
|
||||
bool eofWithSavingBufferState(ReadBuffer & buf, DB::Memory<> & memory, size_t & used_size, char * & begin_pos, bool force_saving_buffer_state = false);
|
||||
|
||||
}
|
||||
|
@ -0,0 +1 @@
|
||||
OK
|
48
dbms/tests/queries/0_stateless/01019_parallel_parsing_cancel.sh
Executable file
48
dbms/tests/queries/0_stateless/01019_parallel_parsing_cancel.sh
Executable file
@ -0,0 +1,48 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
|
||||
. $CURDIR/../shell_config.sh
|
||||
|
||||
$CLICKHOUSE_CLIENT --query="DROP TABLE IF EXISTS a;"
|
||||
$CLICKHOUSE_CLIENT --query="DROP TABLE IF EXISTS b;"
|
||||
|
||||
$CLICKHOUSE_CLIENT --query="CREATE TABLE a (x UInt64) ENGINE = Memory;"
|
||||
$CLICKHOUSE_CLIENT --query="CREATE TABLE b (x UInt64) ENGINE = Memory;"
|
||||
|
||||
function thread1()
|
||||
{
|
||||
while true; do
|
||||
seq 1 11000000 | $CLICKHOUSE_CLIENT --query_id=11 --query="INSERT INTO a(x) FORMAT TSV"
|
||||
sleep 1
|
||||
$CLICKHOUSE_CLIENT --query="kill query where query_id='22'" SYNC
|
||||
|
||||
done
|
||||
}
|
||||
|
||||
function thread2()
|
||||
{
|
||||
while true; do
|
||||
seq 1 11000000 | $CLICKHOUSE_CLIENT --query_id=22 --query="INSERT INTO b(x) FORMAT TSV"
|
||||
sleep 1
|
||||
$CLICKHOUSE_CLIENT --query="kill query where query_id='11'" SYNC
|
||||
done
|
||||
}
|
||||
|
||||
|
||||
# https://stackoverflow.com/questions/9954794/execute-a-shell-function-with-timeout
|
||||
export -f thread1;
|
||||
export -f thread2;
|
||||
|
||||
TIMEOUT=20
|
||||
|
||||
timeout $TIMEOUT bash -c thread1 2>&1 > /dev/null &
|
||||
timeout $TIMEOUT bash -c thread2 2>&1 > /dev/null &
|
||||
|
||||
wait
|
||||
|
||||
echo OK
|
||||
|
||||
$CLICKHOUSE_CLIENT --query "DROP TABLE a"
|
||||
$CLICKHOUSE_CLIENT --query "DROP TABLE b"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user