@@ -105,27 +105,52 @@ void TTxBlobsWritingFinished::DoComplete(const TActorContext& ctx) {
105105 AFL_VERIFY (CommitSnapshot);
106106 Self->OperationsManager ->AddTemporaryTxLink (op->GetLockId ());
107107 Self->OperationsManager ->CommitTransactionOnComplete (*Self, op->GetLockId (), *CommitSnapshot);
108+ Self->Counters .GetTabletCounters ()->IncCounter (COUNTER_IMMEDIATE_TX_COMPLETED);
108109 }
109110 Self->Counters .GetCSCounters ().OnWriteTxComplete (now - writeMeta.GetWriteStartInstant ());
110111 Self->Counters .GetCSCounters ().OnSuccessWriteResponse ();
111112 }
112113 Self->SetupCompaction (pathIds);
113- Self->Counters .GetTabletCounters ()->IncCounter (COUNTER_IMMEDIATE_TX_COMPLETED);
114114}
115115
116116TTxBlobsWritingFinished::TTxBlobsWritingFinished (TColumnShard* self, const NKikimrProto::EReplyStatus writeStatus,
117117 const std::shared_ptr<NOlap::IBlobsWritingAction>& writingActions, std::vector<TInsertedPortions>&& packs,
118- const std::vector<TFailedWrite >& fails )
118+ const std::vector<TNoDataWrite >& noDataWrites )
119119 : TBase(self, " TTxBlobsWritingFinished" )
120- , PutBlobResult(writeStatus)
121120 , Packs(std::move(packs))
122121 , WritingActions(writingActions) {
123- Y_UNUSED (PutBlobResult);
124- for (auto && i : fails) {
122+ for (auto && i : noDataWrites) {
125123 auto ev = NEvents::TDataEvents::TEvWriteResult::BuildCompleted (Self->TabletID ());
126124 auto op = Self->GetOperationsManager ().GetOperationVerified ((TOperationWriteId)i.GetWriteMeta ().GetWriteId ());
127125 Results.emplace_back (std::move (ev), i.GetWriteMeta ().GetSource (), op->GetCookie ());
128126 }
129127}
130128
129+ bool TTxBlobsWritingFailed::DoExecute (TTransactionContext& txc, const TActorContext& ctx) {
130+ for (auto && pack : Packs) {
131+ const auto & writeMeta = pack.GetWriteMeta ();
132+ AFL_VERIFY (!writeMeta.HasLongTxId ());
133+ auto op = Self->GetOperationsManager ().GetOperationVerified ((TOperationWriteId)writeMeta.GetWriteId ());
134+ Self->OperationsManager ->AddTemporaryTxLink (op->GetLockId ());
135+ Self->OperationsManager ->AbortTransactionOnExecute (*Self, op->GetLockId (), txc);
136+
137+ auto ev = NEvents::TDataEvents::TEvWriteResult::BuildError (Self->TabletID (), op->GetLockId (),
138+ NKikimrDataEvents::TEvWriteResult::STATUS_INTERNAL_ERROR, " cannot write blob: " + ::ToString (PutBlobResult));
139+ Results.emplace_back (std::move (ev), writeMeta.GetSource (), op->GetCookie ());
140+ }
141+ return true ;
142+ }
143+
144+ void TTxBlobsWritingFailed::DoComplete (const TActorContext& ctx) {
145+ for (auto && i : Results) {
146+ i.DoSendReply (ctx);
147+ Self->Counters .GetCSCounters ().OnFailedWriteResponse (EWriteFailReason::PutBlob);
148+ }
149+ for (auto && pack : Packs) {
150+ const auto & writeMeta = pack.GetWriteMeta ();
151+ auto op = Self->GetOperationsManager ().GetOperationVerified ((TOperationWriteId)writeMeta.GetWriteId ());
152+ Self->OperationsManager ->AbortTransactionOnComplete (*Self, op->GetLockId ());
153+ }
154+ }
155+
131156} // namespace NKikimr::NColumnShard
0 commit comments