aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorivanmorozov <ivanmorozov@ydb.tech>2023-12-08 11:52:07 +0300
committerivanmorozov <ivanmorozov@ydb.tech>2023-12-08 12:37:23 +0300
commitd9780f23a01f92920cb691449b60d840f3312a8c (patch)
tree1190d288e07861297c596d90fb1110cb135b9bfb
parent08fcacebb86d9506d6eb05665ca7a5e2cabcffd7 (diff)
downloadydb-d9780f23a01f92920cb691449b60d840f3312a8c.tar.gz
KIKIMR-20072: fix tests
-rw-r--r--ydb/core/tx/columnshard/blobs_reader/actor.cpp6
-rw-r--r--ydb/core/tx/columnshard/blobs_reader/task.h4
-rw-r--r--ydb/core/tx/columnshard/splitter/batch_slice.cpp2
-rw-r--r--ydb/core/tx/columnshard/ut_schema/ut_columnshard_schema.cpp47
4 files changed, 41 insertions, 18 deletions
diff --git a/ydb/core/tx/columnshard/blobs_reader/actor.cpp b/ydb/core/tx/columnshard/blobs_reader/actor.cpp
index 092e0edff8..6112a82e26 100644
--- a/ydb/core/tx/columnshard/blobs_reader/actor.cpp
+++ b/ydb/core/tx/columnshard/blobs_reader/actor.cpp
@@ -5,17 +5,21 @@ namespace NKikimr::NOlap::NBlobOperations::NRead {
TAtomicCounter TActor::WaitingBlobsCount = 0;
void TActor::Handle(NBlobCache::TEvBlobCache::TEvReadBlobRangeResult::TPtr& ev) {
+ if (!Task) {
+ return;
+ }
ACFL_TRACE("event", "TEvReadBlobRangeResult")("blob_id", ev->Get()->BlobRange);
auto& event = *ev->Get();
- WaitingBlobsCount.Dec();
bool aborted = false;
if (event.Status != NKikimrProto::EReplyStatus::OK) {
+ WaitingBlobsCount.Sub(Task->GetWaitingCount());
if (!Task->AddError(event.BlobRange, IBlobsReadingAction::TErrorStatus::Fail(event.Status, "cannot get blob"))) {
aborted = true;
}
} else {
+ WaitingBlobsCount.Dec();
Task->AddData(event.BlobRange, event.Data);
}
if (aborted || Task->IsFinished()) {
diff --git a/ydb/core/tx/columnshard/blobs_reader/task.h b/ydb/core/tx/columnshard/blobs_reader/task.h
index 072e06f5f2..65525b03f4 100644
--- a/ydb/core/tx/columnshard/blobs_reader/task.h
+++ b/ydb/core/tx/columnshard/blobs_reader/task.h
@@ -77,6 +77,10 @@ public:
return *ReadRangesCount;
}
+ ui32 GetWaitingCount() const {
+ return BlobsWaiting.size();
+ }
+
THashSet<TBlobRange> GetExpectedRanges() const {
THashSet<TBlobRange> result;
for (auto&& i : Agents) {
diff --git a/ydb/core/tx/columnshard/splitter/batch_slice.cpp b/ydb/core/tx/columnshard/splitter/batch_slice.cpp
index 0a3dc0ff0f..8c8ea7db21 100644
--- a/ydb/core/tx/columnshard/splitter/batch_slice.cpp
+++ b/ydb/core/tx/columnshard/splitter/batch_slice.cpp
@@ -108,7 +108,7 @@ TGeneralSerializedSlice::TGeneralSerializedSlice(const std::map<ui32, std::vecto
if (!recordsCount) {
recordsCount = column.GetRecordsCount();
} else {
- Y_ABORT_UNLESS(*recordsCount == column.GetRecordsCount());
+ AFL_VERIFY(*recordsCount == column.GetRecordsCount())("records_count", *recordsCount)("column", column.GetRecordsCount());
}
Size += column.GetSize();
Columns.emplace_back(std::move(column));
diff --git a/ydb/core/tx/columnshard/ut_schema/ut_columnshard_schema.cpp b/ydb/core/tx/columnshard/ut_schema/ut_columnshard_schema.cpp
index 1a3fe1a268..11fe7c7873 100644
--- a/ydb/core/tx/columnshard/ut_schema/ut_columnshard_schema.cpp
+++ b/ydb/core/tx/columnshard/ut_schema/ut_columnshard_schema.cpp
@@ -48,13 +48,13 @@ protected:
return true;
}
virtual bool DoOnWriteIndexComplete(const ui64 /*tabletId*/, const TString& changeClassName) override {
- if (changeClassName == "TTL") {
+ if (changeClassName.find("TTL") != TString::npos) {
AtomicIncrement(TTLFinishedCounter);
}
return true;
}
virtual bool DoOnWriteIndexStart(const ui64 /*tabletId*/, const TString& changeClassName) override {
- if (changeClassName == "TTL") {
+ if (changeClassName.find("TTL") != TString::npos) {
AtomicIncrement(TTLStartedCounter);
}
return true;
@@ -631,27 +631,30 @@ public:
std::vector<std::pair<ui32, ui64>> TestTiers(bool reboots, const std::vector<TString>& blobs,
const std::vector<TTestSchema::TTableSpecials>& specsExt,
- std::optional<ui32> eventLoss = {})
+ std::optional<ui32> eventLoss = {}, const bool buildTTL = true)
{
auto specs = specsExt;
- for (auto&& i : specs) {
- if (!i.HasTtl() && i.HasTiers()) {
- std::optional<TDuration> d;
- for (auto&& i : i.Tiers) {
- if (!d || *d < i.EvictAfter) {
- d = i.EvictAfter;
+ if (buildTTL) {
+ for (auto&& i : specs) {
+ if (!i.HasTtl() && i.HasTiers()) {
+ std::optional<TDuration> d;
+ for (auto&& i : i.Tiers) {
+ if (!d || *d < i.EvictAfter) {
+ d = i.EvictAfter;
+ }
}
+ Y_ABORT_UNLESS(d);
+ i.SetTtl(*d);
}
- Y_ABORT_UNLESS(d);
- i.SetTtl(*d);
}
}
+
auto csControllerGuard = NKikimr::NYDBTest::TControllers::RegisterCSControllerGuard<TWaitCompactionController>();
TTestBasicRuntime runtime;
TTester::Setup(runtime);
runtime.SetLogPriority(NKikimrServices::TX_COLUMNSHARD, NActors::NLog::PRI_DEBUG);
- runtime.SetLogPriority(NKikimrServices::TX_COLUMNSHARD_SCAN, NActors::NLog::PRI_INFO);
+ runtime.SetLogPriority(NKikimrServices::TX_COLUMNSHARD_SCAN, NActors::NLog::PRI_DEBUG);
TActorId sender = runtime.AllocateEdgeActor();
CreateTestBootstrapper(runtime,
@@ -720,6 +723,9 @@ std::vector<std::pair<ui32, ui64>> TestTiers(bool reboots, const std::vector<TSt
bool hasColdEviction = false;
bool misconfig = false;
auto expectedReadResult = EExpectedResult::OK;
+ ui32 tIdx = 0;
+ std::optional<ui32> tIdxCorrect;
+ TString originalEndpoint;
for (auto&& spec : specs[i].Tiers) {
hasColdEviction = true;
if (spec.S3.GetEndpoint() != "fake") {
@@ -728,11 +734,14 @@ std::vector<std::pair<ui32, ui64>> TestTiers(bool reboots, const std::vector<TSt
if (i > 1) {
expectedReadResult = EExpectedResult::ERROR;
}
+ originalEndpoint = spec.S3.GetEndpoint();
+ spec.S3.SetEndpoint("fake");
+ tIdxCorrect = tIdx++;
}
break;
}
if (i) {
- const ui32 version = i + 1;
+ const ui32 version = 2 * i + 1;
const bool ok = ProposeSchemaTx(runtime, sender,
TTestSchema::AlterTableTxBody(tableId, version, specs[i]),
NOlap::TSnapshot(++planStep, ++txId));
@@ -791,6 +800,12 @@ std::vector<std::pair<ui32, ui64>> TestTiers(bool reboots, const std::vector<TSt
runtime.SimulateSleep(TDuration::Seconds(1)); // wait all finished before (ttl especially)
}
+ if (tIdxCorrect) {
+ specs[i].Tiers[*tIdxCorrect].S3.SetEndpoint(originalEndpoint);
+ csControllerGuard->SetTiersSnapshot(runtime, sender, TTestSchema::BuildSnapshot(specs[i]));
+ }
+
+
if (reboots) {
Cerr << "INTERMEDIATE REBOOT(" << i << ")" << Endl;
RebootTablet(runtime, TTestTxConfig::TxTablet0, sender);
@@ -980,11 +995,11 @@ std::vector<std::pair<ui32, ui64>> TestTiersAndTtl(const TTestSchema::TTableSpec
std::vector<std::pair<ui32, ui64>> TestOneTierExport(const TTestSchema::TTableSpecials& spec,
const std::vector<TTestSchema::TTableSpecials>& alters,
- const std::vector<ui64>& ts, bool reboots, std::optional<ui32> loss) {
+ const std::vector<ui64>& ts, bool reboots, std::optional<ui32> loss, const bool buildTTL = true) {
ui32 overlapSize = 0;
std::vector<TString> blobs = MakeData(ts, PORTION_ROWS, overlapSize, spec.TtlColumn);
- auto rowsBytes = TestTiers(reboots, blobs, alters, loss);
+ auto rowsBytes = TestTiers(reboots, blobs, alters, loss, buildTTL);
for (auto&& i : rowsBytes) {
Cerr << i.first << "/" << i.second << Endl;
}
@@ -1081,7 +1096,7 @@ void TestExport(bool reboot, TExportTestOpts&& opts = TExportTestOpts{}) {
alters[alterNo].Tiers.clear();
}
- auto rowsBytes = TestOneTierExport(spec, alters, ts, reboot, opts.Loss);
+ auto rowsBytes = TestOneTierExport(spec, alters, ts, reboot, opts.Loss, !opts.Misconfig);
if (!opts.Misconfig) {
changes.Assert(spec, rowsBytes, 1);
}