mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-30 03:22:14 +00:00
Write to first non-readonly disk
This commit is contained in:
parent
926b35b7c4
commit
d324e8cc3e
@ -312,13 +312,19 @@ MergeTreeData::MergeTreeData(
|
||||
if (!attach || !read_format_version)
|
||||
{
|
||||
format_version = min_format_version;
|
||||
auto disk = getStoragePolicy()->getAnyDisk();
|
||||
|
||||
// try to write to first non-readonly disk
|
||||
for (const auto & disk : getStoragePolicy()->getDisks())
|
||||
{
|
||||
if (!disk->isReadOnly())
|
||||
{
|
||||
auto buf = disk->writeFile(format_version_path, DBMS_DEFAULT_BUFFER_SIZE, WriteMode::Rewrite, context_->getWriteSettings());
|
||||
writeIntText(format_version.toUnderType(), *buf);
|
||||
if (getContext()->getSettingsRef().fsync_metadata)
|
||||
buf->sync();
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user