mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-09-20 00:30:49 +00:00
ConfigReloader: use last_write_time
for FileWithTimestamp
Previously it used `FS::getModificationTime` which has only a second precision. This caused an issue in some cases where the configuration has been changed more frequently than once per second, and the change wasn't propagated. This commit fixes that issue. Closes #53276
This commit is contained in:
parent
88128db26f
commit
021c607725
@ -164,10 +164,10 @@ void ConfigReloader::reloadIfNewer(bool force, bool throw_on_error, bool fallbac
|
||||
struct ConfigReloader::FileWithTimestamp
|
||||
{
|
||||
std::string path;
|
||||
time_t modification_time;
|
||||
fs::file_time_type modification_time;
|
||||
|
||||
FileWithTimestamp(const std::string & path_, time_t modification_time_)
|
||||
: path(path_), modification_time(modification_time_) {}
|
||||
explicit FileWithTimestamp(const std::string & path_)
|
||||
: path(path_), modification_time(fs::last_write_time(path_)) {}
|
||||
|
||||
bool operator < (const FileWithTimestamp & rhs) const
|
||||
{
|
||||
@ -184,7 +184,7 @@ struct ConfigReloader::FileWithTimestamp
|
||||
void ConfigReloader::FilesChangesTracker::addIfExists(const std::string & path_to_add)
|
||||
{
|
||||
if (!path_to_add.empty() && fs::exists(path_to_add))
|
||||
files.emplace(path_to_add, FS::getModificationTime(path_to_add));
|
||||
files.emplace(path_to_add);
|
||||
}
|
||||
|
||||
bool ConfigReloader::FilesChangesTracker::isDifferOrNewerThan(const FilesChangesTracker & rhs)
|
||||
|
Loading…
Reference in New Issue
Block a user