mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-26 09:32:01 +00:00
Merge pull request #45148 from mateng0915/replicas_status_api_optimize
Feature: Optimize the replica delay api logic
This commit is contained in:
commit
e914e7c98d
@ -59,14 +59,22 @@ void ReplicasStatusHandler::handleRequest(HTTPServerRequest & request, HTTPServe
|
||||
time_t absolute_delay = 0;
|
||||
time_t relative_delay = 0;
|
||||
|
||||
table_replicated->getReplicaDelays(absolute_delay, relative_delay);
|
||||
if (!table_replicated->isTableReadOnly())
|
||||
{
|
||||
table_replicated->getReplicaDelays(absolute_delay, relative_delay);
|
||||
|
||||
if ((settings.min_absolute_delay_to_close && absolute_delay >= static_cast<time_t>(settings.min_absolute_delay_to_close))
|
||||
|| (settings.min_relative_delay_to_close && relative_delay >= static_cast<time_t>(settings.min_relative_delay_to_close)))
|
||||
ok = false;
|
||||
if ((settings.min_absolute_delay_to_close && absolute_delay >= static_cast<time_t>(settings.min_absolute_delay_to_close))
|
||||
|| (settings.min_relative_delay_to_close && relative_delay >= static_cast<time_t>(settings.min_relative_delay_to_close)))
|
||||
ok = false;
|
||||
|
||||
message << backQuoteIfNeed(db.first) << "." << backQuoteIfNeed(iterator->name())
|
||||
<< ":\tAbsolute delay: " << absolute_delay << ". Relative delay: " << relative_delay << ".\n";
|
||||
message << backQuoteIfNeed(db.first) << "." << backQuoteIfNeed(iterator->name())
|
||||
<< ":\tAbsolute delay: " << absolute_delay << ". Relative delay: " << relative_delay << ".\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
message << backQuoteIfNeed(db.first) << "." << backQuoteIfNeed(iterator->name())
|
||||
<< ":\tis readonly. \n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -323,6 +323,8 @@ public:
|
||||
const String & replica_name, const String & zookeeper_path, const ContextPtr & local_context, const zkutil::ZooKeeperPtr & zookeeper);
|
||||
|
||||
bool canUseZeroCopyReplication() const;
|
||||
|
||||
bool isTableReadOnly () { return is_readonly; }
|
||||
private:
|
||||
std::atomic_bool are_restoring_replica {false};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user