@@ -1608,7 +1608,14 @@ struct TTxShardReply: public TSchemeShard::TIndexBuilder::TTxReply {
1608
1608
}
1609
1609
1610
1610
if (buildInfo.State != TIndexBuildInfo::EState::Filling) {
1611
- LOG_I (" TTxReply : " << TypeName<TEvResponse>() << " superfluous event, id# " << BuildId);
1611
+ LOG_N (" TTxReply : " << TypeName<TEvResponse>() << " superfluous state event, id# " << BuildId
1612
+ << " , TIndexBuildInfo: " << buildInfo);
1613
+ return true ;
1614
+ }
1615
+
1616
+ if (!buildInfo.InProgressShards .contains (shardIdx)) {
1617
+ LOG_N (" TTxReply : " << TypeName<TEvResponse>() << " superfluous shard event, id# " << BuildId
1618
+ << " , TIndexBuildInfo: " << buildInfo);
1612
1619
return true ;
1613
1620
}
1614
1621
@@ -1637,41 +1644,50 @@ struct TTxShardReply: public TSchemeShard::TIndexBuilder::TTxReply {
1637
1644
shardStatus.Status = record.GetStatus ();
1638
1645
1639
1646
switch (shardStatus.Status ) {
1640
- case NKikimrIndexBuilder::EBuildStatus::INVALID:
1647
+ case NKikimrIndexBuilder::EBuildStatus::INVALID:
1641
1648
Y_ENSURE (false , " Unreachable" );
1642
- case NKikimrIndexBuilder::EBuildStatus::ACCEPTED: // TODO: do we need ACCEPTED?
1643
- case NKikimrIndexBuilder::EBuildStatus::IN_PROGRESS:
1649
+ case NKikimrIndexBuilder::EBuildStatus::ACCEPTED: // TODO: do we need ACCEPTED?
1650
+ case NKikimrIndexBuilder::EBuildStatus::IN_PROGRESS: {
1644
1651
HandleProgress (shardStatus, buildInfo);
1645
1652
Self->PersistBuildIndexUploadProgress (db, BuildId, shardIdx, shardStatus);
1653
+ // no progress
1654
+ // no pipe close
1646
1655
return true ;
1647
- case NKikimrIndexBuilder::EBuildStatus::DONE:
1648
- if (buildInfo.InProgressShards .erase (shardIdx)) {
1649
- HandleDone (db, buildInfo);
1650
- buildInfo.DoneShards .emplace_back (shardIdx);
1651
- }
1652
- break ;
1653
- case NKikimrIndexBuilder::EBuildStatus::ABORTED:
1656
+ }
1657
+ case NKikimrIndexBuilder::EBuildStatus::DONE: {
1658
+ bool erased = buildInfo.InProgressShards .erase (shardIdx);
1659
+ Y_ENSURE (erased);
1660
+ buildInfo.DoneShards .emplace_back (shardIdx);
1661
+ HandleDone (db, buildInfo);
1662
+ Self->PersistBuildIndexUploadProgress (db, BuildId, shardIdx, shardStatus);
1663
+ Self->IndexBuildPipes .Close (BuildId, shardId, ctx);
1664
+ Progress (BuildId);
1665
+ return true ;
1666
+ }
1667
+ case NKikimrIndexBuilder::EBuildStatus::ABORTED: {
1654
1668
// datashard gracefully rebooted, reschedule shard
1655
- if (buildInfo.InProgressShards .erase (shardIdx)) {
1656
- buildInfo.ToUploadShards .emplace_front (shardIdx);
1657
- }
1658
- break ;
1659
- case NKikimrIndexBuilder::EBuildStatus::BUILD_ERROR:
1660
- case NKikimrIndexBuilder::EBuildStatus::BAD_REQUEST:
1669
+ bool erased = buildInfo.InProgressShards .erase (shardIdx);
1670
+ Y_ENSURE (erased);
1671
+ buildInfo.ToUploadShards .emplace_front (shardIdx);
1672
+ Self->PersistBuildIndexUploadProgress (db, BuildId, shardIdx, shardStatus);
1673
+ Self->IndexBuildPipes .Close (BuildId, shardId, ctx);
1674
+ Progress (BuildId);
1675
+ return true ;
1676
+ }
1677
+ case NKikimrIndexBuilder::EBuildStatus::BUILD_ERROR:
1678
+ case NKikimrIndexBuilder::EBuildStatus::BAD_REQUEST: {
1661
1679
Self->PersistBuildIndexAddIssue (db, buildInfo, TStringBuilder ()
1662
1680
<< " One of the shards report " << shardStatus.Status << " " << shardStatus.DebugMessage
1663
1681
<< " at Filling stage, process has to be canceled"
1664
1682
<< " , shardId: " << shardId
1665
1683
<< " , shardIdx: " << shardIdx);
1684
+ Self->PersistBuildIndexUploadProgress (db, BuildId, shardIdx, shardStatus);
1685
+ Self->IndexBuildPipes .Close (BuildId, shardId, ctx);
1666
1686
ChangeState (buildInfo.Id , TIndexBuildInfo::EState::Rejection_Applying);
1667
1687
Progress (BuildId);
1668
1688
return true ;
1669
1689
}
1670
- Self->PersistBuildIndexUploadProgress (db, BuildId, shardIdx, shardStatus);
1671
- Self->IndexBuildPipes .Close (BuildId, shardId, ctx);
1672
- Progress (BuildId);
1673
-
1674
- return true ;
1690
+ }
1675
1691
}
1676
1692
1677
1693
virtual void HandleProgress (TIndexBuildInfo::TShardStatus& shardStatus, TIndexBuildInfo& buildInfo) {
0 commit comments