add some comment and modify a parameter type

This commit is contained in:
TCeason 2021-04-16 09:42:55 +08:00
parent 63403c709c
commit b4bf53dfc9
4 changed files with 6 additions and 7 deletions

View File

@ -445,8 +445,8 @@ class IColumn;
M(Bool, database_replicated_always_detach_permanently, false, "Execute DETACH TABLE as DETACH TABLE PERMANENTLY if database engine is Replicated", 0) \ M(Bool, database_replicated_always_detach_permanently, false, "Execute DETACH TABLE as DETACH TABLE PERMANENTLY if database engine is Replicated", 0) \
M(DistributedDDLOutputMode, distributed_ddl_output_mode, DistributedDDLOutputMode::THROW, "Format of distributed DDL query result", 0) \ M(DistributedDDLOutputMode, distributed_ddl_output_mode, DistributedDDLOutputMode::THROW, "Format of distributed DDL query result", 0) \
M(UInt64, distributed_ddl_entry_format_version, 1, "Version of DDL entry to write into ZooKeeper", 0) \ M(UInt64, distributed_ddl_entry_format_version, 1, "Version of DDL entry to write into ZooKeeper", 0) \
M(UInt64, external_storage_max_read_rows, 0, "Limit maximum number of rows when MaterializeMySQL should flush history data. If equal to 0, this setting is disabled", 0) \ M(UInt64, external_storage_max_read_rows, 0, "Limit maximum number of rows when table with external engine should flush history data. Now supported only for MySQL table engine, database engine, dictionary and MaterializeMySQL. If equal to 0, this setting is disabled", 0) \
M(UInt64, external_storage_max_read_bytes, (DEFAULT_INSERT_BLOCK_SIZE * 256), "Limit maximum number of bytes when MaterializeMySQL should flush history data. If equal to 0, this setting is disabled", 0) \ M(UInt64, external_storage_max_read_bytes, 0, "Limit maximum number of bytes when table with external engine should flush history data. Now supported only for MySQL table engine, database engine, dictionary and MaterializeMySQL. If equal to 0, this setting is disabled", 0) \
\ \
/** Obsolete settings that do nothing but left for compatibility reasons. Remove each one after half a year of obsolescence. */ \ /** Obsolete settings that do nothing but left for compatibility reasons. Remove each one after half a year of obsolescence. */ \
\ \

View File

@ -31,7 +31,7 @@ namespace ErrorCodes
} }
StreamSettings::StreamSettings(const Settings & settings, bool auto_close_, bool fetch_by_name_, size_t max_retry_) StreamSettings::StreamSettings(const Settings & settings, bool auto_close_, bool fetch_by_name_, size_t max_retry_)
: max_read_mysql_row_nums(settings.external_storage_max_read_rows) : max_read_mysql_row_nums((settings.external_storage_max_read_rows) ? settings.external_storage_max_read_rows : settings.max_block_size)
, max_read_mysql_bytes_size(settings.external_storage_max_read_bytes) , max_read_mysql_bytes_size(settings.external_storage_max_read_bytes)
, auto_close(auto_close_) , auto_close(auto_close_)
, fetch_by_name(fetch_by_name_) , fetch_by_name(fetch_by_name_)

View File

@ -13,6 +13,7 @@ namespace DB
struct StreamSettings struct StreamSettings
{ {
/// Check if setting is enabled, otherwise use common `max_block_size` setting.
size_t max_read_mysql_row_nums; size_t max_read_mysql_row_nums;
size_t max_read_mysql_bytes_size; size_t max_read_mysql_bytes_size;
bool auto_close; bool auto_close;
@ -38,7 +39,7 @@ public:
Block getHeader() const override { return description.sample_block.cloneEmpty(); } Block getHeader() const override { return description.sample_block.cloneEmpty(); }
protected: protected:
MySQLBlockInputStream(const Block & sample_block_, const struct StreamSettings & settings); MySQLBlockInputStream(const Block & sample_block_, const StreamSettings & settings);
Block readImpl() override; Block readImpl() override;
void initPositionMappingFromQueryResultStructure(); void initPositionMappingFromQueryResultStructure();

View File

@ -71,7 +71,7 @@ Pipe StorageMySQL::read(
SelectQueryInfo & query_info_, SelectQueryInfo & query_info_,
ContextPtr context_, ContextPtr context_,
QueryProcessingStage::Enum /*processed_stage*/, QueryProcessingStage::Enum /*processed_stage*/,
size_t max_block_size, size_t /*max_block_size*/,
unsigned) unsigned)
{ {
metadata_snapshot->check(column_names_, getVirtuals(), getStorageID()); metadata_snapshot->check(column_names_, getVirtuals(), getStorageID());
@ -95,8 +95,6 @@ Pipe StorageMySQL::read(
sample_block.insert({ column_data.type, column_data.name }); sample_block.insert({ column_data.type, column_data.name });
} }
if (!context_->getSettingsRef().external_storage_max_read_rows)
context_->setSetting("external_storage_max_read_rows", max_block_size);
StreamSettings mysql_input_stream_settings(context_->getSettingsRef(), true, false); StreamSettings mysql_input_stream_settings(context_->getSettingsRef(), true, false);
return Pipe(std::make_shared<SourceFromInputStream>( return Pipe(std::make_shared<SourceFromInputStream>(