diff options
author | snaury <snaury@ydb.tech> | 2023-10-18 12:31:56 +0300 |
---|---|---|
committer | snaury <snaury@ydb.tech> | 2023-10-18 13:30:15 +0300 |
commit | 3a11a6565c7b0ae519cbb33f08a5a878ce46c7e7 (patch) | |
tree | 938f8d9f3f14dd72af6a49c42e02370cdb616b57 | |
parent | d47be70a771e2e4814bb66351730780b1118db2f (diff) | |
download | ydb-3a11a6565c7b0ae519cbb33f08a5a878ce46c7e7.tar.gz |
Don't allow new reads in certain states KIKIMR-19739
-rw-r--r-- | ydb/core/tx/datashard/datashard__read_iterator.cpp | 2 | ||||
-rw-r--r-- | ydb/core/tx/datashard/datashard_impl.h | 6 |
2 files changed, 7 insertions, 1 deletions
diff --git a/ydb/core/tx/datashard/datashard__read_iterator.cpp b/ydb/core/tx/datashard/datashard__read_iterator.cpp index 12c3863bcc..bde44b4168 100644 --- a/ydb/core/tx/datashard/datashard__read_iterator.cpp +++ b/ydb/core/tx/datashard/datashard__read_iterator.cpp @@ -2545,7 +2545,7 @@ void TDataShard::Handle(TEvDataShard::TEvRead::TPtr& ev, const TActorContext& ct return; } - if (!IsStateActive()) { + if (!IsStateNewReadAllowed()) { replyWithError( Ydb::StatusIds::OVERLOADED, TStringBuilder() << "Shard " << TabletID() << " is splitting/merging"); diff --git a/ydb/core/tx/datashard/datashard_impl.h b/ydb/core/tx/datashard/datashard_impl.h index 9819649631..5ff3a5f3b0 100644 --- a/ydb/core/tx/datashard/datashard_impl.h +++ b/ydb/core/tx/datashard/datashard_impl.h @@ -1487,6 +1487,12 @@ public: State == TShardState::Frozen; } + bool IsStateNewReadAllowed() const { + return State == TShardState::Ready || + State == TShardState::Readonly || + State == TShardState::Frozen; + } + bool IsStateFrozen() const { return State == TShardState::Frozen; } |