diff options
author | pavook <pavook@yandex-team.com> | 2024-07-15 19:56:37 +0300 |
---|---|---|
committer | pavook <pavook@yandex-team.com> | 2024-07-15 20:07:30 +0300 |
commit | bd5c2054b6029d924c5d48e1eca55df7e2b05052 (patch) | |
tree | 94dc848d34f1c2917c918948f33376e3e153bca3 | |
parent | 56df51dfe4f24edbdf9dce85670449904a34deca (diff) | |
download | ydb-bd5c2054b6029d924c5d48e1eca55df7e2b05052.tar.gz |
Revert "YT-22077: Throw exception on statistic paths with invalid characters"
Users rely on the statistics with strange characters, so another solution for the problem is required.
e4af01fbdbe5954330ae2d9512cbe1a41f5f67a3
-rw-r--r-- | yt/yt/core/misc/statistics-inl.h | 5 | ||||
-rw-r--r-- | yt/yt/core/misc/statistics.cpp | 21 | ||||
-rw-r--r-- | yt/yt/core/misc/statistics.h | 5 | ||||
-rw-r--r-- | yt/yt/core/misc/unittests/statistics_ut.cpp | 19 |
4 files changed, 0 insertions, 50 deletions
diff --git a/yt/yt/core/misc/statistics-inl.h b/yt/yt/core/misc/statistics-inl.h index 6a2e5ec5113..2ca1778addc 100644 --- a/yt/yt/core/misc/statistics-inl.h +++ b/yt/yt/core/misc/statistics-inl.h @@ -65,11 +65,6 @@ std::pair<typename TSummaryMap::iterator, bool> CheckedEmplaceStatistic( const NYPath::TYPath& path, Ts&&... args) { - if (auto c = CheckStatisticPath(path)) { - THROW_ERROR_EXCEPTION("Invalid character in a statistic path") - << TErrorAttribute("path", path) - << TErrorAttribute("invalid_character", *c); - } auto [conflictType, hint] = IsCompatibleStatistic(existingStatistics, path); if (conflictType == EStatisticPathConflictType::Exists) { return {hint, false}; diff --git a/yt/yt/core/misc/statistics.cpp b/yt/yt/core/misc/statistics.cpp index eabb4eda66a..29e07851347 100644 --- a/yt/yt/core/misc/statistics.cpp +++ b/yt/yt/core/misc/statistics.cpp @@ -91,27 +91,6 @@ bool TSummary::operator ==(const TSummary& other) const //////////////////////////////////////////////////////////////////////////////// -namespace { - -bool IsAllowedComponentChar(char c) noexcept -{ - return IsAsciiAlnum(c) || c == '_'; -} - -} // namespace - -std::optional<char> CheckStatisticPath(const NYPath::TYPath& path) -{ - for (auto c : path) { - if (!IsAllowedComponentChar(c) && c != '/') { - return c; - } - } - return {}; -} - -//////////////////////////////////////////////////////////////////////////////// - TSummary& TStatistics::GetSummary(const NYPath::TYPath& path) { auto [iterator, _] = CheckedEmplaceStatistic(Data_, path, TSummary()); diff --git a/yt/yt/core/misc/statistics.h b/yt/yt/core/misc/statistics.h index 191cff05091..53b1a04afc8 100644 --- a/yt/yt/core/misc/statistics.h +++ b/yt/yt/core/misc/statistics.h @@ -49,11 +49,6 @@ void Serialize(const TSummary& summary, NYson::IYsonConsumer* consumer); //////////////////////////////////////////////////////////////////////////////// -//! Returns the invalid character if the given path is invalid, otherwise returns |nullopt|. -std::optional<char> CheckStatisticPath(const NYPath::TYPath& path); - -//////////////////////////////////////////////////////////////////////////////// - class TStatistics { public: diff --git a/yt/yt/core/misc/unittests/statistics_ut.cpp b/yt/yt/core/misc/unittests/statistics_ut.cpp index 83345d8b127..cab0babb459 100644 --- a/yt/yt/core/misc/unittests/statistics_ut.cpp +++ b/yt/yt/core/misc/unittests/statistics_ut.cpp @@ -99,14 +99,6 @@ TEST(TStatistics, AddSample) statistics.Merge(CreateStatistics({{"/key", 5}})), std::exception); - EXPECT_THROW( - statistics.AddSample("/invalid.key/subkey", 42), - std::exception); - - EXPECT_THROW( - statistics.AddSample("/invalid key/subkey", 42), - std::exception); - statistics.AddSample("/key/subkey/x", 10); EXPECT_EQ(20, GetNumericValue(statistics, "/key/subkey/x")); @@ -117,17 +109,6 @@ TEST(TStatistics, AddSample) EXPECT_EQ(42, GetNumericValue(deserializedStatistics, "/key/sub")); } -TEST(TStatistics, InvalidNames) { - // For the statistic merge to work correctly, symbols with code points - // less than '/' must be forbidden. See YT-22118. - TStatistics statistics; - for (char c = std::numeric_limits<char>::min(); c < '/'; ++c) { - EXPECT_THROW( - statistics.AddSample("/key/abc" + TString{c} + "def", 5), - std::exception); - } -} - //////////////////////////////////////////////////////////////////////////////// class TStatisticsUpdater |