You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
The issue happens when vertices and edges are created in IN_MEMORY_ANALYTICAL mode. The vertices and edges will be created and added to the skip list correctly, however when we try to delete these objects, they will be flagged for deletion as they should. Unfortunately the way analytical mode and garbage collection works at the moment, the GC will not be able to pick up the "deleted" objects and actually remove them from the skip list. This will clog up the skip list over time.
Under the hood, the way the deletion of skip list related objects is handled is that instead of actually deleting these object from memory, we just "mark" them as deleted objects. The garbage collector runs periodically, or we can force-call it by calling the FREE MEMORY query. Its job is to take care of the "marked" objects, un-link and delete them. The way this "marking" works is that the bool flag, deleted, is set to true for the given object, and it also involves the delta-chain of the transaction. This is problematic, because the way ANALYTICAL storage mode is implemented, these operations on transactions are almost always a no-op. When the garbage collector runs, the way it checks for the "marked" objects is by traversing the committed transactions, which will be an empty list in ANALYTICAL mode, so nothing is actually removed during garbage collection. There is an interesting occurrence here, in ANALYTICAL mode the delta-chain of the transaction is not modified, but the boolean flag of the vertex is set. So after deleting the vertices, running the query MATCH (n) RETURN COUNT (*) returns 0, but checking the number of vertices through SHOW STORAGE INFO is unchanged.
To Reproduce
Steps to reproduce the behavior:
Set the database into analytical mode STORAGE MODE IN_MEMORY_ANALYTICAL;
Create a couple of objects, CREATE (n:NODE{id:1}), (m:NODE{id:2}), (k:NODE{id:3});
Delete the objects MATCH (n) DETACH DELETE (n);
Force call the garbage collector FREE MEMORY;
Check if the vertices have been removed or not with SHOW STORAGE INFO;
after step 5 you should be seeing that the objects have not been removed in analytical mode. They are flaged as "deleted", but they are still in the skip list.
The text was updated successfully, but these errors were encountered:
gitbuda
changed the title
[Vertices and edges created with analytical mode can not be picked up by the GC when deleted]
GC doesn't work properly in the ANALYTICAL MODEJun 7, 2023
Memgraph version
2.8
Describe the bug
The issue happens when vertices and edges are created in
IN_MEMORY_ANALYTICAL
mode. The vertices and edges will be created and added to the skip list correctly, however when we try to delete these objects, they will be flagged for deletion as they should. Unfortunately the way analytical mode and garbage collection works at the moment, the GC will not be able to pick up the "deleted" objects and actually remove them from the skip list. This will clog up the skip list over time.Under the hood, the way the deletion of skip list related objects is handled is that instead of actually deleting these object from memory, we just "mark" them as deleted objects. The garbage collector runs periodically, or we can force-call it by calling the
FREE MEMORY
query. Its job is to take care of the "marked" objects, un-link and delete them. The way this "marking" works is that thebool
flag, deleted, is set to true for the given object, and it also involves the delta-chain of the transaction. This is problematic, because the wayANALYTICAL
storage mode is implemented, these operations on transactions are almost always a no-op. When the garbage collector runs, the way it checks for the "marked" objects is by traversing the committed transactions, which will be an empty list in ANALYTICAL mode, so nothing is actually removed during garbage collection. There is an interesting occurrence here, in ANALYTICAL mode the delta-chain of the transaction is not modified, but the boolean flag of the vertex is set. So after deleting the vertices, running the query MATCH (n) RETURN COUNT (*) returns 0, but checking the number of vertices through SHOW STORAGE INFO is unchanged.To Reproduce
Steps to reproduce the behavior:
STORAGE MODE IN_MEMORY_ANALYTICAL;
CREATE (n:NODE{id:1}), (m:NODE{id:2}), (k:NODE{id:3});
MATCH (n) DETACH DELETE (n);
FREE MEMORY;
SHOW STORAGE INFO;
after step 5 you should be seeing that the objects have not been removed in analytical mode. They are flaged as "deleted", but they are still in the skip list.
The text was updated successfully, but these errors were encountered: