diff --git a/ydb/core/kqp/executer_actor/kqp_data_executer.cpp b/ydb/core/kqp/executer_actor/kqp_data_executer.cpp index 1d18d034ac9d..23da1403fed2 100644 --- a/ydb/core/kqp/executer_actor/kqp_data_executer.cpp +++ b/ydb/core/kqp/executer_actor/kqp_data_executer.cpp @@ -842,6 +842,7 @@ class TKqpDataExecuter : public TKqpExecuterBase, pu } return; } + case NKikimrDataEvents::TEvWriteResult::STATUS_DISK_SPACE_EXHAUSTED: { + CA_LOG_E("Got DISK_SPACE_EXHAUSTED for table `" + << SchemeEntry->TableId.PathId.ToString() << "`." + << " ShardID=" << ev->Get()->Record.GetOrigin() << "," + << " Sink=" << this->SelfId() << "." + << getIssues().ToOneLineString()); + + RuntimeError( + TStringBuilder() << "Got DISK_SPACE_EXHAUSTED for table `" + << SchemeEntry->TableId.PathId.ToString() << "`.", + NYql::NDqProto::StatusIds::PRECONDITION_FAILED, + getIssues()); + return; + } case NKikimrDataEvents::TEvWriteResult::STATUS_OVERLOADED: { CA_LOG_W("Got OVERLOADED for table `" << SchemeEntry->TableId.PathId.ToString() << "`." diff --git a/ydb/core/protos/counters_datashard.proto b/ydb/core/protos/counters_datashard.proto index 4b168f10e5cf..9d9b4245e780 100644 --- a/ydb/core/protos/counters_datashard.proto +++ b/ydb/core/protos/counters_datashard.proto @@ -147,6 +147,8 @@ enum ECumulativeCounters { COUNTER_WRITE_CANCELLED = 109 [(CounterOpts) = {Name: "WriteCancelled"}]; COUNTER_WRITE_ROWS = 110 [(CounterOpts) = {Name: "WriteRows"}]; COUNTER_WRITE_BYTES = 111 [(CounterOpts) = {Name: "WriteBytes"}]; + COUNTER_WRITE_DISK_SPACE_EXHAUSTED = 112 [(CounterOpts) = {Name: "WriteDiskSpaceExhausted"}]; + COUNTER_PREPARE_DISK_SPACE_EXHAUSTED = 113 [(CounterOpts) = {Name: "PrepareSpaceExhausted"}]; } enum EPercentileCounters { diff --git a/ydb/core/protos/data_events.proto b/ydb/core/protos/data_events.proto index 627296a769a1..ab04523e4081 100644 --- a/ydb/core/protos/data_events.proto +++ b/ydb/core/protos/data_events.proto @@ -126,6 +126,7 @@ message TEvWriteResult { STATUS_BAD_REQUEST = 7; STATUS_SCHEME_CHANGED = 8; STATUS_LOCKS_BROKEN = 9; + STATUS_DISK_SPACE_EXHAUSTED = 10; } // Status diff --git a/ydb/core/tx/datashard/check_data_tx_unit.cpp b/ydb/core/tx/datashard/check_data_tx_unit.cpp index 20c4c2543559..553591342f67 100644 --- a/ydb/core/tx/datashard/check_data_tx_unit.cpp +++ b/ydb/core/tx/datashard/check_data_tx_unit.cpp @@ -212,9 +212,9 @@ EExecutionStatus TCheckDataTxUnit::Execute(TOperation::TPtr op, // Updates are not allowed when database is out of space TString err = "Cannot perform writes: database is out of disk space"; - DataShard.IncCounter(COUNTER_PREPARE_OUT_OF_SPACE); + DataShard.IncCounter(COUNTER_PREPARE_DISK_SPACE_EXHAUSTED); - BuildResult(op)->AddError(NKikimrTxDataShard::TError::OUT_OF_SPACE, err); + BuildResult(op)->AddError(NKikimrTxDataShard::TError::DISK_SPACE_EXHAUSTED, err); op->Abort(EExecutionUnitKind::FinishPropose); LOG_LOG_S_THROTTLE(DataShard.GetLogThrottler(TDataShard::ELogThrottlerType::CheckDataTxUnit_Execute), ctx, NActors::NLog::PRI_ERROR, NKikimrServices::TX_DATASHARD, err); diff --git a/ydb/core/tx/datashard/check_write_unit.cpp b/ydb/core/tx/datashard/check_write_unit.cpp index b811f6322d1c..d0dcab048b1a 100644 --- a/ydb/core/tx/datashard/check_write_unit.cpp +++ b/ydb/core/tx/datashard/check_write_unit.cpp @@ -88,9 +88,9 @@ EExecutionStatus TCheckWriteUnit::Execute(TOperation::TPtr op, // Updates are not allowed when database is out of space TString err = "Cannot perform writes: database is out of disk space"; - DataShard.IncCounter(COUNTER_WRITE_OUT_OF_SPACE); + DataShard.IncCounter(COUNTER_WRITE_DISK_SPACE_EXHAUSTED); - writeOp->SetError(NKikimrDataEvents::TEvWriteResult::STATUS_OVERLOADED, err); + writeOp->SetError(NKikimrDataEvents::TEvWriteResult::STATUS_DISK_SPACE_EXHAUSTED, err); op->Abort(EExecutionUnitKind::FinishProposeWrite); DataShard.SetOverloadSubscribed(writeOp->GetWriteTx()->GetOverloadSubscribe(), writeOp->GetRecipient(), op->GetTarget(), ERejectReasons::YellowChannels, writeOp->GetWriteResult()->Record); diff --git a/ydb/core/tx/datashard/datashard__op_rows.cpp b/ydb/core/tx/datashard/datashard__op_rows.cpp index a43925e821a1..3dbfc1c8c004 100644 --- a/ydb/core/tx/datashard/datashard__op_rows.cpp +++ b/ydb/core/tx/datashard/datashard__op_rows.cpp @@ -203,7 +203,7 @@ static bool MaybeReject(TDataShard* self, TEvRequest& ev, const TActorContext& c Reject(self, ev, txDesc, rejectReasons, rejectDescription, &OutOfSpace, ctx, logThrottlerType); return true; } else if (self->IsSubDomainOutOfSpace()) { - self->IncCounter(COUNTER_PREPARE_OUT_OF_SPACE); + self->IncCounter(COUNTER_PREPARE_DISK_SPACE_EXHAUSTED); rejectReasons = ERejectReasons::DiskSpace; rejectDescription = "Cannot perform writes: database is out of disk space"; Reject(self, ev, txDesc, rejectReasons, rejectDescription, &DiskSpaceExhausted, ctx, logThrottlerType); diff --git a/ydb/core/tx/datashard/datashard__write.cpp b/ydb/core/tx/datashard/datashard__write.cpp index 6662d074f144..3c1f487015b2 100644 --- a/ydb/core/tx/datashard/datashard__write.cpp +++ b/ydb/core/tx/datashard/datashard__write.cpp @@ -293,8 +293,9 @@ NKikimrDataEvents::TEvWriteResult::EStatus NEvWrite::TConvertor::ConvertErrCode( case NKikimrTxDataShard::TError_EKind_SCHEME_CHANGED: return NKikimrDataEvents::TEvWriteResult::STATUS_SCHEME_CHANGED; case NKikimrTxDataShard::TError_EKind_OUT_OF_SPACE: - case NKikimrTxDataShard::TError_EKind_DISK_SPACE_EXHAUSTED: return NKikimrDataEvents::TEvWriteResult::STATUS_OVERLOADED; + case NKikimrTxDataShard::TError_EKind_DISK_SPACE_EXHAUSTED: + return NKikimrDataEvents::TEvWriteResult::STATUS_DISK_SPACE_EXHAUSTED; default: return NKikimrDataEvents::TEvWriteResult::STATUS_INTERNAL_ERROR; } diff --git a/ydb/core/tx/datashard/datashard_impl.h b/ydb/core/tx/datashard/datashard_impl.h index 18c07fc3a342..12bdeb35fa54 100644 --- a/ydb/core/tx/datashard/datashard_impl.h +++ b/ydb/core/tx/datashard/datashard_impl.h @@ -3276,7 +3276,13 @@ class TDataShard ev->Record.MutableTableStats()->SetImmediateTxCompleted(TabletCounters->Cumulative()[COUNTER_PREPARE_IMMEDIATE].Get() + TabletCounters->Cumulative()[COUNTER_WRITE_IMMEDIATE].Get()); ev->Record.MutableTableStats()->SetPlannedTxCompleted(TabletCounters->Cumulative()[COUNTER_PLANNED_TX_COMPLETE].Get()); ev->Record.MutableTableStats()->SetTxRejectedByOverload(TabletCounters->Cumulative()[COUNTER_PREPARE_OVERLOADED].Get() + TabletCounters->Cumulative()[COUNTER_WRITE_OVERLOADED].Get()); - ev->Record.MutableTableStats()->SetTxRejectedBySpace(TabletCounters->Cumulative()[COUNTER_PREPARE_OUT_OF_SPACE].Get() + TabletCounters->Cumulative()[COUNTER_WRITE_OUT_OF_SPACE].Get()); + ev->Record.MutableTableStats()->SetTxRejectedBySpace( + TabletCounters->Cumulative()[COUNTER_PREPARE_OUT_OF_SPACE].Get() + + TabletCounters->Cumulative()[COUNTER_PREPARE_DISK_SPACE_EXHAUSTED].Get() + + TabletCounters->Cumulative()[COUNTER_WRITE_OUT_OF_SPACE].Get() + + TabletCounters->Cumulative()[COUNTER_WRITE_DISK_SPACE_EXHAUSTED].Get() + ); + ev->Record.MutableTableStats()->SetTxCompleteLagMsec(TabletCounters->Simple()[COUNTER_TX_COMPLETE_LAG].Get()); ev->Record.MutableTableStats()->SetInFlightTxCount(TabletCounters->Simple()[COUNTER_TX_IN_FLY].Get() + TabletCounters->Simple()[COUNTER_IMMEDIATE_TX_IN_FLY].Get());