add system sync file cache

This commit is contained in:
freedomDR 2023-01-27 01:10:40 +00:00
parent cb803a887a
commit 379850b6c4
4 changed files with 19 additions and 0 deletions

View File

@ -171,6 +171,7 @@ enum class AccessType
M(SYSTEM_WAIT_LOADING_PARTS, "WAIT LOADING PARTS", TABLE, SYSTEM) \
M(SYSTEM_SYNC_DATABASE_REPLICA, "SYNC DATABASE REPLICA", DATABASE, SYSTEM) \
M(SYSTEM_SYNC_TRANSACTION_LOG, "SYNC TRANSACTION LOG", GLOBAL, SYSTEM) \
M(SYSTEM_SYNC_FILE_CACHE, "SYNC SYSCALL", GLOBAL, SYSTEM) \
M(SYSTEM_FLUSH_DISTRIBUTED, "FLUSH DISTRIBUTED", TABLE, SYSTEM_FLUSH) \
M(SYSTEM_FLUSH_LOGS, "FLUSH LOGS", GLOBAL, SYSTEM_FLUSH) \
M(SYSTEM_FLUSH, "", GROUP, SYSTEM) \

View File

@ -56,6 +56,7 @@
#include <Common/ThreadFuzzer.h>
#include <csignal>
#include <algorithm>
#include <unistd.h>
#include "config.h"
@ -292,6 +293,13 @@ BlockIO InterpreterSystemQuery::execute()
res->wait();
break;
}
case Type::SYNC_FILE_CACHE:
{
// It's too heavy.
LOG_DEBUG(log, "will call syscall sync() function, It's too heavy.");
sync();
break;
}
case Type::DROP_DNS_CACHE:
{
getContext()->checkAccess(AccessType::SYSTEM_DROP_DNS_CACHE);
@ -1133,6 +1141,11 @@ AccessRightsElements InterpreterSystemQuery::getRequiredAccessForDDLOnCluster()
required_access.emplace_back(AccessType::SYSTEM_UNFREEZE);
break;
}
case Type::SYNC_FILE_CACHE:
{
required_access.emplace_back(AccessType::SYSTEM_SYNC_FILE_CACHE);
break;
}
case Type::STOP_LISTEN_QUERIES:
case Type::START_LISTEN_QUERIES:
case Type::STOP_THREAD_FUZZER:

View File

@ -206,6 +206,10 @@ void ASTSystemQuery::formatImpl(const FormatSettings & settings, FormatState &,
{
settings.ostr << (settings.hilite ? hilite_identifier : "") << backQuoteIfNeed(backup_name);
}
else if (type == Type::SYNC_FILE_CACHE)
{
settings.ostr << (settings.hilite ? hilite_none : "");
}
}

View File

@ -42,6 +42,7 @@ public:
SYNC_REPLICA,
SYNC_DATABASE_REPLICA,
SYNC_TRANSACTION_LOG,
SYNC_FILE_CACHE,
RELOAD_DICTIONARY,
RELOAD_DICTIONARIES,
RELOAD_MODEL,