Skip to content

Commit e4d132d

Browse files
fix tests
1 parent cb97bcd commit e4d132d

File tree

6 files changed

+54
-17
lines changed

6 files changed

+54
-17
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#include "helper.h"
2+
3+
namespace NKikimr::NOlap::NEngines::NTest {
4+
5+
NKikimrTxColumnShard::TLogicalMetadata TLocalHelper::GetMetaProto() {
6+
NKikimrTxColumnShard::TLogicalMetadata result;
7+
result.SetDirtyWriteTimeSeconds(TInstant::Now().Seconds());
8+
return result;
9+
}
10+
11+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#pragma once
2+
#include <ydb/core/tx/columnshard/engines/insert_table/meta.h>
3+
4+
namespace NKikimr::NOlap::NEngines::NTest {
5+
6+
class TLocalHelper {
7+
public:
8+
static NKikimrTxColumnShard::TLogicalMetadata GetMetaProto();
9+
};
10+
11+
};

ydb/core/tx/columnshard/engines/ut_insert_table.cpp renamed to ydb/core/tx/columnshard/engines/ut/ut_insert_table.cpp

+7-6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
#include "db_wrapper.h"
2-
#include "insert_table/insert_table.h"
1+
#include "helper.h"
2+
#include <ydb/core/tx/columnshard/engines/db_wrapper.h>
3+
#include <ydb/core/tx/columnshard/engines/insert_table/insert_table.h>
34

45
#include <ydb/core/tx/columnshard/columnshard_schema.h>
56

@@ -9,6 +10,7 @@
910
namespace NKikimr {
1011

1112
using namespace NOlap;
13+
using namespace NKikimr::NOlap::NEngines::NTest;
1214

1315
namespace {
1416

@@ -40,7 +42,6 @@ class TTestInsertTableDB: public IDbWrapper {
4042

4143
}
4244

43-
4445
Y_UNIT_TEST_SUITE(TColumnEngineTestInsertTable) {
4546
Y_UNIT_TEST(TestInsertCommit) {
4647
ui64 writeId = 0;
@@ -53,16 +54,16 @@ Y_UNIT_TEST_SUITE(TColumnEngineTestInsertTable) {
5354
ui64 indexSnapshot = 0;
5455

5556
// insert, not commited
56-
bool ok = insertTable.Insert(dbTable, TInsertedData(writeId, tableId, dedupId, blobId1, {}, indexSnapshot, {}));
57+
bool ok = insertTable.Insert(dbTable, TInsertedData(writeId, tableId, dedupId, blobId1, TLocalHelper::GetMetaProto(), indexSnapshot, {}));
5758
UNIT_ASSERT(ok);
5859

5960
// insert the same blobId1 again
60-
ok = insertTable.Insert(dbTable, TInsertedData(writeId, tableId, dedupId, blobId1, {}, indexSnapshot, {}));
61+
ok = insertTable.Insert(dbTable, TInsertedData(writeId, tableId, dedupId, blobId1, TLocalHelper::GetMetaProto(), indexSnapshot, {}));
6162
UNIT_ASSERT(!ok);
6263

6364
// insert different blodId with the same writeId and dedupId
6465
TUnifiedBlobId blobId2(2222, 1, 2, 100, 1);
65-
ok = insertTable.Insert(dbTable, TInsertedData(writeId, tableId, dedupId, blobId2, {}, indexSnapshot, {}));
66+
ok = insertTable.Insert(dbTable, TInsertedData(writeId, tableId, dedupId, blobId2, TLocalHelper::GetMetaProto(), indexSnapshot, {}));
6667
UNIT_ASSERT(!ok);
6768

6869
// read nothing

ydb/core/tx/columnshard/engines/ut_logs_engine.cpp renamed to ydb/core/tx/columnshard/engines/ut/ut_logs_engine.cpp

+23-10
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
1+
#include "helper.h"
12
#include <library/cpp/testing/unittest/registar.h>
2-
#include "column_engine_logs.h"
3-
#include "predicate/predicate.h"
4-
#include "changes/cleanup.h"
3+
#include <ydb/core/tx/columnshard/engines/column_engine_logs.h>
4+
#include <ydb/core/tx/columnshard/engines/predicate/predicate.h>
5+
#include <ydb/core/tx/columnshard/engines/changes/cleanup.h>
56

67
#include <ydb/core/tx/columnshard/columnshard_ut_common.h>
78
#include <ydb/core/tx/columnshard/engines/changes/compaction.h>
89
#include <ydb/core/tx/columnshard/blobs_action/bs/storage.h>
910
#include <ydb/core/tx/columnshard/hooks/testing/controller.h>
11+
#include <ydb/core/tx/columnshard/data_sharing/manager/shared_blobs.h>
1012

1113

1214
namespace NKikimr {
@@ -16,6 +18,7 @@ namespace NTypeIds = NScheme::NTypeIds;
1618
using TTypeId = NScheme::TTypeId;
1719
using TTypeInfo = NScheme::TTypeInfo;
1820
using TDefaultTestsController = NKikimr::NYDBTest::NColumnShard::TController;
21+
using namespace NKikimr::NOlap::NEngines::NTest;
1922

2023
namespace {
2124

@@ -375,13 +378,23 @@ class TTestStoragesManager: public NOlap::IStoragesManager {
375378
private:
376379
using TBase = NOlap::IStoragesManager;
377380
TIntrusivePtr<TTabletStorageInfo> TabletInfo = new TTabletStorageInfo();
381+
std::shared_ptr<NOlap::NDataSharing::TSharedBlobsManager> SharedBlobsManager = std::make_shared<NOlap::NDataSharing::TSharedBlobsManager>();
378382
protected:
383+
virtual bool DoLoadIdempotency(NTable::TDatabase& /*database*/) override {
384+
return true;
385+
}
386+
379387
virtual std::shared_ptr<NOlap::IBlobsStorageOperator> DoBuildOperator(const TString& storageId) override {
380388
if (storageId == TBase::DefaultStorageId) {
381-
return std::make_shared<NOlap::NBlobOperations::NBlobStorage::TOperator>(storageId, NActors::TActorId(), TabletInfo, 1);
389+
return std::make_shared<NOlap::NBlobOperations::NBlobStorage::TOperator>(storageId, NActors::TActorId(), TabletInfo,
390+
1, SharedBlobsManager->GetStorageManagerGuarantee(TBase::DefaultStorageId));
382391
} else
383392
return nullptr;
384393
}
394+
public:
395+
virtual const std::shared_ptr<NDataSharing::TSharedBlobsManager>& GetSharedBlobsManager() const override {
396+
return SharedBlobsManager;
397+
}
385398
};
386399

387400
std::shared_ptr<NKikimr::NOlap::IStoragesManager> CommonStoragesManager = std::make_shared<TTestStoragesManager>();
@@ -411,8 +424,8 @@ Y_UNIT_TEST_SUITE(TColumnEngineTestLogs) {
411424
engine.Load(db);
412425

413426
std::vector<TInsertedData> dataToIndex = {
414-
TInsertedData(2, paths[0], "", blobRanges[0].BlobId, {}, 0, {}),
415-
TInsertedData(1, paths[0], "", blobRanges[1].BlobId, {}, 0, {})
427+
TInsertedData(2, paths[0], "", blobRanges[0].BlobId, TLocalHelper::GetMetaProto(), 0, {}),
428+
TInsertedData(1, paths[0], "", blobRanges[1].BlobId, TLocalHelper::GetMetaProto(), 0, {})
416429
};
417430

418431
// write
@@ -507,7 +520,7 @@ Y_UNIT_TEST_SUITE(TColumnEngineTestLogs) {
507520
// PlanStep, TxId, PathId, DedupId, BlobId, Data, [Metadata]
508521
std::vector<TInsertedData> dataToIndex;
509522
dataToIndex.push_back(
510-
TInsertedData(txId, pathId, "", blobRange.BlobId, {}, 0, {}));
523+
TInsertedData(txId, pathId, "", blobRange.BlobId, TLocalHelper::GetMetaProto(), 0, {}));
511524

512525
bool ok = Insert(engine, db, TSnapshot(planStep, txId), std::move(dataToIndex), blobs, step);
513526
UNIT_ASSERT(ok);
@@ -605,7 +618,7 @@ Y_UNIT_TEST_SUITE(TColumnEngineTestLogs) {
605618
// PlanStep, TxId, PathId, DedupId, BlobId, Data, [Metadata]
606619
std::vector<TInsertedData> dataToIndex;
607620
dataToIndex.push_back(
608-
TInsertedData(txId, pathId, "", blobRange.BlobId, {}, 0, {}));
621+
TInsertedData(txId, pathId, "", blobRange.BlobId, TLocalHelper::GetMetaProto(), 0, {}));
609622

610623
bool ok = Insert(engine, db, TSnapshot(planStep, txId), std::move(dataToIndex), blobs, step);
611624
for (auto&& i : blobs) {
@@ -639,7 +652,7 @@ Y_UNIT_TEST_SUITE(TColumnEngineTestLogs) {
639652
// PlanStep, TxId, PathId, DedupId, BlobId, Data, [Metadata]
640653
std::vector<TInsertedData> dataToIndex;
641654
dataToIndex.push_back(
642-
TInsertedData(txId, pathId, "", blobRange.BlobId, {}, 0, {}));
655+
TInsertedData(txId, pathId, "", blobRange.BlobId, TLocalHelper::GetMetaProto(), 0, {}));
643656

644657
bool ok = Insert(engine, db, TSnapshot(planStep, txId), std::move(dataToIndex), blobs, step);
645658
UNIT_ASSERT(ok);
@@ -680,7 +693,7 @@ Y_UNIT_TEST_SUITE(TColumnEngineTestLogs) {
680693
// PlanStep, TxId, PathId, DedupId, BlobId, Data, [Metadata]
681694
std::vector<TInsertedData> dataToIndex;
682695
dataToIndex.push_back(
683-
TInsertedData(txId, pathId, "", blobRange.BlobId, {}, 0, {}));
696+
TInsertedData(txId, pathId, "", blobRange.BlobId, TLocalHelper::GetMetaProto(), 0, {}));
684697

685698
bool ok = Insert(engine, db, TSnapshot(planStep, txId), std::move(dataToIndex), blobs, step);
686699
UNIT_ASSERT(ok);

ydb/core/tx/columnshard/engines/ut_program.cpp renamed to ydb/core/tx/columnshard/engines/ut/ut_program.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#include "index_info.h"
1+
#include <ydb/core/tx/columnshard/engines/index_info.h>
22

33
#include <ydb/core/tx/columnshard/columnshard__index_scan.h>
44
#include <ydb/core/tx/columnshard/columnshard_ut_common.h>

ydb/core/tx/columnshard/engines/ut/ya.make

+1
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ SRCS(
3535
ut_insert_table.cpp
3636
ut_logs_engine.cpp
3737
ut_program.cpp
38+
helper.cpp
3839
ydb/core/tx/columnshard/columnshard_ut_common.cpp
3940
)
4041

0 commit comments

Comments
 (0)