mirror of
https://github.com/dragonflydb/dragonfly.git
synced 2025-05-10 18:05:44 +02:00
fix: HNSW schema deleting document crash (#4987)
fixed: https://github.com/dragonflydb/dragonfly/issues/4979
This commit is contained in:
parent
5ea3070abf
commit
2128eb31c9
2 changed files with 16 additions and 1 deletions
|
@ -281,7 +281,10 @@ struct HnswlibAdapter {
|
|||
}
|
||||
|
||||
void Remove(DocId id) {
|
||||
world_.markDelete(id);
|
||||
try {
|
||||
world_.markDelete(id);
|
||||
} catch (const std::exception& e) {
|
||||
}
|
||||
}
|
||||
|
||||
vector<pair<float, DocId>> Knn(float* target, size_t k, std::optional<size_t> ef) {
|
||||
|
|
|
@ -2722,6 +2722,18 @@ TEST_F(SearchFamilyTest, JsonWithNullFields) {
|
|||
AreDocIds("doc:1", "doc:2"));
|
||||
}
|
||||
|
||||
TEST_F(SearchFamilyTest, TestHsetDeleteDocumentHnswSchemaCrash) {
|
||||
EXPECT_EQ(Run({"FT.CREATE", "idx", "SCHEMA", "n", "NUMERIC", "v", "VECTOR", "HNSW", "8", "TYPE",
|
||||
"FLOAT16", "DIM", "4", "DISTANCE_METRIC", "L2", "M", "65536"}),
|
||||
"OK");
|
||||
|
||||
auto res = Run({"HSET", "doc", "n", "0"});
|
||||
EXPECT_EQ(res, 1);
|
||||
|
||||
res = Run({"DEL", "doc"});
|
||||
EXPECT_EQ(res, 1);
|
||||
}
|
||||
|
||||
TEST_F(SearchFamilyTest, RenameDocumentBetweenIndices) {
|
||||
absl::FlagSaver fs;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue