diff options
author | ilnaz <ilnaz@ydb.tech> | 2022-09-26 19:40:10 +0300 |
---|---|---|
committer | ilnaz <ilnaz@ydb.tech> | 2022-09-26 19:40:10 +0300 |
commit | 7881b02bb3ef2f12d7abc3c8ff505ac451e6190c (patch) | |
tree | 38b6e386f549285c9c2a5778e61688e65aeb638c | |
parent | d4faa398be8fa410481d8bbff90b0984ca537fe5 (diff) | |
download | ydb-7881b02bb3ef2f12d7abc3c8ff505ac451e6190c.tar.gz |
Add test
-rw-r--r-- | ydb/core/tx/datashard/datashard_ut_change_collector.cpp | 30 |
1 files changed, 23 insertions, 7 deletions
diff --git a/ydb/core/tx/datashard/datashard_ut_change_collector.cpp b/ydb/core/tx/datashard/datashard_ut_change_collector.cpp index d087a4a3681..fe40d93d91f 100644 --- a/ydb/core/tx/datashard/datashard_ut_change_collector.cpp +++ b/ydb/core/tx/datashard/datashard_ut_change_collector.cpp @@ -848,15 +848,31 @@ Y_UNIT_TEST_SUITE(CdcStreamChangeCollector) { } Y_UNIT_TEST(PageFaults) { - Run(TinyCacheParams(), "/Root/path", TinyCacheTable(), TVector<TCdcStream>{KeysOnly()}, TVector<TString>{ - "UPSERT INTO `/Root/path` (key, value) VALUES (1, 10);", + constexpr ui32 count = 1000; + TVector<TStructRecord> expectedRecords(Reserve(count + 2)); + auto bigUpsert = TStringBuilder() << "UPSERT INTO `/Root/path` (key, value) VALUES "; + + for (ui32 i = 1; i <= count; ++i) { + expectedRecords.push_back(TStructRecord(NTable::ERowOp::Upsert, {{"key", i}}, {}, {}, {{"value", i}})); + + if (i > 1) { + bigUpsert << ","; + } + + bigUpsert << "(" << i << "," << i << ")"; + } + + bigUpsert << ";"; + expectedRecords.push_back(TStructRecord(NTable::ERowOp::Upsert, {{"key", 1}}, {}, {{"value", 1}}, {{"value", 10}})); + expectedRecords.push_back(TStructRecord(NTable::ERowOp::Upsert, {{"key", 1000}}, {}, {{"value", 1000}}, {{"value", 10000}})); + + Run(TinyCacheParams(), "/Root/path", TinyCacheTable(), TVector<TCdcStream>{NewAndOldImages()}, TVector<TString>{ + bigUpsert, "COMPACT TABLE `/Root/path`;", - "UPDATE `/Root/path` SET value = 20 WHERE key = 1;", + "SELECT * FROM `/Root/path` WHERE key = 1;", + "UPSERT INTO `/Root/path` (key, value) VALUES (1, 10), (1000, 10000);", }, { - {"keys_stream", { - TStructRecord(NTable::ERowOp::Upsert, {{"key", 1}}), - TStructRecord(NTable::ERowOp::Upsert, {{"key", 1}}), - }}, + {"new_and_old_images", expectedRecords}, }); } |