mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-18 21:51:57 +00:00
Try adding lock for storage
This commit is contained in:
parent
eff26f9d54
commit
89144ba843
@ -467,11 +467,12 @@ void PostgreSQLReplicationHandler::reloadFromSnapshot(const std::vector<std::pai
|
||||
|
||||
try
|
||||
{
|
||||
auto materialized_table_lock = materialized_storage->lockForShare(String(), context->getSettingsRef().lock_acquire_timeout);
|
||||
InterpreterRenameQuery(ast_rename, nested_context).execute();
|
||||
|
||||
{
|
||||
auto nested_storage = DatabaseCatalog::instance().getTable(StorageID(table_id.database_name, table_id.table_name), nested_context);
|
||||
auto table_lock = nested_storage->lockForShare(String(), context->getSettingsRef().lock_acquire_timeout);
|
||||
auto nested_table_lock = nested_storage->lockForShare(String(), context->getSettingsRef().lock_acquire_timeout);
|
||||
auto nested_table_id = nested_storage->getStorageID();
|
||||
|
||||
materialized_storage->setNestedStorageID(nested_table_id);
|
||||
|
@ -24,7 +24,6 @@
|
||||
#include <Storages/ReadFinalForExternalReplicaStorage.h>
|
||||
#include <Core/PostgreSQL/PostgreSQLConnectionPool.h>
|
||||
|
||||
/// TODO: Add test for allow_automatic_update setting in case of single storage.
|
||||
|
||||
namespace DB
|
||||
{
|
||||
@ -75,7 +74,7 @@ StorageMaterializePostgreSQL::StorageMaterializePostgreSQL(
|
||||
metadata_path,
|
||||
getContext(),
|
||||
replication_settings->materialize_postgresql_max_block_size.value,
|
||||
replication_settings->materialize_postgresql_allow_automatic_update.value, false);
|
||||
/* allow_automatic_update */ false, /* is_materialize_postgresql_database */false);
|
||||
}
|
||||
|
||||
|
||||
@ -252,6 +251,7 @@ Pipe StorageMaterializePostgreSQL::read(
|
||||
size_t max_block_size,
|
||||
unsigned num_streams)
|
||||
{
|
||||
auto materialized_table_lock = lockForShare(String(), context_->getSettingsRef().lock_acquire_timeout);
|
||||
auto nested_table = getNested();
|
||||
return readFinalFromNestedStorage(nested_table, column_names, metadata_snapshot,
|
||||
query_info, context_, processed_stage, max_block_size, num_streams);
|
||||
|
Loading…
Reference in New Issue
Block a user