mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-26 17:41:59 +00:00
Merge pull request #54467 from ClickHouse/drop-lost-part-log
Add a log message on replicated table drop
This commit is contained in:
commit
f730a003ea
@ -981,6 +981,16 @@ void StorageReplicatedMergeTree::drop()
|
||||
{
|
||||
/// Session could expire, get it again
|
||||
zookeeper = getZooKeeperIfTableShutDown();
|
||||
|
||||
auto lost_part_count_path = fs::path(zookeeper_path) / "lost_part_count";
|
||||
Coordination::Stat lost_part_count_stat;
|
||||
String lost_part_count_str;
|
||||
if (zookeeper->tryGet(lost_part_count_path, lost_part_count_str, &lost_part_count_stat))
|
||||
{
|
||||
UInt64 lost_part_count = lost_part_count_str.empty() ? 0 : parse<UInt64>(lost_part_count_str);
|
||||
if (lost_part_count > 0)
|
||||
LOG_INFO(log, "Dropping table with non-zero lost_part_count equal to {}", lost_part_count);
|
||||
}
|
||||
dropReplica(zookeeper, zookeeper_path, replica_name, log, getSettings(), &has_metadata_in_zookeeper);
|
||||
}
|
||||
}
|
||||
|
@ -1,2 +1,4 @@
|
||||
1
|
||||
1
|
||||
1
|
||||
2
|
||||
|
@ -12,6 +12,8 @@ drop table rmt1;
|
||||
system sync replica rmt2;
|
||||
select lost_part_count from system.replicas where database = currentDatabase() and table = 'rmt2';
|
||||
drop table rmt2;
|
||||
SYSTEM FLUSH LOGS;
|
||||
select count() from system.text_log where logger_name like '%' || currentDatabase() || '%' and message ilike '%table with non-zero lost_part_count equal to%';
|
||||
|
||||
|
||||
create table rmt1 (d DateTime, n int) engine=ReplicatedMergeTree('/test/01165/{database}/rmt', '1') order by n partition by tuple();
|
||||
@ -24,6 +26,8 @@ drop table rmt1;
|
||||
system sync replica rmt2;
|
||||
select lost_part_count from system.replicas where database = currentDatabase() and table = 'rmt2';
|
||||
drop table rmt2;
|
||||
SYSTEM FLUSH LOGS;
|
||||
select count() from system.text_log where logger_name like '%' || currentDatabase() || '%' and message ilike '%table with non-zero lost_part_count equal to%';
|
||||
|
||||
|
||||
create table rmt1 (n UInt8, m Int32, d Date, t DateTime) engine=ReplicatedMergeTree('/test/01165/{database}/rmt', '1') order by n partition by (n, m, d, t);
|
||||
|
Loading…
Reference in New Issue
Block a user