mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-17 13:13:36 +00:00
Fix tests
This commit is contained in:
parent
378e1f74aa
commit
9d0444774a
@ -568,12 +568,10 @@ void DatabaseAtomic::checkDetachedTableNotInUse(const UUID & uuid)
|
||||
assertDetachedTableNotInUse(uuid);
|
||||
}
|
||||
|
||||
void DatabaseAtomic::modifySettings(const SettingsChanges & settings_changes, ContextPtr local_context)
|
||||
void DatabaseAtomic::modifySettingsMetadata(const SettingsChanges & settings_changes, ContextPtr local_context)
|
||||
{
|
||||
applySettings(settings_changes, local_context);
|
||||
|
||||
auto create_query = getCreateDatabaseQuery()->clone();
|
||||
auto create = create_query->as<ASTCreateQuery>();
|
||||
auto * create = create_query->as<ASTCreateQuery>();
|
||||
auto * settings = create->storage->settings;
|
||||
if (settings)
|
||||
{
|
||||
|
@ -61,7 +61,7 @@ public:
|
||||
void checkDetachedTableNotInUse(const UUID & uuid) override;
|
||||
void setDetachedTableNotInUseForce(const UUID & uuid);
|
||||
|
||||
void modifySettings(const SettingsChanges & settings_changes, ContextPtr local_context) override;
|
||||
void modifySettingsMetadata(const SettingsChanges & settings_changes, ContextPtr local_context) override;
|
||||
|
||||
protected:
|
||||
void commitAlterTable(const StorageID & table_id, const String & table_metadata_tmp_path, const String & table_metadata_path, const String & statement, ContextPtr query_context) override;
|
||||
|
@ -105,7 +105,7 @@ DatabasePtr DatabaseFactory::getImpl(const ASTCreateQuery & create, const String
|
||||
|
||||
static const std::unordered_set<std::string_view> database_engines{"Ordinary", "Atomic", "Memory",
|
||||
"Dictionary", "Lazy", "Replicated", "MySQL", "MaterializeMySQL", "MaterializedMySQL",
|
||||
"Lazy", "Replicated", "PostgreSQL", "MaterializedPostgreSQL", "SQLite"};
|
||||
"PostgreSQL", "MaterializedPostgreSQL", "SQLite"};
|
||||
|
||||
if (!database_engines.contains(engine_name))
|
||||
throw Exception(ErrorCodes::BAD_ARGUMENTS, "Database engine name `{}` does not exist", engine_name);
|
||||
|
@ -279,12 +279,12 @@ public:
|
||||
throw Exception(ErrorCodes::NOT_IMPLEMENTED, "Alter is not supported by database engine {}", getEngineName());
|
||||
}
|
||||
|
||||
virtual void modifySettings(const SettingsChanges &, ContextPtr)
|
||||
virtual void modifySettingsMetadata(const SettingsChanges &, ContextPtr)
|
||||
{
|
||||
throw Exception(ErrorCodes::NOT_IMPLEMENTED, "Database engine {} does not support settings", getEngineName());
|
||||
}
|
||||
|
||||
virtual void applySettings(const SettingsChanges &, ContextPtr)
|
||||
virtual void tryApplySettings(const SettingsChanges &, ContextPtr)
|
||||
{
|
||||
throw Exception(ErrorCodes::NOT_IMPLEMENTED, "Database engine {} does not support settings", getEngineName());
|
||||
}
|
||||
|
@ -140,7 +140,7 @@ void DatabaseMaterializedPostgreSQL::checkAlterIsPossible(const AlterCommands &
|
||||
}
|
||||
|
||||
|
||||
void DatabaseMaterializedPostgreSQL::applySettings(const SettingsChanges & settings_changes, ContextPtr local_context)
|
||||
void DatabaseMaterializedPostgreSQL::tryApplySettings(const SettingsChanges & settings_changes, ContextPtr local_context)
|
||||
{
|
||||
for (const auto & change : settings_changes)
|
||||
{
|
||||
@ -208,7 +208,7 @@ void DatabaseMaterializedPostgreSQL::createTable(ContextPtr local_context, const
|
||||
|
||||
/// Create ReplacingMergeTree table.
|
||||
auto query_copy = query->clone();
|
||||
auto create_query = assert_cast<ASTCreateQuery *>(query_copy.get());
|
||||
auto * create_query = assert_cast<ASTCreateQuery *>(query_copy.get());
|
||||
create_query->attach = false;
|
||||
create_query->attach_short_syntax = false;
|
||||
DatabaseAtomic::createTable(StorageMaterializedPostgreSQL::makeNestedTableContext(local_context), table_name, table, query_copy);
|
||||
@ -273,6 +273,7 @@ ASTPtr DatabaseMaterializedPostgreSQL::createAlterSettingsQuery(const SettingCha
|
||||
|
||||
void DatabaseMaterializedPostgreSQL::attachTable(const String & table_name, const StoragePtr & table, const String & relative_table_path)
|
||||
{
|
||||
/// TODO: If attach fails, need to delete nested...
|
||||
if (CurrentThread::isInitialized() && CurrentThread::get().getQueryContext())
|
||||
{
|
||||
auto tables_to_replicate = settings->materialized_postgresql_tables_list.value;
|
||||
|
@ -64,7 +64,7 @@ public:
|
||||
|
||||
void checkAlterIsPossible(const AlterCommands & commands, ContextPtr context) const override;
|
||||
|
||||
void applySettings(const SettingsChanges & settings_changes, ContextPtr context) override;
|
||||
void tryApplySettings(const SettingsChanges & settings_changes, ContextPtr context) override;
|
||||
|
||||
void shutdown() override;
|
||||
|
||||
@ -76,7 +76,7 @@ protected:
|
||||
private:
|
||||
void startSynchronization();
|
||||
|
||||
ASTPtr createAlterSettingsQuery(const SettingChange & change);
|
||||
ASTPtr createAlterSettingsQuery(const SettingChange & new_setting);
|
||||
|
||||
String getTablesList(const String & except = {}) const;
|
||||
|
||||
|
@ -365,7 +365,10 @@ void AlterCommands::apply(DatabasePtr database, ContextPtr context) const
|
||||
if (!command.ignore)
|
||||
{
|
||||
if (command.type == AlterCommand::MODIFY_DATABASE_SETTING)
|
||||
database->modifySettings(command.settings_changes, context);
|
||||
{
|
||||
database->tryApplySettings(command.settings_changes, context);
|
||||
database->modifySettingsMetadata(command.settings_changes, context);
|
||||
}
|
||||
else
|
||||
throw Exception(ErrorCodes::BAD_ARGUMENTS, "Unsupported alter command");
|
||||
}
|
||||
|
@ -51,7 +51,7 @@ StorageMaterializedPostgreSQL::StorageMaterializedPostgreSQL(
|
||||
std::unique_ptr<MaterializedPostgreSQLSettings> replication_settings)
|
||||
: IStorage(table_id_)
|
||||
, WithContext(context_->getGlobalContext())
|
||||
, log(&Poco::Logger::get("StorageMaterializedPostgreSQL(" + postgres::formatNameForLogs(remote_database_name, remote_table_name) + ")"))
|
||||
, log(&Poco::Logger::get("StorageMaterializedPostgreSQL(" + postgres::formatNameForLogs(remote_database_name, remote_table_name_) + ")"))
|
||||
, is_materialized_postgresql_database(false)
|
||||
, has_nested(false)
|
||||
, nested_context(makeNestedTableContext(context_->getGlobalContext()))
|
||||
|
Loading…
Reference in New Issue
Block a user