aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoralexvru <alexvru@ydb.tech>2023-08-01 11:23:27 +0300
committeralexvru <alexvru@ydb.tech>2023-08-01 11:23:27 +0300
commit0cc2c02c32be31494e95ea489c313070a75d8928 (patch)
treebf1494061f4ce0c31eb9475b6b5f6e2ef5255694
parent7e0591a87e723564979f7a7564ef22a2ff3aa8ca (diff)
downloadydb-0cc2c02c32be31494e95ea489c313070a75d8928.tar.gz
Copy ineffective rope in DS proxy Get request KIKIMR-18902
-rw-r--r--library/cpp/actors/util/CMakeLists.darwin-x86_64.txt2
-rw-r--r--library/cpp/actors/util/CMakeLists.linux-aarch64.txt2
-rw-r--r--library/cpp/actors/util/CMakeLists.linux-x86_64.txt2
-rw-r--r--library/cpp/actors/util/CMakeLists.windows-x86_64.txt2
-rw-r--r--library/cpp/actors/util/rope.cpp13
-rw-r--r--library/cpp/actors/util/rope.h2
-rw-r--r--library/cpp/actors/util/ut/CMakeLists.darwin-x86_64.txt2
-rw-r--r--library/cpp/actors/util/ya.make2
-rw-r--r--ydb/core/blobstorage/crypto/ut/CMakeLists.darwin-x86_64.txt2
-rw-r--r--ydb/core/blobstorage/dsproxy/dsproxy_get_impl.h5
-rw-r--r--ydb/core/erasure/ut/CMakeLists.darwin-x86_64.txt2
-rw-r--r--ydb/core/erasure/ut_perf/CMakeLists.darwin-x86_64.txt2
-rw-r--r--ydb/core/erasure/ut_rope/CMakeLists.darwin-x86_64.txt2
13 files changed, 40 insertions, 0 deletions
diff --git a/library/cpp/actors/util/CMakeLists.darwin-x86_64.txt b/library/cpp/actors/util/CMakeLists.darwin-x86_64.txt
index 6ab1bb43c30..be68d418f78 100644
--- a/library/cpp/actors/util/CMakeLists.darwin-x86_64.txt
+++ b/library/cpp/actors/util/CMakeLists.darwin-x86_64.txt
@@ -12,6 +12,7 @@ add_library(cpp-actors-util)
target_link_libraries(cpp-actors-util PUBLIC
contrib-libs-cxxsupp
yutil
+ cpp-containers-absl_flat_hash
cpp-deprecated-atomic
library-cpp-pop_count
)
@@ -19,6 +20,7 @@ target_sources(cpp-actors-util PRIVATE
${CMAKE_SOURCE_DIR}/library/cpp/actors/util/affinity.cpp
${CMAKE_SOURCE_DIR}/library/cpp/actors/util/memory_track.cpp
${CMAKE_SOURCE_DIR}/library/cpp/actors/util/memory_tracker.cpp
+ ${CMAKE_SOURCE_DIR}/library/cpp/actors/util/rope.cpp
${CMAKE_SOURCE_DIR}/library/cpp/actors/util/rc_buf.cpp
${CMAKE_SOURCE_DIR}/library/cpp/actors/util/shared_data.cpp
${CMAKE_SOURCE_DIR}/library/cpp/actors/util/should_continue.cpp
diff --git a/library/cpp/actors/util/CMakeLists.linux-aarch64.txt b/library/cpp/actors/util/CMakeLists.linux-aarch64.txt
index 4582852947b..9c5183c2bd9 100644
--- a/library/cpp/actors/util/CMakeLists.linux-aarch64.txt
+++ b/library/cpp/actors/util/CMakeLists.linux-aarch64.txt
@@ -13,6 +13,7 @@ target_link_libraries(cpp-actors-util PUBLIC
contrib-libs-linux-headers
contrib-libs-cxxsupp
yutil
+ cpp-containers-absl_flat_hash
cpp-deprecated-atomic
library-cpp-pop_count
)
@@ -20,6 +21,7 @@ target_sources(cpp-actors-util PRIVATE
${CMAKE_SOURCE_DIR}/library/cpp/actors/util/affinity.cpp
${CMAKE_SOURCE_DIR}/library/cpp/actors/util/memory_track.cpp
${CMAKE_SOURCE_DIR}/library/cpp/actors/util/memory_tracker.cpp
+ ${CMAKE_SOURCE_DIR}/library/cpp/actors/util/rope.cpp
${CMAKE_SOURCE_DIR}/library/cpp/actors/util/rc_buf.cpp
${CMAKE_SOURCE_DIR}/library/cpp/actors/util/shared_data.cpp
${CMAKE_SOURCE_DIR}/library/cpp/actors/util/should_continue.cpp
diff --git a/library/cpp/actors/util/CMakeLists.linux-x86_64.txt b/library/cpp/actors/util/CMakeLists.linux-x86_64.txt
index 4582852947b..9c5183c2bd9 100644
--- a/library/cpp/actors/util/CMakeLists.linux-x86_64.txt
+++ b/library/cpp/actors/util/CMakeLists.linux-x86_64.txt
@@ -13,6 +13,7 @@ target_link_libraries(cpp-actors-util PUBLIC
contrib-libs-linux-headers
contrib-libs-cxxsupp
yutil
+ cpp-containers-absl_flat_hash
cpp-deprecated-atomic
library-cpp-pop_count
)
@@ -20,6 +21,7 @@ target_sources(cpp-actors-util PRIVATE
${CMAKE_SOURCE_DIR}/library/cpp/actors/util/affinity.cpp
${CMAKE_SOURCE_DIR}/library/cpp/actors/util/memory_track.cpp
${CMAKE_SOURCE_DIR}/library/cpp/actors/util/memory_tracker.cpp
+ ${CMAKE_SOURCE_DIR}/library/cpp/actors/util/rope.cpp
${CMAKE_SOURCE_DIR}/library/cpp/actors/util/rc_buf.cpp
${CMAKE_SOURCE_DIR}/library/cpp/actors/util/shared_data.cpp
${CMAKE_SOURCE_DIR}/library/cpp/actors/util/should_continue.cpp
diff --git a/library/cpp/actors/util/CMakeLists.windows-x86_64.txt b/library/cpp/actors/util/CMakeLists.windows-x86_64.txt
index 6ab1bb43c30..be68d418f78 100644
--- a/library/cpp/actors/util/CMakeLists.windows-x86_64.txt
+++ b/library/cpp/actors/util/CMakeLists.windows-x86_64.txt
@@ -12,6 +12,7 @@ add_library(cpp-actors-util)
target_link_libraries(cpp-actors-util PUBLIC
contrib-libs-cxxsupp
yutil
+ cpp-containers-absl_flat_hash
cpp-deprecated-atomic
library-cpp-pop_count
)
@@ -19,6 +20,7 @@ target_sources(cpp-actors-util PRIVATE
${CMAKE_SOURCE_DIR}/library/cpp/actors/util/affinity.cpp
${CMAKE_SOURCE_DIR}/library/cpp/actors/util/memory_track.cpp
${CMAKE_SOURCE_DIR}/library/cpp/actors/util/memory_tracker.cpp
+ ${CMAKE_SOURCE_DIR}/library/cpp/actors/util/rope.cpp
${CMAKE_SOURCE_DIR}/library/cpp/actors/util/rc_buf.cpp
${CMAKE_SOURCE_DIR}/library/cpp/actors/util/shared_data.cpp
${CMAKE_SOURCE_DIR}/library/cpp/actors/util/should_continue.cpp
diff --git a/library/cpp/actors/util/rope.cpp b/library/cpp/actors/util/rope.cpp
new file mode 100644
index 00000000000..0927774099d
--- /dev/null
+++ b/library/cpp/actors/util/rope.cpp
@@ -0,0 +1,13 @@
+#include "rope.h"
+#include <library/cpp/containers/absl_flat_hash/flat_hash_set.h>
+
+size_t TRope::GetOccupiedMemorySize() const {
+ size_t res = 0;
+ absl::flat_hash_set<const void*> chunks;
+ for (const auto& chunk : Chain) {
+ if (const auto [it, inserted] = chunks.insert(chunk.Backend.UniqueId()); inserted) {
+ res += chunk.Backend.GetOccupiedMemorySize();
+ }
+ }
+ return res;
+}
diff --git a/library/cpp/actors/util/rope.h b/library/cpp/actors/util/rope.h
index 9df251db9ce..201ce06f0d4 100644
--- a/library/cpp/actors/util/rope.h
+++ b/library/cpp/actors/util/rope.h
@@ -806,6 +806,8 @@ public:
return TRcBuf(Begin().GetChunk());
}
+ size_t GetOccupiedMemorySize() const;
+
friend bool operator==(const TRope& x, const TRope& y) { return Compare(x, y) == 0; }
friend bool operator!=(const TRope& x, const TRope& y) { return Compare(x, y) != 0; }
friend bool operator< (const TRope& x, const TRope& y) { return Compare(x, y) < 0; }
diff --git a/library/cpp/actors/util/ut/CMakeLists.darwin-x86_64.txt b/library/cpp/actors/util/ut/CMakeLists.darwin-x86_64.txt
index cb32e0652f7..f02b2d926c3 100644
--- a/library/cpp/actors/util/ut/CMakeLists.darwin-x86_64.txt
+++ b/library/cpp/actors/util/ut/CMakeLists.darwin-x86_64.txt
@@ -22,6 +22,8 @@ target_link_options(library-cpp-actors-util-ut PRIVATE
-Wl,-platform_version,macos,11.0,11.0
-fPIC
-fPIC
+ -framework
+ CoreFoundation
)
target_sources(library-cpp-actors-util-ut PRIVATE
${CMAKE_SOURCE_DIR}/library/cpp/actors/util/cpu_load_log_ut.cpp
diff --git a/library/cpp/actors/util/ya.make b/library/cpp/actors/util/ya.make
index 912b55868d2..48d595c156b 100644
--- a/library/cpp/actors/util/ya.make
+++ b/library/cpp/actors/util/ya.make
@@ -19,6 +19,7 @@ SRCS(
memory_tracker.cpp
memory_tracker.h
recentwnd.h
+ rope.cpp
rope.h
rc_buf.cpp
rc_buf.h
@@ -37,6 +38,7 @@ SRCS(
)
PEERDIR(
+ library/cpp/containers/absl_flat_hash
library/cpp/deprecated/atomic
library/cpp/pop_count
)
diff --git a/ydb/core/blobstorage/crypto/ut/CMakeLists.darwin-x86_64.txt b/ydb/core/blobstorage/crypto/ut/CMakeLists.darwin-x86_64.txt
index 26ad3f0a64f..8a9975fbf26 100644
--- a/ydb/core/blobstorage/crypto/ut/CMakeLists.darwin-x86_64.txt
+++ b/ydb/core/blobstorage/crypto/ut/CMakeLists.darwin-x86_64.txt
@@ -22,6 +22,8 @@ target_link_options(ydb-core-blobstorage-crypto-ut PRIVATE
-Wl,-platform_version,macos,11.0,11.0
-fPIC
-fPIC
+ -framework
+ CoreFoundation
)
target_sources(ydb-core-blobstorage-crypto-ut PRIVATE
${CMAKE_SOURCE_DIR}/ydb/core/blobstorage/crypto/chacha_ut.cpp
diff --git a/ydb/core/blobstorage/dsproxy/dsproxy_get_impl.h b/ydb/core/blobstorage/dsproxy/dsproxy_get_impl.h
index ff9b0f2f0ee..b4dafc03391 100644
--- a/ydb/core/blobstorage/dsproxy/dsproxy_get_impl.h
+++ b/ydb/core/blobstorage/dsproxy/dsproxy_get_impl.h
@@ -223,6 +223,11 @@ public:
// TODO(cthulhu): Verify shift and response size, and cookie
R_LOG_DEBUG_SX(logCtx, "BPG58", "Got# OK orderNumber# " << orderNumber << " vDiskId# " << vdisk.ToString());
resultBuffer.Compact();
+ if (resultBuffer.GetOccupiedMemorySize() > resultBuffer.size() * 2) {
+ auto temp = TRcBuf::Uninitialized(resultBuffer.size());
+ resultBuffer.ExtractFrontPlain(temp.GetDataMut(), temp.size());
+ resultBuffer.Insert(resultBuffer.End(), std::move(temp));
+ }
Blackboard.AddResponseData(blobId, orderNumber, resultShift, std::move(resultBuffer), result.GetKeep(),
result.GetDoNotKeep());
} else if (replyStatus == NKikimrProto::NODATA) {
diff --git a/ydb/core/erasure/ut/CMakeLists.darwin-x86_64.txt b/ydb/core/erasure/ut/CMakeLists.darwin-x86_64.txt
index 69913df2c57..ff15eec7e55 100644
--- a/ydb/core/erasure/ut/CMakeLists.darwin-x86_64.txt
+++ b/ydb/core/erasure/ut/CMakeLists.darwin-x86_64.txt
@@ -23,6 +23,8 @@ target_link_options(ydb-core-erasure-ut PRIVATE
-Wl,-platform_version,macos,11.0,11.0
-fPIC
-fPIC
+ -framework
+ CoreFoundation
)
target_sources(ydb-core-erasure-ut PRIVATE
${CMAKE_SOURCE_DIR}/ydb/core/erasure/erasure_ut.cpp
diff --git a/ydb/core/erasure/ut_perf/CMakeLists.darwin-x86_64.txt b/ydb/core/erasure/ut_perf/CMakeLists.darwin-x86_64.txt
index 3535dbf830e..82951db456f 100644
--- a/ydb/core/erasure/ut_perf/CMakeLists.darwin-x86_64.txt
+++ b/ydb/core/erasure/ut_perf/CMakeLists.darwin-x86_64.txt
@@ -22,6 +22,8 @@ target_link_options(ydb-core-erasure-ut_perf PRIVATE
-Wl,-platform_version,macos,11.0,11.0
-fPIC
-fPIC
+ -framework
+ CoreFoundation
)
target_sources(ydb-core-erasure-ut_perf PRIVATE
${CMAKE_SOURCE_DIR}/ydb/core/erasure/erasure_perf_test.cpp
diff --git a/ydb/core/erasure/ut_rope/CMakeLists.darwin-x86_64.txt b/ydb/core/erasure/ut_rope/CMakeLists.darwin-x86_64.txt
index 9d531bfbeab..f07378583d3 100644
--- a/ydb/core/erasure/ut_rope/CMakeLists.darwin-x86_64.txt
+++ b/ydb/core/erasure/ut_rope/CMakeLists.darwin-x86_64.txt
@@ -23,6 +23,8 @@ target_link_options(ydb-core-erasure-ut_rope PRIVATE
-Wl,-platform_version,macos,11.0,11.0
-fPIC
-fPIC
+ -framework
+ CoreFoundation
)
target_sources(ydb-core-erasure-ut_rope PRIVATE
${CMAKE_SOURCE_DIR}/ydb/core/erasure/erasure_rope_ut.cpp