Bug fixes

This commit is contained in:
alesapin 2019-06-19 15:30:56 +03:00
parent f0c273ee4c
commit dd2e4fd805
3 changed files with 13 additions and 5 deletions

View File

@ -540,13 +540,13 @@ void MergeTreeDataPart::loadIndexGranularity()
{
String full_path = getFullPath();
index_granularity_info.changeGranularityIfRequired(getFullPath());
index_granularity_info.changeGranularityIfRequired(full_path);
if (columns.empty())
throw Exception("No columns in part " + name, ErrorCodes::NO_FILE_IN_DATA_PART);
/// We can use any column, it doesn't matter
std::string marks_file_path = index_granularity_info.getMarksFilePath(getFullPath() + escapeForFileName(columns.front().name));
std::string marks_file_path = index_granularity_info.getMarksFilePath(full_path + escapeForFileName(columns.front().name));
if (!Poco::File(marks_file_path).exists())
throw Exception("Marks file '" + marks_file_path + "' doesn't exist", ErrorCodes::NO_FILE_IN_DATA_PART);
@ -707,7 +707,7 @@ void MergeTreeDataPart::loadRowsCount()
ErrorCodes::LOGICAL_ERROR);
}
size_t last_mark_index_granularity = index_granularity.getLastMarkRows();
size_t last_mark_index_granularity = index_granularity.getLastNonFinalMarkRows();
size_t rows_approx = index_granularity.getTotalRows();
if (!(rows_count <= rows_approx && rows_approx < rows_count + last_mark_index_granularity))
throw Exception(

View File

@ -62,6 +62,14 @@ public:
return getMarkRows(last);
}
size_t getLastNonFinalMarkRows() const
{
size_t last_mark_rows = getLastMarkRows();
if (last_mark_rows != 0)
return last_mark_rows;
return getMarkRows(marks_rows_partial_sums.size() - 2);
}
bool hasFinalMark() const
{
return getLastMarkRows() == 0;

View File

@ -98,8 +98,8 @@ void ReplicatedMergeTreeTableMetadata::read(ReadBuffer & in)
if (in.eof())
data_format_version = 0;
else
in >> "data format version: " >> data_format_version.toUnderType() >> "\n";
else if (checkString("data format version: ", in))
in >> data_format_version.toUnderType() >> "\n";
if (data_format_version >= MERGE_TREE_DATA_MIN_FORMAT_VERSION_WITH_CUSTOM_PARTITIONING)
in >> "partition key: " >> partition_key >> "\n";