diff options
author | sskvor <sskvor@yandex-team.ru> | 2022-02-10 16:48:04 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:48:04 +0300 |
commit | 10ade5dcb952a8fae61f734485641a8409e1c545 (patch) | |
tree | b222e5ac2e2e98872661c51ccceee5da0d291e13 | |
parent | 75abffb472365d28bd0a019db1a54cb32a6100dd (diff) | |
download | ydb-10ade5dcb952a8fae61f734485641a8409e1c545.tar.gz |
Restoring authorship annotation for <sskvor@yandex-team.ru>. Commit 2 of 2.
-rw-r--r-- | build/ya.conf.json | 2 | ||||
-rw-r--r-- | contrib/libs/hyperscan/src/rose/rose_graph.h | 4 | ||||
-rw-r--r-- | contrib/libs/hyperscan/src/util/ue2_graph.h | 2 | ||||
-rw-r--r-- | library/cpp/deprecated/ya.make | 8 | ||||
-rw-r--r-- | library/cpp/http/server/http.cpp | 22 | ||||
-rw-r--r-- | library/cpp/http/server/http.h | 2 | ||||
-rw-r--r-- | library/cpp/http/server/options.h | 16 | ||||
-rw-r--r-- | library/cpp/logger/all.h | 2 | ||||
-rw-r--r-- | library/cpp/logger/sync_page_cache_file.cpp | 250 | ||||
-rw-r--r-- | library/cpp/logger/sync_page_cache_file.h | 38 | ||||
-rw-r--r-- | library/cpp/logger/ya.make | 2 | ||||
-rw-r--r-- | library/cpp/testing/benchmark/bench.h | 12 | ||||
-rw-r--r-- | library/cpp/testing/benchmark/dummy.cpp | 16 | ||||
-rw-r--r-- | library/cpp/testing/benchmark/ya.make | 2 | ||||
-rw-r--r-- | library/cpp/threading/skip_list/skiplist.h | 16 | ||||
-rw-r--r-- | util/thread/pool.h | 2 |
16 files changed, 198 insertions, 198 deletions
diff --git a/build/ya.conf.json b/build/ya.conf.json index 3e2a463506..5f7cc875d6 100644 --- a/build/ya.conf.json +++ b/build/ya.conf.json @@ -7887,7 +7887,7 @@ }, "cs": { "formula": { - "sandbox_id": 1206856496, + "sandbox_id": 1206856496, "match": "cs" }, "executable": { diff --git a/contrib/libs/hyperscan/src/rose/rose_graph.h b/contrib/libs/hyperscan/src/rose/rose_graph.h index 78d601ac68..b5bf1985d8 100644 --- a/contrib/libs/hyperscan/src/rose/rose_graph.h +++ b/contrib/libs/hyperscan/src/rose/rose_graph.h @@ -112,7 +112,7 @@ struct LeftEngInfo { } size_t hash() const; void reset(void); - explicit operator bool() const; + explicit operator bool() const; bool tracksSom() const { return !!haig; } }; @@ -133,7 +133,7 @@ struct RoseSuffixInfo { bool operator<(const RoseSuffixInfo &b) const; size_t hash() const; void reset(void); - explicit operator bool() const { return graph || castle || haig || rdfa || tamarama; } + explicit operator bool() const { return graph || castle || haig || rdfa || tamarama; } }; /** \brief Properties attached to each Rose graph vertex. */ diff --git a/contrib/libs/hyperscan/src/util/ue2_graph.h b/contrib/libs/hyperscan/src/util/ue2_graph.h index e6af47a6de..aa9718d73a 100644 --- a/contrib/libs/hyperscan/src/util/ue2_graph.h +++ b/contrib/libs/hyperscan/src/util/ue2_graph.h @@ -176,7 +176,7 @@ public: vertex_descriptor() : p(nullptr), serial(0) {} explicit vertex_descriptor(vertex_node *pp) : p(pp), serial(pp->serial) {} - explicit operator bool() const { return p; } + explicit operator bool() const { return p; } bool operator<(const vertex_descriptor b) const { if (p && b.p) { /* no vertices in the same graph can have the same serial */ diff --git a/library/cpp/deprecated/ya.make b/library/cpp/deprecated/ya.make index 52e73457fb..6c753f68a9 100644 --- a/library/cpp/deprecated/ya.make +++ b/library/cpp/deprecated/ya.make @@ -23,11 +23,11 @@ RECURSE( mapped_file mapped_file/ut mbitmap - omni + omni text_norm - omni/print_omni - omni/usage - omni/ut + omni/print_omni + omni/usage + omni/ut prog_options prog_options/ut sgi_hash diff --git a/library/cpp/http/server/http.cpp b/library/cpp/http/server/http.cpp index 978847d5ca..128583bdd7 100644 --- a/library/cpp/http/server/http.cpp +++ b/library/cpp/http/server/http.cpp @@ -2,7 +2,7 @@ #include "http_ex.h" #include <library/cpp/threading/equeue/equeue.h> - + #include <util/generic/buffer.h> #include <util/generic/cast.h> #include <util/generic/intrlist.h> @@ -458,8 +458,8 @@ public: THttpServer* Parent_ = nullptr; TWakeupPollAble WakeupPollAble; TMutex StopMutex; - -private: + +private: template <class TThreadPool_> static THolder<IThreadPool> MakeThreadPool(IThreadFactory* factory, bool elastic, ICallBack* callback = nullptr, const TString& threadName = {}) { if (!factory) { @@ -470,20 +470,20 @@ private: const auto params = IThreadPool::TParams().SetFactory(factory).SetThreadName(threadName); if (callback) { pool = MakeHolder<TThreadPoolBinder<TThreadPool_, THttpServer::ICallBack>>(callback, params); - } else { + } else { pool = MakeHolder<TThreadPool_>(params); - } - - if (elastic) { + } + + if (elastic) { pool = MakeHolder<TElasticQueue>(std::move(pool)); - } + } return pool; - } + } }; -THttpServer::THttpServer(ICallBack* cb, const TOptions& options, IThreadFactory* pool) - : Impl_(new TImpl(this, cb, options, pool)) +THttpServer::THttpServer(ICallBack* cb, const TOptions& options, IThreadFactory* pool) + : Impl_(new TImpl(this, cb, options, pool)) { } diff --git a/library/cpp/http/server/http.h b/library/cpp/http/server/http.h index 79e8754a0c..b292d38f27 100644 --- a/library/cpp/http/server/http.h +++ b/library/cpp/http/server/http.h @@ -64,7 +64,7 @@ public: typedef THttpServerOptions TOptions; typedef TSimpleSharedPtr<IThreadPool> TMtpQueueRef; - THttpServer(ICallBack* cb, const TOptions& options = TOptions(), IThreadFactory* pool = nullptr); + THttpServer(ICallBack* cb, const TOptions& options = TOptions(), IThreadFactory* pool = nullptr); THttpServer(ICallBack* cb, TMtpQueueRef mainWorkers, TMtpQueueRef failWorkers, const TOptions& options = TOptions()); virtual ~THttpServer(); diff --git a/library/cpp/http/server/options.h b/library/cpp/http/server/options.h index 5d35eddf5d..38eda0e5e7 100644 --- a/library/cpp/http/server/options.h +++ b/library/cpp/http/server/options.h @@ -124,13 +124,13 @@ public: return *this; } - /// Use TElasticQueue instead of TThreadPool for request queues - inline THttpServerOptions& EnableElasticQueues(bool enable) noexcept { - UseElasticQueues = enable; - - return *this; - } - + /// Use TElasticQueue instead of TThreadPool for request queues + inline THttpServerOptions& EnableElasticQueues(bool enable) noexcept { + UseElasticQueues = enable; + + return *this; + } + inline THttpServerOptions& SetThreadsName(const TString& listenThreadName, const TString& requestsThreadName, const TString& failRequestsThreadName) noexcept { ListenThreadName = listenThreadName; RequestsThreadName = requestsThreadName; @@ -165,7 +165,7 @@ public: size_t OutputBufferSize = 0; ui64 MaxInputContentLength = sizeof(size_t) <= 4 ? 2_GB : 64_GB; size_t MaxRequestsPerConnection = 0; // If keep-alive is enabled, request limit before connection is closed - bool UseElasticQueues = false; + bool UseElasticQueues = false; TDuration PollTimeout; // timeout of TSocketPoller::WaitT call TDuration ExpirationTimeout; // drop inactive connections after ExpirationTimeout (should be > 0) diff --git a/library/cpp/logger/all.h b/library/cpp/logger/all.h index e7530f1771..ee1666844e 100644 --- a/library/cpp/logger/all.h +++ b/library/cpp/logger/all.h @@ -6,4 +6,4 @@ #include "stream.h" #include "thread.h" #include "system.h" -#include "sync_page_cache_file.h" +#include "sync_page_cache_file.h" diff --git a/library/cpp/logger/sync_page_cache_file.cpp b/library/cpp/logger/sync_page_cache_file.cpp index c767b8d75d..a0e93a78d7 100644 --- a/library/cpp/logger/sync_page_cache_file.cpp +++ b/library/cpp/logger/sync_page_cache_file.cpp @@ -1,125 +1,125 @@ -#include "sync_page_cache_file.h" -#include "record.h" - -#include <util/generic/buffer.h> -#include <util/system/file.h> -#include <util/system/info.h> -#include <util/system/mutex.h> -#include <util/system/rwlock.h> -#include <util/system/align.h> - -class TSyncPageCacheFileLogBackend::TImpl: public TNonCopyable { -public: - TImpl(const TString& path, size_t maxBufferSize, size_t maxPendingCacheSize) - : File_{OpenFile(path)} - , MaxBufferSize_{maxBufferSize} - , MaxPendingCacheSize_{maxPendingCacheSize} - , Buffer_{maxBufferSize} - { - ResetPtrs(); - } - - ~TImpl() noexcept { - try { - Write(); - FlushSync(GuaranteedWrittenPtr_, WrittenPtr_); - } catch (...) { - } - } - - void WriteData(const TLogRecord& rec) { - TGuard guard{Lock_}; - - Buffer_.Append(rec.Data, rec.Len); - if (Buffer_.size() >= MaxBufferSize_) { - const i64 prevAlignedEndPtr = PageAlignedWrittenPtr_; - Write(); - - if (prevAlignedEndPtr < PageAlignedWrittenPtr_) { - FlushAsync(prevAlignedEndPtr, PageAlignedWrittenPtr_); - } - - const i64 minPendingCacheOffset = PageAlignedWrittenPtr_ - MaxPendingCacheSize_; - if (minPendingCacheOffset > GuaranteedWrittenPtr_) { - FlushSync(GuaranteedWrittenPtr_, minPendingCacheOffset); - } - } - } - - void ReopenLog() { - TGuard guard{Lock_}; - - Write(); - FlushSync(GuaranteedWrittenPtr_, WrittenPtr_); - - File_.LinkTo(OpenFile(File_.GetName())); - - ResetPtrs(); - } - -private: - void ResetPtrs() { - WrittenPtr_ = File_.GetLength(); - PageAlignedWrittenPtr_ = AlignDown(WrittenPtr_, GetPageSize()); - GuaranteedWrittenPtr_ = WrittenPtr_; - } - - static TFile OpenFile(const TString& path) { - return TFile{path, OpenAlways | WrOnly | ForAppend | Seq | NoReuse}; - } - - static i64 GetPageSize() { - static const i64 pageSize = NSystemInfo::GetPageSize(); - Y_ASSUME(IsPowerOf2(pageSize)); - return pageSize; - } - - void Write() { - File_.Write(Buffer_.Data(), Buffer_.Size()); - WrittenPtr_ += Buffer_.Size(); - PageAlignedWrittenPtr_ = AlignDown(WrittenPtr_, GetPageSize()); - Buffer_.Clear(); - } - - void FlushAsync(const i64 from, const i64 to) { - File_.FlushCache(from, to - from, /* wait = */ false); - } - - void FlushSync(const i64 from, const i64 to) { - const i64 begin = AlignDown(from, GetPageSize()); - const i64 end = AlignUp(to, GetPageSize()); - const i64 length = end - begin; - - File_.FlushCache(begin, length, /* wait = */ true); - File_.EvictCache(begin, length); - - GuaranteedWrittenPtr_ = to; - } - -private: - TMutex Lock_; - TFile File_; - - const size_t MaxBufferSize_ = 0; - const size_t MaxPendingCacheSize_ = 0; - - TBuffer Buffer_; - i64 WrittenPtr_ = 0; - i64 PageAlignedWrittenPtr_ = 0; - i64 GuaranteedWrittenPtr_ = 0; -}; - -TSyncPageCacheFileLogBackend::TSyncPageCacheFileLogBackend(const TString& path, size_t maxBufferSize, size_t maxPengingCacheSize) - : Impl_(MakeHolder<TImpl>(path, maxBufferSize, maxPengingCacheSize)) -{} - -TSyncPageCacheFileLogBackend::~TSyncPageCacheFileLogBackend() { -} - -void TSyncPageCacheFileLogBackend::WriteData(const TLogRecord& rec) { - Impl_->WriteData(rec); -} - -void TSyncPageCacheFileLogBackend::ReopenLog() { - Impl_->ReopenLog(); -} +#include "sync_page_cache_file.h" +#include "record.h" + +#include <util/generic/buffer.h> +#include <util/system/file.h> +#include <util/system/info.h> +#include <util/system/mutex.h> +#include <util/system/rwlock.h> +#include <util/system/align.h> + +class TSyncPageCacheFileLogBackend::TImpl: public TNonCopyable { +public: + TImpl(const TString& path, size_t maxBufferSize, size_t maxPendingCacheSize) + : File_{OpenFile(path)} + , MaxBufferSize_{maxBufferSize} + , MaxPendingCacheSize_{maxPendingCacheSize} + , Buffer_{maxBufferSize} + { + ResetPtrs(); + } + + ~TImpl() noexcept { + try { + Write(); + FlushSync(GuaranteedWrittenPtr_, WrittenPtr_); + } catch (...) { + } + } + + void WriteData(const TLogRecord& rec) { + TGuard guard{Lock_}; + + Buffer_.Append(rec.Data, rec.Len); + if (Buffer_.size() >= MaxBufferSize_) { + const i64 prevAlignedEndPtr = PageAlignedWrittenPtr_; + Write(); + + if (prevAlignedEndPtr < PageAlignedWrittenPtr_) { + FlushAsync(prevAlignedEndPtr, PageAlignedWrittenPtr_); + } + + const i64 minPendingCacheOffset = PageAlignedWrittenPtr_ - MaxPendingCacheSize_; + if (minPendingCacheOffset > GuaranteedWrittenPtr_) { + FlushSync(GuaranteedWrittenPtr_, minPendingCacheOffset); + } + } + } + + void ReopenLog() { + TGuard guard{Lock_}; + + Write(); + FlushSync(GuaranteedWrittenPtr_, WrittenPtr_); + + File_.LinkTo(OpenFile(File_.GetName())); + + ResetPtrs(); + } + +private: + void ResetPtrs() { + WrittenPtr_ = File_.GetLength(); + PageAlignedWrittenPtr_ = AlignDown(WrittenPtr_, GetPageSize()); + GuaranteedWrittenPtr_ = WrittenPtr_; + } + + static TFile OpenFile(const TString& path) { + return TFile{path, OpenAlways | WrOnly | ForAppend | Seq | NoReuse}; + } + + static i64 GetPageSize() { + static const i64 pageSize = NSystemInfo::GetPageSize(); + Y_ASSUME(IsPowerOf2(pageSize)); + return pageSize; + } + + void Write() { + File_.Write(Buffer_.Data(), Buffer_.Size()); + WrittenPtr_ += Buffer_.Size(); + PageAlignedWrittenPtr_ = AlignDown(WrittenPtr_, GetPageSize()); + Buffer_.Clear(); + } + + void FlushAsync(const i64 from, const i64 to) { + File_.FlushCache(from, to - from, /* wait = */ false); + } + + void FlushSync(const i64 from, const i64 to) { + const i64 begin = AlignDown(from, GetPageSize()); + const i64 end = AlignUp(to, GetPageSize()); + const i64 length = end - begin; + + File_.FlushCache(begin, length, /* wait = */ true); + File_.EvictCache(begin, length); + + GuaranteedWrittenPtr_ = to; + } + +private: + TMutex Lock_; + TFile File_; + + const size_t MaxBufferSize_ = 0; + const size_t MaxPendingCacheSize_ = 0; + + TBuffer Buffer_; + i64 WrittenPtr_ = 0; + i64 PageAlignedWrittenPtr_ = 0; + i64 GuaranteedWrittenPtr_ = 0; +}; + +TSyncPageCacheFileLogBackend::TSyncPageCacheFileLogBackend(const TString& path, size_t maxBufferSize, size_t maxPengingCacheSize) + : Impl_(MakeHolder<TImpl>(path, maxBufferSize, maxPengingCacheSize)) +{} + +TSyncPageCacheFileLogBackend::~TSyncPageCacheFileLogBackend() { +} + +void TSyncPageCacheFileLogBackend::WriteData(const TLogRecord& rec) { + Impl_->WriteData(rec); +} + +void TSyncPageCacheFileLogBackend::ReopenLog() { + Impl_->ReopenLog(); +} diff --git a/library/cpp/logger/sync_page_cache_file.h b/library/cpp/logger/sync_page_cache_file.h index a909f01a64..a36340651c 100644 --- a/library/cpp/logger/sync_page_cache_file.h +++ b/library/cpp/logger/sync_page_cache_file.h @@ -1,19 +1,19 @@ -#pragma once - -#include "backend.h" - -#include <util/generic/fwd.h> -#include <util/generic/ptr.h> - -class TSyncPageCacheFileLogBackend final: public TLogBackend { -public: - TSyncPageCacheFileLogBackend(const TString& path, size_t maxBufferSize, size_t maxPendingCacheSize); - ~TSyncPageCacheFileLogBackend(); - - void WriteData(const TLogRecord& rec) override; - void ReopenLog() override; - -private: - class TImpl; - THolder<TImpl> Impl_; -}; +#pragma once + +#include "backend.h" + +#include <util/generic/fwd.h> +#include <util/generic/ptr.h> + +class TSyncPageCacheFileLogBackend final: public TLogBackend { +public: + TSyncPageCacheFileLogBackend(const TString& path, size_t maxBufferSize, size_t maxPendingCacheSize); + ~TSyncPageCacheFileLogBackend(); + + void WriteData(const TLogRecord& rec) override; + void ReopenLog() override; + +private: + class TImpl; + THolder<TImpl> Impl_; +}; diff --git a/library/cpp/logger/ya.make b/library/cpp/logger/ya.make index 8c69ec0989..00a5263cba 100644 --- a/library/cpp/logger/ya.make +++ b/library/cpp/logger/ya.make @@ -33,7 +33,7 @@ SRCS( GLOBAL rotating_file_creator.cpp stream.cpp GLOBAL stream_creator.cpp - sync_page_cache_file.cpp + sync_page_cache_file.cpp GLOBAL sync_page_cache_file_creator.cpp system.cpp GLOBAL system_creator.cpp diff --git a/library/cpp/testing/benchmark/bench.h b/library/cpp/testing/benchmark/bench.h index 96e80b038a..21551ad0dd 100644 --- a/library/cpp/testing/benchmark/bench.h +++ b/library/cpp/testing/benchmark/bench.h @@ -4,7 +4,7 @@ #include <util/system/types.h> #include <utility> - + namespace NBench { namespace NCpu { struct TParams { @@ -47,11 +47,11 @@ namespace NBench { : : "memory"); } -#elif defined(_MSC_VER) - Y_FORCE_INLINE void Clobber() { - _ReadWriteBarrier(); - } - +#elif defined(_MSC_VER) + Y_FORCE_INLINE void Clobber() { + _ReadWriteBarrier(); + } + #else Y_FORCE_INLINE void Clobber() { } diff --git a/library/cpp/testing/benchmark/dummy.cpp b/library/cpp/testing/benchmark/dummy.cpp index 3c533ec52f..cdb05c19db 100644 --- a/library/cpp/testing/benchmark/dummy.cpp +++ b/library/cpp/testing/benchmark/dummy.cpp @@ -1,8 +1,8 @@ -#include "bench.h" - -namespace NBench { - namespace NPrivate { - void UseCharPointer(volatile const char*) { - } - } -} +#include "bench.h" + +namespace NBench { + namespace NPrivate { + void UseCharPointer(volatile const char*) { + } + } +} diff --git a/library/cpp/testing/benchmark/ya.make b/library/cpp/testing/benchmark/ya.make index d4e6db0ee9..f42be80698 100644 --- a/library/cpp/testing/benchmark/ya.make +++ b/library/cpp/testing/benchmark/ya.make @@ -7,7 +7,7 @@ OWNER( SRCS( bench.cpp - dummy.cpp + dummy.cpp ) PEERDIR( diff --git a/library/cpp/threading/skip_list/skiplist.h b/library/cpp/threading/skip_list/skiplist.h index 03c6a33928..914a7c6ee7 100644 --- a/library/cpp/threading/skip_list/skiplist.h +++ b/library/cpp/threading/skip_list/skiplist.h @@ -78,8 +78,8 @@ namespace NThreading { TNode* Next[]; // variable-size array maximum of MaxHeight values public: - TNode(T&& value) - : Value(std::move(value)) + TNode(T&& value) + : Value(std::move(value)) { Y_UNUSED(Next); } @@ -192,13 +192,13 @@ namespace NThreading { Init(); } - bool Insert(T value) { + bool Insert(T value) { TNode* node = PrepareInsert(value); if (Y_UNLIKELY(node && Compare(node, value) == 0)) { // we do not allow duplicates return false; } - node = DoInsert(std::move(value)); + node = DoInsert(std::move(value)); TCounter::OnInsert(node->GetValue()); return true; } @@ -277,11 +277,11 @@ namespace NThreading { return static_cast<TNode*>(buffer); } - TNode* AllocateNode(T&& value, int height) { + TNode* AllocateNode(T&& value, int height) { size_t size = sizeof(TNode) + sizeof(TNode*) * height; void* buffer = Allocator.Allocate(size); memset(buffer, 0, size); - return new (buffer) TNode(std::move(value)); + return new (buffer) TNode(std::move(value)); } TNode* FindFirst() const { @@ -382,7 +382,7 @@ namespace NThreading { return next; } - TNode* DoInsert(T&& value) { + TNode* DoInsert(T&& value) { // choose level to place new node int currentHeight = AtomicGet(Height); int height = RandomHeight(); @@ -394,7 +394,7 @@ namespace NThreading { AtomicSet(Height, height); } - TNode* node = AllocateNode(std::move(value), height); + TNode* node = AllocateNode(std::move(value), height); node->Link(height, Prev); // keep last inserted node to optimize sequential inserts diff --git a/util/thread/pool.h b/util/thread/pool.h index 3b5fd58350..d1ea3a67cb 100644 --- a/util/thread/pool.h +++ b/util/thread/pool.h @@ -347,7 +347,7 @@ public: template <class... Args> inline TThreadPoolBinder(TSlave* slave, Args&&... args) - : TQueueType(std::forward<Args>(args)...) + : TQueueType(std::forward<Args>(args)...) , Slave_(slave) { } |