Fix tests

This commit is contained in:
kssenii 2022-07-11 21:10:25 +02:00
parent dd9651a6ca
commit e8daa50bad
5 changed files with 9 additions and 19 deletions

View File

@ -247,7 +247,6 @@ std::unordered_map<String, String> DiskObjectStorage::getSerializedMetadata(cons
String DiskObjectStorage::getUniqueId(const String & path) const
{
LOG_TRACE(log, "Remote path: {}, Path: {}", object_storage_root_path, path);
String id;
auto blobs_paths = metadata_storage->getStorageObjects(path);
if (!blobs_paths.empty())
@ -261,7 +260,7 @@ bool DiskObjectStorage::checkUniqueId(const String & id) const
return false;
auto object = StoredObject::create(*object_storage, id, {}, true);
return object_storage->exists(std::move(object));
return object_storage->exists(object);
}
void DiskObjectStorage::createHardLink(const String & src_path, const String & dst_path, bool should_send_metadata)

View File

@ -55,11 +55,11 @@ void registerDiskHDFS(DiskFactory & factory)
#ifdef NDEBUG
bool use_cache = true;
#else
#else
/// Current S3 cache implementation lead to allocations in destructor of
/// read buffer.
bool use_cache = false;
#endif
#endif
if (config.getBool(config_prefix + ".cache_enabled", use_cache))
{

View File

@ -63,7 +63,7 @@ std::unique_ptr<ReadBufferFromFileBase> LocalObjectStorage::readObject( /// NOLI
if (!file_size)
file_size = tryGetSizeFromFilePath(path);
/// For now we cannot allow asynchrnous reader from local filesystem when CachedObjectStorage is used.
/// For now we cannot allow asynchronous reader from local filesystem when CachedObjectStorage is used.
ReadSettings modified_settings{read_settings};
switch (modified_settings.local_fs_method)
{

View File

@ -177,7 +177,7 @@ void MetadataStorageFromDiskTransaction::commit()
toString(state), toString(MetadataFromDiskTransactionState::PREPARING));
{
std::unique_lock lock(metadata_storage.metadata_mutex);
std::lock_guard lock(metadata_storage.metadata_mutex);
for (size_t i = 0; i < operations.size(); ++i)
{
try
@ -292,20 +292,14 @@ void MetadataStorageFromDiskTransaction::setReadOnly(const std::string & path)
{
auto metadata = metadata_storage.readMetadata(path);
metadata->setReadOnly();
auto data = metadata->serializeToString();
if (!data.empty())
addOperation(std::make_unique<WriteFileOperation>(path, *metadata_storage.getDisk(), data));
writeStringToFile(path, metadata->serializeToString());
}
void MetadataStorageFromDiskTransaction::createEmptyMetadataFile(const std::string & path)
{
auto metadata = std::make_unique<DiskObjectStorageMetadata>(
metadata_storage.getDisk()->getPath(), metadata_storage.getObjectStorageRootPath(), path);
auto data = metadata->serializeToString();
if (!data.empty())
addOperation(std::make_unique<WriteFileOperation>(path, *metadata_storage.getDisk(), data));
writeStringToFile(path, metadata->serializeToString());
}
void MetadataStorageFromDiskTransaction::createMetadataFile(const std::string & path, const std::string & blob_name, uint64_t size_in_bytes)
@ -327,10 +321,7 @@ void MetadataStorageFromDiskTransaction::addBlobToMetadata(const std::string & p
{
metadata = metadata_storage.readMetadata(path);
metadata->addObject(blob_name, size_in_bytes);
auto data = metadata->serializeToString();
if (!data.empty())
addOperation(std::make_unique<WriteFileOperation>(path, *metadata_storage.getDisk(), data));
writeStringToFile(path, metadata->serializeToString());
}
else
{

View File

@ -545,7 +545,7 @@ std::unique_ptr<IObjectStorage> S3ObjectStorage::cloneObjectStorage(
return std::make_unique<S3ObjectStorage>(
getClient(config, config_prefix, context),
getSettings(config, config_prefix, context),
version_id, s3_capabilities, new_namespace, cache);
version_id, s3_capabilities, new_namespace, nullptr);
}
}