diff --git a/ydb/core/tx/columnshard/engines/ut/helper.cpp b/ydb/core/tx/columnshard/engines/ut/helper.cpp new file mode 100644 index 000000000000..eee9159edea7 --- /dev/null +++ b/ydb/core/tx/columnshard/engines/ut/helper.cpp @@ -0,0 +1,11 @@ +#include "helper.h" + +namespace NKikimr::NOlap::NEngines::NTest { + +NKikimrTxColumnShard::TLogicalMetadata TLocalHelper::GetMetaProto() { + NKikimrTxColumnShard::TLogicalMetadata result; + result.SetDirtyWriteTimeSeconds(TInstant::Now().Seconds()); + return result; +} + +} \ No newline at end of file diff --git a/ydb/core/tx/columnshard/engines/ut/helper.h b/ydb/core/tx/columnshard/engines/ut/helper.h new file mode 100644 index 000000000000..8e17730a21c6 --- /dev/null +++ b/ydb/core/tx/columnshard/engines/ut/helper.h @@ -0,0 +1,11 @@ +#pragma once +#include + +namespace NKikimr::NOlap::NEngines::NTest { + +class TLocalHelper { +public: + static NKikimrTxColumnShard::TLogicalMetadata GetMetaProto(); +}; + +}; \ No newline at end of file diff --git a/ydb/core/tx/columnshard/engines/ut_insert_table.cpp b/ydb/core/tx/columnshard/engines/ut/ut_insert_table.cpp similarity index 89% rename from ydb/core/tx/columnshard/engines/ut_insert_table.cpp rename to ydb/core/tx/columnshard/engines/ut/ut_insert_table.cpp index e54f8248f3d6..9e2dad244ac6 100644 --- a/ydb/core/tx/columnshard/engines/ut_insert_table.cpp +++ b/ydb/core/tx/columnshard/engines/ut/ut_insert_table.cpp @@ -1,5 +1,6 @@ -#include "db_wrapper.h" -#include "insert_table/insert_table.h" +#include "helper.h" +#include +#include #include @@ -9,6 +10,7 @@ namespace NKikimr { using namespace NOlap; +using namespace NKikimr::NOlap::NEngines::NTest; namespace { @@ -40,7 +42,6 @@ class TTestInsertTableDB: public IDbWrapper { } - Y_UNIT_TEST_SUITE(TColumnEngineTestInsertTable) { Y_UNIT_TEST(TestInsertCommit) { ui64 writeId = 0; @@ -53,16 +54,16 @@ Y_UNIT_TEST_SUITE(TColumnEngineTestInsertTable) { ui64 indexSnapshot = 0; // insert, not commited - bool ok = insertTable.Insert(dbTable, TInsertedData(writeId, tableId, dedupId, blobId1, {}, indexSnapshot, {})); + bool ok = insertTable.Insert(dbTable, TInsertedData(writeId, tableId, dedupId, blobId1, TLocalHelper::GetMetaProto(), indexSnapshot, {})); UNIT_ASSERT(ok); // insert the same blobId1 again - ok = insertTable.Insert(dbTable, TInsertedData(writeId, tableId, dedupId, blobId1, {}, indexSnapshot, {})); + ok = insertTable.Insert(dbTable, TInsertedData(writeId, tableId, dedupId, blobId1, TLocalHelper::GetMetaProto(), indexSnapshot, {})); UNIT_ASSERT(!ok); // insert different blodId with the same writeId and dedupId TUnifiedBlobId blobId2(2222, 1, 2, 100, 1); - ok = insertTable.Insert(dbTable, TInsertedData(writeId, tableId, dedupId, blobId2, {}, indexSnapshot, {})); + ok = insertTable.Insert(dbTable, TInsertedData(writeId, tableId, dedupId, blobId2, TLocalHelper::GetMetaProto(), indexSnapshot, {})); UNIT_ASSERT(!ok); // read nothing diff --git a/ydb/core/tx/columnshard/engines/ut_logs_engine.cpp b/ydb/core/tx/columnshard/engines/ut/ut_logs_engine.cpp similarity index 98% rename from ydb/core/tx/columnshard/engines/ut_logs_engine.cpp rename to ydb/core/tx/columnshard/engines/ut/ut_logs_engine.cpp index 75b483aa5b03..a5c07fcc014c 100644 --- a/ydb/core/tx/columnshard/engines/ut_logs_engine.cpp +++ b/ydb/core/tx/columnshard/engines/ut/ut_logs_engine.cpp @@ -1,7 +1,8 @@ +#include "helper.h" #include -#include "column_engine_logs.h" -#include "predicate/predicate.h" -#include "changes/cleanup.h" +#include +#include +#include #include #include @@ -16,6 +17,7 @@ namespace NTypeIds = NScheme::NTypeIds; using TTypeId = NScheme::TTypeId; using TTypeInfo = NScheme::TTypeInfo; using TDefaultTestsController = NKikimr::NYDBTest::NColumnShard::TController; +using namespace NKikimr::NOlap::NEngines::NTest; namespace { @@ -411,8 +413,8 @@ Y_UNIT_TEST_SUITE(TColumnEngineTestLogs) { engine.Load(db); std::vector dataToIndex = { - TInsertedData(2, paths[0], "", blobRanges[0].BlobId, {}, 0, {}), - TInsertedData(1, paths[0], "", blobRanges[1].BlobId, {}, 0, {}) + TInsertedData(2, paths[0], "", blobRanges[0].BlobId, TLocalHelper::GetMetaProto(), 0, {}), + TInsertedData(1, paths[0], "", blobRanges[1].BlobId, TLocalHelper::GetMetaProto(), 0, {}) }; // write @@ -507,7 +509,7 @@ Y_UNIT_TEST_SUITE(TColumnEngineTestLogs) { // PlanStep, TxId, PathId, DedupId, BlobId, Data, [Metadata] std::vector dataToIndex; dataToIndex.push_back( - TInsertedData(txId, pathId, "", blobRange.BlobId, {}, 0, {})); + TInsertedData(txId, pathId, "", blobRange.BlobId, TLocalHelper::GetMetaProto(), 0, {})); bool ok = Insert(engine, db, TSnapshot(planStep, txId), std::move(dataToIndex), blobs, step); UNIT_ASSERT(ok); @@ -605,7 +607,7 @@ Y_UNIT_TEST_SUITE(TColumnEngineTestLogs) { // PlanStep, TxId, PathId, DedupId, BlobId, Data, [Metadata] std::vector dataToIndex; dataToIndex.push_back( - TInsertedData(txId, pathId, "", blobRange.BlobId, {}, 0, {})); + TInsertedData(txId, pathId, "", blobRange.BlobId, TLocalHelper::GetMetaProto(), 0, {})); bool ok = Insert(engine, db, TSnapshot(planStep, txId), std::move(dataToIndex), blobs, step); for (auto&& i : blobs) { @@ -639,7 +641,7 @@ Y_UNIT_TEST_SUITE(TColumnEngineTestLogs) { // PlanStep, TxId, PathId, DedupId, BlobId, Data, [Metadata] std::vector dataToIndex; dataToIndex.push_back( - TInsertedData(txId, pathId, "", blobRange.BlobId, {}, 0, {})); + TInsertedData(txId, pathId, "", blobRange.BlobId, TLocalHelper::GetMetaProto(), 0, {})); bool ok = Insert(engine, db, TSnapshot(planStep, txId), std::move(dataToIndex), blobs, step); UNIT_ASSERT(ok); @@ -680,7 +682,7 @@ Y_UNIT_TEST_SUITE(TColumnEngineTestLogs) { // PlanStep, TxId, PathId, DedupId, BlobId, Data, [Metadata] std::vector dataToIndex; dataToIndex.push_back( - TInsertedData(txId, pathId, "", blobRange.BlobId, {}, 0, {})); + TInsertedData(txId, pathId, "", blobRange.BlobId, TLocalHelper::GetMetaProto(), 0, {})); bool ok = Insert(engine, db, TSnapshot(planStep, txId), std::move(dataToIndex), blobs, step); UNIT_ASSERT(ok); diff --git a/ydb/core/tx/columnshard/engines/ut_program.cpp b/ydb/core/tx/columnshard/engines/ut/ut_program.cpp similarity index 99% rename from ydb/core/tx/columnshard/engines/ut_program.cpp rename to ydb/core/tx/columnshard/engines/ut/ut_program.cpp index 884c5739b5c1..4cfe3282267a 100644 --- a/ydb/core/tx/columnshard/engines/ut_program.cpp +++ b/ydb/core/tx/columnshard/engines/ut/ut_program.cpp @@ -1,4 +1,4 @@ -#include "index_info.h" +#include #include #include diff --git a/ydb/core/tx/columnshard/engines/ut/ya.make b/ydb/core/tx/columnshard/engines/ut/ya.make index 13fc351c5a56..fc8159e31764 100644 --- a/ydb/core/tx/columnshard/engines/ut/ya.make +++ b/ydb/core/tx/columnshard/engines/ut/ya.make @@ -35,6 +35,7 @@ SRCS( ut_insert_table.cpp ut_logs_engine.cpp ut_program.cpp + helper.cpp ydb/core/tx/columnshard/columnshard_ut_common.cpp )