@@ -2398,6 +2398,27 @@ TChangefeedDescription::TChangefeedDescription(const Ydb::Table::ChangefeedDescr
2398
2398
: TChangefeedDescription(FromProto(proto))
2399
2399
{}
2400
2400
2401
+ TChangefeedDescription::TInitialScanProgress::TInitialScanProgress (uint32_t total, uint32_t completed)
2402
+ : PartsTotal(total)
2403
+ , PartsCompleted(completed)
2404
+ {}
2405
+
2406
+ uint32_t TChangefeedDescription::TInitialScanProgress::GetPartsTotal () const {
2407
+ return PartsTotal;
2408
+ }
2409
+
2410
+ uint32_t TChangefeedDescription::TInitialScanProgress::GetPartsCompleted () const {
2411
+ return PartsCompleted;
2412
+ }
2413
+
2414
+ float TChangefeedDescription::TInitialScanProgress::GetProgress () const {
2415
+ if (PartsTotal == 0 ) {
2416
+ return 0 ;
2417
+ }
2418
+
2419
+ return 100 * float (PartsCompleted) / float (PartsTotal);
2420
+ }
2421
+
2401
2422
TChangefeedDescription& TChangefeedDescription::WithVirtualTimestamps () {
2402
2423
VirtualTimestamps_ = true ;
2403
2424
return *this ;
@@ -2474,6 +2495,10 @@ const std::string& TChangefeedDescription::GetAwsRegion() const {
2474
2495
return AwsRegion_;
2475
2496
}
2476
2497
2498
+ const std::optional<TChangefeedDescription::TInitialScanProgress>& TChangefeedDescription::GetInitialScanProgress () const {
2499
+ return InitialScanProgress_;
2500
+ }
2501
+
2477
2502
template <typename TProto>
2478
2503
TChangefeedDescription TChangefeedDescription::FromProto (const TProto& proto) {
2479
2504
EChangefeedMode mode;
@@ -2541,6 +2566,13 @@ TChangefeedDescription TChangefeedDescription::FromProto(const TProto& proto) {
2541
2566
ret.State_ = EChangefeedState::Unknown;
2542
2567
break ;
2543
2568
}
2569
+
2570
+ if (proto.has_initial_scan_progress ()) {
2571
+ ret.InitialScanProgress_ = std::make_optional<TInitialScanProgress>(
2572
+ proto.initial_scan_progress ().parts_total (),
2573
+ proto.initial_scan_progress ().parts_completed ()
2574
+ );
2575
+ }
2544
2576
}
2545
2577
2546
2578
for (const auto & [key, value] : proto.attributes ()) {
@@ -2628,6 +2660,10 @@ void TChangefeedDescription::Out(IOutputStream& o) const {
2628
2660
o << " , aws_region: " << AwsRegion_;
2629
2661
}
2630
2662
2663
+ if (InitialScanProgress_) {
2664
+ o << " , initial_scan_progress: " << InitialScanProgress_->GetProgress () << " %" ;
2665
+ }
2666
+
2631
2667
o << " }" ;
2632
2668
}
2633
2669
0 commit comments