mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-11 08:52:06 +00:00
Allow modify some other settings
This commit is contained in:
parent
a2b0996ac3
commit
fd621381c7
@ -151,11 +151,9 @@ void DatabaseMaterializedPostgreSQL::applySettings(const SettingsChanges & setti
|
||||
if (!local_context->isInternalQuery())
|
||||
throw Exception(ErrorCodes::QUERY_NOT_ALLOWED, "Changing setting `{}` is not allowed", change.name);
|
||||
}
|
||||
else if (change.name == "materialized_postgresql_allow_automatic_update")
|
||||
{
|
||||
}
|
||||
else if (change.name == "materialized_postgresql_max_block_size")
|
||||
else if ((change.name == "materialized_postgresql_allow_automatic_update") || (change.name == "materialized_postgresql_max_block_size"))
|
||||
{
|
||||
replication_handler->setSetting(change);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -8,6 +8,7 @@
|
||||
#include <DataTypes/DataTypeNullable.h>
|
||||
#include <Interpreters/Context.h>
|
||||
#include <Interpreters/InterpreterInsertQuery.h>
|
||||
#include <Common/SettingsChanges.h>
|
||||
|
||||
|
||||
namespace DB
|
||||
@ -634,6 +635,15 @@ void MaterializedPostgreSQLConsumer::removeNested(const String & postgres_table_
|
||||
}
|
||||
|
||||
|
||||
void MaterializedPostgreSQLConsumer::setSetting(const SettingChange & setting)
|
||||
{
|
||||
if (setting.name == "materialized_postgresql_max_block_size")
|
||||
max_block_size = setting.value.safeGet<UInt64>();
|
||||
else if (setting.name == "materialized_postgresql_allow_automatic_update")
|
||||
allow_automatic_update = setting.value.safeGet<bool>();
|
||||
}
|
||||
|
||||
|
||||
/// Read binary changes from replication slot via COPY command (starting from current lsn in a slot).
|
||||
bool MaterializedPostgreSQLConsumer::readFromReplicationSlot()
|
||||
{
|
||||
|
@ -13,6 +13,7 @@
|
||||
|
||||
namespace DB
|
||||
{
|
||||
struct SettingChange;
|
||||
|
||||
class MaterializedPostgreSQLConsumer
|
||||
{
|
||||
@ -40,6 +41,8 @@ public:
|
||||
|
||||
void removeNested(const String & postgres_table_name);
|
||||
|
||||
void setSetting(const SettingChange & setting);
|
||||
|
||||
private:
|
||||
/// Read approximarely up to max_block_size changes from WAL.
|
||||
bool readFromReplicationSlot();
|
||||
@ -110,7 +113,7 @@ private:
|
||||
/// current_lsn converted from String to Int64 via getLSNValue().
|
||||
UInt64 lsn_value;
|
||||
|
||||
const size_t max_block_size;
|
||||
size_t max_block_size;
|
||||
bool allow_automatic_update;
|
||||
|
||||
String table_to_insert;
|
||||
|
@ -451,6 +451,14 @@ void PostgreSQLReplicationHandler::removeTableFromPublication(pqxx::nontransacti
|
||||
}
|
||||
|
||||
|
||||
void PostgreSQLReplicationHandler::setSetting(const SettingChange & setting)
|
||||
{
|
||||
consumer_task->deactivate();
|
||||
consumer->setSetting(setting);
|
||||
consumer_task->schedule();
|
||||
}
|
||||
|
||||
|
||||
void PostgreSQLReplicationHandler::shutdownFinal()
|
||||
{
|
||||
try
|
||||
|
@ -10,6 +10,7 @@ namespace DB
|
||||
{
|
||||
|
||||
class StorageMaterializedPostgreSQL;
|
||||
struct SettingChange;
|
||||
|
||||
class PostgreSQLReplicationHandler
|
||||
{
|
||||
@ -50,6 +51,8 @@ public:
|
||||
|
||||
void removeTableFromReplication(const String & postgres_table_name);
|
||||
|
||||
void setSetting(const SettingChange & setting);
|
||||
|
||||
private:
|
||||
using MaterializedStorages = std::unordered_map<String, StorageMaterializedPostgreSQL *>;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user