@@ -1169,18 +1169,21 @@ DbSlice::PrimeItAndExp DbSlice::ExpireIfNeeded(const Context& cntx, PrimeIterato
11691169 auto & db = db_arr_[cntx.db_index ];
11701170 auto expire_it = db->expire .Find (it->first );
11711171
1172- if (IsValid (expire_it) || !shard_owner ()->shard_lock ()->Check (IntentLock::Mode::EXCLUSIVE)) {
1173- // TODO: to employ multi-generation update of expire-base and the underlying values.
1174- time_t expire_time = ExpireTime (expire_it);
1175-
1176- // Never do expiration on replica or if expiration is disabled.
1177- if (time_t (cntx.time_now_ms ) < expire_time || owner_->IsReplica () || !expire_allowed_)
1178- return {it, expire_it};
1179- } else {
1172+ if (!IsValid (expire_it)) {
11801173 LOG (DFATAL) << " Internal error, entry " << it->first .ToString ()
11811174 << " not found in expire table, db_index: " << cntx.db_index
11821175 << " , expire table size: " << db->expire .size ()
11831176 << " , prime table size: " << db->prime .size () << util::fb2::GetStacktrace ();
1177+ return {it, ExpireIterator{}};
1178+ }
1179+
1180+ // TODO: to employ multi-generation update of expire-base and the underlying values.
1181+ time_t expire_time = ExpireTime (expire_it);
1182+
1183+ // Never do expiration on replica or if expiration is disabled or global lock was taken.
1184+ if (time_t (cntx.time_now_ms ) < expire_time || owner_->IsReplica () || !expire_allowed_ ||
1185+ !shard_owner ()->shard_lock ()->Check (IntentLock::Mode::EXCLUSIVE)) {
1186+ return {it, expire_it};
11841187 }
11851188
11861189 string scratch;
0 commit comments