imbajin commented on issue #2742:
URL: 
https://github.com/apache/incubator-hugegraph/issues/2742#issuecomment-2702688227

   > In HugeGraph, when using the memory backend, the default behavior for 
handling duplicate entries is to merge columns if the entry already exists. 
This means that if you attempt to insert a vertex with a duplicate primary key, 
the system will not throw an exception but will instead merge the new entry 
with the existing one. This is why your test case is passing without an error, 
and only one vertex is present in the result 
[[1]](https://github.com/apache/incubator-hugegraph/blob/master/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/memory/InMemoryDBTable.java?rgh-link-date=2025-03-05T12%3A19%3A20.000Z).
   > 
   > Currently, there is no configuration option available to change this 
default behavior of merging entries in the memory backend 
[[1]](https://github.com/apache/incubator-hugegraph/blob/master/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/memory/InMemoryDBTable.java?rgh-link-date=2025-03-05T12%3A19%3A20.000Z).
 If you require different behavior, such as throwing an exception for duplicate 
primary keys, you might need to implement custom logic or consider using a 
different backend that supports such a feature.
   > 
   > _To continue talking to [Dosu](https://dosu.dev), mention 
[@dosu](https://github.com/dosu?rgh-link-date=2025-03-05T12%3A19%3A20.000Z)._
   > 
   > Help Dosu learn! Give it feedback: [Great 
Response](https://app.dosu.dev/response-feedback/d4d106cf-3884-410f-b894-a03ab5b91eb3?feedback_type=great_response)
 | [Irrelevant 
Answer](https://app.dosu.dev/response-feedback/d4d106cf-3884-410f-b894-a03ab5b91eb3?feedback_type=irrelevant_answer)
 | [Incorrect 
Sources](https://app.dosu.dev/response-feedback/d4d106cf-3884-410f-b894-a03ab5b91eb3?feedback_type=incorrect_sources)
 | [Too 
Verbose](https://app.dosu.dev/response-feedback/d4d106cf-3884-410f-b894-a03ab5b91eb3?feedback_type=too_verbose)
 | 
[Hallucination](https://app.dosu.dev/response-feedback/d4d106cf-3884-410f-b894-a03ab5b91eb3?feedback_type=hallucination)
 | [Bug 
Report](https://app.dosu.dev/response-feedback/d4d106cf-3884-410f-b894-a03ab5b91eb3?feedback_type=bug_report)
 | 
[Other](https://app.dosu.dev/response-feedback/d4d106cf-3884-410f-b894-a03ab5b91eb3?feedback_type=other)
   
   @mkj-git @dosu (All backends have the same logic, not only the `memory`)
   
   In HG's design, the primary key mode does not mean that the key cannot be 
duplicated. The fundamental reason is that in LSM trees, there is only the 
concept of 'append' without updating, which results in much faster write 
performance (without the need to read it again) 
   
   So by default, the same vid/id will be overwritten instead of reporting an 
error. If you need a unique constraint, we support a unique index to achieve 
this effect. If you need to update, we have separate single point and batch 
update interfaces that can meet your needs


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to