mirror of
https://github.com/dragonflydb/dragonfly.git
synced 2025-05-10 18:05:44 +02:00
fix: RENAME in cluster mode crash (#4995)
fixed: https://github.com/dragonflydb/dragonfly/issues/4993
This commit is contained in:
parent
0f415acb81
commit
aa7e8abcb6
2 changed files with 22 additions and 0 deletions
|
@ -870,6 +870,9 @@ OpResult<void> OpRen(const OpArgs& op_args, string_view from_key, string_view to
|
|||
is_prior_list = (to_res.it->second.ObjType() == OBJ_LIST);
|
||||
}
|
||||
|
||||
// Delete the "from" document from the search index before deleting from the database
|
||||
op_args.shard->search_indices()->RemoveDoc(from_key, op_args.db_cntx, from_res.it->second);
|
||||
|
||||
bool sticky = from_res.it->first.IsSticky();
|
||||
uint64_t exp_ts = db_slice.ExpireTime(from_res.exp_it);
|
||||
|
||||
|
|
|
@ -2722,4 +2722,23 @@ TEST_F(SearchFamilyTest, JsonWithNullFields) {
|
|||
AreDocIds("doc:1", "doc:2"));
|
||||
}
|
||||
|
||||
TEST_F(SearchFamilyTest, RenameDocumentBetweenIndices) {
|
||||
absl::FlagSaver fs;
|
||||
|
||||
SetTestFlag("cluster_mode", "emulated");
|
||||
ResetService();
|
||||
|
||||
EXPECT_EQ(Run({"ft.create", "idx1", "prefix", "1", "idx1", "filter", "@index==\"yes\"", "schema",
|
||||
"t", "text"}),
|
||||
"OK");
|
||||
EXPECT_EQ(Run({"ft.create", "idx2", "prefix", "1", "idx2", "filter", "@index==\"yes\"", "schema",
|
||||
"t", "text"}),
|
||||
"OK");
|
||||
|
||||
Run({"hset", "idx1:{doc}1", "t", "foo1", "index", "yes"});
|
||||
|
||||
EXPECT_EQ(Run({"rename", "idx1:{doc}1", "idx2:{doc}1"}), "OK");
|
||||
EXPECT_EQ(Run({"rename", "idx2:{doc}1", "idx1:{doc}1"}), "OK");
|
||||
}
|
||||
|
||||
} // namespace dfly
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue