From d4bd1c5e60f9fa139c58a05a44aab96a765fd234 Mon Sep 17 00:00:00 2001 From: Andrew Kryczka Date: Wed, 20 Mar 2024 14:18:51 -0700 Subject: [PATCH] replayGetContextLog status handling --- db/table_cache.cc | 3 ++- table/get_context.cc | 11 +++++++---- table/get_context.h | 8 ++++---- 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/db/table_cache.cc b/db/table_cache.cc index 13cbbe584189..d3728e86dc4d 100644 --- a/db/table_cache.cc +++ b/db/table_cache.cc @@ -415,7 +415,8 @@ bool TableCache::GetFromRowCache(const Slice& user_key, IterKey& row_cache_key, // If row cache hit, knowing cache key is the same to row_cache_key, // can use row_cache_key's seq no to construct InternalKey. replayGetContextLog(*row_cache.Value(row_handle), user_key, get_context, - &value_pinner, seq_no); + &value_pinner, seq_no) + .PermitUncheckedError(); // TODO RecordTick(ioptions_.stats, ROW_CACHE_HIT); found = true; } else { diff --git a/table/get_context.cc b/table/get_context.cc index 68c0c53cc15e..763bd8d197e8 100644 --- a/table/get_context.cc +++ b/table/get_context.cc @@ -577,9 +577,9 @@ void GetContext::push_operand(const Slice& value, Cleanable* value_pinner) { } } -void replayGetContextLog(const Slice& replay_log, const Slice& user_key, - GetContext* get_context, Cleanable* value_pinner, - SequenceNumber seq_no) { +Status replayGetContextLog(const Slice& replay_log, const Slice& user_key, + GetContext* get_context, Cleanable* value_pinner, + SequenceNumber seq_no) { Slice s = replay_log; Slice ts; size_t ts_sz = get_context->TimestampSize(); @@ -612,8 +612,11 @@ void replayGetContextLog(const Slice& replay_log, const Slice& user_key, Status read_status; get_context->SaveValue(ikey, value, &dont_care, &read_status, value_pinner); - read_status.PermitUncheckedError(); // TODO + if (!read_status.ok()) { + return read_status; + } } + return Status::OK(); } } // namespace ROCKSDB_NAMESPACE diff --git a/table/get_context.h b/table/get_context.h index 2b48d0a56ee9..ada479001c92 100644 --- a/table/get_context.h +++ b/table/get_context.h @@ -251,9 +251,9 @@ class GetContext { // Call this to replay a log and bring the get_context up to date. The replay // log must have been created by another GetContext object, whose replay log // must have been set by calling GetContext::SetReplayLog(). -void replayGetContextLog(const Slice& replay_log, const Slice& user_key, - GetContext* get_context, - Cleanable* value_pinner = nullptr, - SequenceNumber seq_no = kMaxSequenceNumber); +Status replayGetContextLog(const Slice& replay_log, const Slice& user_key, + GetContext* get_context, + Cleanable* value_pinner = nullptr, + SequenceNumber seq_no = kMaxSequenceNumber); } // namespace ROCKSDB_NAMESPACE