diff options
author | snaury <snaury@ydb.tech> | 2023-10-25 18:46:32 +0300 |
---|---|---|
committer | snaury <snaury@ydb.tech> | 2023-10-25 19:18:29 +0300 |
commit | 7d4a06825cb7fdaecd688cd944223b9f0554c51f (patch) | |
tree | 8852a76f4d70d7900919f250be286415478bdbd0 | |
parent | 3e7c82a0c982ed6e9dfda585ac3ec73d5304a253 (diff) | |
download | ydb-7d4a06825cb7fdaecd688cd944223b9f0554c51f.tar.gz |
Fix mem table merge when writing over committed deltas KIKIMR-19837
-rw-r--r-- | ydb/core/tablet_flat/flat_mem_warm.h | 4 | ||||
-rw-r--r-- | ydb/core/tablet_flat/ut/ut_db_iface.cpp | 29 |
2 files changed, 31 insertions, 2 deletions
diff --git a/ydb/core/tablet_flat/flat_mem_warm.h b/ydb/core/tablet_flat/flat_mem_warm.h index 9d6bcb106c..032e22a073 100644 --- a/ydb/core/tablet_flat/flat_mem_warm.h +++ b/ydb/core/tablet_flat/flat_mem_warm.h @@ -299,8 +299,8 @@ namespace NMem { rop = ERowOp::Reset; } - ScratchMergeTagsLast.swap(ScratchMergeTags); - ScratchMergeTagsLast.clear(); + ScratchMergeTags.swap(ScratchMergeTagsLast); + ScratchMergeTags.clear(); auto have = ScratchUpdateTags.begin(); auto haveLast = ScratchMergeTagsLast.begin(); diff --git a/ydb/core/tablet_flat/ut/ut_db_iface.cpp b/ydb/core/tablet_flat/ut/ut_db_iface.cpp index 53b893940b..adbb6d0807 100644 --- a/ydb/core/tablet_flat/ut/ut_db_iface.cpp +++ b/ydb/core/tablet_flat/ut/ut_db_iface.cpp @@ -948,6 +948,35 @@ Y_UNIT_TEST_SUITE(DBase) { me.To(52).Select(table1).HasN(1_u64, 11_u64, 13_u64); } + Y_UNIT_TEST(UncommittedChangesCommitWithUpdates) { + TDbExec me; + + const ui32 table1 = 1; + + me.To(10).Begin(); + me.To(11).Apply(*TAlter() + .AddTable("me_1", table1) + .AddColumn(table1, "key", 1, ETypes::Uint64, false) + .AddColumn(table1, "arg1", 4, ETypes::Uint64, false, Cimple(10004_u64)) + .AddColumn(table1, "arg2", 5, ETypes::Uint64, false, Cimple(10005_u64)) + .AddColumnToKey(table1, 1)); + me.To(12).PutN(table1, 1_u64, 11_u64, 12_u64); + me.To(13).Commit(); + + me.To(20).Begin(); + me.To(21).WriteTx(123).PutN(table1, 1_u64, ECellOp::Empty, 22_u64); + me.To(22).Commit(); + + me.To(30).Begin(); + me.To(31).WriteVer({ 1, 51 }); + me.To(32).CommitTx(table1, 123); + me.To(33).PutN(table1, 1_u64, 21_u64, ECellOp::Empty); + me.To(34).Commit(); + + me.To(41).ReadVer({ 1, 50 }).Select(table1).HasN(1_u64, 11_u64, 12_u64); + me.To(42).ReadVer({ 1, 51 }).Select(table1).HasN(1_u64, 21_u64, 22_u64); + } + Y_UNIT_TEST(ReplayNewTable) { TDbExec me; |