mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-24 08:32:02 +00:00
Code style and logical issues fix.
This commit is contained in:
parent
8c09902310
commit
d91ef06370
@ -24,10 +24,10 @@ private:
|
||||
std::unique_ptr<ReadBufferFromFileBase> file_in;
|
||||
|
||||
const std::string path;
|
||||
size_t buf_size;
|
||||
size_t estimated_size;
|
||||
size_t aio_threshold;
|
||||
size_t mmap_threshold;
|
||||
size_t buf_size {};
|
||||
size_t estimated_size {};
|
||||
size_t aio_threshold {};
|
||||
size_t mmap_threshold {};
|
||||
|
||||
size_t file_pos;
|
||||
|
||||
|
@ -65,10 +65,11 @@ MarkCache::MappedPtr MergeTreeMarksLoader::loadMarksImpl()
|
||||
{
|
||||
/// Read directly to marks.
|
||||
auto buffer = disk->readFile(mrk_path, file_size);
|
||||
buffer->readStrict(reinterpret_cast<char *>(res->data()), sizeof(*res->data()));
|
||||
buffer->readStrict(reinterpret_cast<char *>(res->data()), file_size);
|
||||
|
||||
if (buffer->eof() || buffer->buffer().size() != file_size)
|
||||
throw Exception("Cannot read all marks from file " + mrk_path, ErrorCodes::CANNOT_READ_ALL_DATA);
|
||||
if (!buffer->eof())
|
||||
throw Exception("Cannot read all marks from file " + mrk_path + ", eof: " + std::to_string(buffer->eof())
|
||||
+ ", buffer size: " + std::to_string(buffer->buffer().size()) + ", file size: " + std::to_string(file_size), ErrorCodes::CANNOT_READ_ALL_DATA);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -14,6 +14,7 @@
|
||||
#include <Poco/File.h>
|
||||
|
||||
#include <iostream>
|
||||
#include <Disks/DiskLocal.h>
|
||||
|
||||
namespace DB
|
||||
{
|
||||
@ -27,6 +28,7 @@ namespace ErrorCodes
|
||||
|
||||
void run(String part_path, String date_column, String dest_path)
|
||||
{
|
||||
std::shared_ptr<IDisk> disk = std::make_shared<DiskLocal>("local", "/", 0);
|
||||
auto old_part_path = Poco::Path::forDirectory(part_path);
|
||||
String old_part_name = old_part_path.directory(old_part_path.depth() - 1);
|
||||
String old_part_path_str = old_part_path.toString();
|
||||
@ -83,12 +85,12 @@ void run(String part_path, String date_column, String dest_path)
|
||||
IMergeTreeDataPart::MinMaxIndex minmax_idx(min_date, max_date);
|
||||
Names minmax_idx_columns = {date_column};
|
||||
DataTypes minmax_idx_column_types = {std::make_shared<DataTypeDate>()};
|
||||
minmax_idx.store(minmax_idx_columns, minmax_idx_column_types, new_tmp_part_path_str, checksums);
|
||||
minmax_idx.store(minmax_idx_columns, minmax_idx_column_types, disk, new_tmp_part_path_str, checksums);
|
||||
|
||||
Block partition_key_sample{{nullptr, std::make_shared<DataTypeUInt32>(), makeASTFunction("toYYYYMM", std::make_shared<ASTIdentifier>(date_column))->getColumnName()}};
|
||||
|
||||
MergeTreePartition partition(yyyymm);
|
||||
partition.store(partition_key_sample, new_tmp_part_path_str, checksums);
|
||||
partition.store(partition_key_sample, disk, new_tmp_part_path_str, checksums);
|
||||
String partition_id = partition.getID(partition_key_sample);
|
||||
|
||||
Poco::File(new_tmp_part_path_str + "checksums.txt").setWriteable();
|
||||
|
Loading…
Reference in New Issue
Block a user