mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-04 21:42:39 +00:00
fix
fix fix fix
This commit is contained in:
parent
4be47ca7e7
commit
f9a76666c9
@ -34,56 +34,55 @@ void FileLogDirectoryWatcher::onItemAdded(const Poco::DirectoryWatcher::Director
|
|||||||
{
|
{
|
||||||
std::lock_guard<std::mutex> lock(mutex);
|
std::lock_guard<std::mutex> lock(mutex);
|
||||||
DirEvent de;
|
DirEvent de;
|
||||||
de.callback = "onItemAdded";
|
de.callback = "onItemAdded";
|
||||||
de.path = ev.item.path();
|
de.path = ev.item.path();
|
||||||
de.type = ev.event;
|
de.type = ev.event;
|
||||||
events.push_back(de);
|
events.emplace_back(de);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void FileLogDirectoryWatcher::onItemRemoved(const Poco::DirectoryWatcher::DirectoryEvent& ev)
|
void FileLogDirectoryWatcher::onItemRemoved(const Poco::DirectoryWatcher::DirectoryEvent& ev)
|
||||||
{
|
{
|
||||||
std::lock_guard<std::mutex> lock(mutex);
|
std::lock_guard<std::mutex> lock(mutex);
|
||||||
DirEvent de;
|
DirEvent de;
|
||||||
de.callback = "onItemRemoved";
|
de.callback = "onItemRemoved";
|
||||||
de.path = ev.item.path();
|
de.path = ev.item.path();
|
||||||
de.type = ev.event;
|
de.type = ev.event;
|
||||||
events.push_back(de);
|
events.emplace_back(de);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void FileLogDirectoryWatcher::onItemModified(const Poco::DirectoryWatcher::DirectoryEvent& ev)
|
void FileLogDirectoryWatcher::onItemModified(const Poco::DirectoryWatcher::DirectoryEvent& ev)
|
||||||
{
|
{
|
||||||
std::lock_guard<std::mutex> lock(mutex);
|
std::lock_guard<std::mutex> lock(mutex);
|
||||||
DirEvent de;
|
DirEvent de;
|
||||||
de.callback = "onItemModified";
|
de.callback = "onItemModified";
|
||||||
de.path = ev.item.path();
|
de.path = ev.item.path();
|
||||||
de.type = ev.event;
|
de.type = ev.event;
|
||||||
events.push_back(de);
|
events.emplace_back(de);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FileLogDirectoryWatcher::onItemMovedFrom(const Poco::DirectoryWatcher::DirectoryEvent& ev)
|
void FileLogDirectoryWatcher::onItemMovedFrom(const Poco::DirectoryWatcher::DirectoryEvent& ev)
|
||||||
{
|
{
|
||||||
std::lock_guard<std::mutex> lock(mutex);
|
std::lock_guard<std::mutex> lock(mutex);
|
||||||
DirEvent de;
|
DirEvent de;
|
||||||
de.callback = "onItemMovedFrom";
|
de.callback = "onItemMovedFrom";
|
||||||
de.path = ev.item.path();
|
de.path = ev.item.path();
|
||||||
de.type = ev.event;
|
de.type = ev.event;
|
||||||
events.push_back(de);
|
events.emplace_back(de);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FileLogDirectoryWatcher::onItemMovedTo(const Poco::DirectoryWatcher::DirectoryEvent& ev)
|
void FileLogDirectoryWatcher::onItemMovedTo(const Poco::DirectoryWatcher::DirectoryEvent& ev)
|
||||||
{
|
{
|
||||||
std::lock_guard<std::mutex> lock(mutex);
|
std::lock_guard<std::mutex> lock(mutex);
|
||||||
DirEvent de;
|
DirEvent de;
|
||||||
de.callback = "onItemMovedTo";
|
de.callback = "onItemMovedTo";
|
||||||
de.path = ev.item.path();
|
de.path = ev.item.path();
|
||||||
de.type = ev.event;
|
de.type = ev.event;
|
||||||
events.push_back(de);
|
events.emplace_back(de);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void FileLogDirectoryWatcher::onError(const Poco::Exception &)
|
void FileLogDirectoryWatcher::onError(const Poco::Exception &)
|
||||||
{
|
{
|
||||||
error = true;
|
error = true;
|
||||||
}
|
}
|
||||||
|
@ -4,20 +4,19 @@
|
|||||||
#include <Poco/Foundation.h>
|
#include <Poco/Foundation.h>
|
||||||
#include <Poco/Path.h>
|
#include <Poco/Path.h>
|
||||||
|
|
||||||
#include <deque>
|
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
|
|
||||||
class FileLogDirectoryWatcher
|
class FileLogDirectoryWatcher
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
struct DirEvent
|
struct DirEvent
|
||||||
{
|
{
|
||||||
Poco::DirectoryWatcher::DirectoryEventType type;
|
Poco::DirectoryWatcher::DirectoryEventType type;
|
||||||
std::string callback;
|
std::string callback;
|
||||||
std::string path;
|
std::string path;
|
||||||
};
|
};
|
||||||
|
|
||||||
using Events = std::deque<DirEvent>;
|
using Events = std::vector<DirEvent>;
|
||||||
|
|
||||||
explicit FileLogDirectoryWatcher(const std::string & path_);
|
explicit FileLogDirectoryWatcher(const std::string & path_);
|
||||||
~FileLogDirectoryWatcher() = default;
|
~FileLogDirectoryWatcher() = default;
|
||||||
@ -30,10 +29,10 @@ public:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
void onItemAdded(const Poco::DirectoryWatcher::DirectoryEvent& ev);
|
void onItemAdded(const Poco::DirectoryWatcher::DirectoryEvent& ev);
|
||||||
void onItemRemoved(const Poco::DirectoryWatcher::DirectoryEvent& ev);
|
void onItemRemoved(const Poco::DirectoryWatcher::DirectoryEvent & ev);
|
||||||
void onItemModified(const Poco::DirectoryWatcher::DirectoryEvent& ev);
|
void onItemModified(const Poco::DirectoryWatcher::DirectoryEvent& ev);
|
||||||
void onItemMovedFrom(const Poco::DirectoryWatcher::DirectoryEvent& ev);
|
void onItemMovedFrom(const Poco::DirectoryWatcher::DirectoryEvent & ev);
|
||||||
void onItemMovedTo(const Poco::DirectoryWatcher::DirectoryEvent& ev);
|
void onItemMovedTo(const Poco::DirectoryWatcher::DirectoryEvent & ev);
|
||||||
void onError(const Poco::Exception &);
|
void onError(const Poco::Exception &);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -88,28 +88,28 @@ Pipe StorageFileLog::read(
|
|||||||
|
|
||||||
void StorageFileLog::startup()
|
void StorageFileLog::startup()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
createReadBuffer();
|
createReadBuffer();
|
||||||
}
|
}
|
||||||
catch (const Exception &)
|
catch (const Exception &)
|
||||||
{
|
{
|
||||||
tryLogCurrentException(log);
|
tryLogCurrentException(log);
|
||||||
}
|
}
|
||||||
|
|
||||||
task->holder->activateAndSchedule();
|
task->holder->activateAndSchedule();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void StorageFileLog::shutdown()
|
void StorageFileLog::shutdown()
|
||||||
{
|
{
|
||||||
task->stream_cancelled = true;
|
task->stream_cancelled = true;
|
||||||
|
|
||||||
LOG_TRACE(log, "Waiting for cleanup");
|
LOG_TRACE(log, "Waiting for cleanup");
|
||||||
task->holder->deactivate();
|
task->holder->deactivate();
|
||||||
|
|
||||||
LOG_TRACE(log, "Closing files");
|
LOG_TRACE(log, "Closing files");
|
||||||
destroyReadBuffer();
|
destroyReadBuffer();
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t StorageFileLog::getMaxBlockSize() const
|
size_t StorageFileLog::getMaxBlockSize() const
|
||||||
|
@ -50,7 +50,6 @@ const char * auto_config_build[]
|
|||||||
"USE_LDAP", "@USE_LDAP@",
|
"USE_LDAP", "@USE_LDAP@",
|
||||||
"TZDATA_VERSION", "@TZDATA_VERSION@",
|
"TZDATA_VERSION", "@TZDATA_VERSION@",
|
||||||
"USE_KRB5", "@USE_KRB5@",
|
"USE_KRB5", "@USE_KRB5@",
|
||||||
"USE_KRB5", "@USE_KRB5@",
|
|
||||||
"USE_FILELOG", "@USE_FILELOG@",
|
"USE_FILELOG", "@USE_FILELOG@",
|
||||||
|
|
||||||
nullptr, nullptr
|
nullptr, nullptr
|
||||||
|
Loading…
Reference in New Issue
Block a user