aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrobot-tplatform-ci <robot-tplatform-ci@yandex-team.com>2024-01-19 22:55:36 +0300
committerAlexander Smirnov <alex@ydb.tech>2024-01-24 15:01:46 +0300
commitade1688cbffb24e141553a6bd917db46175aa62e (patch)
treef3247db710f05e8ab75afb81428493f392d57662
parent5b05a950389da0f0551f79af4557eb5ef5714476 (diff)
downloadydb-ade1688cbffb24e141553a6bd917db46175aa62e.tar.gz
update taxitool rev. 13268634
update taxitool; ci_url = https://a.yandex-team.ru/projects/automation_group_backend_mlu/ci/releases/flow?dir=taxi%2Ftaxi_tool&id=my-main-release&version=295
-rw-r--r--yt/yt/core/misc/error.cpp15
-rw-r--r--yt/yt/core/misc/error.h9
-rw-r--r--yt/yt/core/misc/unittests/error_ut.cpp18
3 files changed, 20 insertions, 22 deletions
diff --git a/yt/yt/core/misc/error.cpp b/yt/yt/core/misc/error.cpp
index 511a9fb26c..2740ae34c9 100644
--- a/yt/yt/core/misc/error.cpp
+++ b/yt/yt/core/misc/error.cpp
@@ -70,16 +70,16 @@ TString ToString(TErrorCode code)
YT_THREAD_LOCAL(bool) ErrorSanitizerEnabled = false;
YT_THREAD_LOCAL(TInstant) ErrorSanitizerDatetimeOverride = {};
-YT_THREAD_LOCAL(TErrorSanitizerGuard::THostNameSanitizer) LocalHostNameSanitizer = {};
+YT_THREAD_LOCAL(TSharedRef) ErrorSanitizerLocalHostNameOverride = {};
-TErrorSanitizerGuard::TErrorSanitizerGuard(TInstant datetimeOverride, THostNameSanitizer localHostNameSanitizer)
+TErrorSanitizerGuard::TErrorSanitizerGuard(TInstant datetimeOverride, TSharedRef localHostNameOverride)
: SavedEnabled_(ErrorSanitizerEnabled)
, SavedDatetimeOverride_(GetTlsRef(ErrorSanitizerDatetimeOverride))
- , SavedLocalHostNameSanitizer_(GetTlsRef(LocalHostNameSanitizer))
+ , SavedLocalHostNameOverride_(GetTlsRef(ErrorSanitizerLocalHostNameOverride))
{
ErrorSanitizerEnabled = true;
GetTlsRef(ErrorSanitizerDatetimeOverride) = datetimeOverride;
- GetTlsRef(LocalHostNameSanitizer) = localHostNameSanitizer;
+ GetTlsRef(ErrorSanitizerLocalHostNameOverride) = std::move(localHostNameOverride);
}
TErrorSanitizerGuard::~TErrorSanitizerGuard()
@@ -88,6 +88,7 @@ TErrorSanitizerGuard::~TErrorSanitizerGuard()
ErrorSanitizerEnabled = SavedEnabled_;
GetTlsRef(ErrorSanitizerDatetimeOverride) = SavedDatetimeOverride_;
+ GetTlsRef(ErrorSanitizerLocalHostNameOverride) = std::move(SavedLocalHostNameOverride_);
}
////////////////////////////////////////////////////////////////////////////////
@@ -299,8 +300,8 @@ private:
{
if (ErrorSanitizerEnabled) {
Datetime_ = GetTlsRef(ErrorSanitizerDatetimeOverride);
- auto handleLocalHostName = GetTlsRef(LocalHostNameSanitizer);
- Host_ = handleLocalHostName(NNet::ReadLocalHostName());
+ HostHolder_ = GetTlsRef(ErrorSanitizerLocalHostNameOverride);
+ Host_ = HostHolder_.empty() ? TStringBuf() : TStringBuf(HostHolder_.Begin(), HostHolder_.End());
return;
}
@@ -957,7 +958,7 @@ void AppendError(TStringBuilderBase* builder, const TError& error, int indent)
AppendAttribute(
builder,
"host",
- Format("%v", error.GetHost()),
+ ToString(error.GetHost()),
indent);
}
diff --git a/yt/yt/core/misc/error.h b/yt/yt/core/misc/error.h
index dbc7b044d5..fe1b928476 100644
--- a/yt/yt/core/misc/error.h
+++ b/yt/yt/core/misc/error.h
@@ -67,21 +67,18 @@ constexpr int ErrorSerializationDepthLimit = 16;
////////////////////////////////////////////////////////////////////////////////
//! When this guard is set, newly created errors do not have non-deterministic
-//! system attributes and have "datetime" attribute overridden with a given value.
+//! system attributes and have "datetime" and "host" attributes overridden with a given values.
class TErrorSanitizerGuard
: public TNonCopyable
{
public:
- using TLocalHostNameSanitizerSignature = TString (TStringBuf);
- using THostNameSanitizer = TCallback<TLocalHostNameSanitizerSignature>;
-
- explicit TErrorSanitizerGuard(TInstant datetimeOverride, THostNameSanitizer localHostNameSanitizer);
+ TErrorSanitizerGuard(TInstant datetimeOverride, TSharedRef localHostNameOverride);
~TErrorSanitizerGuard();
private:
const bool SavedEnabled_;
const TInstant SavedDatetimeOverride_;
- const THostNameSanitizer SavedLocalHostNameSanitizer_;
+ const TSharedRef SavedLocalHostNameOverride_;
};
////////////////////////////////////////////////////////////////////////////////
diff --git a/yt/yt/core/misc/unittests/error_ut.cpp b/yt/yt/core/misc/unittests/error_ut.cpp
index 8c17bd8d14..e83e762358 100644
--- a/yt/yt/core/misc/unittests/error_ut.cpp
+++ b/yt/yt/core/misc/unittests/error_ut.cpp
@@ -683,18 +683,13 @@ TEST(TErrorTest, CompositeYTExceptionToError)
}
}
-TString HostSanitizer(TStringBuf)
-{
- return "";
-}
-
TEST(TErrorTest, ErrorSanitizer)
{
auto checkSantizied = [&] (const TError& error) {
EXPECT_FALSE(error.HasOriginAttributes());
EXPECT_FALSE(error.HasTracingAttributes());
- EXPECT_EQ("", error.GetHost());
+ EXPECT_EQ("<host-override>", error.GetHost());
EXPECT_EQ(0, error.GetPid());
EXPECT_EQ(NThreading::InvalidThreadId, error.GetTid());
EXPECT_EQ(NConcurrency::InvalidFiberId, error.GetFid());
@@ -705,7 +700,7 @@ TEST(TErrorTest, ErrorSanitizer)
auto checkNotSanitized = [&] (const TError& error) {
EXPECT_TRUE(error.HasOriginAttributes());
- EXPECT_FALSE(error.GetHost() == "");
+ EXPECT_FALSE(error.GetHost() == "<host-override>");
EXPECT_FALSE(error.GetPid() == 0);
auto now = TInstant::Now();
@@ -717,7 +712,9 @@ TEST(TErrorTest, ErrorSanitizer)
{
auto instant1 = TInstant::Days(123);
- TErrorSanitizerGuard guard1(instant1, BIND(&HostSanitizer));
+ TErrorSanitizerGuard guard1(
+ instant1,
+ /*localHostNameOverride*/ TSharedRef::FromString("<host-override>"));
auto error2 = TError("error2");
checkSantizied(error2);
@@ -725,7 +722,10 @@ TEST(TErrorTest, ErrorSanitizer)
{
auto instant2 = TInstant::Days(234);
- TErrorSanitizerGuard guard2(instant2, BIND(&HostSanitizer));
+ TErrorSanitizerGuard guard2(
+ instant2,
+ /*localHostNameOverride*/
+ TSharedRef::FromString("<host-override>"));
auto error3 = TError("error3");
checkSantizied(error3);