This commit is contained in:
Michael Kolupaev 2014-07-14 15:45:34 +04:00
parent 3efa9e91c9
commit 8f394dd852
3 changed files with 11 additions and 7 deletions

View File

@ -341,8 +341,9 @@ public:
bool hasColumnFiles(const String & column) const
{
return Poco::File(storage.full_path + name + "/" + column + ".bin").exists() &&
Poco::File(storage.full_path + name + "/" + column + ".mrk").exists();
String escaped_column = escapeForFileName(column);
return Poco::File(storage.full_path + name + "/" + escaped_column + ".bin").exists() &&
Poco::File(storage.full_path + name + "/" + escaped_column + ".mrk").exists();
}
};

View File

@ -421,6 +421,12 @@ MergeTreeData::AlterDataPartTransactionPtr MergeTreeData::alterDataPart(DataPart
AlterDataPartTransactionPtr transaction(new AlterDataPartTransaction(part));
createConvertExpression(part, *columns, new_columns, expression, transaction->rename_map); // TODO: part->columns
if (transaction->rename_map.empty())
{
transaction->data_part = nullptr;
return transaction;
}
DataPart::Checksums add_checksums;
/// Применим выражение и запишем результат во временные файлы.
@ -441,7 +447,7 @@ MergeTreeData::AlterDataPartTransactionPtr MergeTreeData::alterDataPart(DataPart
add_checksums = out.writeSuffixAndGetChecksums();
}
/// Обновим контрольные суммы. Заполним в транзакции список переименований файлов.
/// Обновим контрольные суммы.
DataPart::Checksums new_checksums = part->checksums;
for (auto it : transaction->rename_map)
{
@ -463,9 +469,6 @@ MergeTreeData::AlterDataPartTransactionPtr MergeTreeData::alterDataPart(DataPart
transaction->rename_map["checksums.txt.tmp"] = "checksums.txt";
}
if (transaction->rename_map.empty())
transaction->data_part = nullptr;
return transaction;
}

View File

@ -107,7 +107,7 @@ private:
}
if (zookeeper.exists(path + "/" + *(it - 1), nullptr, event))
event->tryWait(60 * 1000);
event->wait();
success = true;
}