9
9
#include < ydb/core/formats/arrow/converter.h>
10
10
#include < ydb/core/io_formats/arrow/csv_arrow.h>
11
11
#include < ydb/core/base/tablet_pipecache.h>
12
- #include < ydb/library/ydb_issue/issue_helpers.h>
13
12
#include < ydb/core/base/path.h>
14
13
#include < ydb/core/base/feature_flags.h>
15
14
#include < ydb/core/scheme/scheme_tablecell.h>
29
28
#undef INCLUDE_YDB_INTERNAL_H
30
29
31
30
#include < ydb/library/actors/core/actor_bootstrapped.h>
31
+ #include < ydb/library/wilson_ids/wilson.h>
32
+ #include < ydb/library/ydb_issue/issue_helpers.h>
32
33
33
34
#include < util/string/join.h>
34
35
#include < util/string/vector.h>
@@ -208,18 +209,21 @@ class TUploadRowsBase : public TActorBootstrapped<TUploadRowsBase<DerivedActivit
208
209
std::shared_ptr<arrow::RecordBatch> Batch;
209
210
float RuCost = 0.0 ;
210
211
212
+ NWilson::TSpan Span;
213
+
211
214
public:
212
215
static constexpr NKikimrServices::TActivity::EType ActorActivityType () {
213
216
return DerivedActivityType;
214
217
}
215
218
216
- explicit TUploadRowsBase (TDuration timeout = TDuration::Max(), bool diskQuotaExceeded = false)
219
+ explicit TUploadRowsBase (TDuration timeout = TDuration::Max(), bool diskQuotaExceeded = false, NWilson::TSpan span = {} )
217
220
: TBase()
218
221
, SchemeCache(MakeSchemeCacheID())
219
222
, LeaderPipeCache(MakePipePeNodeCacheID(false ))
220
223
, Timeout((timeout && timeout <= DEFAULT_TIMEOUT) ? timeout : DEFAULT_TIMEOUT)
221
224
, Status(Ydb::StatusIds::SUCCESS)
222
225
, DiskQuotaExceeded(diskQuotaExceeded)
226
+ , Span(std::move(span))
223
227
{}
224
228
225
229
void Bootstrap (const NActors::TActorContext& ctx) {
@@ -232,10 +236,10 @@ class TUploadRowsBase : public TActorBootstrapped<TUploadRowsBase<DerivedActivit
232
236
for (auto & pr : ShardUploadRetryStates) {
233
237
if (pr.second .SentOverloadSeqNo ) {
234
238
auto * msg = new TEvDataShard::TEvOverloadUnsubscribe (pr.second .SentOverloadSeqNo );
235
- ctx.Send (LeaderPipeCache, new TEvPipeCache::TEvForward (msg, pr.first , false ));
239
+ ctx.Send (LeaderPipeCache, new TEvPipeCache::TEvForward (msg, pr.first , false ), 0 , 0 , Span. GetTraceId () );
236
240
}
237
241
}
238
- ctx.Send (LeaderPipeCache, new TEvPipeCache::TEvUnlink (0 ));
242
+ ctx.Send (LeaderPipeCache, new TEvPipeCache::TEvUnlink (0 ), 0 , 0 , Span. GetTraceId () );
239
243
if (TimeoutTimerActorId) {
240
244
ctx.Send (TimeoutTimerActorId, new TEvents::TEvPoisonPill ());
241
245
}
@@ -330,6 +334,7 @@ class TUploadRowsBase : public TActorBootstrapped<TUploadRowsBase<DerivedActivit
330
334
private:
331
335
void Handle (TEvents::TEvPoison::TPtr&, const TActorContext& ctx) {
332
336
OnBeforePoison (ctx);
337
+ Span.EndError (" poison" );
333
338
Die (ctx);
334
339
}
335
340
@@ -595,7 +600,7 @@ class TUploadRowsBase : public TActorBootstrapped<TUploadRowsBase<DerivedActivit
595
600
entry.SyncVersion = true ;
596
601
entry.ShowPrivatePath = AllowWriteToPrivateTable;
597
602
request->ResultSet .emplace_back (entry);
598
- ctx.Send (SchemeCache, new TEvTxProxySchemeCache::TEvNavigateKeySet (request));
603
+ ctx.Send (SchemeCache, new TEvTxProxySchemeCache::TEvNavigateKeySet (request), 0 , 0 , Span. GetTraceId () );
599
604
600
605
TimeoutTimerActorId = CreateLongTimer (ctx, Timeout,
601
606
new IEventHandle (ctx.SelfID , ctx.SelfID , new TEvents::TEvWakeup ()));
@@ -743,7 +748,7 @@ class TUploadRowsBase : public TActorBootstrapped<TUploadRowsBase<DerivedActivit
743
748
// Begin Long Tx for writing a batch into OLAP table
744
749
TActorId longTxServiceId = NLongTxService::MakeLongTxServiceID (ctx.SelfID .NodeId ());
745
750
NKikimrLongTxService::TEvBeginTx::EMode mode = NKikimrLongTxService::TEvBeginTx::MODE_WRITE_ONLY;
746
- ctx.Send (longTxServiceId, new NLongTxService::TEvLongTxService::TEvBeginTx (GetDatabase (), mode));
751
+ ctx.Send (longTxServiceId, new NLongTxService::TEvLongTxService::TEvBeginTx (GetDatabase (), mode), 0 , 0 , Span. GetTraceId () );
747
752
TBase::Become (&TThis::StateWaitBeginLongTx);
748
753
}
749
754
@@ -861,7 +866,7 @@ class TUploadRowsBase : public TActorBootstrapped<TUploadRowsBase<DerivedActivit
861
866
LogPrefix () << " rolling back LongTx '" << LongTxId.ToString () << " '" );
862
867
863
868
TActorId longTxServiceId = NLongTxService::MakeLongTxServiceID (ctx.SelfID .NodeId ());
864
- ctx.Send (longTxServiceId, new NLongTxService::TEvLongTxService::TEvRollbackTx (LongTxId));
869
+ ctx.Send (longTxServiceId, new NLongTxService::TEvLongTxService::TEvRollbackTx (LongTxId), 0 , 0 , Span. GetTraceId () );
865
870
}
866
871
867
872
STFUNC (StateWaitWriteBatchResult) {
@@ -887,7 +892,7 @@ class TUploadRowsBase : public TActorBootstrapped<TUploadRowsBase<DerivedActivit
887
892
888
893
void CommitLongTx (const TActorContext& ctx) {
889
894
TActorId longTxServiceId = NLongTxService::MakeLongTxServiceID (ctx.SelfID .NodeId ());
890
- ctx.Send (longTxServiceId, new NLongTxService::TEvLongTxService::TEvCommitTx (LongTxId));
895
+ ctx.Send (longTxServiceId, new NLongTxService::TEvLongTxService::TEvCommitTx (LongTxId), 0 , 0 , Span. GetTraceId () );
891
896
TBase::Become (&TThis::StateWaitCommitLongTx);
892
897
}
893
898
@@ -966,7 +971,7 @@ class TUploadRowsBase : public TActorBootstrapped<TUploadRowsBase<DerivedActivit
966
971
request->ResultSet .emplace_back (std::move (keyRange));
967
972
968
973
TAutoPtr<TEvTxProxySchemeCache::TEvResolveKeySet> resolveReq (new TEvTxProxySchemeCache::TEvResolveKeySet (request));
969
- ctx.Send (SchemeCache, resolveReq.Release ());
974
+ ctx.Send (SchemeCache, resolveReq.Release (), 0 , 0 , Span. GetTraceId () );
970
975
971
976
TBase::Become (&TThis::StateWaitResolveShards);
972
977
}
@@ -1027,7 +1032,7 @@ class TUploadRowsBase : public TActorBootstrapped<TUploadRowsBase<DerivedActivit
1027
1032
ev->Record .SetOverloadSubscribe (seqNo);
1028
1033
state->SentOverloadSeqNo = seqNo;
1029
1034
1030
- ctx.Send (LeaderPipeCache, new TEvPipeCache::TEvForward (ev.release (), shardId, true ), IEventHandle::FlagTrackDelivery);
1035
+ ctx.Send (LeaderPipeCache, new TEvPipeCache::TEvForward (ev.release (), shardId, true ), IEventHandle::FlagTrackDelivery, 0 , Span. GetTraceId () );
1031
1036
}
1032
1037
1033
1038
void MakeShardRequests (const NActors::TActorContext& ctx) {
@@ -1109,7 +1114,7 @@ class TUploadRowsBase : public TActorBootstrapped<TUploadRowsBase<DerivedActivit
1109
1114
ev->Record .SetOverloadSubscribe (seqNo);
1110
1115
uploadRetryStates[idx]->SentOverloadSeqNo = seqNo;
1111
1116
1112
- ctx.Send (LeaderPipeCache, new TEvPipeCache::TEvForward (ev.release (), shardId, true ), IEventHandle::FlagTrackDelivery);
1117
+ ctx.Send (LeaderPipeCache, new TEvPipeCache::TEvForward (ev.release (), shardId, true ), IEventHandle::FlagTrackDelivery, 0 , Span. GetTraceId () );
1113
1118
1114
1119
auto res = ShardRepliesLeft.insert (shardId);
1115
1120
if (!res.second ) {
@@ -1133,7 +1138,7 @@ class TUploadRowsBase : public TActorBootstrapped<TUploadRowsBase<DerivedActivit
1133
1138
}
1134
1139
1135
1140
void Handle (TEvPipeCache::TEvDeliveryProblem::TPtr &ev, const TActorContext &ctx) {
1136
- ctx.Send (SchemeCache, new TEvTxProxySchemeCache::TEvInvalidateTable (GetKeyRange ()->TableId , TActorId ()));
1141
+ ctx.Send (SchemeCache, new TEvTxProxySchemeCache::TEvInvalidateTable (GetKeyRange ()->TableId , TActorId ()), 0 , 0 , Span. GetTraceId () );
1137
1142
1138
1143
SetError (Ydb::StatusIds::UNAVAILABLE, Sprintf (" Failed to connect to shard %" PRIu64, ev->Get ()->TabletId ));
1139
1144
ShardRepliesLeft.erase (ev->Get ()->TabletId );
@@ -1170,7 +1175,7 @@ class TUploadRowsBase : public TActorBootstrapped<TUploadRowsBase<DerivedActivit
1170
1175
switch (shardResponse.GetStatus ()) {
1171
1176
case NKikimrTxDataShard::TError::WRONG_SHARD_STATE:
1172
1177
case NKikimrTxDataShard::TError::SHARD_IS_BLOCKED:
1173
- ctx.Send (SchemeCache, new TEvTxProxySchemeCache::TEvInvalidateTable (GetKeyRange ()->TableId , TActorId ()));
1178
+ ctx.Send (SchemeCache, new TEvTxProxySchemeCache::TEvInvalidateTable (GetKeyRange ()->TableId , TActorId ()), 0 , 0 , Span. GetTraceId () );
1174
1179
status = Ydb::StatusIds::OVERLOADED;
1175
1180
break ;
1176
1181
case NKikimrTxDataShard::TError::DISK_SPACE_EXHAUSTED:
@@ -1203,7 +1208,7 @@ class TUploadRowsBase : public TActorBootstrapped<TUploadRowsBase<DerivedActivit
1203
1208
}
1204
1209
1205
1210
// Notify the cache that we are done with the pipe
1206
- ctx.Send (LeaderPipeCache, new TEvPipeCache::TEvUnlink (shardId));
1211
+ ctx.Send (LeaderPipeCache, new TEvPipeCache::TEvUnlink (shardId), 0 , 0 , Span. GetTraceId () );
1207
1212
1208
1213
ShardRepliesLeft.erase (shardId);
1209
1214
ShardUploadRetryStates.erase (shardId);
@@ -1266,6 +1271,7 @@ class TUploadRowsBase : public TActorBootstrapped<TUploadRowsBase<DerivedActivit
1266
1271
Y_DEBUG_ABORT_UNLESS (status != ::Ydb::StatusIds::SUCCESS);
1267
1272
RollbackLongTx (ctx);
1268
1273
}
1274
+ Span.EndOk ();
1269
1275
1270
1276
Die (ctx);
1271
1277
}
0 commit comments