@@ -110,8 +110,8 @@ class SetCmd {
110
110
OpStatus SetExisting (const SetParams& params, DbSlice::Iterator it, DbSlice::ExpIterator e_it,
111
111
std::string_view key, std::string_view value);
112
112
113
- void AddNew (const SetParams& params, DbSlice::Iterator it, DbSlice::ExpIterator e_it ,
114
- std::string_view key, std::string_view value);
113
+ void AddNew (const SetParams& params, DbSlice::Iterator it, std::string_view key ,
114
+ std::string_view value);
115
115
116
116
// Called at the end of AddNew of SetExisting
117
117
void PostEdit (const SetParams& params, std::string_view key, std::string_view value,
@@ -846,7 +846,7 @@ OpStatus SetCmd::Set(const SetParams& params, string_view key, string_view value
846
846
847
847
return SetExisting (params, op_res->it , op_res->exp_it , key, value);
848
848
} else {
849
- AddNew (params, op_res->it , op_res-> exp_it , key, value);
849
+ AddNew (params, op_res->it , key, value);
850
850
return OpStatus::OK;
851
851
}
852
852
}
@@ -869,19 +869,6 @@ OpStatus SetCmd::SetExisting(const SetParams& params, DbSlice::Iterator it,
869
869
e_it->second = db_slice.FromAbsoluteTime (at_ms);
870
870
} else {
871
871
// Add new expiry information.
872
-
873
- // Note: some consistency checks, following #4672. Once it's resolved we can remove them.
874
- // -------------------------------------------------------------------------------------
875
- ExpireTable* etable = db_slice.GetTables (op_args_.db_cntx .db_index ).second ;
876
- ExpireIterator check_it = etable->Find (it->first .AsRef ());
877
- if (IsValid (check_it)) {
878
- LOG (ERROR) << " Inconsistent state in SetCmd::SetExisting "
879
- << " key: " << key << " , "
880
- << " it.key:" << it.key () << " , "
881
- << " it->first:" << it->first .ToString ()
882
- << " params.prev_val: " << params.prev_val << " " << params.flags ;
883
- }
884
- // ------------------------------------------------
885
872
db_slice.AddExpire (op_args_.db_cntx .db_index , it, at_ms);
886
873
}
887
874
} else {
@@ -893,6 +880,8 @@ OpStatus SetCmd::SetExisting(const SetParams& params, DbSlice::Iterator it,
893
880
it->first .SetSticky (true );
894
881
}
895
882
883
+ bool has_expire = prime_value.HasExpire ();
884
+
896
885
// Update flags
897
886
prime_value.SetFlag (params.memcache_flags != 0 );
898
887
db_slice.SetMCFlag (op_args_.db_cntx .db_index , it->first .AsRef (), params.memcache_flags );
@@ -905,12 +894,14 @@ OpStatus SetCmd::SetExisting(const SetParams& params, DbSlice::Iterator it,
905
894
// overwrite existing entry.
906
895
prime_value.SetString (value);
907
896
897
+ DCHECK_EQ (has_expire, prime_value.HasExpire ());
898
+
908
899
PostEdit (params, key, value, &prime_value);
909
900
return OpStatus::OK;
910
901
}
911
902
912
- void SetCmd::AddNew (const SetParams& params, DbSlice::Iterator it, DbSlice::ExpIterator e_it ,
913
- std::string_view key, std::string_view value) {
903
+ void SetCmd::AddNew (const SetParams& params, DbSlice::Iterator it, std::string_view key ,
904
+ std::string_view value) {
914
905
auto & db_slice = op_args_.GetDbSlice ();
915
906
916
907
// Adding new value.
0 commit comments