1
1
#include " interconnect_channel.h"
2
+ #include " interconnect_zc_processor.h"
2
3
3
4
#include < ydb/library/actors/core/events.h>
4
5
#include < ydb/library/actors/core/executor_thread.h>
@@ -56,10 +57,10 @@ namespace NActors {
56
57
return true ;
57
58
}
58
59
59
- void TEventOutputChannel::DropConfirmed (ui64 confirm) {
60
+ void TEventOutputChannel::DropConfirmed (ui64 confirm, TEventHolderPool& pool ) {
60
61
LOG_DEBUG_IC_SESSION (" ICOCH98" , " Dropping confirmed messages" );
61
62
for (auto it = NotYetConfirmed.begin (); it != NotYetConfirmed.end () && it->Serial <= confirm; ) {
62
- Pool .Release (NotYetConfirmed, it++);
63
+ pool .Release (NotYetConfirmed, it++);
63
64
}
64
65
}
65
66
@@ -185,7 +186,7 @@ namespace NActors {
185
186
if (allowCopy && (reinterpret_cast <uintptr_t >(data) & 63 ) + len <= 64 ) {
186
187
task.Write <External>(data, len);
187
188
} else {
188
- task.Append <External>(data, len);
189
+ task.Append <External>(data, len, &event. ZcTransferId );
189
190
}
190
191
*bytesSerialized += len;
191
192
Y_DEBUG_ABORT_UNLESS (len <= PartLenRemain);
@@ -314,17 +315,19 @@ namespace NActors {
314
315
};
315
316
char *ptr = reinterpret_cast <char *>(part + 1 );
316
317
*ptr++ = static_cast <ui8>(EXdcCommand::PUSH_DATA);
317
- *reinterpret_cast <ui16*>(ptr) = bytesSerialized;
318
+
319
+ WriteUnaligned<ui16>(ptr, bytesSerialized);
318
320
ptr += sizeof (ui16);
319
321
if (task.ChecksummingXxhash ()) {
320
322
XXH3_state_t state;
321
323
XXH3_64bits_reset (&state);
322
324
task.XdcStream .ScanLastBytes (bytesSerialized, [&state](TContiguousSpan span) {
323
325
XXH3_64bits_update (&state, span.data (), span.size ());
324
326
});
325
- *reinterpret_cast <ui32*>(ptr) = XXH3_64bits_digest (&state);
327
+ const ui32 cs = XXH3_64bits_digest (&state);
328
+ WriteUnaligned<ui32>(ptr, cs);
326
329
} else if (task.ChecksummingCrc32c ()) {
327
- * reinterpret_cast <ui32* >(ptr) = task.ExternalChecksum ;
330
+ WriteUnaligned <ui32>(ptr, task.ExternalChecksum ) ;
328
331
}
329
332
330
333
task.WriteBookmark (std::move (partBookmark), buffer, partSize);
@@ -335,7 +338,7 @@ namespace NActors {
335
338
return complete;
336
339
}
337
340
338
- void TEventOutputChannel::NotifyUndelivered ( ) {
341
+ void TEventOutputChannel::ProcessUndelivered (TEventHolderPool& pool, NInterconnect::IZcGuard* zg ) {
339
342
LOG_DEBUG_IC_SESSION (" ICOCH89" , " Notyfying about Undelivered messages! NotYetConfirmed size: %zu, Queue size: %zu" , NotYetConfirmed.size (), Queue.size ());
340
343
if (State == EState::BODY && Queue.front ().Event ) {
341
344
Y_ABORT_UNLESS (!Chunker.IsComplete ()); // chunk must have an event being serialized
@@ -350,11 +353,17 @@ namespace NActors {
350
353
item.ForwardOnNondelivery (true );
351
354
}
352
355
}
353
- Pool.Release (NotYetConfirmed);
356
+
357
+ // Events in the NotYetConfirmed may be actualy not sended by kernel.
358
+ // In case of enabled ZC we need to wait kernel send task to be completed before reusing buffers
359
+ if (zg) {
360
+ zg->ExtractToSafeTermination (NotYetConfirmed);
361
+ }
362
+ pool.Release (NotYetConfirmed);
354
363
for (auto & item : Queue) {
355
364
item.ForwardOnNondelivery (false );
356
365
}
357
- Pool .Release (Queue);
366
+ pool .Release (Queue);
358
367
}
359
368
360
369
}
0 commit comments