Skip to content

Commit 7106c93

Browse files
authored
Merge pull request ClickHouse#79119 from ClickHouse/hanfei/backport-28892
backport ClickHouse#28892 to open source repo
2 parents c765b94 + c1b2f34 commit 7106c93

File tree

3 files changed

+8
-0
lines changed

3 files changed

+8
-0
lines changed

src/Backups/RestorerFromBackup.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1001,6 +1001,8 @@ void RestorerFromBackup::createTable(const QualifiedTableName & table_name)
10011001
create_query_context->setSetting("keeper_initial_backoff_ms", zookeeper_retries_info.initial_backoff_ms);
10021002
create_query_context->setSetting("keeper_max_backoff_ms", zookeeper_retries_info.max_backoff_ms);
10031003

1004+
create_query_context->setUnderRestore(true);
1005+
10041006
/// Execute CREATE TABLE query (we call IDatabase::createTableRestoredFromBackup() to allow the database to do some
10051007
/// database-specific things).
10061008
database->createTableRestoredFromBackup(

src/Interpreters/Context.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1036,6 +1036,7 @@ ContextData::ContextData(const ContextData &o) :
10361036
merge_tree_read_task_callback(o.merge_tree_read_task_callback),
10371037
merge_tree_all_ranges_callback(o.merge_tree_all_ranges_callback),
10381038
parallel_replicas_group_uuid(o.parallel_replicas_group_uuid),
1039+
is_under_restore(o.is_under_restore),
10391040
client_protocol_version(o.client_protocol_version),
10401041
query_access_info(std::make_shared<QueryAccessInfo>(*o.query_access_info)),
10411042
query_factories_info(o.query_factories_info),

src/Interpreters/Context.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -346,6 +346,8 @@ class ContextData
346346
std::optional<MergeTreeAllRangesCallback> merge_tree_all_ranges_callback;
347347
UUID parallel_replicas_group_uuid{UUIDHelpers::Nil};
348348

349+
bool is_under_restore = false;
350+
349351
/// This parameter can be set by the HTTP client to tune the behavior of output formats for compatibility.
350352
UInt64 client_protocol_version = 0;
351353

@@ -913,6 +915,9 @@ class Context: public ContextData, public std::enable_shared_from_this<Context>
913915
void setDistributed(bool is_distributed_) { is_distributed = is_distributed_; }
914916
bool isDistributed() const { return is_distributed; }
915917

918+
bool isUnderRestore() const { return is_under_restore; }
919+
void setUnderRestore(bool under_restore) { is_under_restore = under_restore; }
920+
916921
String getDefaultFormat() const; /// If default_format is not specified, some global default format is returned.
917922
void setDefaultFormat(const String & name);
918923

0 commit comments

Comments
 (0)