aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorosidorkin <osidorkin@yandex-team.com>2024-07-19 13:30:22 +0300
committerosidorkin <osidorkin@yandex-team.com>2024-07-19 13:54:48 +0300
commit387e46be08d38c207b7176115d6799fc6e063ea0 (patch)
treeef9eb03f8cf1a56e728c24ef120a56d1343fdab1
parentccfb768b9bf9dff2336c9b0931b4e35c1bfb18df (diff)
downloadydb-387e46be08d38c207b7176115d6799fc6e063ea0.tar.gz
YT-21101: Limit response size of PullRows call according to available memory limit
903730a71cebe66dbf915dccf7b90150c3f1b304
-rw-r--r--yt/yt/client/api/queue_client.h2
-rw-r--r--yt/yt/core/misc/memory_usage_tracker.h11
-rw-r--r--yt/yt/core/misc/public.h1
3 files changed, 14 insertions, 0 deletions
diff --git a/yt/yt/client/api/queue_client.h b/yt/yt/client/api/queue_client.h
index a50cd9da1b..ad489e547a 100644
--- a/yt/yt/client/api/queue_client.h
+++ b/yt/yt/client/api/queue_client.h
@@ -27,6 +27,8 @@ struct TPullRowsOptions
NChaosClient::TReplicationProgress ReplicationProgress;
NTransactionClient::TTimestamp UpperTimestamp = NTransactionClient::NullTimestamp;
NTableClient::TTableSchemaPtr TableSchema;
+ i64 MaxDataWeight = 1_GB;
+ IReservingMemoryUsageTrackerPtr MemoryTracker;
};
struct TPullRowsResult
diff --git a/yt/yt/core/misc/memory_usage_tracker.h b/yt/yt/core/misc/memory_usage_tracker.h
index 00d93cb30f..bcd132e8ed 100644
--- a/yt/yt/core/misc/memory_usage_tracker.h
+++ b/yt/yt/core/misc/memory_usage_tracker.h
@@ -41,6 +41,17 @@ struct IMemoryUsageTracker
DEFINE_REFCOUNTED_TYPE(IMemoryUsageTracker)
+/////////////////////////////////////////////////////////////////////////////
+
+struct IReservingMemoryUsageTracker
+ : public IMemoryUsageTracker
+{
+ virtual void ReleaseUnusedReservation() = 0;
+ virtual TError TryReserve(i64 size) = 0;
+};
+
+DEFINE_REFCOUNTED_TYPE(IReservingMemoryUsageTracker)
+
////////////////////////////////////////////////////////////////////////////////
IMemoryUsageTrackerPtr GetNullMemoryUsageTracker();
diff --git a/yt/yt/core/misc/public.h b/yt/yt/core/misc/public.h
index 77464ae366..7efd15b738 100644
--- a/yt/yt/core/misc/public.h
+++ b/yt/yt/core/misc/public.h
@@ -173,6 +173,7 @@ DEFINE_ENUM(EProcessErrorCode,
////////////////////////////////////////////////////////////////////////////////
DECLARE_REFCOUNTED_STRUCT(IMemoryUsageTracker)
+DECLARE_REFCOUNTED_STRUCT(IReservingMemoryUsageTracker)
////////////////////////////////////////////////////////////////////////////////