apache / apache/age

Error is reported when concurrently merging nodes/edges

Open
#2,179 3 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
C
Stars
4.8k
Forks
523
Avg merge
1d 2h
Merged PRs (30d)
9

Description

**Describe the bug**
When multiple clients perform merge edges concurrently, there is error reported, "sequence already exists", or "relation already exists".
Here is my code:

Image

I try to fix this issue in this PR: https://github.com/apache/age/pull/2178. But the issue still exists.

**How are you accessing AGE (Command line, driver, etc.)?**
- python driver

**What data setup do we need to do?**

**What is the necessary configuration info needed?**
- [e.g. Installed PostGIS]

**What is the command that caused the error?**
```python

cq = f"""
--
  | MATCH (source:{source_node_label} {{doc_id:'{doc_id}'}})
  | MATCH (target:{target_node_label} {{doc_id:'{doc_id}'}})
  | WITH source, target
  | MERGE (source)-[r:DIRECTED]->(target)
  | SET {set_properties}
  | RETURN r
  | """
  | query = sql.SQL(
  | f"SELECT * FROM cypher('{self.graph_name}', $$ {cq} $$) as (result agtype)"
  | )

```
Error message is:
```
Key (relname, relnamespace)=(DIRECTED_id_seq, 42609) already exists.
```
Or
```
relation "DIRECTED" already exists
```

**Expected behavior**
A clear and concise description of what you expected to happen.

**Environment (please complete the following information):**
- Version: [e.g. 0.4.0]

**Additional context**
Add any other context about the problem here.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.