@@ -926,6 +926,50 @@ Y_UNIT_TEST_SUITE(TPDiskTest) {
926
926
UNIT_ASSERT_VALUES_EQUAL (writeLog (), NKikimrProto::OK);
927
927
}
928
928
929
+ Y_UNIT_TEST (TestChunkWriteCrossOwner) {
930
+ TActorTestContext testCtx ({ false });
931
+
932
+ TVDiskMock vdisk1 (&testCtx);
933
+ TVDiskMock vdisk2 (&testCtx);
934
+
935
+ vdisk1.InitFull ();
936
+ vdisk2.InitFull ();
937
+
938
+ vdisk1.ReserveChunk ();
939
+ vdisk2.ReserveChunk ();
940
+
941
+ vdisk1.CommitReservedChunks ();
942
+ vdisk2.CommitReservedChunks ();
943
+
944
+ UNIT_ASSERT (vdisk1.Chunks [EChunkState::COMMITTED].size () == 1 );
945
+ UNIT_ASSERT (vdisk2.Chunks [EChunkState::COMMITTED].size () == 1 );
946
+
947
+ auto chunk1 = *vdisk1.Chunks [EChunkState::COMMITTED].begin ();
948
+ auto chunk2 = *vdisk2.Chunks [EChunkState::COMMITTED].begin ();
949
+
950
+ TString data (123 , ' 0' );
951
+ auto parts = MakeIntrusive<NPDisk::TEvChunkWrite::TStrokaBackedUpParts>(data);
952
+
953
+ // write to own chunk is OK
954
+ testCtx.TestResponse <NPDisk::TEvChunkWriteResult>(new NPDisk::TEvChunkWrite (
955
+ vdisk1.PDiskParams ->Owner , vdisk1.PDiskParams ->OwnerRound ,
956
+ chunk1, 0 , parts, nullptr , false , 0 ),
957
+ NKikimrProto::OK);
958
+ testCtx.TestResponse <NPDisk::TEvChunkWriteResult>(new NPDisk::TEvChunkWrite (
959
+ vdisk2.PDiskParams ->Owner , vdisk2.PDiskParams ->OwnerRound ,
960
+ chunk2, 0 , parts, nullptr , false , 0 ),
961
+ NKikimrProto::OK);
962
+
963
+ // write to neighbour's chunk is ERROR
964
+ testCtx.TestResponse <NPDisk::TEvChunkWriteResult>(new NPDisk::TEvChunkWrite (
965
+ vdisk1.PDiskParams ->Owner , vdisk1.PDiskParams ->OwnerRound ,
966
+ chunk2, 0 , parts, nullptr , false , 0 ),
967
+ NKikimrProto::ERROR);
968
+ testCtx.TestResponse <NPDisk::TEvChunkWriteResult>(new NPDisk::TEvChunkWrite (
969
+ vdisk2.PDiskParams ->Owner , vdisk2.PDiskParams ->OwnerRound ,
970
+ chunk1, 0 , parts, nullptr , false , 0 ),
971
+ NKikimrProto::ERROR);
972
+ }
929
973
}
930
974
931
975
Y_UNIT_TEST_SUITE (PDiskCompatibilityInfo) {
@@ -961,7 +1005,7 @@ Y_UNIT_TEST_SUITE(PDiskCompatibilityInfo) {
961
1005
962
1006
void TestMajorVerionMigration (TCurrent oldInfo, TCurrent intermediateInfo, TCurrent newInfo) {
963
1007
TCompatibilityInfoTest::Reset (&oldInfo);
964
-
1008
+
965
1009
TActorTestContext testCtx ({
966
1010
.IsBad = false ,
967
1011
.SuppressCompatibilityCheck = false ,
0 commit comments