@@ -1446,6 +1446,44 @@ void TPartition::Handle(TEvPQ::TEvGetMaxSeqNoRequest::TPtr& ev, const TActorCont
1446
1446
ctx.Send (Tablet, response.Release ());
1447
1447
}
1448
1448
1449
+ void TPartition::OnReadComplete (TReadInfo& info,
1450
+ TUserInfo* userInfo,
1451
+ const TEvPQ::TEvBlobResponse* blobResponse,
1452
+ const TActorContext& ctx)
1453
+ {
1454
+ TReadAnswer answer = info.FormAnswer (
1455
+ ctx, blobResponse, StartOffset, EndOffset, Partition, userInfo,
1456
+ info.Destination , GetSizeLag (info.Offset ), Tablet, Config.GetMeteringMode (), IsActive ()
1457
+ );
1458
+ const auto & resp = dynamic_cast <TEvPQ::TEvProxyResponse*>(answer.Event .Get ())->Response ;
1459
+
1460
+ if (blobResponse && HasError (*blobResponse)) {
1461
+ if (info.IsSubscription ) {
1462
+ TabletCounters.Cumulative ()[COUNTER_PQ_READ_SUBSCRIPTION_ERROR].Increment (1 );
1463
+ }
1464
+ TabletCounters.Cumulative ()[COUNTER_PQ_READ_ERROR].Increment (1 );
1465
+ TabletCounters.Percentile ()[COUNTER_LATENCY_PQ_READ_ERROR].IncrementFor ((ctx.Now () - info.Timestamp ).MilliSeconds ());
1466
+ } else {
1467
+ if (info.IsSubscription ) {
1468
+ TabletCounters.Cumulative ()[COUNTER_PQ_READ_SUBSCRIPTION_OK].Increment (1 );
1469
+ }
1470
+
1471
+ if (blobResponse) {
1472
+ TabletCounters.Cumulative ()[COUNTER_PQ_READ_OK].Increment (1 );
1473
+ TabletCounters.Percentile ()[COUNTER_LATENCY_PQ_READ_OK].IncrementFor ((ctx.Now () - info.Timestamp ).MilliSeconds ());
1474
+ } else {
1475
+ TabletCounters.Cumulative ()[COUNTER_PQ_READ_HEAD_ONLY_OK].Increment (1 );
1476
+ TabletCounters.Percentile ()[COUNTER_LATENCY_PQ_READ_HEAD_ONLY].IncrementFor ((ctx.Now () - info.Timestamp ).MilliSeconds ());
1477
+ }
1478
+
1479
+ TabletCounters.Cumulative ()[COUNTER_PQ_READ_BYTES].Increment (resp->ByteSize ());
1480
+ }
1481
+
1482
+ ctx.Send (info.Destination != 0 ? Tablet : ctx.SelfID , answer.Event .Release ());
1483
+
1484
+ OnReadRequestFinished (info.Destination , answer.Size , info.User , ctx);
1485
+ }
1486
+
1449
1487
void TPartition::Handle (TEvPQ::TEvBlobResponse::TPtr& ev, const TActorContext& ctx) {
1450
1488
const ui64 cookie = ev->Get ()->GetCookie ();
1451
1489
auto it = ReadInfo.find (cookie);
@@ -1465,28 +1503,7 @@ void TPartition::Handle(TEvPQ::TEvBlobResponse::TPtr& ev, const TActorContext& c
1465
1503
OnReadRequestFinished (info.Destination , 0 , info.User , ctx);
1466
1504
}
1467
1505
1468
- TReadAnswer answer (info.FormAnswer (
1469
- ctx, *ev->Get (), StartOffset, EndOffset, Partition, userInfo,
1470
- info.Destination , GetSizeLag (info.Offset ), Tablet, Config.GetMeteringMode (), IsActive ()
1471
- ));
1472
- const auto & resp = dynamic_cast <TEvPQ::TEvProxyResponse*>(answer.Event .Get ())->Response ;
1473
-
1474
- if (HasError (*ev->Get ())) {
1475
- if (info.IsSubscription ) {
1476
- TabletCounters.Cumulative ()[COUNTER_PQ_READ_SUBSCRIPTION_ERROR].Increment (1 );
1477
- }
1478
- TabletCounters.Cumulative ()[COUNTER_PQ_READ_ERROR].Increment (1 );
1479
- TabletCounters.Percentile ()[COUNTER_LATENCY_PQ_READ_ERROR].IncrementFor ((ctx.Now () - info.Timestamp ).MilliSeconds ());
1480
- } else {
1481
- if (info.IsSubscription ) {
1482
- TabletCounters.Cumulative ()[COUNTER_PQ_READ_SUBSCRIPTION_OK].Increment (1 );
1483
- }
1484
- TabletCounters.Cumulative ()[COUNTER_PQ_READ_OK].Increment (1 );
1485
- TabletCounters.Percentile ()[COUNTER_LATENCY_PQ_READ_OK].IncrementFor ((ctx.Now () - info.Timestamp ).MilliSeconds ());
1486
- TabletCounters.Cumulative ()[COUNTER_PQ_READ_BYTES].Increment (resp->ByteSize ());
1487
- }
1488
- ctx.Send (info.Destination != 0 ? Tablet : ctx.SelfID , answer.Event .Release ());
1489
- OnReadRequestFinished (info.Destination , answer.Size , info.User , ctx);
1506
+ OnReadComplete (info, userInfo, ev->Get (), ctx);
1490
1507
}
1491
1508
1492
1509
void TPartition::Handle (TEvPQ::TEvError::TPtr& ev, const TActorContext& ctx) {
0 commit comments