Browse Source

Не проверяется MaxGraphCheckpointsSizeBytes

- AddToStateSize - не использовалась (и выглядит лишним - каждый раз (на стейт) обновлять в БД метаданные)
- передаю state_size от координатора (из статистики),
- тесты перенес в ydb/,
- тесты на координатор были сломаны (это видно по логам теста по отсутствию соощений Checkpoint successfully created)
kardymon-d 1 year ago
parent
commit
210a1a8304

+ 6 - 0
.mapping.json

@@ -4868,6 +4868,12 @@
   "ydb/core/fq/libs/checkpoint_storage/proto/CMakeLists.linux-x86_64.txt":"",
   "ydb/core/fq/libs/checkpoint_storage/proto/CMakeLists.txt":"",
   "ydb/core/fq/libs/checkpoint_storage/proto/CMakeLists.windows-x86_64.txt":"",
+  "ydb/core/fq/libs/checkpoint_storage/ut/CMakeLists.darwin-arm64.txt":"",
+  "ydb/core/fq/libs/checkpoint_storage/ut/CMakeLists.darwin-x86_64.txt":"",
+  "ydb/core/fq/libs/checkpoint_storage/ut/CMakeLists.linux-aarch64.txt":"",
+  "ydb/core/fq/libs/checkpoint_storage/ut/CMakeLists.linux-x86_64.txt":"",
+  "ydb/core/fq/libs/checkpoint_storage/ut/CMakeLists.txt":"",
+  "ydb/core/fq/libs/checkpoint_storage/ut/CMakeLists.windows-x86_64.txt":"",
   "ydb/core/fq/libs/checkpointing/CMakeLists.darwin-arm64.txt":"",
   "ydb/core/fq/libs/checkpointing/CMakeLists.darwin-x86_64.txt":"",
   "ydb/core/fq/libs/checkpointing/CMakeLists.linux-aarch64.txt":"",

+ 1 - 0
ydb/core/fq/libs/checkpoint_storage/CMakeLists.darwin-arm64.txt

@@ -8,6 +8,7 @@
 
 add_subdirectory(events)
 add_subdirectory(proto)
+add_subdirectory(ut)
 
 add_library(fq-libs-checkpoint_storage)
 target_compile_options(fq-libs-checkpoint_storage PRIVATE

+ 1 - 0
ydb/core/fq/libs/checkpoint_storage/CMakeLists.darwin-x86_64.txt

@@ -8,6 +8,7 @@
 
 add_subdirectory(events)
 add_subdirectory(proto)
+add_subdirectory(ut)
 
 add_library(fq-libs-checkpoint_storage)
 target_compile_options(fq-libs-checkpoint_storage PRIVATE

+ 1 - 0
ydb/core/fq/libs/checkpoint_storage/CMakeLists.linux-aarch64.txt

@@ -8,6 +8,7 @@
 
 add_subdirectory(events)
 add_subdirectory(proto)
+add_subdirectory(ut)
 
 add_library(fq-libs-checkpoint_storage)
 target_compile_options(fq-libs-checkpoint_storage PRIVATE

+ 1 - 0
ydb/core/fq/libs/checkpoint_storage/CMakeLists.linux-x86_64.txt

@@ -8,6 +8,7 @@
 
 add_subdirectory(events)
 add_subdirectory(proto)
+add_subdirectory(ut)
 
 add_library(fq-libs-checkpoint_storage)
 target_compile_options(fq-libs-checkpoint_storage PRIVATE

+ 1 - 0
ydb/core/fq/libs/checkpoint_storage/CMakeLists.windows-x86_64.txt

@@ -8,6 +8,7 @@
 
 add_subdirectory(events)
 add_subdirectory(proto)
+add_subdirectory(ut)
 
 add_library(fq-libs-checkpoint_storage)
 target_compile_options(fq-libs-checkpoint_storage PRIVATE

+ 2 - 7
ydb/core/fq/libs/checkpoint_storage/checkpoint_storage.h

@@ -17,7 +17,6 @@ class ICheckpointStorage : public virtual TThrRefBase {
 public:
     using TGetCheckpointsResult = std::pair<TCheckpoints, NYql::TIssues>;
     using TGetCoordinatorsResult = std::pair<TCoordinators, NYql::TIssues>;
-    using TAddToStateSizeResult = std::pair<ui64, NYql::TIssues>;
     using TGetTotalCheckpointsStateSizeResult = std::pair<ui64, NYql::TIssues>;
     using TCreateCheckpointResult = std::pair<TString, NYql::TIssues>; // graphDescId for subsequent usage.
 
@@ -44,7 +43,8 @@ public:
         const TCoordinatorId& coordinator,
         const TCheckpointId& checkpointId,
         ECheckpointStatus newStatus,
-        ECheckpointStatus prevStatus) = 0;
+        ECheckpointStatus prevStatus,
+        ui64 stateSizeBytes) = 0;
 
     virtual NThreading::TFuture<NYql::TIssues> AbortCheckpoint(
         const TCoordinatorId& coordinator,
@@ -71,11 +71,6 @@ public:
         const TString& graphId,
         const TCheckpointId& checkpointUpperBound) = 0;
 
-    virtual NThreading::TFuture<ICheckpointStorage::TAddToStateSizeResult> AddToStateSize(
-        const TString& graphId,
-        const TCheckpointId& checkpoint,
-        ui64 size) = 0;
-
     virtual NThreading::TFuture<ICheckpointStorage::TGetTotalCheckpointsStateSizeResult> GetTotalCheckpointsStateSize(const TString& graphId) = 0;
 };
 

+ 8 - 4
ydb/core/fq/libs/checkpoint_storage/events/events.h

@@ -92,13 +92,15 @@ struct TEvCheckpointStorage {
 
     struct TEvSetCheckpointPendingCommitStatusRequest
         : NActors::TEventLocal<TEvSetCheckpointPendingCommitStatusRequest, EvSetCheckpointStatusPendingCommitRequest> {
-        TEvSetCheckpointPendingCommitStatusRequest(TCoordinatorId coordinatorId, TCheckpointId checkpointId)
+        TEvSetCheckpointPendingCommitStatusRequest(TCoordinatorId coordinatorId, TCheckpointId checkpointId, ui64 stateSizeBytes)
             : CoordinatorId(std::move(coordinatorId))
-            , CheckpointId(std::move(checkpointId)) {
+            , CheckpointId(std::move(checkpointId))
+            , StateSizeBytes(stateSizeBytes) {
         }
 
         TCoordinatorId CoordinatorId;
         TCheckpointId CheckpointId;
+        ui64 StateSizeBytes;
     };
 
     struct TEvSetCheckpointPendingCommitStatusResponse
@@ -114,13 +116,15 @@ struct TEvCheckpointStorage {
 
     struct TEvCompleteCheckpointRequest
         : NActors::TEventLocal<TEvCompleteCheckpointRequest, EvCompleteCheckpointRequest> {
-        TEvCompleteCheckpointRequest(TCoordinatorId coordinatorId, TCheckpointId checkpointId)
+        TEvCompleteCheckpointRequest(TCoordinatorId coordinatorId, TCheckpointId checkpointId, ui64 stateSizeBytes)
             : CoordinatorId(std::move(coordinatorId))
-            , CheckpointId(std::move(checkpointId)) {
+            , CheckpointId(std::move(checkpointId))
+            , StateSizeBytes(stateSizeBytes) {
         }
 
         TCoordinatorId CoordinatorId;
         TCheckpointId CheckpointId;
+        ui64 StateSizeBytes;
     };
 
     struct TEvCompleteCheckpointResponse

+ 2 - 2
ydb/core/fq/libs/checkpoint_storage/storage_proxy.cpp

@@ -234,7 +234,7 @@ void TStorageProxy::Handle(TEvCheckpointStorage::TEvCreateCheckpointRequest::TPt
 void TStorageProxy::Handle(TEvCheckpointStorage::TEvSetCheckpointPendingCommitStatusRequest::TPtr& ev) {
     const auto* event = ev->Get();
     LOG_STREAMS_STORAGE_SERVICE_DEBUG("[" << event->CoordinatorId << "] [" << event->CheckpointId << "] Got TEvSetCheckpointPendingCommitStatusRequest")
-    CheckpointStorage->UpdateCheckpointStatus(event->CoordinatorId, event->CheckpointId, ECheckpointStatus::PendingCommit, ECheckpointStatus::Pending)
+    CheckpointStorage->UpdateCheckpointStatus(event->CoordinatorId, event->CheckpointId, ECheckpointStatus::PendingCommit, ECheckpointStatus::Pending, event->StateSizeBytes)
         .Apply([checkpointId = event->CheckpointId,
                 coordinatorId = event->CoordinatorId,
                 cookie = ev->Cookie,
@@ -256,7 +256,7 @@ void TStorageProxy::Handle(TEvCheckpointStorage::TEvSetCheckpointPendingCommitSt
 void TStorageProxy::Handle(TEvCheckpointStorage::TEvCompleteCheckpointRequest::TPtr& ev) {
     const auto* event = ev->Get();
     LOG_STREAMS_STORAGE_SERVICE_DEBUG("[" << event->CoordinatorId << "] [" << event->CheckpointId << "] Got TEvCompleteCheckpointRequest")
-    CheckpointStorage->UpdateCheckpointStatus(event->CoordinatorId, event->CheckpointId, ECheckpointStatus::Completed, ECheckpointStatus::PendingCommit)
+    CheckpointStorage->UpdateCheckpointStatus(event->CoordinatorId, event->CheckpointId, ECheckpointStatus::Completed, ECheckpointStatus::PendingCommit, event->StateSizeBytes)
         .Apply([checkpointId = event->CheckpointId,
                 coordinatorId = event->CoordinatorId,
                 cookie = ev->Cookie,

+ 79 - 0
ydb/core/fq/libs/checkpoint_storage/ut/CMakeLists.darwin-arm64.txt

@@ -0,0 +1,79 @@
+
+# This file was generated by the build system used internally in the Yandex monorepo.
+# Only simple modifications are allowed (adding source-files to targets, adding simple properties
+# like target_include_directories). These modifications will be ported to original
+# ya.make files by maintainers. Any complex modifications which can't be ported back to the
+# original buildsystem will not be accepted.
+
+
+
+add_executable(ydb-core-fq-libs-checkpoint_storage-ut)
+target_compile_options(ydb-core-fq-libs-checkpoint_storage-ut PRIVATE
+  -DUSE_CURRENT_UDF_ABI_VERSION
+)
+target_include_directories(ydb-core-fq-libs-checkpoint_storage-ut PRIVATE
+  ${CMAKE_SOURCE_DIR}/ydb/core/fq/libs/checkpoint_storage
+)
+target_link_libraries(ydb-core-fq-libs-checkpoint_storage-ut PUBLIC
+  contrib-libs-cxxsupp
+  yutil
+  cpp-testing-unittest_main
+  fq-libs-checkpoint_storage
+  library-cpp-retry
+  cpp-testing-unittest
+  libs-actors-logging
+  libs-checkpoint_storage-events
+  core-testlib-default
+  ydb-library-security
+  cpp-client-ydb_table
+)
+target_link_options(ydb-core-fq-libs-checkpoint_storage-ut PRIVATE
+  -Wl,-platform_version,macos,11.0,11.0
+  -fPIC
+  -fPIC
+  -framework
+  CoreFoundation
+)
+target_sources(ydb-core-fq-libs-checkpoint_storage-ut PRIVATE
+  ${CMAKE_SOURCE_DIR}/ydb/core/fq/libs/checkpoint_storage/ut/gc_ut.cpp
+  ${CMAKE_SOURCE_DIR}/ydb/core/fq/libs/checkpoint_storage/ut/storage_service_ydb_ut.cpp
+  ${CMAKE_SOURCE_DIR}/ydb/core/fq/libs/checkpoint_storage/ut/ydb_state_storage_ut.cpp
+  ${CMAKE_SOURCE_DIR}/ydb/core/fq/libs/checkpoint_storage/ut/ydb_checkpoint_storage_ut.cpp
+)
+set_property(
+  TARGET
+  ydb-core-fq-libs-checkpoint_storage-ut
+  PROPERTY
+  SPLIT_FACTOR
+  10
+)
+add_yunittest(
+  NAME
+  ydb-core-fq-libs-checkpoint_storage-ut
+  TEST_TARGET
+  ydb-core-fq-libs-checkpoint_storage-ut
+  TEST_ARG
+  --print-before-suite
+  --print-before-test
+  --fork-tests
+  --print-times
+  --show-fails
+)
+set_yunittest_property(
+  TEST
+  ydb-core-fq-libs-checkpoint_storage-ut
+  PROPERTY
+  LABELS
+  MEDIUM
+)
+set_yunittest_property(
+  TEST
+  ydb-core-fq-libs-checkpoint_storage-ut
+  PROPERTY
+  PROCESSORS
+  1
+)
+target_allocator(ydb-core-fq-libs-checkpoint_storage-ut
+  system_allocator
+)
+vcs_info(ydb-core-fq-libs-checkpoint_storage-ut)

Some files were not shown because too many files changed in this diff