Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion ydb/core/tx/columnshard/columnshard__write.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -345,12 +345,23 @@ void TColumnShard::Handle(NEvents::TDataEvents::TEvWrite::TPtr& ev, const TActor
const auto source = ev->Sender;
const auto cookie = ev->Cookie;


std::optional<TDuration> writeTimeout;
if (record.HasTimeoutSeconds()) {
writeTimeout = TDuration::Seconds(record.GetTimeoutSeconds());
}

const float rejectProbabilty = Executor()->GetRejectProbability();
if (rejectProbabilty > 0) {
const float rnd = AppData(ctx)->RandomProvider->GenRandReal2();
if (rnd < rejectProbabilty) {
LWPROBE(EvWrite, TabletID(), source.ToString(), cookie, record.GetTxId(), writeTimeout.value_or(TDuration::Max()), 0, "", false, false, ToString(NKikimrDataEvents::TEvWriteResult::STATUS_OVERLOADED), "decided to reject due to given RejectProbability");
auto result = NEvents::TDataEvents::TEvWriteResult::BuildError(
TabletID(), 0, NKikimrDataEvents::TEvWriteResult::STATUS_OVERLOADED, "decided to reject due to given RejectProbability");
ctx.Send(source, result.release(), 0, cookie);
return;
}
}

if (!TablesManager.GetPrimaryIndex()) {
LWPROBE(EvWrite, TabletID(), source.ToString(), cookie, record.GetTxId(), writeTimeout.value_or(TDuration::Max()), 0, "", false, false, ToString(NKikimrDataEvents::TEvWriteResult::STATUS_BAD_REQUEST), "schema not ready for writing");
Counters.GetTabletCounters()->IncCounter(COUNTER_WRITE_FAIL);
Expand Down
Loading