aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorchertus <azuikov@ydb.tech>2023-06-30 21:46:16 +0300
committerchertus <azuikov@ydb.tech>2023-06-30 21:46:16 +0300
commit1dd51935f8e289a4f832773b327671d60cf60913 (patch)
tree4e0566c088b1d26b236b742215e709dd85f1639e
parent8c9046c9959fcd5d518e89492b3d88d93017a16e (diff)
downloadydb-1dd51935f8e289a4f832773b327671d60cf60913.tar.gz
tx counter for tx logging
-rw-r--r--ydb/core/tx/columnshard/columnshard__export.cpp24
-rw-r--r--ydb/core/tx/columnshard/columnshard__forget.cpp18
-rw-r--r--ydb/core/tx/columnshard/columnshard__plan_step.cpp26
-rw-r--r--ydb/core/tx/columnshard/columnshard__progress_tx.cpp20
-rw-r--r--ydb/core/tx/columnshard/columnshard__propose_transaction.cpp29
-rw-r--r--ydb/core/tx/columnshard/columnshard__read.cpp18
-rw-r--r--ydb/core/tx/columnshard/columnshard__write.cpp16
-rw-r--r--ydb/core/tx/columnshard/columnshard__write_index.cpp37
-rw-r--r--ydb/core/tx/columnshard/columnshard_impl.h1
9 files changed, 133 insertions, 56 deletions
diff --git a/ydb/core/tx/columnshard/columnshard__export.cpp b/ydb/core/tx/columnshard/columnshard__export.cpp
index 3559b30b723..4c1e718926e 100644
--- a/ydb/core/tx/columnshard/columnshard__export.cpp
+++ b/ydb/core/tx/columnshard/columnshard__export.cpp
@@ -10,8 +10,9 @@ class TTxExportFinish: public TTransactionBase<TColumnShard> {
public:
TTxExportFinish(TColumnShard* self, TEvPrivate::TEvExport::TPtr& ev)
: TBase(self)
- , Ev(ev) {
- }
+ , Ev(ev)
+ , TabletTxNo(++Self->TabletTxCounter)
+ {}
bool Execute(TTransactionContext& txc, const TActorContext& ctx) override;
void Complete(const TActorContext& ctx) override;
@@ -19,13 +20,22 @@ public:
private:
TEvPrivate::TEvExport::TPtr Ev;
+ const ui32 TabletTxNo;
THashMap<TString, THashSet<NOlap::TEvictedBlob>> BlobsToForget;
+
+ TStringBuilder TxPrefix() const {
+ return TStringBuilder() << "TxExportFinish[" << ToString(TabletTxNo) << "] ";
+ }
+
+ TString TxSuffix() const {
+ return TStringBuilder() << " at tablet " << Self->TabletID();
+ }
};
bool TTxExportFinish::Execute(TTransactionContext& txc, const TActorContext&) {
Y_VERIFY(Ev);
- LOG_S_DEBUG("TTxExportFinish.Execute at tablet " << Self->TabletID());
+ LOG_S_DEBUG(TxPrefix() << "execute" << TxSuffix());
txc.DB.NoMoreReadsForTx();
//NIceDb::TNiceDb db(txc.DB);
@@ -58,12 +68,12 @@ bool TTxExportFinish::Execute(TTransactionContext& txc, const TActorContext&) {
// Delayed erase of evicted blob. Blob could be already deleted.
if (present && !dropped) {
- LOG_S_NOTICE("Blob exported '" << blobId.ToStringNew() << "' at tablet " << Self->TabletID());
+ LOG_S_INFO(TxPrefix() << "Blob exported '" << blobId.ToStringNew() << "'" << TxSuffix());
Self->BlobManager->DeleteBlob(blobId, blobManagerDb);
Self->IncCounter(COUNTER_BLOBS_ERASED);
Self->IncCounter(COUNTER_BYTES_ERASED, blobId.BlobSize());
} else if (present && dropped) {
- LOG_S_NOTICE("Stale blob exported '" << blobId.ToStringNew() << "' at tablet " << Self->TabletID());
+ LOG_S_INFO(TxPrefix() << "Stale blob exported '" << blobId.ToStringNew() << "'" << TxSuffix());
TEvictMetadata meta;
evict = Self->BlobManager->GetDropped(blobId, meta);
@@ -71,7 +81,7 @@ bool TTxExportFinish::Execute(TTransactionContext& txc, const TActorContext&) {
BlobsToForget[meta.GetTierName()].emplace(std::move(evict));
} else {
- LOG_S_ERROR("Unknown blob exported '" << blobId.ToStringNew() << "' at tablet " << Self->TabletID());
+ LOG_S_ERROR(TxPrefix() << "Unknown blob exported '" << blobId.ToStringNew() << "'" << TxSuffix());
}
}
}
@@ -87,7 +97,7 @@ bool TTxExportFinish::Execute(TTransactionContext& txc, const TActorContext&) {
void TTxExportFinish::Complete(const TActorContext& ctx) {
Y_VERIFY(Ev);
- LOG_S_DEBUG("TTxExportFinish.Complete at tablet " << Self->TabletID());
+ LOG_S_DEBUG(TxPrefix() << "complete" << TxSuffix());
if (!BlobsToForget.empty()) {
Self->ForgetBlobs(ctx, BlobsToForget);
diff --git a/ydb/core/tx/columnshard/columnshard__forget.cpp b/ydb/core/tx/columnshard/columnshard__forget.cpp
index 02cdbfb25b7..5c3288a8b89 100644
--- a/ydb/core/tx/columnshard/columnshard__forget.cpp
+++ b/ydb/core/tx/columnshard/columnshard__forget.cpp
@@ -10,6 +10,7 @@ public:
TTxForget(TColumnShard* self, TEvPrivate::TEvForget::TPtr& ev)
: TBase(self)
, Ev(ev)
+ , TabletTxNo(++Self->TabletTxCounter)
{}
bool Execute(TTransactionContext& txc, const TActorContext& ctx) override;
@@ -18,12 +19,21 @@ public:
private:
TEvPrivate::TEvForget::TPtr Ev;
+ const ui32 TabletTxNo;
+
+ TStringBuilder TxPrefix() const {
+ return TStringBuilder() << "TxForget[" << ToString(TabletTxNo) << "] ";
+ }
+
+ TString TxSuffix() const {
+ return TStringBuilder() << " at tablet " << Self->TabletID();
+ }
};
bool TTxForget::Execute(TTransactionContext& txc, const TActorContext&) {
Y_VERIFY(Ev);
- LOG_S_DEBUG("TTxForget.Execute at tablet " << Self->TabletID());
+ LOG_S_DEBUG(TxPrefix() << "execute" << TxSuffix());
txc.DB.NoMoreReadsForTx();
//NIceDb::TNiceDb db(txc.DB);
@@ -40,10 +50,10 @@ bool TTxForget::Execute(TTransactionContext& txc, const TActorContext&) {
if (erased) {
strBlobs += "'" + evict.Blob.ToStringNew() + "' ";
} else {
- LOG_S_ERROR("Forget unknown blob " << evict.Blob << " at tablet " << Self->TabletID());
+ LOG_S_WARN(TxPrefix() << "forget unknown blob " << evict.Blob << TxSuffix());
}
}
- LOG_S_NOTICE("Forget evicted blobs " << strBlobs << "at tablet " << Self->TabletID());
+ LOG_S_INFO(TxPrefix() << "forget evicted blobs " << strBlobs << TxSuffix());
Self->IncCounter(COUNTER_FORGET_SUCCESS);
} else {
@@ -54,7 +64,7 @@ bool TTxForget::Execute(TTransactionContext& txc, const TActorContext&) {
}
void TTxForget::Complete(const TActorContext&) {
- LOG_S_DEBUG("TTxForget.Complete at tablet " << Self->TabletID());
+ LOG_S_DEBUG(TxPrefix() << "complete" << TxSuffix());
}
diff --git a/ydb/core/tx/columnshard/columnshard__plan_step.cpp b/ydb/core/tx/columnshard/columnshard__plan_step.cpp
index 97f48de5776..4d185fd5e34 100644
--- a/ydb/core/tx/columnshard/columnshard__plan_step.cpp
+++ b/ydb/core/tx/columnshard/columnshard__plan_step.cpp
@@ -13,6 +13,7 @@ public:
TTxPlanStep(TColumnShard* self, TEvTxProcessing::TEvPlanStep::TPtr& ev)
: TBase(self)
, Ev(ev)
+ , TabletTxNo(++Self->TabletTxCounter)
{}
bool Execute(TTransactionContext& txc, const TActorContext& ctx) override;
@@ -21,14 +22,23 @@ public:
private:
TEvTxProcessing::TEvPlanStep::TPtr Ev;
+ const ui32 TabletTxNo;
THashMap<TActorId, std::vector<ui64>> TxAcks;
std::unique_ptr<TEvTxProcessing::TEvPlanStepAccepted> Result;
+
+ TStringBuilder TxPrefix() const {
+ return TStringBuilder() << "TxPlanStep[" << ToString(TabletTxNo) << "] ";
+ }
+
+ TString TxSuffix() const {
+ return TStringBuilder() << " at tablet " << Self->TabletID();
+ }
};
bool TTxPlanStep::Execute(TTransactionContext& txc, const TActorContext& ctx) {
Y_VERIFY(Ev);
- LOG_S_DEBUG("TTxPlanStep.Execute at tablet " << Self->TabletID());
+ LOG_S_DEBUG(TxPrefix() << "execute" << TxSuffix());
txc.DB.NoMoreReadsForTx();
NIceDb::TNiceDb db(txc.DB);
@@ -63,15 +73,15 @@ bool TTxPlanStep::Execute(TTransactionContext& txc, const TActorContext& ctx) {
}
++plannedCount;
} else {
- LOG_S_WARN("Ignoring step " << step
+ LOG_S_WARN(TxPrefix() << "Ignoring step " << step
<< " for txId " << txId
<< " which is already planned for step " << step
- << " at tablet " << Self->TabletID());
+ << TxSuffix());
}
} else {
- LOG_S_WARN("Ignoring step " << step
+ LOG_S_WARN(TxPrefix() << "Ignoring step " << step
<< " for unknown txId " << txId
- << " at tablet " << Self->TabletID());
+ << TxSuffix());
}
lastTxId = txId;
}
@@ -81,11 +91,11 @@ bool TTxPlanStep::Execute(TTransactionContext& txc, const TActorContext& ctx) {
Schema::SaveSpecialValue(db, Schema::EValueIds::LastPlannedTxId, Self->LastPlannedTxId);
Self->RescheduleWaitingReads();
} else {
- LOG_S_ERROR("Ignore old txIds ["
+ LOG_S_ERROR(TxPrefix() << "Ignore old txIds ["
<< JoinStrings(txIds.begin(), txIds.end(), ", ")
<< "] for step " << step
<< " last planned step " << Self->LastPlannedStep
- << " at tablet " << Self->TabletID());
+ << TxSuffix());
}
Result = std::make_unique<TEvTxProcessing::TEvPlanStepAccepted>(Self->TabletID(), step);
@@ -101,7 +111,7 @@ bool TTxPlanStep::Execute(TTransactionContext& txc, const TActorContext& ctx) {
void TTxPlanStep::Complete(const TActorContext& ctx) {
Y_VERIFY(Ev);
Y_VERIFY(Result);
- LOG_S_DEBUG("TTxPlanStep.Complete at tablet " << Self->TabletID());
+ LOG_S_DEBUG(TxPrefix() << "complete" << TxSuffix());
ui64 step = Ev->Get()->Record.GetStep();
for (auto& kv : TxAcks) {
diff --git a/ydb/core/tx/columnshard/columnshard__progress_tx.cpp b/ydb/core/tx/columnshard/columnshard__progress_tx.cpp
index 196a5b4df31..e3a71ca589c 100644
--- a/ydb/core/tx/columnshard/columnshard__progress_tx.cpp
+++ b/ydb/core/tx/columnshard/columnshard__progress_tx.cpp
@@ -41,15 +41,24 @@ private:
POST_SCHEMA
};
+ TStringBuilder TxPrefix() const {
+ return TStringBuilder() << "TxProgressTx[" << ToString(TabletTxNo) << "] ";
+ }
+
+ TString TxSuffix() const {
+ return TStringBuilder() << " at tablet " << Self->TabletID();
+ }
+
public:
TTxProgressTx(TColumnShard* self)
: TTransactionBase(self)
- { }
+ , TabletTxNo(++Self->TabletTxCounter)
+ {}
TTxType GetTxType() const override { return TXTYPE_PROGRESS; }
bool Execute(TTransactionContext& txc, const TActorContext& ctx) override {
- LOG_S_DEBUG("TTxProgressTx.Execute at tablet " << Self->TabletID());
+ LOG_S_DEBUG(TxPrefix() << "execute" << TxSuffix());
Y_VERIFY(Self->ProgressTxInFlight);
NIceDb::TNiceDb db(txc.DB);
@@ -65,8 +74,8 @@ public:
break;
}
ui64 txId = it->TxId;
- LOG_S_DEBUG("Removing outdated txId " << txId << " max step " << it->MaxStep << " outdated step "
- << outdatedStep << " at tablet " << Self->TabletID());
+ LOG_S_DEBUG(TxPrefix() << "Removing outdated txId " << txId << " max step " << it->MaxStep
+ << " outdated step " << outdatedStep << TxSuffix());
Self->DeadlineQueue.erase(it);
Self->RemoveTx(txc.DB, txId);
++removedCount;
@@ -184,7 +193,7 @@ public:
}
void Complete(const TActorContext& ctx) override {
- LOG_S_DEBUG("TTxProgressTx.Complete at tablet " << Self->TabletID());
+ LOG_S_DEBUG(TxPrefix() << "complete" << TxSuffix());
for (auto& rec : TxEvents) {
ctx.Send(rec.Target, rec.Event.Release(), 0, rec.Cookie);
@@ -217,6 +226,7 @@ private:
std::vector<TResultEvent> TxResults;
std::vector<TEvent> TxEvents;
ETriggerActivities Trigger{ETriggerActivities::NONE};
+ const ui32 TabletTxNo;
};
void TColumnShard::EnqueueProgressTx(const TActorContext& ctx) {
diff --git a/ydb/core/tx/columnshard/columnshard__propose_transaction.cpp b/ydb/core/tx/columnshard/columnshard__propose_transaction.cpp
index 8f36356401a..df70479a5f8 100644
--- a/ydb/core/tx/columnshard/columnshard__propose_transaction.cpp
+++ b/ydb/core/tx/columnshard/columnshard__propose_transaction.cpp
@@ -13,6 +13,7 @@ public:
TTxProposeTransaction(TColumnShard* self, TEvColumnShard::TEvProposeTransaction::TPtr& ev)
: TBase(self)
, Ev(ev)
+ , TabletTxNo(++Self->TabletTxCounter)
{}
bool Execute(TTransactionContext& txc, const TActorContext& ctx) override;
@@ -21,13 +22,22 @@ public:
private:
TEvColumnShard::TEvProposeTransaction::TPtr Ev;
+ const ui32 TabletTxNo;
std::unique_ptr<TEvColumnShard::TEvProposeTransactionResult> Result;
+
+ TStringBuilder TxPrefix() const {
+ return TStringBuilder() << "TxProposeTransaction[" << ToString(TabletTxNo) << "] ";
+ }
+
+ TString TxSuffix() const {
+ return TStringBuilder() << " at tablet " << Self->TabletID();
+ }
};
bool TTxProposeTransaction::Execute(TTransactionContext& txc, const TActorContext& ctx) {
Y_VERIFY(Ev);
- LOG_S_DEBUG("TTxProposeTransaction.Execute at tablet " << Self->TabletID());
+ LOG_S_DEBUG(TxPrefix() << "execute" << TxSuffix());
txc.DB.NoMoreReadsForTx();
NIceDb::TNiceDb db(txc.DB);
@@ -89,7 +99,7 @@ bool TTxProposeTransaction::Execute(TTransactionContext& txc, const TActorContex
<< " ssId " << Self->CurrentSchemeShardId
<< " seqNo " << seqNo
<< " lastSeqNo " << lastSeqNo;
- LOG_S_INFO(statusMessage);
+ LOG_S_INFO(TxPrefix() << statusMessage << TxSuffix());
break;
}
@@ -117,14 +127,14 @@ bool TTxProposeTransaction::Execute(TTransactionContext& txc, const TActorContex
existing.Body = std::move(meta.Body);
}
- LOG_S_DEBUG("TTxProposeTransaction schema txId " << txId << " at tablet " << Self->TabletID());
+ LOG_S_DEBUG(TxPrefix() << "schema txId " << txId << TxSuffix());
status = NKikimrTxColumnShard::EResultStatus::PREPARED;
break;
}
case NKikimrTxColumnShard::TX_KIND_COMMIT: {
if (Self->CommitsInFlight.contains(txId)) {
- LOG_S_DEBUG("TTxProposeTransaction CommitTx (retry) TxId " << txId << " at tablet " << Self->TabletID());
+ LOG_S_DEBUG(TxPrefix() << "CommitTx (retry) TxId " << txId << TxSuffix());
Y_VERIFY(Self->BasicTxInfo.contains(txId));
const auto& txInfo = Self->BasicTxInfo[txId];
@@ -205,7 +215,7 @@ bool TTxProposeTransaction::Execute(TTransactionContext& txc, const TActorContex
Self->DeadlineQueue.emplace(txInfo.MaxStep, txId);
- LOG_S_DEBUG("TTxProposeTransaction CommitTx txId " << txId << " at tablet " << Self->TabletID());
+ LOG_S_DEBUG(TxPrefix() << "CommitTx txId " << txId << TxSuffix());
status = NKikimrTxColumnShard::EResultStatus::PREPARED;
break;
@@ -214,9 +224,9 @@ bool TTxProposeTransaction::Execute(TTransactionContext& txc, const TActorContex
NKikimrTxDataShard::TDataTransaction dataTransaction;
Y_VERIFY(dataTransaction.ParseFromString(record.GetTxBody()));
- LOG_S_DEBUG("TTxProposeTransaction immediate data tx txId " << txId
+ LOG_S_DEBUG(TxPrefix() << "immediate data tx txId " << txId
<< " '" << dataTransaction.DebugString()
- << "' at tablet " << Self->TabletID());
+ << TxSuffix());
bool isImmediate = record.GetFlags() & NKikimrTxColumnShard::ETransactionFlag::TX_FLAG_IMMEDIATE;
if (isImmediate) {
@@ -340,8 +350,7 @@ bool TTxProposeTransaction::Execute(TTransactionContext& txc, const TActorContex
Self->IncCounter(COUNTER_PREPARE_SUCCESS);
} else {
Self->IncCounter(COUNTER_PREPARE_ERROR);
- LOG_S_INFO("TTxProposeTransaction error txId " << txId << " at tablet " << Self->TabletID()
- << " " << statusMessage);
+ LOG_S_INFO(TxPrefix() << "error txId " << txId << " " << statusMessage << TxSuffix());
}
return true;
}
@@ -349,7 +358,7 @@ bool TTxProposeTransaction::Execute(TTransactionContext& txc, const TActorContex
void TTxProposeTransaction::Complete(const TActorContext& ctx) {
Y_VERIFY(Ev);
Y_VERIFY(Result);
- LOG_S_DEBUG("TTxProposeTransaction.Complete at tablet " << Self->TabletID());
+ LOG_S_DEBUG(TxPrefix() << "complete" << TxSuffix());
ctx.Send(Ev->Get()->GetSource(), Result.release());
diff --git a/ydb/core/tx/columnshard/columnshard__read.cpp b/ydb/core/tx/columnshard/columnshard__read.cpp
index 117aefeba55..466d4db6398 100644
--- a/ydb/core/tx/columnshard/columnshard__read.cpp
+++ b/ydb/core/tx/columnshard/columnshard__read.cpp
@@ -25,6 +25,7 @@ public:
TTxRead(TColumnShard* self, TEvColumnShard::TEvRead::TPtr& ev)
: TTxReadBase(self)
, Ev(ev)
+ , TabletTxNo(++Self->TabletTxCounter)
{}
bool Execute(TTransactionContext& txc, const TActorContext& ctx) override;
@@ -33,8 +34,17 @@ public:
private:
TEvColumnShard::TEvRead::TPtr Ev;
+ const ui32 TabletTxNo;
std::unique_ptr<TEvColumnShard::TEvReadResult> Result;
NOlap::TReadMetadata::TConstPtr ReadMetadata;
+
+ TStringBuilder TxPrefix() const {
+ return TStringBuilder() << "TxRead[" << ToString(TabletTxNo) << "] ";
+ }
+
+ TString TxSuffix() const {
+ return TStringBuilder() << " at tablet " << Self->TabletID();
+ }
};
@@ -42,7 +52,7 @@ bool TTxRead::Execute(TTransactionContext& txc, const TActorContext& ctx) {
Y_VERIFY(Ev);
Y_VERIFY(Self->TablesManager.HasPrimaryIndex());
Y_UNUSED(txc);
- LOG_S_DEBUG("TTxRead.Execute at tablet " << Self->TabletID());
+ LOG_S_DEBUG(TxPrefix() << "execute" << TxSuffix());
txc.DB.NoMoreReadsForTx();
@@ -113,13 +123,13 @@ void TTxRead::Complete(const TActorContext& ctx) {
bool success = (Proto(Result.get()).GetStatus() == NKikimrTxColumnShard::EResultStatus::SUCCESS);
if (!success) {
- LOG_S_DEBUG("TTxRead.Complete. Error " << ErrorDescription << " while reading at tablet " << Self->TabletID());
+ LOG_S_DEBUG(TxPrefix() << "complete. Error " << ErrorDescription << " while reading" << TxSuffix());
ctx.Send(Ev->Get()->GetSource(), Result.release());
} else if (noData) {
- LOG_S_DEBUG("TTxRead.Complete. Empty result at tablet " << Self->TabletID());
+ LOG_S_DEBUG(TxPrefix() << "complete. Empty result" << TxSuffix());
ctx.Send(Ev->Get()->GetSource(), Result.release());
} else {
- LOG_S_DEBUG("TTxRead.Complete at tablet " << Self->TabletID() << " Metadata: " << *ReadMetadata);
+ LOG_S_DEBUG(TxPrefix() << "complete" << TxSuffix() << " Metadata: " << *ReadMetadata);
const ui64 requestCookie = Self->InFlightReadsTracker.AddInFlightRequest(
std::static_pointer_cast<const NOlap::TReadMetadataBase>(ReadMetadata), *Self->BlobManager);
diff --git a/ydb/core/tx/columnshard/columnshard__write.cpp b/ydb/core/tx/columnshard/columnshard__write.cpp
index f8048b0b959..6e76150f8a0 100644
--- a/ydb/core/tx/columnshard/columnshard__write.cpp
+++ b/ydb/core/tx/columnshard/columnshard__write.cpp
@@ -12,6 +12,7 @@ public:
TTxWrite(TColumnShard* self, TEvColumnShard::TEvWrite::TPtr& ev)
: TBase(self)
, Ev(ev)
+ , TabletTxNo(++Self->TabletTxCounter)
{}
bool Execute(TTransactionContext& txc, const TActorContext& ctx) override;
@@ -20,13 +21,22 @@ public:
private:
TEvColumnShard::TEvWrite::TPtr Ev;
+ const ui32 TabletTxNo;
std::unique_ptr<TEvColumnShard::TEvWriteResult> Result;
+
+ TStringBuilder TxPrefix() const {
+ return TStringBuilder() << "TxWrite[" << ToString(TabletTxNo) << "] ";
+ }
+
+ TString TxSuffix() const {
+ return TStringBuilder() << " at tablet " << Self->TabletID();
+ }
};
bool TTxWrite::Execute(TTransactionContext& txc, const TActorContext&) {
Y_VERIFY(Ev);
- LOG_S_DEBUG("TTxWrite.Execute at tablet " << Self->TabletID());
+ LOG_S_DEBUG(TxPrefix() << "execute" << TxSuffix());
txc.DB.NoMoreReadsForTx();
NIceDb::TNiceDb db(txc.DB);
@@ -100,7 +110,7 @@ bool TTxWrite::Execute(TTransactionContext& txc, const TActorContext&) {
Self->BlobManager->SaveBlobBatch(std::move(Ev->Get()->BlobBatch), blobManagerDb);
} else {
- LOG_S_DEBUG("TTxWrite duplicate writeId " << writeId << " at tablet " << Self->TabletID());
+ LOG_S_DEBUG(TxPrefix() << "duplicate writeId " << writeId << TxSuffix());
// Return EResultStatus::SUCCESS for dups
Self->IncCounter(COUNTER_WRITE_DUPLICATE);
@@ -119,7 +129,7 @@ bool TTxWrite::Execute(TTransactionContext& txc, const TActorContext&) {
void TTxWrite::Complete(const TActorContext& ctx) {
Y_VERIFY(Ev);
Y_VERIFY(Result);
- LOG_S_DEBUG("TTxWrite.Complete at tablet " << Self->TabletID());
+ LOG_S_DEBUG(TxPrefix() << "complete" << TxSuffix());
ctx.Send(Ev->Get()->GetSource(), Result.release());
}
diff --git a/ydb/core/tx/columnshard/columnshard__write_index.cpp b/ydb/core/tx/columnshard/columnshard__write_index.cpp
index f212cd2e0ae..4a8f618577d 100644
--- a/ydb/core/tx/columnshard/columnshard__write_index.cpp
+++ b/ydb/core/tx/columnshard/columnshard__write_index.cpp
@@ -16,6 +16,7 @@ public:
TTxWriteIndex(TColumnShard* self, TEvPrivate::TEvWriteIndex::TPtr& ev)
: TBase(self)
, Ev(ev)
+ , TabletTxNo(++Self->TabletTxCounter)
{}
bool Execute(TTransactionContext& txc, const TActorContext& ctx) override;
@@ -26,10 +27,19 @@ private:
using TPathIdBlobs = THashMap<ui64, THashSet<TUnifiedBlobId>>;
TEvPrivate::TEvWriteIndex::TPtr Ev;
+ const ui32 TabletTxNo;
THashMap<TString, TPathIdBlobs> ExportTierBlobs;
THashMap<TString, THashSet<NOlap::TEvictedBlob>> BlobsToForget;
ui64 ExportNo = 0;
TBackgroundActivity TriggerActivity = TBackgroundActivity::All();
+
+ TStringBuilder TxPrefix() const {
+ return TStringBuilder() << "TxWriteIndex[" << ToString(TabletTxNo) << "] ";
+ }
+
+ TString TxSuffix() const {
+ return TStringBuilder() << " at tablet " << Self->TabletID();
+ }
};
@@ -47,8 +57,7 @@ bool TTxWriteIndex::Execute(TTransactionContext& txc, const TActorContext& ctx)
auto changes = Ev->Get()->IndexChanges;
Y_VERIFY(changes);
- LOG_S_DEBUG("TTxWriteIndex (" << changes->TypeString()
- << ") changes: " << *changes << " at tablet " << Self->TabletID());
+ LOG_S_DEBUG(TxPrefix() << "execute(" << changes->TypeString() << ") changes: " << *changes << TxSuffix());
bool ok = false;
if (Ev->Get()->GetPutStatus() == NKikimrProto::OK) {
@@ -59,7 +68,7 @@ bool TTxWriteIndex::Execute(TTransactionContext& txc, const TActorContext& ctx)
NOlap::TDbWrapper dbWrap(txc.DB, &dsGroupSelector);
ok = Self->TablesManager.MutablePrimaryIndex().ApplyChanges(dbWrap, changes, snapshot); // update changes + apply
if (ok) {
- LOG_S_DEBUG("TTxWriteIndex (" << changes->TypeString() << ") apply at tablet " << Self->TabletID());
+ LOG_S_DEBUG(TxPrefix() << "(" << changes->TypeString() << ") apply" << TxSuffix());
TBlobManagerDb blobManagerDb(txc.DB);
for (const auto& cmtd : changes->DataToIndex) {
@@ -145,8 +154,8 @@ bool TTxWriteIndex::Execute(TTransactionContext& txc, const TActorContext& ctx)
blobsToExport.emplace(blobId, evictionFeatures);
} else {
// TODO: support S3 -> S3 eviction
- LOG_S_ERROR("Prevent evict evicted blob '" << blobId.ToStringNew()
- << "' at tablet " << Self->TabletID());
+ LOG_S_ERROR(TxPrefix() << "Prevent evict evicted blob '" << blobId.ToStringNew()
+ << "'" << TxSuffix());
protectedBlobs.insert(blobId);
}
}
@@ -163,7 +172,8 @@ bool TTxWriteIndex::Execute(TTransactionContext& txc, const TActorContext& ctx)
} else if (!protectedBlobs.contains(blobId)) {
// We could drop the blob immediately
if (blobsToDrop.emplace(blobId).second) {
- LOG_S_TRACE("Delete evicted blob '" << blobId.ToStringNew() << "' at tablet " << Self->TabletID());
+ LOG_S_TRACE(TxPrefix() << "Delete evicted blob '" << blobId.ToStringNew()
+ << "'" << TxSuffix());
}
}
@@ -174,7 +184,7 @@ bool TTxWriteIndex::Execute(TTransactionContext& txc, const TActorContext& ctx)
for (const auto& rec : portionInfo.Records) {
const auto& blobId = rec.BlobRange.BlobId;
if (blobsToDrop.emplace(blobId).second) {
- LOG_S_TRACE("Delete blob '" << blobId.ToStringNew() << "' at tablet " << Self->TabletID());
+ LOG_S_TRACE(TxPrefix() << "Delete blob '" << blobId.ToStringNew() << "'" << TxSuffix());
}
}
Self->IncCounter(COUNTER_RAW_BYTES_ERASED, portionInfo.RawBytesSum());
@@ -189,7 +199,7 @@ bool TTxWriteIndex::Execute(TTransactionContext& txc, const TActorContext& ctx)
BlobsToForget[meta.GetTierName()].emplace(std::move(evict));
if (NOlap::IsDeleted(evict.State)) {
- LOG_S_DEBUG("Skip delete blob '" << blobId.ToStringNew() << "' at tablet " << Self->TabletID());
+ LOG_S_DEBUG(TxPrefix() << "Skip delete blob '" << blobId.ToStringNew() << "'" << TxSuffix());
continue;
}
}
@@ -206,14 +216,11 @@ bool TTxWriteIndex::Execute(TTransactionContext& txc, const TActorContext& ctx)
Self->UpdateIndexCounters();
} else {
- LOG_S_NOTICE("TTxWriteIndex (" << changes->TypeString()
- << ") cannot apply changes: " << *changes << " at tablet " << Self->TabletID());
-
- // TODO: delayed insert
+ LOG_S_NOTICE(TxPrefix() << "(" << changes->TypeString() << ") cannot apply changes: "
+ << *changes << TxSuffix());
}
} else {
- LOG_S_ERROR("TTxWriteIndex (" << changes->TypeString()
- << ") cannot write index blobs at tablet " << Self->TabletID());
+ LOG_S_ERROR(TxPrefix() << " (" << changes->TypeString() << ") cannot write index blobs" << TxSuffix());
}
if (blobsToExport.size()) {
@@ -252,7 +259,7 @@ bool TTxWriteIndex::Execute(TTransactionContext& txc, const TActorContext& ctx)
void TTxWriteIndex::Complete(const TActorContext& ctx) {
Y_VERIFY(Ev);
- LOG_S_DEBUG("TTxWriteIndex.Complete at tablet " << Self->TabletID());
+ LOG_S_DEBUG(TxPrefix() << "complete" << TxSuffix());
if (Ev->Get()->GetPutStatus() == NKikimrProto::TRYLATER) {
ctx.Schedule(Self->FailActivationDelay, new TEvPrivate::TEvPeriodicWakeup(true));
diff --git a/ydb/core/tx/columnshard/columnshard_impl.h b/ydb/core/tx/columnshard/columnshard_impl.h
index 7e345880ca7..a9bf4b93581 100644
--- a/ydb/core/tx/columnshard/columnshard_impl.h
+++ b/ydb/core/tx/columnshard/columnshard_impl.h
@@ -416,6 +416,7 @@ private:
ui64 WritesInFlight = 0;
ui64 WritesSizeInFlight = 0;
ui64 OwnerPathId = 0;
+ ui64 TabletTxCounter = 0;
ui64 StatsReportRound = 0;
ui32 SkippedIndexations = TSettings::MAX_INDEXATIONS_TO_SKIP; // Force indexation on tablet init
TString OwnerPath;