Skip to content

Memgraph crashes when using unique constraints and periodic commit #3616

@Josipmrden

Description

@Josipmrden

Query:

USING PERIODIC COMMIT 10000
CALL migrate.neo4j
(
  'MATCH p=(m:M)-[r:O]->(d:D) WHERE d.d>=20251231 AND m.pi is not null RETURN m.pi as pi,properties(m) AS mp,d.d as d',
  { 
    host: "",
    port: 7687,
    username: "",
    password: ""
  }
)
YIELD row
MERGE (m:M {pi: row.pi})
SET m += row.mp
MERGE (d:D {d: row.d})
MERGE (m)-[:O]->(d);

Logs:

[2026-01-08 06:36:54.536] [memgraph_log] [critical]
Assertion failed in file /home/mg/memgraph/src/storage/v2/inmemory/storage.cpp at line 1068.
        Expression: 'is_transaction_active_'
        Message: 'The transaction is already terminated!'
[2026-01-08 06:36:54.538] [memgraph_log] [trace] Storage GC on 'memgraph' started [periodic]
[2026-01-08 06:36:54.538] [memgraph_log] [trace] Storage GC on 'memgraph' finished [periodic]. Duration: 0.000s
PeriodicCommit failed: Unable to commit due to constraint violation.

Version: 3.7.2 MAGE

Need to use unique constraint, and somehow execute periodic commit writing queries.

Reproduction steps:

  1. Run Memgraph MAGE (don't need to run Neo4j as the migrate.neo4j is compatible).
  2. Queries:
CREATE CONSTRAINT ON (n:Node) ASSERT n.id IS UNIQUE;

UNWIND range(1, 10000) as x
CREATE (:Node {id: x});

USING PERIODIC COMMIT 100
CALL migrate.neo4j("MATCH (n)RETURN n.id as nid, properties(n) as props_n", {host: "", password: ""})
YIELD row
CREATE (n:Node {id: row.nid})
SET n += row.props_n;

Metadata

Metadata

Assignees

Type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions