13
13
namespace NKikimr {
14
14
namespace NSchemeShard {
15
15
16
- void TSchemeShard::TIndexBuilder::TTxBase::ApplyState (NTabletFlatExecutor::TTransactionContext& txc) {
16
+ void TSchemeShard::TIndexBuilder::TTxBase::ApplyState (NTabletFlatExecutor::TTransactionContext& txc, const TActorContext& ctx ) {
17
17
for (auto & rec: StateChanges) {
18
18
TIndexBuildId buildId;
19
19
TIndexBuildInfo::EState state;
@@ -23,6 +23,11 @@ void TSchemeShard::TIndexBuilder::TTxBase::ApplyState(NTabletFlatExecutor::TTran
23
23
Y_VERIFY_S (buildInfoPtr, " IndexBuilds has no " << buildId);
24
24
auto & buildInfo = *buildInfoPtr->Get ();
25
25
LOG_I (" Change state from " << buildInfo.State << " to " << state);
26
+ if (state == TIndexBuildInfo::EState::Rejected ||
27
+ state == TIndexBuildInfo::EState::Cancelled ||
28
+ state == TIndexBuildInfo::EState::Done) {
29
+ buildInfo.EndTime = ctx.Now ();
30
+ }
26
31
buildInfo.State = state;
27
32
28
33
NIceDb::TNiceDb db (txc.DB );
@@ -32,7 +37,7 @@ void TSchemeShard::TIndexBuilder::TTxBase::ApplyState(NTabletFlatExecutor::TTran
32
37
33
38
void TSchemeShard::TIndexBuilder::TTxBase::ApplyOnExecute (NTabletFlatExecutor::TTransactionContext& txc, const TActorContext& ctx) {
34
39
SideEffects.ApplyOnExecute (Self, txc, ctx);
35
- ApplyState (txc);
40
+ ApplyState (txc, ctx );
36
41
ApplyBill (txc, ctx);
37
42
}
38
43
@@ -195,6 +200,15 @@ void TSchemeShard::TIndexBuilder::TTxBase::Fill(NKikimrIndexBuilder::TIndexBuild
195
200
if (indexInfo.Issue ) {
196
201
AddIssue (index .MutableIssues (), indexInfo.Issue );
197
202
}
203
+ if (indexInfo.StartTime != TInstant::Zero ()) {
204
+ *index .MutableStartTime () = SecondsToProtoTimeStamp (indexInfo.StartTime .Seconds ());
205
+ }
206
+ if (indexInfo.EndTime != TInstant::Zero ()) {
207
+ *index .MutableEndTime () = SecondsToProtoTimeStamp (indexInfo.EndTime .Seconds ());
208
+ }
209
+ if (indexInfo.UserSID ) {
210
+ index .SetUserSID (*indexInfo.UserSID );
211
+ }
198
212
199
213
for (const auto & item: indexInfo.Shards ) {
200
214
const TShardIdx& shardIdx = item.first ;
0 commit comments