@@ -128,10 +128,16 @@ TCompletionChunkReadPart::TCompletionChunkReadPart(TPDisk *pDisk, TIntrusivePtr<
128
128
, PayloadReadSize(payloadReadSize)
129
129
, CommonBufferOffset(commonBufferOffset)
130
130
, CumulativeCompletion(cumulativeCompletion)
131
+ , ChunkNonce(CumulativeCompletion->GetChunkNonce ())
131
132
, Buffer(PDisk->BufferPool->Pop ())
132
133
, IsTheLastPart(isTheLastPart)
133
134
, Span(std::move(span))
134
135
{
136
+ TCompletionAction::CanBeExecutedInAdditionalCompletionThread = true ;
137
+
138
+ TBufferWithGaps *commonBuffer = CumulativeCompletion->GetCommonBuffer ();
139
+ Destination = commonBuffer->RawDataPtr (CommonBufferOffset, PayloadReadSize);
140
+
135
141
if (!IsTheLastPart) {
136
142
CumulativeCompletion->AddPart ();
137
143
}
@@ -166,8 +172,6 @@ void TCompletionChunkReadPart::Exec(TActorSystem *actorSystem) {
166
172
Read->Offset + CommonBufferOffset, PayloadReadSize, firstSector, lastSector, sectorOffset);
167
173
Y_ABORT_UNLESS (isOk);
168
174
169
- TBufferWithGaps *commonBuffer = CumulativeCompletion->GetCommonBuffer ();
170
- ui8 *destination = commonBuffer->RawDataPtr (CommonBufferOffset, PayloadReadSize);
171
175
172
176
ui8* source = Buffer->Data ();
173
177
@@ -183,8 +187,6 @@ void TCompletionChunkReadPart::Exec(TActorSystem *actorSystem) {
183
187
sectorOffset = 0 ;
184
188
}
185
189
186
- ui64 chunkNonce = CumulativeCompletion->GetChunkNonce ();
187
-
188
190
ui32 beginBadUserOffset = 0xffffffff ;
189
191
ui32 endBadUserOffset = 0xffffffff ;
190
192
ui32 userSectorSize = format.SectorPayloadSize ();
@@ -193,7 +195,7 @@ void TCompletionChunkReadPart::Exec(TActorSystem *actorSystem) {
193
195
194
196
TSectorRestorator restorator (false , 1 , false ,
195
197
format, PDisk->PCtx .get (), &PDisk->Mon , PDisk->BufferPool .Get ());
196
- ui64 lastNonce = Min ((ui64)0 , chunkNonce - 1 );
198
+ ui64 lastNonce = Min ((ui64)0 , ChunkNonce - 1 );
197
199
restorator.Restore (source, format.Offset (Read->ChunkIdx , sectorIdx), format.MagicDataChunk , lastNonce,
198
200
Read->Owner );
199
201
@@ -211,7 +213,7 @@ void TCompletionChunkReadPart::Exec(TActorSystem *actorSystem) {
211
213
<< " for owner# " << Read->Owner
212
214
<< " beginBadUserOffet# " << beginBadUserOffset << " endBadUserOffset# " << endBadUserOffset
213
215
<< " due to multiple sectors with incorrect hashes. Marker# BPC001" );
214
- commonBuffer ->AddGap (beginBadUserOffset, endBadUserOffset);
216
+ CumulativeCompletion ->AddGap (beginBadUserOffset, endBadUserOffset);
215
217
beginBadUserOffset = 0xffffffff ;
216
218
endBadUserOffset = 0xffffffff ;
217
219
}
@@ -221,35 +223,35 @@ void TCompletionChunkReadPart::Exec(TActorSystem *actorSystem) {
221
223
222
224
// Decrypt data
223
225
if (beginBadUserOffset != 0xffffffff ) {
224
- memset (destination , 0 , sectorPayloadSize);
226
+ memset (Destination , 0 , sectorPayloadSize);
225
227
} else {
226
228
TDataSectorFooter *footer = (TDataSectorFooter*) (source + format.SectorSize - sizeof (TDataSectorFooter));
227
- if (footer->Nonce != chunkNonce + sectorIdx) {
229
+ if (footer->Nonce != ChunkNonce + sectorIdx) {
228
230
ui32 userOffset = sectorIdx * userSectorSize;
229
231
LOG_INFO_S (*actorSystem, NKikimrServices::BS_PDISK, " PDiskId# " << PDisk->PCtx ->PDiskId
230
232
<< " ReqId# " << Read->ReqId
231
233
<< " Can't read chunk chunkIdx# " << Read->ChunkIdx
232
234
<< " for owner# " << Read->Owner
233
- << " nonce mismatch: expected# " << (ui64)(chunkNonce + sectorIdx)
235
+ << " nonce mismatch: expected# " << (ui64)(ChunkNonce + sectorIdx)
234
236
<< " , on-disk# " << (ui64)footer->Nonce
235
237
<< " for userOffset# " << userOffset
236
238
<< " ! Marker# BPC002" );
237
239
if (beginBadUserOffset == 0xffffffff ) {
238
240
beginBadUserOffset = userOffset;
239
241
}
240
242
endBadUserOffset = beginUserOffset + userSectorSize;
241
- memset (destination , 0 , sectorPayloadSize);
243
+ memset (Destination , 0 , sectorPayloadSize);
242
244
} else {
243
245
cypher.StartMessage (footer->Nonce );
244
- if (sectorOffset > 0 || intptr_t (destination ) % 32 ) {
246
+ if (sectorOffset > 0 || intptr_t (Destination ) % 32 ) {
245
247
cypher.InplaceEncrypt (source, sectorOffset + sectorPayloadSize);
246
248
if (CommonBufferOffset == 0 || !IsTheLastPart) {
247
- memcpy (destination , source + sectorOffset, sectorPayloadSize);
249
+ memcpy (Destination , source + sectorOffset, sectorPayloadSize);
248
250
} else {
249
- memcpy (destination , source, sectorPayloadSize);
251
+ memcpy (Destination , source, sectorPayloadSize);
250
252
}
251
253
} else {
252
- cypher.Encrypt (destination , source, sectorPayloadSize);
254
+ cypher.Encrypt (Destination , source, sectorPayloadSize);
253
255
}
254
256
if (CanarySize > 0 ) {
255
257
ui32 canaryPosition = sectorOffset + sectorPayloadSize;
@@ -259,7 +261,7 @@ void TCompletionChunkReadPart::Exec(TActorSystem *actorSystem) {
259
261
}
260
262
}
261
263
}
262
- destination += sectorPayloadSize;
264
+ Destination += sectorPayloadSize;
263
265
source += format.SectorSize ;
264
266
PayloadReadSize -= sectorPayloadSize;
265
267
sectorPayloadSize = Min (format.SectorPayloadSize (), PayloadReadSize);
@@ -273,7 +275,7 @@ void TCompletionChunkReadPart::Exec(TActorSystem *actorSystem) {
273
275
<< " for owner# " << Read->Owner
274
276
<< " beginBadUserOffet# " << beginBadUserOffset << " endBadUserOffset# " << endBadUserOffset
275
277
<< " due to multiple sectors with incorrect hashes/nonces. Marker# BPC003" );
276
- commonBuffer ->AddGap (beginBadUserOffset, endBadUserOffset);
278
+ CumulativeCompletion ->AddGap (beginBadUserOffset, endBadUserOffset);
277
279
beginBadUserOffset = 0xffffffff ;
278
280
endBadUserOffset = 0xffffffff ;
279
281
}
@@ -407,4 +409,3 @@ void TChunkTrimCompletion::Exec(TActorSystem *actorSystem) {
407
409
408
410
} // NPDisk
409
411
} // NKikimr
410
-
0 commit comments