This commit is contained in:
kssenii 2024-01-23 11:51:21 +01:00
parent 1aa8e62bb7
commit bca73d4b0a
4 changed files with 7 additions and 15 deletions

View File

@ -89,7 +89,7 @@ private:
{
if (!attach)
throw;
configuration.is_broken = true;
tryLogCurrentException(__PRETTY_FUNCTION__);
return configuration;
}
}
@ -104,11 +104,10 @@ private:
const bool updated = base_configuration.update(local_context);
auto new_keys = getDataFiles(base_configuration, local_context);
if (!updated && !base_configuration.is_broken && new_keys == Storage::getConfiguration().keys)
if (!updated && new_keys == Storage::getConfiguration().keys)
return;
Storage::useConfiguration(getConfigurationForDataRead(base_configuration, local_context, new_keys));
base_configuration.is_broken = false;
}
Configuration base_configuration;

View File

@ -29,7 +29,7 @@ StoragePtr StorageIceberg::create(
{
if (!attach)
throw;
configuration.is_broken = true;
tryLogCurrentException(__PRETTY_FUNCTION__);
}
return std::make_shared<StorageIceberg>(
@ -74,21 +74,15 @@ void StorageIceberg::updateConfigurationImpl(ContextPtr local_context)
const bool updated = base_configuration.update(local_context);
auto new_metadata = parseIcebergMetadata(base_configuration, local_context);
if (!current_metadata)
current_metadata = parseIcebergMetadata(base_configuration, local_context);
/// Check if nothing was changed.
if (!updated && !base_configuration.is_broken && new_metadata->getVersion() == current_metadata->getVersion())
return;
if (new_metadata->getVersion() != current_metadata->getVersion())
if (!current_metadata || new_metadata->getVersion() != current_metadata->getVersion())
current_metadata = std::move(new_metadata);
else if (!updated)
return;
auto updated_configuration{base_configuration};
/// If metadata wasn't changed, we won't list data files again.
updated_configuration.keys = current_metadata->getDataFiles();
StorageS3::useConfiguration(updated_configuration);
base_configuration.is_broken = false;
}
}

View File

@ -304,7 +304,6 @@ public:
std::shared_ptr<const S3::Client> client;
std::vector<String> keys;
bool is_broken = false;
};
StorageS3(

View File

@ -34,7 +34,7 @@ protected:
columns = parseColumnsListFromString(TableFunction::configuration.structure, context);
StoragePtr storage = Storage::create(
TableFunction::configuration, context, true, StorageID(TableFunction::getDatabaseName(), table_name),
TableFunction::configuration, context, false, StorageID(TableFunction::getDatabaseName(), table_name),
columns, ConstraintsDescription{}, String{}, std::nullopt);
storage->startup();