Fix: check storage type

This commit is contained in:
kssenii 2024-10-18 19:01:25 +02:00
parent 6a3d109444
commit 38e1719827
3 changed files with 11 additions and 1 deletions

View File

@ -131,6 +131,8 @@ StorageObjectStorageQueue::StorageObjectStorageQueue(
LoadingStrictnessLevel mode)
: IStorage(table_id_)
, WithContext(context_)
, type(engine_args->engine->name == "S3Queue" ? StorageObjectStorageQueueType::S3 : StorageObjectStorageQueueType::Azure)
, engine_name(engine_args->engine->name)
, zk_path(chooseZooKeeperPath(table_id_, context_->getSettingsRef(), *queue_settings_))
, enable_logging_to_queue_log(queue_settings_->enable_logging_to_queue_log)
, polling_min_timeout_ms(queue_settings_->polling_min_timeout_ms)

View File

@ -8,6 +8,7 @@
#include <Storages/ObjectStorageQueue/ObjectStorageQueueSettings.h>
#include <Storages/ObjectStorageQueue/ObjectStorageQueueSource.h>
#include <Storages/ObjectStorage/StorageObjectStorage.h>
#include <Storages/System/StorageSystemObjectStorageQueueSettings.h>
#include <Interpreters/Context.h>
#include <Storages/StorageFactory.h>
@ -33,7 +34,9 @@ public:
ASTStorage * engine_args,
LoadingStrictnessLevel mode);
String getName() const override { return "ObjectStorageQueue"; }
String getName() const override { return engine_name; }
StorageObjectStorageQueueType getType() { return type; }
void read(
QueryPlan & query_plan,
@ -58,6 +61,8 @@ private:
using FileIterator = ObjectStorageQueueSource::FileIterator;
using CommitSettings = ObjectStorageQueueSource::CommitSettings;
StorageObjectStorageQueueType type;
const std::string engine_name;
const fs::path zk_path;
const bool enable_logging_to_queue_log;
const UInt32 polling_min_timeout_ms;

View File

@ -43,6 +43,9 @@ void StorageSystemObjectStorageQueueSettings<type>::fillData(
auto add_table = [&](
const DatabaseTablesIteratorPtr & it, StorageObjectStorageQueue & storage)
{
if (storage.getType() != type)
return;
/// We cannot use setting.isValueChanged(), because we do not store initial settings in storage.
/// Therefore check if the setting was changed via table metadata.
const auto & settings_changes = storage.getInMemoryMetadataPtr()->settings_changes->as<ASTSetQuery>()->changes;