aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorserg-belyakov <serg-belyakov@yandex-team.com>2023-01-24 15:23:40 +0300
committerserg-belyakov <serg-belyakov@yandex-team.com>2023-01-24 15:23:40 +0300
commit57c70077b6f99797a7cfc5d77c9d8b3db32085a8 (patch)
tree67e15d4bdcc331dd596f0b0c28500e668e86570d
parentdefe9d304049a148823ce8845179a09f3b0bdb61 (diff)
downloadydb-57c70077b6f99797a7cfc5d77c9d8b3db32085a8.tar.gz
Add separate DoNotKeep flag to blob_depot test,
Minor changes Add DoNotKeepFlag
-rw-r--r--ydb/core/blobstorage/ut_blobstorage/blob_depot_auxiliary_structures.h7
-rw-r--r--ydb/core/blobstorage/ut_blobstorage/blob_depot_event_managers.cpp12
-rw-r--r--ydb/core/blobstorage/ut_blobstorage/blob_depot_event_managers.h3
-rw-r--r--ydb/core/blobstorage/ut_blobstorage/blob_depot_test_functions.cpp2
4 files changed, 10 insertions, 14 deletions
diff --git a/ydb/core/blobstorage/ut_blobstorage/blob_depot_auxiliary_structures.h b/ydb/core/blobstorage/ut_blobstorage/blob_depot_auxiliary_structures.h
index 75fa60b403..48a7816043 100644
--- a/ydb/core/blobstorage/ut_blobstorage/blob_depot_auxiliary_structures.h
+++ b/ydb/core/blobstorage/ut_blobstorage/blob_depot_auxiliary_structures.h
@@ -19,7 +19,6 @@ struct TBlobInfo {
: Status(EStatus::NONEXISTENT)
, Id(tablet, gen, step, channel, data.size(), cookie)
, Data(data)
- , KeepFlag(false)
{
}
@@ -34,13 +33,15 @@ struct TBlobInfo {
} else {
status = "COLLECTED";
}
- return TStringBuilder() << "Status# " << status << " Id# {" << Id.ToString() << "} Data# " << Data << " KeepFlag# " << KeepFlag;
+ return TStringBuilder() << "Status# " << status << " Id# {" << Id.ToString() << "} Data# " << Data <<
+ " Keep# " << Keep << " DoNotKeep# " << DoNotKeep;
}
EStatus Status;
const TLogoBlobID Id;
TString Data;
- bool KeepFlag;
+ bool Keep = false;
+ bool DoNotKeep = false;
static const TBlobInfo& Nothing() {
static const TBlobInfo nothing(TString(), 0, 0, 0, 0, 0);
diff --git a/ydb/core/blobstorage/ut_blobstorage/blob_depot_event_managers.cpp b/ydb/core/blobstorage/ut_blobstorage/blob_depot_event_managers.cpp
index c16d919193..50a8377c84 100644
--- a/ydb/core/blobstorage/ut_blobstorage/blob_depot_event_managers.cpp
+++ b/ydb/core/blobstorage/ut_blobstorage/blob_depot_event_managers.cpp
@@ -11,12 +11,13 @@
// #define LOG_BLOCK
// #define LOG_COLLECT_GARBAGE
-bool IsCollected(const TLogoBlobID& id, ui32 collectGen, ui32 collectStep) {
+bool CheckBarrier(const TLogoBlobID& id, ui32 collectGen, ui32 collectStep) {
return (id.Generation() < collectGen) || (id.Generation() == collectGen && id.Step() <= collectStep);
}
bool IsCollected(const TBlobInfo& blob, ui32 softCollectGen, ui32 softCollectStep, ui32 hardCollectGen, ui32 hardCollectStep) {
- return IsCollected(blob.Id, hardCollectGen, hardCollectStep) || (!blob.KeepFlag && IsCollected(blob.Id, softCollectGen, softCollectStep));
+ bool keep = !blob.DoNotKeep && blob.Keep;
+ return CheckBarrier(blob.Id, hardCollectGen, hardCollectStep) || (!keep && CheckBarrier(blob.Id, softCollectGen, softCollectStep));
}
@@ -566,15 +567,12 @@ void VerifyTEvCollectGarbageResult(TAutoPtr<TEventHandle<TEvBlobStorage::TEvColl
for (auto& blob : blobs) {
if (keep) {
if (setKeep.find(blob.Id) != setKeep.end()) {
- if (blob.Status != TBlobInfo::EStatus::WRITTEN) {
- UNIT_FAIL("Setting keep flag on nonexistent blob");
- }
- blob.KeepFlag = true;
+ blob.Keep = true;
}
}
if (doNotKeep) {
if (setNotKeep.find(blob.Id) != setNotKeep.end()) {
- blob.KeepFlag = false;
+ blob.DoNotKeep = true;
}
}
diff --git a/ydb/core/blobstorage/ut_blobstorage/blob_depot_event_managers.h b/ydb/core/blobstorage/ut_blobstorage/blob_depot_event_managers.h
index 174dc76c1c..a63f783a95 100644
--- a/ydb/core/blobstorage/ut_blobstorage/blob_depot_event_managers.h
+++ b/ydb/core/blobstorage/ut_blobstorage/blob_depot_event_managers.h
@@ -7,9 +7,6 @@
#include <optional>
-bool IsCollected(const TLogoBlobID& id, ui32 collectGen, ui32 collectStep);
-bool IsCollected(const TBlobInfo& blob, ui32 softCollectGen, ui32 softCollectStep, ui32 hardCollectGen, ui32 hardCollectStep);
-
std::unique_ptr<IEventHandle> CaptureAnyResult(TEnvironmentSetup& env, TActorId sender);
/* --------------------------------- PUT --------------------------------- */
diff --git a/ydb/core/blobstorage/ut_blobstorage/blob_depot_test_functions.cpp b/ydb/core/blobstorage/ut_blobstorage/blob_depot_test_functions.cpp
index e00d11f075..034fa7221d 100644
--- a/ydb/core/blobstorage/ut_blobstorage/blob_depot_test_functions.cpp
+++ b/ydb/core/blobstorage/ut_blobstorage/blob_depot_test_functions.cpp
@@ -785,7 +785,7 @@ void TestLoadPutAndGet(TBlobDepotTestEnvironment& tenv, ui64 tabletId, ui32 grou
for (ui32 iteration = 0; iteration < readsNum; ++iteration) {
ui32 action = act.GetInterval(tenv.Rand(act.UpperLimit()));
if (iteration == readsNum - 1) { // Catch all results on the last iteration
- action = 4;
+ action = EActions::CATCH_ALL;
}
if (tenv.IsFinished()) {
break;