mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-22 15:42:02 +00:00
clickhouse: fixed a leak of file descriptors and memory. [#METR-9664]
This commit is contained in:
parent
532945a535
commit
fd05f7ea53
@ -221,6 +221,7 @@ private:
|
|||||||
String escaped_size_name = escapeForFileName(DataTypeNested::extractNestedTableName(name))
|
String escaped_size_name = escapeForFileName(DataTypeNested::extractNestedTableName(name))
|
||||||
+ ARRAY_SIZES_COLUMN_NAME_SUFFIX + toString(level);
|
+ ARRAY_SIZES_COLUMN_NAME_SUFFIX + toString(level);
|
||||||
|
|
||||||
|
if (!streams.count(size_name))
|
||||||
streams.insert(std::make_pair(size_name, new Stream(
|
streams.insert(std::make_pair(size_name, new Stream(
|
||||||
path + escaped_size_name, uncompressed_cache)));
|
path + escaped_size_name, uncompressed_cache)));
|
||||||
|
|
||||||
@ -231,16 +232,14 @@ private:
|
|||||||
String size_name = name + ARRAY_SIZES_COLUMN_NAME_SUFFIX + toString(level);
|
String size_name = name + ARRAY_SIZES_COLUMN_NAME_SUFFIX + toString(level);
|
||||||
String escaped_size_name = escaped_column_name + ARRAY_SIZES_COLUMN_NAME_SUFFIX + toString(level);
|
String escaped_size_name = escaped_column_name + ARRAY_SIZES_COLUMN_NAME_SUFFIX + toString(level);
|
||||||
|
|
||||||
streams.insert(std::make_pair(size_name, new Stream(
|
streams[size_name] = new Stream(path + escaped_size_name, uncompressed_cache);
|
||||||
path + escaped_size_name, uncompressed_cache)));
|
|
||||||
|
|
||||||
const NamesAndTypesList & columns = *type_nested->getNestedTypesList();
|
const NamesAndTypesList & columns = *type_nested->getNestedTypesList();
|
||||||
for (NamesAndTypesList::const_iterator it = columns.begin(); it != columns.end(); ++it)
|
for (NamesAndTypesList::const_iterator it = columns.begin(); it != columns.end(); ++it)
|
||||||
addStream(DataTypeNested::concatenateNestedName(name, it->first), *it->second, level + 1);
|
addStream(DataTypeNested::concatenateNestedName(name, it->first), *it->second, level + 1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
streams.insert(std::make_pair(name, new Stream(
|
streams[name] = new Stream(path + escaped_column_name, uncompressed_cache);
|
||||||
path + escaped_column_name, uncompressed_cache)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void readData(const String & name, const IDataType & type, IColumn & column, size_t from_mark, size_t max_rows_to_read,
|
void readData(const String & name, const IDataType & type, IColumn & column, size_t from_mark, size_t max_rows_to_read,
|
||||||
|
@ -109,6 +109,7 @@ void LogBlockInputStream::addStream(const String & name, const IDataType & type,
|
|||||||
if (const DataTypeArray * type_arr = dynamic_cast<const DataTypeArray *>(&type))
|
if (const DataTypeArray * type_arr = dynamic_cast<const DataTypeArray *>(&type))
|
||||||
{
|
{
|
||||||
String size_name = DataTypeNested::extractNestedTableName(name) + ARRAY_SIZES_COLUMN_NAME_SUFFIX + toString(level);
|
String size_name = DataTypeNested::extractNestedTableName(name) + ARRAY_SIZES_COLUMN_NAME_SUFFIX + toString(level);
|
||||||
|
if (!streams.count(size_name))
|
||||||
streams.insert(std::make_pair(size_name, new Stream(
|
streams.insert(std::make_pair(size_name, new Stream(
|
||||||
storage.files[size_name].data_file.path(),
|
storage.files[size_name].data_file.path(),
|
||||||
mark_number
|
mark_number
|
||||||
@ -120,22 +121,22 @@ void LogBlockInputStream::addStream(const String & name, const IDataType & type,
|
|||||||
else if (const DataTypeNested * type_nested = dynamic_cast<const DataTypeNested *>(&type))
|
else if (const DataTypeNested * type_nested = dynamic_cast<const DataTypeNested *>(&type))
|
||||||
{
|
{
|
||||||
String size_name = name + ARRAY_SIZES_COLUMN_NAME_SUFFIX + toString(level);
|
String size_name = name + ARRAY_SIZES_COLUMN_NAME_SUFFIX + toString(level);
|
||||||
streams.insert(std::make_pair(size_name, new Stream(
|
streams[size_name] = new Stream(
|
||||||
storage.files[size_name].data_file.path(),
|
storage.files[size_name].data_file.path(),
|
||||||
mark_number
|
mark_number
|
||||||
? storage.files[size_name].marks[mark_number].offset
|
? storage.files[size_name].marks[mark_number].offset
|
||||||
: 0)));
|
: 0);
|
||||||
|
|
||||||
const NamesAndTypesList & columns = *type_nested->getNestedTypesList();
|
const NamesAndTypesList & columns = *type_nested->getNestedTypesList();
|
||||||
for (NamesAndTypesList::const_iterator it = columns.begin(); it != columns.end(); ++it)
|
for (NamesAndTypesList::const_iterator it = columns.begin(); it != columns.end(); ++it)
|
||||||
addStream(DataTypeNested::concatenateNestedName(name, it->first), *it->second, level + 1);
|
addStream(DataTypeNested::concatenateNestedName(name, it->first), *it->second, level + 1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
streams.insert(std::make_pair(name, new Stream(
|
streams[name] = new Stream(
|
||||||
storage.files[name].data_file.path(),
|
storage.files[name].data_file.path(),
|
||||||
mark_number
|
mark_number
|
||||||
? storage.files[name].marks[mark_number].offset
|
? storage.files[name].marks[mark_number].offset
|
||||||
: 0)));
|
: 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -234,6 +235,7 @@ void LogBlockOutputStream::addStream(const String & name, const IDataType & type
|
|||||||
if (const DataTypeArray * type_arr = dynamic_cast<const DataTypeArray *>(&type))
|
if (const DataTypeArray * type_arr = dynamic_cast<const DataTypeArray *>(&type))
|
||||||
{
|
{
|
||||||
String size_name = DataTypeNested::extractNestedTableName(name) + ARRAY_SIZES_COLUMN_NAME_SUFFIX + toString(level);
|
String size_name = DataTypeNested::extractNestedTableName(name) + ARRAY_SIZES_COLUMN_NAME_SUFFIX + toString(level);
|
||||||
|
if (!streams.count(size_name))
|
||||||
streams.insert(std::make_pair(size_name, new Stream(
|
streams.insert(std::make_pair(size_name, new Stream(
|
||||||
storage.files[size_name].data_file.path())));
|
storage.files[size_name].data_file.path())));
|
||||||
|
|
||||||
@ -242,16 +244,14 @@ void LogBlockOutputStream::addStream(const String & name, const IDataType & type
|
|||||||
else if (const DataTypeNested * type_nested = dynamic_cast<const DataTypeNested *>(&type))
|
else if (const DataTypeNested * type_nested = dynamic_cast<const DataTypeNested *>(&type))
|
||||||
{
|
{
|
||||||
String size_name = name + ARRAY_SIZES_COLUMN_NAME_SUFFIX + toString(level);
|
String size_name = name + ARRAY_SIZES_COLUMN_NAME_SUFFIX + toString(level);
|
||||||
streams.insert(std::make_pair(size_name, new Stream(
|
streams[size_name] = new Stream(storage.files[size_name].data_file.path());
|
||||||
storage.files[size_name].data_file.path())));
|
|
||||||
|
|
||||||
const NamesAndTypesList & columns = *type_nested->getNestedTypesList();
|
const NamesAndTypesList & columns = *type_nested->getNestedTypesList();
|
||||||
for (NamesAndTypesList::const_iterator it = columns.begin(); it != columns.end(); ++it)
|
for (NamesAndTypesList::const_iterator it = columns.begin(); it != columns.end(); ++it)
|
||||||
addStream(DataTypeNested::concatenateNestedName(name, it->first), *it->second, level + 1);
|
addStream(DataTypeNested::concatenateNestedName(name, it->first), *it->second, level + 1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
streams.insert(std::make_pair(name, new Stream(
|
streams[name] = new Stream(storage.files[name].data_file.path());
|
||||||
storage.files[name].data_file.path())));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -102,6 +102,7 @@ void TinyLogBlockInputStream::addStream(const String & name, const IDataType & t
|
|||||||
if (const DataTypeArray * type_arr = dynamic_cast<const DataTypeArray *>(&type))
|
if (const DataTypeArray * type_arr = dynamic_cast<const DataTypeArray *>(&type))
|
||||||
{
|
{
|
||||||
String size_name = DataTypeNested::extractNestedTableName(name) + ARRAY_SIZES_COLUMN_NAME_SUFFIX + toString(level);
|
String size_name = DataTypeNested::extractNestedTableName(name) + ARRAY_SIZES_COLUMN_NAME_SUFFIX + toString(level);
|
||||||
|
if (!streams.count(size_name))
|
||||||
streams.insert(std::make_pair(size_name, new Stream(storage.files[size_name].data_file.path())));
|
streams.insert(std::make_pair(size_name, new Stream(storage.files[size_name].data_file.path())));
|
||||||
|
|
||||||
addStream(name, *type_arr->getNestedType(), level + 1);
|
addStream(name, *type_arr->getNestedType(), level + 1);
|
||||||
@ -109,14 +110,14 @@ void TinyLogBlockInputStream::addStream(const String & name, const IDataType & t
|
|||||||
else if (const DataTypeNested * type_nested = dynamic_cast<const DataTypeNested *>(&type))
|
else if (const DataTypeNested * type_nested = dynamic_cast<const DataTypeNested *>(&type))
|
||||||
{
|
{
|
||||||
String size_name = name + ARRAY_SIZES_COLUMN_NAME_SUFFIX + toString(level);
|
String size_name = name + ARRAY_SIZES_COLUMN_NAME_SUFFIX + toString(level);
|
||||||
streams.insert(std::make_pair(size_name, new Stream(storage.files[size_name].data_file.path())));
|
streams[size_name] = new Stream(storage.files[size_name].data_file.path());
|
||||||
|
|
||||||
const NamesAndTypesList & columns = *type_nested->getNestedTypesList();
|
const NamesAndTypesList & columns = *type_nested->getNestedTypesList();
|
||||||
for (NamesAndTypesList::const_iterator it = columns.begin(); it != columns.end(); ++it)
|
for (NamesAndTypesList::const_iterator it = columns.begin(); it != columns.end(); ++it)
|
||||||
addStream(DataTypeNested::concatenateNestedName(name, it->first), *it->second, level + 1);
|
addStream(DataTypeNested::concatenateNestedName(name, it->first), *it->second, level + 1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
streams.insert(std::make_pair(name, new Stream(storage.files[name].data_file.path())));
|
streams[name] = new Stream(storage.files[name].data_file.path());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -185,6 +186,7 @@ void TinyLogBlockOutputStream::addStream(const String & name, const IDataType &
|
|||||||
if (const DataTypeArray * type_arr = dynamic_cast<const DataTypeArray *>(&type))
|
if (const DataTypeArray * type_arr = dynamic_cast<const DataTypeArray *>(&type))
|
||||||
{
|
{
|
||||||
String size_name = DataTypeNested::extractNestedTableName(name) + ARRAY_SIZES_COLUMN_NAME_SUFFIX + toString(level);
|
String size_name = DataTypeNested::extractNestedTableName(name) + ARRAY_SIZES_COLUMN_NAME_SUFFIX + toString(level);
|
||||||
|
if (streams.count(size_name))
|
||||||
streams.insert(std::make_pair(size_name, new Stream(storage.files[size_name].data_file.path())));
|
streams.insert(std::make_pair(size_name, new Stream(storage.files[size_name].data_file.path())));
|
||||||
|
|
||||||
addStream(name, *type_arr->getNestedType(), level + 1);
|
addStream(name, *type_arr->getNestedType(), level + 1);
|
||||||
@ -192,14 +194,14 @@ void TinyLogBlockOutputStream::addStream(const String & name, const IDataType &
|
|||||||
else if (const DataTypeNested * type_nested = dynamic_cast<const DataTypeNested *>(&type))
|
else if (const DataTypeNested * type_nested = dynamic_cast<const DataTypeNested *>(&type))
|
||||||
{
|
{
|
||||||
String size_name = name + ARRAY_SIZES_COLUMN_NAME_SUFFIX + toString(level);
|
String size_name = name + ARRAY_SIZES_COLUMN_NAME_SUFFIX + toString(level);
|
||||||
streams.insert(std::make_pair(size_name, new Stream(storage.files[size_name].data_file.path())));
|
streams[size_name] = new Stream(storage.files[size_name].data_file.path());
|
||||||
|
|
||||||
const NamesAndTypesList & columns = *type_nested->getNestedTypesList();
|
const NamesAndTypesList & columns = *type_nested->getNestedTypesList();
|
||||||
for (NamesAndTypesList::const_iterator it = columns.begin(); it != columns.end(); ++it)
|
for (NamesAndTypesList::const_iterator it = columns.begin(); it != columns.end(); ++it)
|
||||||
addStream(DataTypeNested::concatenateNestedName(name, it->first), *it->second, level + 1);
|
addStream(DataTypeNested::concatenateNestedName(name, it->first), *it->second, level + 1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
streams.insert(std::make_pair(name, new Stream(storage.files[name].data_file.path())));
|
streams[name] = new Stream(storage.files[name].data_file.path());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user