2
2
#include " columnshard_schema.h"
3
3
4
4
#include < ydb/core/tx/columnshard/operations/write.h>
5
+
5
6
#include < ydb/library/yql/dq/actors/compute/dq_compute_actor.h>
6
7
7
8
namespace NKikimr ::NColumnShard {
8
9
9
- class TColumnShard ::TTxProgressTx : public TTransactionBase<TColumnShard> {
10
+ class TColumnShard ::TTxProgressTx: public TTransactionBase<TColumnShard> {
11
+ private:
12
+ bool AbortedThroughRemoveExpired = false ;
13
+ TTxController::ITransactionOperator::TPtr TxOperator;
14
+ const ui32 TabletTxNo;
15
+ std::optional<NOlap::TSnapshot> LastCompletedTx;
16
+ std::optional<TTxController::TPlanQueueItem> PlannedQueueItem;
17
+
10
18
public:
11
19
TTxProgressTx (TColumnShard* self)
12
20
: TTransactionBase(self)
13
- , TabletTxNo(++Self->TabletTxCounter)
14
- { }
21
+ , TabletTxNo(++Self->TabletTxCounter) {
22
+ }
15
23
16
- TTxType GetTxType () const override { return TXTYPE_PROGRESS; }
24
+ TTxType GetTxType () const override {
25
+ return TXTYPE_PROGRESS;
26
+ }
17
27
18
28
bool Execute (TTransactionContext& txc, const TActorContext& ctx) override {
19
- NActors::TLogContextGuard logGuard = NActors::TLogContextBuilder::Build (NKikimrServices::TX_COLUMNSHARD)(" tablet_id" , Self->TabletID ())(" tx_state" , " execute" );
29
+ NActors::TLogContextGuard logGuard =
30
+ NActors::TLogContextBuilder::Build (NKikimrServices::TX_COLUMNSHARD)(" tablet_id" , Self->TabletID ())(" tx_state" , " execute" );
20
31
Y_ABORT_UNLESS (Self->ProgressTxInFlight );
21
32
Self->Counters .GetTabletCounters ()->SetCounter (COUNTER_TX_COMPLETE_LAG, Self->GetTxCompleteLag ().MilliSeconds ());
22
33
23
34
const size_t removedCount = Self->ProgressTxController ->CleanExpiredTxs (txc);
24
35
if (removedCount > 0 ) {
25
36
// We cannot continue with this transaction, start a new transaction
37
+ AbortedThroughRemoveExpired = true ;
26
38
Self->Execute (new TTxProgressTx (Self), ctx);
27
39
return true ;
28
40
}
@@ -49,7 +61,11 @@ class TColumnShard::TTxProgressTx : public TTransactionBase<TColumnShard> {
49
61
}
50
62
51
63
void Complete (const TActorContext& ctx) override {
52
- NActors::TLogContextGuard logGuard = NActors::TLogContextBuilder::Build (NKikimrServices::TX_COLUMNSHARD)(" tablet_id" , Self->TabletID ())(" tx_state" , " complete" );
64
+ if (AbortedThroughRemoveExpired) {
65
+ return ;
66
+ }
67
+ NActors::TLogContextGuard logGuard =
68
+ NActors::TLogContextBuilder::Build (NKikimrServices::TX_COLUMNSHARD)(" tablet_id" , Self->TabletID ())(" tx_state" , " complete" );
53
69
if (TxOperator) {
54
70
TxOperator->ProgressOnComplete (*Self, ctx);
55
71
Self->RescheduleWaitingReads ();
@@ -66,12 +82,6 @@ class TColumnShard::TTxProgressTx : public TTransactionBase<TColumnShard> {
66
82
}
67
83
Self->SetupIndexation ();
68
84
}
69
-
70
- private:
71
- TTxController::ITransactionOperator::TPtr TxOperator;
72
- const ui32 TabletTxNo;
73
- std::optional<NOlap::TSnapshot> LastCompletedTx;
74
- std::optional<TTxController::TPlanQueueItem> PlannedQueueItem;
75
85
};
76
86
77
87
void TColumnShard::EnqueueProgressTx (const TActorContext& ctx) {
@@ -102,4 +112,4 @@ void TColumnShard::Handle(TEvColumnShard::TEvCheckPlannedTransaction::TPtr& ev,
102
112
// For now do not return result for not finished tx. It would be sent in TTxProgressTx::Complete()
103
113
}
104
114
105
- }
115
+ } // namespace NKikimr::NColumnShard
0 commit comments