@@ -312,7 +312,7 @@ void TPartition::AnswerCurrentWrites(const TActorContext& ctx) {
312312 " , Offset: " << offset << " is " << (already ? " already written" : " stored on disk" )
313313 );
314314
315- if (PartitionWriteQuotaWaitCounter) {
315+ if (PartitionWriteQuotaWaitCounter && !writeResponse. Internal ) {
316316 PartitionWriteQuotaWaitCounter->IncFor (PartitionQuotaWaitTimeForCurrentBlob.MilliSeconds ());
317317 }
318318 if (!already && partNo + 1 == totalParts && !writeResponse.Msg .HeartbeatVersion )
@@ -524,15 +524,20 @@ void TPartition::HandleWriteResponse(const TActorContext& ctx) {
524524 " TPartition::HandleWriteResponse writeNewSize# " << WriteNewSize;
525525 );
526526
527+ if (SupportivePartitionTimeLag) {
528+ SupportivePartitionTimeLag->UpdateTimestamp (now.MilliSeconds ());
529+ }
527530 if (SplitMergeEnabled (Config)) {
528- SplitMergeAvgWriteBytes->Update (WriteNewSize , now);
531+ SplitMergeAvgWriteBytes->Update (WriteNewSizeFull , now);
529532 auto needScaling = CheckScaleStatus (ctx);
530533 ChangeScaleStatusIfNeeded (needScaling);
531534 }
532535 WriteCycleSize = 0 ;
533536 WriteNewSize = 0 ;
537+ WriteNewSizeFull = 0 ;
534538 WriteNewSizeInternal = 0 ;
535539 WriteNewSizeUncompressed = 0 ;
540+ WriteNewSizeUncompressedFull = 0 ;
536541 WriteNewMessages = 0 ;
537542 WriteNewMessagesInternal = 0 ;
538543 UpdateWriteBufferIsFullState (now);
@@ -1044,14 +1049,17 @@ bool TPartition::ExecRequest(TWriteMsg& p, ProcessParameters& parameters, TEvKey
10441049 << " . Writing seqNo: " << sourceId.UpdatedSeqNo ()
10451050 << " . EndOffset: " << EndOffset << " . CurOffset: " << curOffset << " . Offset: " << poffset
10461051 );
1047-
1048- TabletCounters.Cumulative ()[COUNTER_PQ_WRITE_ALREADY].Increment (1 );
1049- MsgsDiscarded.Inc ();
1050- TabletCounters.Cumulative ()[COUNTER_PQ_WRITE_BYTES_ALREADY].Increment (p.Msg .Data .size ());
1051- BytesDiscarded.Inc (p.Msg .Data .size ());
1052+ if (!p.Internal ) {
1053+ TabletCounters.Cumulative ()[COUNTER_PQ_WRITE_ALREADY].Increment (1 );
1054+ MsgsDiscarded.Inc ();
1055+ TabletCounters.Cumulative ()[COUNTER_PQ_WRITE_BYTES_ALREADY].Increment (p.Msg .Data .size ());
1056+ BytesDiscarded.Inc (p.Msg .Data .size ());
1057+ }
10521058 } else {
1053- TabletCounters.Cumulative ()[COUNTER_PQ_WRITE_SMALL_OFFSET].Increment (1 );
1054- TabletCounters.Cumulative ()[COUNTER_PQ_WRITE_BYTES_SMALL_OFFSET].Increment (p.Msg .Data .size ());
1059+ if (!p.Internal ) {
1060+ TabletCounters.Cumulative ()[COUNTER_PQ_WRITE_SMALL_OFFSET].Increment (1 );
1061+ TabletCounters.Cumulative ()[COUNTER_PQ_WRITE_BYTES_SMALL_OFFSET].Increment (p.Msg .Data .size ());
1062+ }
10551063 }
10561064
10571065 TString ().swap (p.Msg .Data );
@@ -1153,14 +1161,17 @@ bool TPartition::ExecRequest(TWriteMsg& p, ProcessParameters& parameters, TEvKey
11531161 ctx.Send (Tablet, new TEvents::TEvPoisonPill ());
11541162 return false ;
11551163 }
1156-
1157- WriteNewSize += p.Msg .SourceId .size () + p.Msg .Data .size ();
1158- WriteNewSizeInternal += p.Msg .External ? 0 : (p.Msg .SourceId .size () + p.Msg .Data .size ());
1159- WriteNewSizeUncompressed += p.Msg .UncompressedSize + p.Msg .SourceId .size ();
1160- if (p.Msg .PartNo == 0 ) {
1161- ++WriteNewMessages;
1162- if (!p.Msg .External )
1163- ++WriteNewMessagesInternal;
1164+ WriteNewSizeFull += p.Msg .SourceId .size () + p.Msg .Data .size ();
1165+ WriteNewSizeUncompressedFull += p.Msg .UncompressedSize + p.Msg .SourceId .size ();
1166+ if (!p.Internal ) {
1167+ WriteNewSize += p.Msg .SourceId .size () + p.Msg .Data .size ();
1168+ WriteNewSizeUncompressed += p.Msg .UncompressedSize + p.Msg .SourceId .size ();
1169+ WriteNewSizeInternal += p.Msg .External ? 0 : (p.Msg .SourceId .size () + p.Msg .Data .size ());
1170+ }
1171+ if (p.Msg .PartNo == 0 && !p.Internal ) {
1172+ ++WriteNewMessages;
1173+ if (!p.Msg .External )
1174+ ++WriteNewMessagesInternal;
11641175 }
11651176
11661177 TMaybe<TPartData> partData;
@@ -1176,13 +1187,14 @@ bool TPartition::ExecRequest(TWriteMsg& p, ProcessParameters& parameters, TEvKey
11761187 const ui64 writeLagMs =
11771188 (WriteTimestamp - TInstant::MilliSeconds (p.Msg .CreateTimestamp )).MilliSeconds ();
11781189 WriteLagMs.Update (writeLagMs, WriteTimestamp);
1179- if (InputTimeLag) {
1190+ if (InputTimeLag && !p. Internal ) {
11801191 InputTimeLag->IncFor (writeLagMs, 1 );
1181- if (p.Msg .PartNo == 0 ) {
1182- MessageSize.IncFor (p.Msg .TotalSize + p.Msg .SourceId .size (), 1 );
1183- }
1192+ } else if (SupportivePartitionTimeLag) {
1193+ SupportivePartitionTimeLag->Insert (writeLagMs, 1 );
1194+ }
1195+ if (p.Msg .PartNo == 0 && !p.Internal ) {
1196+ MessageSize.IncFor (p.Msg .TotalSize + p.Msg .SourceId .size (), 1 );
11841197 }
1185-
11861198 bool lastBlobPart = blob.IsLastPart ();
11871199
11881200 // will return compacted tmp blob
@@ -1616,6 +1628,7 @@ void TPartition::BeginAppendHeadWithNewWrites(const TActorContext& ctx)
16161628 WriteCycleSize = 0 ;
16171629 WriteNewSize = 0 ;
16181630 WriteNewSizeUncompressed = 0 ;
1631+ WriteNewSizeUncompressed = 0 ;
16191632 WriteNewMessages = 0 ;
16201633 UpdateWriteBufferIsFullState (ctx.Now ());
16211634 CurrentTimestamp = ctx.Now ();
0 commit comments