2015-06-24 11:03:53 +00:00
|
|
|
#pragma once
|
2019-10-01 16:50:08 +00:00
|
|
|
#include <Storages/MergeTree/MergeTreeBaseSelectProcessor.h>
|
2015-06-24 11:03:53 +00:00
|
|
|
|
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
|
|
|
|
2023-02-03 13:34:18 +00:00
|
|
|
class IMergeTreeReadPool;
|
|
|
|
using IMergeTreeReadPoolPtr = std::shared_ptr<IMergeTreeReadPool>;
|
2017-03-24 13:52:50 +00:00
|
|
|
|
2015-09-09 17:39:28 +00:00
|
|
|
/** Used in conjunction with MergeTreeReadPool, asking it for more work to do and performing whatever reads it is asked
|
2016-12-10 04:51:36 +00:00
|
|
|
* to perform.
|
|
|
|
*/
|
2022-11-18 20:09:20 +00:00
|
|
|
class MergeTreeThreadSelectAlgorithm final : public IMergeTreeSelectAlgorithm
|
2015-06-24 11:03:53 +00:00
|
|
|
{
|
|
|
|
public:
|
2022-11-18 20:09:20 +00:00
|
|
|
MergeTreeThreadSelectAlgorithm(
|
2022-03-13 12:23:51 +00:00
|
|
|
size_t thread_,
|
2023-02-03 13:34:18 +00:00
|
|
|
IMergeTreeReadPoolPtr pool_,
|
|
|
|
size_t min_marks_for_concurrent_read,
|
|
|
|
size_t max_block_size_,
|
2019-08-03 11:02:40 +00:00
|
|
|
size_t preferred_block_size_bytes_,
|
|
|
|
size_t preferred_max_column_in_block_size_bytes_,
|
|
|
|
const MergeTreeData & storage_,
|
2021-07-09 03:15:41 +00:00
|
|
|
const StorageSnapshotPtr & storage_snapshot_,
|
2022-03-13 12:23:51 +00:00
|
|
|
bool use_uncompressed_cache_,
|
2019-08-03 11:02:40 +00:00
|
|
|
const PrewhereInfoPtr & prewhere_info_,
|
2021-06-25 14:49:28 +00:00
|
|
|
ExpressionActionsSettings actions_settings,
|
2019-12-18 15:54:45 +00:00
|
|
|
const MergeTreeReaderSettings & reader_settings_,
|
2023-02-03 13:34:18 +00:00
|
|
|
const Names & virt_column_names_);
|
2015-06-24 11:03:53 +00:00
|
|
|
|
2016-11-20 12:43:20 +00:00
|
|
|
String getName() const override { return "MergeTreeThread"; }
|
2015-12-21 20:17:24 +00:00
|
|
|
|
2022-11-18 20:09:20 +00:00
|
|
|
~MergeTreeThreadSelectAlgorithm() override;
|
2018-01-09 01:51:08 +00:00
|
|
|
|
2015-06-24 11:03:53 +00:00
|
|
|
protected:
|
2015-09-09 17:39:28 +00:00
|
|
|
/// Requests read task from MergeTreeReadPool and signals whether it got one
|
2021-12-09 10:39:28 +00:00
|
|
|
bool getNewTaskImpl() override;
|
|
|
|
|
|
|
|
void finalizeNewTask() override;
|
|
|
|
|
|
|
|
void finish() override;
|
|
|
|
|
2018-04-16 12:21:36 +00:00
|
|
|
private:
|
2017-03-24 13:52:50 +00:00
|
|
|
/// "thread" index (there are N threads and each thread is assigned index in interval [0..N-1])
|
|
|
|
size_t thread;
|
2015-07-03 15:08:21 +00:00
|
|
|
|
2023-02-03 13:34:18 +00:00
|
|
|
IMergeTreeReadPoolPtr pool;
|
2018-04-16 12:21:36 +00:00
|
|
|
|
2020-08-08 01:01:47 +00:00
|
|
|
/// Last part read in this thread
|
2023-02-03 13:34:18 +00:00
|
|
|
std::string last_read_part_name;
|
2015-06-24 11:03:53 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|