diff options
author | gleb-kov <gleb-kov@yandex-team.ru> | 2022-02-10 16:46:22 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:46:22 +0300 |
commit | 7b1cfa32681104c8468c5824c79fd80d9a88a579 (patch) | |
tree | 499e0a6e0f35aba718ac262605efb4342996bdca /library/cpp/actors | |
parent | 89973d10cfeccd97d2f25449a523c93940565edf (diff) | |
download | ydb-7b1cfa32681104c8468c5824c79fd80d9a88a579.tar.gz |
Restoring authorship annotation for <gleb-kov@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/actors')
-rw-r--r-- | library/cpp/actors/core/actor_coroutine.cpp | 4 | ||||
-rw-r--r-- | library/cpp/actors/core/event_local.h | 2 | ||||
-rw-r--r-- | library/cpp/actors/core/event_pb.h | 2 | ||||
-rw-r--r-- | library/cpp/actors/core/executor_thread.cpp | 4 | ||||
-rw-r--r-- | library/cpp/actors/core/invoke.h | 6 | ||||
-rw-r--r-- | library/cpp/actors/core/memory_track.h | 2 | ||||
-rw-r--r-- | library/cpp/actors/interconnect/interconnect_handshake.cpp | 28 | ||||
-rw-r--r-- | library/cpp/actors/interconnect/interconnect_tcp_proxy.cpp | 4 | ||||
-rw-r--r-- | library/cpp/actors/interconnect/logging.h | 18 | ||||
-rw-r--r-- | library/cpp/actors/testlib/test_runtime.cpp | 8 | ||||
-rw-r--r-- | library/cpp/actors/util/rope.h | 248 |
11 files changed, 163 insertions, 163 deletions
diff --git a/library/cpp/actors/core/actor_coroutine.cpp b/library/cpp/actors/core/actor_coroutine.cpp index 0ab4d2b24d..3fd39f7431 100644 --- a/library/cpp/actors/core/actor_coroutine.cpp +++ b/library/cpp/actors/core/actor_coroutine.cpp @@ -2,7 +2,7 @@ #include "executor_thread.h" #include <util/system/sanitizers.h> -#include <util/system/type_name.h> +#include <util/system/type_name.h> namespace NActors { static constexpr size_t StackOverflowGap = 4096; @@ -143,7 +143,7 @@ namespace NActors { Y_FAIL("unhandled TDtorException"); } } catch (const std::exception& ex) { - Y_FAIL("unhandled exception of type %s", TypeName(ex).data()); + Y_FAIL("unhandled exception of type %s", TypeName(ex).data()); } catch (...) { Y_FAIL("unhandled exception of type not derived from std::exception"); } diff --git a/library/cpp/actors/core/event_local.h b/library/cpp/actors/core/event_local.h index 2845aa94dd..96313cf1e3 100644 --- a/library/cpp/actors/core/event_local.h +++ b/library/cpp/actors/core/event_local.h @@ -3,7 +3,7 @@ #include "event.h" #include "scheduler_cookie.h" #include "event_load.h" -#include <util/system/type_name.h> +#include <util/system/type_name.h> namespace NActors { template <typename TEv, ui32 TEventType> diff --git a/library/cpp/actors/core/event_pb.h b/library/cpp/actors/core/event_pb.h index d7546b901a..210d0c2d83 100644 --- a/library/cpp/actors/core/event_pb.h +++ b/library/cpp/actors/core/event_pb.h @@ -268,7 +268,7 @@ namespace NActors { // parse the protobuf TRopeStream stream(iter, size); if (!ev->Record.ParseFromZeroCopyStream(&stream)) { - Y_FAIL("Failed to parse protobuf event type %" PRIu32 " class %s", TEventType, TypeName(ev->Record).data()); + Y_FAIL("Failed to parse protobuf event type %" PRIu32 " class %s", TEventType, TypeName(ev->Record).data()); } } ev->CachedByteSize = input->GetSize(); diff --git a/library/cpp/actors/core/executor_thread.cpp b/library/cpp/actors/core/executor_thread.cpp index 446b651efd..8c528fd0f4 100644 --- a/library/cpp/actors/core/executor_thread.cpp +++ b/library/cpp/actors/core/executor_thread.cpp @@ -19,7 +19,7 @@ #include <unistd.h> #endif -#include <util/system/type_name.h> +#include <util/system/type_name.h> #include <util/system/datetime.h> LWTRACE_USING(ACTORLIB_PROVIDER) @@ -92,7 +92,7 @@ namespace NActors { return "nullptr"; } try { - return TypeName(*t); + return TypeName(*t); } catch (...) { return "unknown-type"; } diff --git a/library/cpp/actors/core/invoke.h b/library/cpp/actors/core/invoke.h index 931a9767dd..da00728062 100644 --- a/library/cpp/actors/core/invoke.h +++ b/library/cpp/actors/core/invoke.h @@ -9,8 +9,8 @@ #include <utility> #include <variant> -#include <util/system/type_name.h> - +#include <util/system/type_name.h> + namespace NActors { struct TEvents::TEvInvokeResult @@ -55,7 +55,7 @@ namespace NActors { return std::move(*value); } else { Y_FAIL("unspported return type for TEvInvokeResult: actual# %s != expected# %s", - TypeName(arg.type()).data(), TypeName<T>().data()); + TypeName(arg.type()).data(), TypeName<T>().data()); } }, Result); } diff --git a/library/cpp/actors/core/memory_track.h b/library/cpp/actors/core/memory_track.h index 6035333eeb..c050aeddcb 100644 --- a/library/cpp/actors/core/memory_track.h +++ b/library/cpp/actors/core/memory_track.h @@ -2,7 +2,7 @@ #include <vector> -#include <util/system/type_name.h> +#include <util/system/type_name.h> #include <util/thread/singleton.h> #define ENABLE_MEMORY_TRACKING diff --git a/library/cpp/actors/interconnect/interconnect_handshake.cpp b/library/cpp/actors/interconnect/interconnect_handshake.cpp index 9ede998d8e..e76f3998d6 100644 --- a/library/cpp/actors/interconnect/interconnect_handshake.cpp +++ b/library/cpp/actors/interconnect/interconnect_handshake.cpp @@ -93,8 +93,8 @@ namespace NActors { TMaybe<THolder<TProgramInfo>> ProgramInfo; // filled in in case of successful handshake; even if null TSessionParams Params; bool ResolveTimedOut = false; - THashMap<ui32, TInstant> LastLogNotice; - const TDuration MuteDuration = TDuration::Seconds(15); + THashMap<ui32, TInstant> LastLogNotice; + const TDuration MuteDuration = TDuration::Seconds(15); TInstant Deadline; public: @@ -791,12 +791,12 @@ namespace NActors { if (network) { TInstant now = Now(); - TInstant prevLog = LastLogNotice[PeerNodeId]; - NActors::NLog::EPriority logPriority = NActors::NLog::PRI_DEBUG; - if (now - prevLog > MuteDuration) { - logPriority = NActors::NLog::PRI_NOTICE; - LastLogNotice[PeerNodeId] = now; - } + TInstant prevLog = LastLogNotice[PeerNodeId]; + NActors::NLog::EPriority logPriority = NActors::NLog::PRI_DEBUG; + if (now - prevLog > MuteDuration) { + logPriority = NActors::NLog::PRI_NOTICE; + LastLogNotice[PeerNodeId] = now; + } LOG_LOG_NET_X(logPriority, PeerNodeId, "network-related error occured on handshake: %s", msg.data()); } else { // calculate log severity based on failure type; permanent failures lead to error log messages @@ -883,12 +883,12 @@ namespace NActors { break; } - auto it = LastLogNotice.find(PeerNodeId); - NActors::NLog::EPriority logPriority = NActors::NLog::PRI_DEBUG; - if (it != LastLogNotice.end()) { - LastLogNotice.erase(it); - logPriority = NActors::NLog::PRI_NOTICE; - } + auto it = LastLogNotice.find(PeerNodeId); + NActors::NLog::EPriority logPriority = NActors::NLog::PRI_DEBUG; + if (it != LastLogNotice.end()) { + LastLogNotice.erase(it); + logPriority = NActors::NLog::PRI_NOTICE; + } LOG_LOG_IC_X(NActorsServices::INTERCONNECT, "ICH05", logPriority, "connected to peer"); } diff --git a/library/cpp/actors/interconnect/interconnect_tcp_proxy.cpp b/library/cpp/actors/interconnect/interconnect_tcp_proxy.cpp index 7e2d8ccb94..647d7e0d44 100644 --- a/library/cpp/actors/interconnect/interconnect_tcp_proxy.cpp +++ b/library/cpp/actors/interconnect/interconnect_tcp_proxy.cpp @@ -451,12 +451,12 @@ namespace NActors { break; case TEvHandshakeFail::HANDSHAKE_FAIL_PERMANENT: - TString timeExplanation = " LastSessionDieTime# " + LastSessionDieTime.ToString(); + TString timeExplanation = " LastSessionDieTime# " + LastSessionDieTime.ToString(); if (Session) { InvokeOtherActor(*Session, &TInterconnectSessionTCP::Terminate, TDisconnectReason::HandshakeFailPermanent()); } - TransitToErrorState(ev->Get()->Explanation + timeExplanation, false); + TransitToErrorState(ev->Get()->Explanation + timeExplanation, false); break; } } diff --git a/library/cpp/actors/interconnect/logging.h b/library/cpp/actors/interconnect/logging.h index c429d1cade..c33654b84a 100644 --- a/library/cpp/actors/interconnect/logging.h +++ b/library/cpp/actors/interconnect/logging.h @@ -20,13 +20,13 @@ LOG_LOG(::NActors::TActivationContext::AsActorContext(), (priority), (component), "%s " marker " %s", LogPrefix.data(), Sprintf(__VA_ARGS__).data()); \ } while (false) -#define LOG_LOG_NET(priority, NODE_ID, FMT, ...) \ - do { \ - const TActorContext& ctx = ::NActors::TActivationContext::AsActorContext(); \ - LOG_LOG(ctx, (priority), ::NActorsServices::INTERCONNECT_NETWORK, "[%" PRIu32 " <-> %" PRIu32 "] %s", \ - ctx.SelfID.NodeId(), (NODE_ID), Sprintf(FMT, __VA_ARGS__).data()); \ - } while (false) - +#define LOG_LOG_NET(priority, NODE_ID, FMT, ...) \ + do { \ + const TActorContext& ctx = ::NActors::TActivationContext::AsActorContext(); \ + LOG_LOG(ctx, (priority), ::NActorsServices::INTERCONNECT_NETWORK, "[%" PRIu32 " <-> %" PRIu32 "] %s", \ + ctx.SelfID.NodeId(), (NODE_ID), Sprintf(FMT, __VA_ARGS__).data()); \ + } while (false) + #define LOG_EMER_IC(marker, ...) LOG_LOG_IC(::NActorsServices::INTERCONNECT, marker, ::NActors::NLog::PRI_EMER, __VA_ARGS__) #define LOG_ALERT_IC(marker, ...) LOG_LOG_IC(::NActorsServices::INTERCONNECT, marker, ::NActors::NLog::PRI_ALERT, __VA_ARGS__) #define LOG_CRIT_IC(marker, ...) LOG_LOG_IC(::NActorsServices::INTERCONNECT, marker, ::NActors::NLog::PRI_CRIT, __VA_ARGS__) @@ -45,8 +45,8 @@ #define LOG_INFO_IC_SESSION(marker, ...) LOG_LOG_IC(::NActorsServices::INTERCONNECT_SESSION, marker, ::NActors::NLog::PRI_INFO, __VA_ARGS__) #define LOG_DEBUG_IC_SESSION(marker, ...) LOG_LOG_IC(::NActorsServices::INTERCONNECT_SESSION, marker, ::NActors::NLog::PRI_DEBUG, __VA_ARGS__) -#define LOG_NOTICE_NET(NODE_ID, FMT, ...) LOG_LOG_NET(::NActors::NLog::PRI_NOTICE, NODE_ID, FMT, __VA_ARGS__) -#define LOG_DEBUG_NET(NODE_ID, FMT, ...) LOG_LOG_NET(::NActors::NLog::PRI_DEBUG, NODE_ID, FMT, __VA_ARGS__) +#define LOG_NOTICE_NET(NODE_ID, FMT, ...) LOG_LOG_NET(::NActors::NLog::PRI_NOTICE, NODE_ID, FMT, __VA_ARGS__) +#define LOG_DEBUG_NET(NODE_ID, FMT, ...) LOG_LOG_NET(::NActors::NLog::PRI_DEBUG, NODE_ID, FMT, __VA_ARGS__) namespace NActors { class TInterconnectLoggingBase { diff --git a/library/cpp/actors/testlib/test_runtime.cpp b/library/cpp/actors/testlib/test_runtime.cpp index 6fa25b9965..90da777489 100644 --- a/library/cpp/actors/testlib/test_runtime.cpp +++ b/library/cpp/actors/testlib/test_runtime.cpp @@ -890,7 +890,7 @@ namespace NActors { const ui64 localActorId = AllocateLocalId(); if (VERBOSE) { - Cerr << "Register actor " << TypeName(*actor) << " as " << localActorId << ", mailbox: " << hint << "\n"; + Cerr << "Register actor " << TypeName(*actor) << " as " << localActorId << ", mailbox: " << hint << "\n"; } // ok, got mailbox @@ -898,7 +898,7 @@ namespace NActors { // do init const TActorId actorId(FirstNodeId + nodeIndex, poolId, localActorId, hint); - ActorNames[actorId] = TypeName(*actor); + ActorNames[actorId] = TypeName(*actor); RegistrationObserver(*this, parentId ? parentId : CurrentRecipient, actorId); DoActorInit(node->ActorSystem.Get(), actor, actorId, parentId ? parentId : CurrentRecipient); @@ -937,12 +937,12 @@ namespace NActors { const ui64 localActorId = AllocateLocalId(); if (VERBOSE) { - Cerr << "Register actor " << TypeName(*actor) << " as " << localActorId << "\n"; + Cerr << "Register actor " << TypeName(*actor) << " as " << localActorId << "\n"; } mailbox->AttachActor(localActorId, actor); const TActorId actorId(FirstNodeId + nodeIndex, poolId, localActorId, hint); - ActorNames[actorId] = TypeName(*actor); + ActorNames[actorId] = TypeName(*actor); RegistrationObserver(*this, parentId ? parentId : CurrentRecipient, actorId); DoActorInit(node->ActorSystem.Get(), actor, actorId, parentId ? parentId : CurrentRecipient); diff --git a/library/cpp/actors/util/rope.h b/library/cpp/actors/util/rope.h index f5595efbaa..a506fd000d 100644 --- a/library/cpp/actors/util/rope.h +++ b/library/cpp/actors/util/rope.h @@ -993,130 +993,130 @@ public: } }; -struct TRopeUtils { - static void Memset(TRope::TConstIterator dst, char c, size_t size) { - while (size) { - Y_VERIFY_DEBUG(dst.Valid()); - size_t len = std::min(size, dst.ContiguousSize()); - memset(const_cast<char*>(dst.ContiguousData()), c, len); - dst += len; - size -= len; - } - } - - static void Memcpy(TRope::TConstIterator dst, TRope::TConstIterator src, size_t size) { - while (size) { - Y_VERIFY_DEBUG(dst.Valid() && src.Valid(), - "Invalid iterator in memcpy: dst.Valid() - %" PRIu32 ", src.Valid() - %" PRIu32, - (ui32)dst.Valid(), (ui32)src.Valid()); - size_t len = std::min(size, std::min(dst.ContiguousSize(), src.ContiguousSize())); - memcpy(const_cast<char*>(dst.ContiguousData()), src.ContiguousData(), len); - dst += len; - src += len; - size -= len; - } - } - - static void Memcpy(TRope::TConstIterator dst, const char* src, size_t size) { - while (size) { - Y_VERIFY_DEBUG(dst.Valid()); - size_t len = std::min(size, dst.ContiguousSize()); - memcpy(const_cast<char*>(dst.ContiguousData()), src, len); - size -= len; - dst += len; - src += len; - } - } - - static void Memcpy(char* dst, TRope::TConstIterator src, size_t size) { - while (size) { - Y_VERIFY_DEBUG(src.Valid()); - size_t len = std::min(size, src.ContiguousSize()); - memcpy(dst, src.ContiguousData(), len); - size -= len; - dst += len; - src += len; - } - } - - // copy less or equal to sizeBound bytes, until src is valid - static size_t SafeMemcpy(char* dst, TRope::TIterator src, size_t sizeBound) { - size_t origSize = sizeBound; - while (sizeBound && src.Valid()) { - size_t len = Min(sizeBound, src.ContiguousSize()); - memcpy(dst, src.ContiguousData(), len); - sizeBound -= len; - dst += len; - src += len; - } - return origSize - sizeBound; - } -}; - -template<size_t BLOCK, size_t ALIGN = 16> -class TRopeSlideView { - alignas(ALIGN) char Slide[BLOCK]; // use if distance from current point and next chunk is less than BLOCK - TRope::TIterator Position; // current position at rope - size_t Size; - char* Head; // points to data, it might be current rope chunk or Slide - -private: - void FillBlock() { - size_t chunkSize = Position.ContiguousSize(); - if (chunkSize >= BLOCK) { - Size = chunkSize; - Head = const_cast<char*>(Position.ContiguousData()); - } else { - Size = TRopeUtils::SafeMemcpy(Slide, Position, BLOCK); - Head = Slide; - } - } - -public: - TRopeSlideView(TRope::TIterator position) - : Position(position) - { - FillBlock(); - } - - TRopeSlideView(TRope &rope) - : TRopeSlideView(rope.Begin()) - {} - - // if view on slide then copy slide to rope - void FlushBlock() { - if (Head == Slide) { - TRopeUtils::Memcpy(Position, Head, Size); - } - } - - TRope::TIterator operator+=(size_t amount) { - Position += amount; - FillBlock(); - return Position; - } - - TRope::TIterator GetPosition() const { - return Position; - } - - char* GetHead() const { - return Head; - } - - ui8* GetUi8Head() const { - return reinterpret_cast<ui8*>(Head); - } - - size_t ContiguousSize() const { - return Size; - } - - bool IsOnChunk() const { - return Head != Slide; - } -}; - +struct TRopeUtils { + static void Memset(TRope::TConstIterator dst, char c, size_t size) { + while (size) { + Y_VERIFY_DEBUG(dst.Valid()); + size_t len = std::min(size, dst.ContiguousSize()); + memset(const_cast<char*>(dst.ContiguousData()), c, len); + dst += len; + size -= len; + } + } + + static void Memcpy(TRope::TConstIterator dst, TRope::TConstIterator src, size_t size) { + while (size) { + Y_VERIFY_DEBUG(dst.Valid() && src.Valid(), + "Invalid iterator in memcpy: dst.Valid() - %" PRIu32 ", src.Valid() - %" PRIu32, + (ui32)dst.Valid(), (ui32)src.Valid()); + size_t len = std::min(size, std::min(dst.ContiguousSize(), src.ContiguousSize())); + memcpy(const_cast<char*>(dst.ContiguousData()), src.ContiguousData(), len); + dst += len; + src += len; + size -= len; + } + } + + static void Memcpy(TRope::TConstIterator dst, const char* src, size_t size) { + while (size) { + Y_VERIFY_DEBUG(dst.Valid()); + size_t len = std::min(size, dst.ContiguousSize()); + memcpy(const_cast<char*>(dst.ContiguousData()), src, len); + size -= len; + dst += len; + src += len; + } + } + + static void Memcpy(char* dst, TRope::TConstIterator src, size_t size) { + while (size) { + Y_VERIFY_DEBUG(src.Valid()); + size_t len = std::min(size, src.ContiguousSize()); + memcpy(dst, src.ContiguousData(), len); + size -= len; + dst += len; + src += len; + } + } + + // copy less or equal to sizeBound bytes, until src is valid + static size_t SafeMemcpy(char* dst, TRope::TIterator src, size_t sizeBound) { + size_t origSize = sizeBound; + while (sizeBound && src.Valid()) { + size_t len = Min(sizeBound, src.ContiguousSize()); + memcpy(dst, src.ContiguousData(), len); + sizeBound -= len; + dst += len; + src += len; + } + return origSize - sizeBound; + } +}; + +template<size_t BLOCK, size_t ALIGN = 16> +class TRopeSlideView { + alignas(ALIGN) char Slide[BLOCK]; // use if distance from current point and next chunk is less than BLOCK + TRope::TIterator Position; // current position at rope + size_t Size; + char* Head; // points to data, it might be current rope chunk or Slide + +private: + void FillBlock() { + size_t chunkSize = Position.ContiguousSize(); + if (chunkSize >= BLOCK) { + Size = chunkSize; + Head = const_cast<char*>(Position.ContiguousData()); + } else { + Size = TRopeUtils::SafeMemcpy(Slide, Position, BLOCK); + Head = Slide; + } + } + +public: + TRopeSlideView(TRope::TIterator position) + : Position(position) + { + FillBlock(); + } + + TRopeSlideView(TRope &rope) + : TRopeSlideView(rope.Begin()) + {} + + // if view on slide then copy slide to rope + void FlushBlock() { + if (Head == Slide) { + TRopeUtils::Memcpy(Position, Head, Size); + } + } + + TRope::TIterator operator+=(size_t amount) { + Position += amount; + FillBlock(); + return Position; + } + + TRope::TIterator GetPosition() const { + return Position; + } + + char* GetHead() const { + return Head; + } + + ui8* GetUi8Head() const { + return reinterpret_cast<ui8*>(Head); + } + + size_t ContiguousSize() const { + return Size; + } + + bool IsOnChunk() const { + return Head != Slide; + } +}; + inline TRope TRope::CopySpaceOptimized(TRope&& origin, size_t worstRatioPer1k, TRopeArena& arena) { TRope res; for (TChunk& chunk : origin.Chain) { |