diff options
author | AlexSm <alex@ydb.tech> | 2024-08-19 16:16:30 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-08-19 17:16:30 +0300 |
commit | 9b567afd3339f4525feab53873592cb025b14251 (patch) | |
tree | 5c8489f98dc5a9a10f66065055e5a401bbd14767 /library | |
parent | 47bd121575c210d4bbb2dddcc2131759a694df05 (diff) | |
download | ydb-9b567afd3339f4525feab53873592cb025b14251.tar.gz |
Library import 240819-0942 (#7994)
Co-authored-by: robot-piglet <robot-piglet@yandex-team.com>
Co-authored-by: hiddenpath <hiddenpath@yandex-team.com>
Co-authored-by: bulatman <bulatman@yandex-team.com>
Co-authored-by: robot-contrib <robot-contrib@yandex-team.com>
Co-authored-by: osidorkin <osidorkin@yandex-team.com>
Co-authored-by: akhropov <akhropov@yandex-team.com>
Co-authored-by: akozhikhov <akozhikhov@yandex-team.com>
Co-authored-by: orlovorlov <orlovorlov@yandex-team.com>
Co-authored-by: babenko <babenko@yandex-team.com>
Co-authored-by: shadchin <shadchin@yandex-team.com>
Co-authored-by: dmasloff <dmasloff@yandex-team.com>
Co-authored-by: aleksei-le <aleksei-le@yandex-team.com>
Co-authored-by: coteeq <coteeq@yandex-team.com>
Co-authored-by: dimdim11 <dimdim11@yandex-team.com>
Co-authored-by: robot-ya-builder <robot-ya-builder@yandex-team.com>
Co-authored-by: iaz1607 <iaz1607@yandex-team.com>
Diffstat (limited to 'library')
-rw-r--r-- | library/cpp/netliba/socket/packet_queue.h | 6 | ||||
-rw-r--r-- | library/cpp/netliba/socket/socket.h | 4 | ||||
-rw-r--r-- | library/cpp/netliba/socket/udp_recv_packet.h | 2 | ||||
-rw-r--r-- | library/cpp/netliba/v6/block_chain.h | 5 | ||||
-rw-r--r-- | library/cpp/netliba/v6/cpu_affinity.cpp | 2 | ||||
-rw-r--r-- | library/cpp/netliba/v6/ib_buffers.h | 9 | ||||
-rw-r--r-- | library/cpp/netliba/v6/ib_collective.cpp | 4 | ||||
-rw-r--r-- | library/cpp/netliba/v6/ib_low.h | 6 | ||||
-rw-r--r-- | library/cpp/netliba/v6/ib_test.cpp | 5 | ||||
-rw-r--r-- | library/cpp/netliba/v6/udp_client_server.cpp | 10 | ||||
-rw-r--r-- | library/cpp/netliba/v6/udp_socket.h | 4 | ||||
-rw-r--r-- | library/cpp/unified_agent_client/logger.h | 7 | ||||
-rw-r--r-- | library/python/cores/__init__.py | 38 |
13 files changed, 62 insertions, 40 deletions
diff --git a/library/cpp/netliba/socket/packet_queue.h b/library/cpp/netliba/socket/packet_queue.h index 58a84709c2..a81e956862 100644 --- a/library/cpp/netliba/socket/packet_queue.h +++ b/library/cpp/netliba/socket/packet_queue.h @@ -20,9 +20,9 @@ namespace NNetlibaSocket { template <size_t TTNumWriterThreads> class TLockFreePacketQueue { private: - enum { MAX_PACKETS_IN_QUEUE = INT_MAX, - CMD_QUEUE_RESERVE = 1 << 20, - MAX_DATA_IN_QUEUE = 32 << 20 }; + static constexpr int MAX_PACKETS_IN_QUEUE = INT_MAX; + static constexpr int CMD_QUEUE_RESERVE = 1 << 20; + static constexpr int MAX_DATA_IN_QUEUE = 32 << 20; typedef std::pair<TUdpRecvPacket*, TPacketMeta> TPacket; typedef std::conditional_t<TTNumWriterThreads == 1, NThreading::TOneOneQueue<TPacket>, NThreading::TManyOneQueue<TPacket, TTNumWriterThreads>> TImpl; diff --git a/library/cpp/netliba/socket/socket.h b/library/cpp/netliba/socket/socket.h index c1da3c145f..0b30bd2ccf 100644 --- a/library/cpp/netliba/socket/socket.h +++ b/library/cpp/netliba/socket/socket.h @@ -74,8 +74,8 @@ namespace NNetlibaSocket { /////////////////////////////////////////////////////////////////////////////// // currently netliba v6 version id is any number which's not equal to NETLIBA_V12_VERSION - enum { NETLIBA_ANY_VERSION = -1, - NETLIBA_V12_VERSION = 112 }; + constexpr int NETLIBA_ANY_VERSION = -1; + constexpr int NETLIBA_V12_VERSION = 112; enum EFragFlag { FF_ALLOW_FRAG, diff --git a/library/cpp/netliba/socket/udp_recv_packet.h b/library/cpp/netliba/socket/udp_recv_packet.h index a2777fbcbf..a02e4c9b50 100644 --- a/library/cpp/netliba/socket/udp_recv_packet.h +++ b/library/cpp/netliba/socket/udp_recv_packet.h @@ -7,7 +7,7 @@ #include "allocator.h" namespace NNetlibaSocket { - enum { UDP_MAX_PACKET_SIZE = 8900 }; + constexpr int UDP_MAX_PACKET_SIZE = 8900; class TUdpHostRecvBufAlloc; struct TUdpRecvPacket: public TWithCustomAllocator { diff --git a/library/cpp/netliba/v6/block_chain.h b/library/cpp/netliba/v6/block_chain.h index 25247ec05f..e214d5f603 100644 --- a/library/cpp/netliba/v6/block_chain.h +++ b/library/cpp/netliba/v6/block_chain.h @@ -140,9 +140,8 @@ namespace NNetliba { TIntrusivePtr<TSharedMemory> SharedData; TVector<TIntrusivePtr<TThrRefBase>> AttachedStorage; char DefaultBuf[128]; // prevent allocs in most cases - enum { - N_DEFAULT_BLOCK_SIZE = 1024 - }; + + static constexpr int N_DEFAULT_BLOCK_SIZE = 1024; char* Alloc(int sz) { char* res = nullptr; diff --git a/library/cpp/netliba/v6/cpu_affinity.cpp b/library/cpp/netliba/v6/cpu_affinity.cpp index 7808092a72..55b4c98b71 100644 --- a/library/cpp/netliba/v6/cpu_affinity.cpp +++ b/library/cpp/netliba/v6/cpu_affinity.cpp @@ -13,7 +13,7 @@ namespace NNetliba { class TCPUSet { public: - enum { MAX_SIZE = 128 }; + static constexpr int MAX_SIZE = 128; private: #if defined(__FreeBSD__) && (__FreeBSD__ >= 7) diff --git a/library/cpp/netliba/v6/ib_buffers.h b/library/cpp/netliba/v6/ib_buffers.h index 8847250137..ae1857cdcb 100644 --- a/library/cpp/netliba/v6/ib_buffers.h +++ b/library/cpp/netliba/v6/ib_buffers.h @@ -11,11 +11,10 @@ namespace NNetliba { // single thread version class TIBBufferPool: public TThrRefBase, TNonCopyable { - enum { - BLOCK_SIZE_LN = 11, - BLOCK_SIZE = 1 << BLOCK_SIZE_LN, - BLOCK_COUNT = 1024 - }; + static constexpr int BLOCK_SIZE_LN = 11; + static constexpr int BLOCK_SIZE = 1 << BLOCK_SIZE_LN; + static constexpr int BLOCK_COUNT = 1024; + struct TSingleBlock { TIntrusivePtr<TMemoryRegion> Mem; TVector<ui8> BlkRefCounts; diff --git a/library/cpp/netliba/v6/ib_collective.cpp b/library/cpp/netliba/v6/ib_collective.cpp index af5dd6d284..5251ad2eb1 100644 --- a/library/cpp/netliba/v6/ib_collective.cpp +++ b/library/cpp/netliba/v6/ib_collective.cpp @@ -343,9 +343,7 @@ namespace NNetliba { ////////////////////////////////////////////////////////////////////////// struct TAllDataSync { - enum { - WR_COUNT = 64 * 2 - }; + static constexpr int WR_COUNT = 64 * 2; int CurrentBuffer; TIntrusivePtr<TIBMemBlock> MemBlock[2]; diff --git a/library/cpp/netliba/v6/ib_low.h b/library/cpp/netliba/v6/ib_low.h index 42e11ed941..f75f1e5379 100644 --- a/library/cpp/netliba/v6/ib_low.h +++ b/library/cpp/netliba/v6/ib_low.h @@ -69,9 +69,9 @@ namespace NNetliba { int Port; int LID; TIntrusivePtr<TIBContext> IBCtx; - enum { - MAX_GID = 16 - }; + + static constexpr int MAX_GID = 16; + ibv_gid MyGidArr[MAX_GID]; public: diff --git a/library/cpp/netliba/v6/ib_test.cpp b/library/cpp/netliba/v6/ib_test.cpp index 178691e837..8d1c825a24 100644 --- a/library/cpp/netliba/v6/ib_test.cpp +++ b/library/cpp/netliba/v6/ib_test.cpp @@ -17,9 +17,8 @@ namespace NNetliba { class TIPSocket { TNetSocket s; - enum { - HDR_SIZE = UDP_LOW_LEVEL_HEADER_SIZE - }; + + static constexpr int HDR_SIZE = UDP_LOW_LEVEL_HEADER_SIZE; public: void Init(int port) { diff --git a/library/cpp/netliba/v6/udp_client_server.cpp b/library/cpp/netliba/v6/udp_client_server.cpp index 14f60625f2..200daa387d 100644 --- a/library/cpp/netliba/v6/udp_client_server.cpp +++ b/library/cpp/netliba/v6/udp_client_server.cpp @@ -31,12 +31,10 @@ namespace NNetliba { // тогда на приемнике повиснет пакет. Этот пакет мы зашибем по этому таймауту const float UDP_MAX_INPUT_DATA_WAIT = UDP_TRANSFER_TIMEOUT * 2; - enum { - UDP_PACKET_SIZE_FULL = 8900, // used for ping to detect jumbo-frame support - UDP_PACKET_SIZE = 8800, // max data in packet - UDP_PACKET_SIZE_SMALL = 1350, // 1180 would be better taking into account that 1280 is guaranteed ipv6 minimum MTU - UDP_PACKET_BUF_SIZE = UDP_PACKET_SIZE + 100, - }; + constexpr int UDP_PACKET_SIZE_FULL = 8900; // used for ping to detect jumbo-frame support + constexpr int UDP_PACKET_SIZE = 8800; // max data in packet + constexpr int UDP_PACKET_SIZE_SMALL = 1350; // 1180 would be better taking into account that 1280 is guaranteed ipv6 minimum MTU + constexpr int UDP_PACKET_BUF_SIZE = UDP_PACKET_SIZE + 100; ////////////////////////////////////////////////////////////////////////// struct TUdpCompleteInTransfer { diff --git a/library/cpp/netliba/v6/udp_socket.h b/library/cpp/netliba/v6/udp_socket.h index bd95b8bcd0..5ba047ea2f 100644 --- a/library/cpp/netliba/v6/udp_socket.h +++ b/library/cpp/netliba/v6/udp_socket.h @@ -9,9 +9,7 @@ namespace NNetliba { bool IsLocalIPv6(ui64 network, ui64 iface); bool InitLocalIPList(); - enum { - UDP_LOW_LEVEL_HEADER_SIZE = 4, - }; + constexpr int UDP_LOW_LEVEL_HEADER_SIZE = 4; using NNetlibaSocket::EFragFlag; using NNetlibaSocket::FF_ALLOW_FRAG; diff --git a/library/cpp/unified_agent_client/logger.h b/library/cpp/unified_agent_client/logger.h index d83cba92de..8130c2894c 100644 --- a/library/cpp/unified_agent_client/logger.h +++ b/library/cpp/unified_agent_client/logger.h @@ -133,6 +133,13 @@ namespace NUnifiedAgent { return Logger; } + ELogPriority FiltrationLevel() const { + if (Logger) { + return Logger->CurrentLogContext_.load()->Priority; + } + return LOG_DEF_PRIORITY; + } + friend class TLogger; private: diff --git a/library/python/cores/__init__.py b/library/python/cores/__init__.py index f5b1bb2478..8c10c0128b 100644 --- a/library/python/cores/__init__.py +++ b/library/python/cores/__init__.py @@ -162,21 +162,45 @@ def get_problem_stack(backtrace): return "\n".join(stack) +BT_COLORS = { + "function_name": "[[c:cyan]]", + "function_arg": "[[c:green]]", + "stack_frame": "[[c:red]]", + "thread_prefix": "[[c:light-cyan]]", + "thread_id": "[[c:red]]", + "file_path": "[[c:light-grey]]", + "line_num": "[[c:magenta]]", + "address": "[[c:light-grey]]", +} + + # XXX -def colorize_backtrace(text): +def colorize_backtrace(text, c=None): + if c is None: + c = BT_COLORS + filters = [ # Function names and the class they belong to - (re.compile(r"^(#[0-9]+ .*?)([a-zA-Z0-9_:\.@]+)(\s?\()", flags=re.MULTILINE), r"\1[[c:cyan]]\2[[rst]]\3"), + ( + re.compile(r"^(#[0-9]+ .*?)([a-zA-Z0-9_:\.@]+)(\s?\()", flags=re.MULTILINE), + r"\1" + c['function_name'] + r"\2[[rst]]\3", + ), # Function argument names - (re.compile(r"([a-zA-Z0-9_#]*)(\s?=\s?)"), r"[[c:green]]\1[[rst]]\2"), + (re.compile(r"([a-zA-Z0-9_#]*)(\s?=\s?)"), c["function_arg"] + r"\1[[rst]]\2"), # Stack frame number - (re.compile(r"^(#[0-9]+)", flags=re.MULTILINE), r"[[c:red]]\1[[rst]]"), + (re.compile(r"^(#[0-9]+)", flags=re.MULTILINE), c["stack_frame"] + r"\1[[rst]]"), # Thread id colorization - (re.compile(r"^([ \*]) ([0-9]+)", flags=re.MULTILINE), r"[[c:light-cyan]]\1 [[c:red]]\2[[rst]]"), + ( + re.compile(r"^([ \*]) ([0-9]+)", flags=re.MULTILINE), + c["thread_prefix"] + r"\1 " + c["thread_id"] + r"\2[[rst]]", + ), # File path and line number - (re.compile(r"(\.*[/A-Za-z0-9\+_\.\-]*):(([0-9]+)(:[0-9]+)?)$", flags=re.MULTILINE), r"[[c:light-grey]]\1[[rst]]:[[c:magenta]]\2[[rst]]"), + ( + re.compile(r"(\.*[/A-Za-z0-9\+_\.\-]*):(([0-9]+)(:[0-9]+)?)$", flags=re.MULTILINE), + c["file_path"] + r"\1[[rst]]:" + c["line_num"] + r"\2[[rst]]", + ), # Addresses - (re.compile(r"\b(0x[a-f0-9]{6,})\b"), r"[[c:light-grey]]\1[[rst]]"), + (re.compile(r"\b(0x[a-f0-9]{6,})\b"), c["address"] + r"\1[[rst]]"), ] text = six.ensure_str(text) |