LINKMAP reference is created in DEFAULT:cluster collection


The question is about creating documents referenced by LINKMAP type. I have two documents with 1:n reference. Everythigs works fine except that additional document describing reference is saved in CLUSTER:default collection and never deleted. It only happens when queries are executed in one transaction.

For example I have two classes created ‘Node’ and ‘Entity’ (first transaction):
OClass entityClass = orientDbSession.createClass(“Entity”);
entityClass.createProperty(“key”, OType.STRING).setMandatory(true).setNotNull(true);
nodeClass.createProperty(“key”, OType.STRING).setMandatory(true).setNotNull(true);
nodeClass.createProperty(“entities”, OType.LINKMAP, entityClass);
nodeClass.createIndex(“nodeKeyUniqueIndex”, OClass.INDEX_TYPE.UNIQUE_HASH_INDEX, “key”);

Now I add new node (second transaction):
orientDbSession.command("UPDATE Node SET key = “nodeKey1” UPSERT WHERE key = “nodeKey1”);

Then in the same transaction I add new Entity add point it to Node:
orientDbSession.command(“UPDATE Entity SET key = “entityKey1” UPSERT WHERE key = “entityKey1”);
OResultSet rs = orientDbSession.command(“SELECT @rid FROM Entity WHERE key = “entityKey1”);
ORecordId recordId =”@rid”);
orientDbSession.command("UPDATE Node SET entities[“entityKey1”] = recordId WHERE key = “nodeKey1”);

After that following query returns one record:
select * from cluster:default
Record looks like this: {“0”:“entityKey1”,“1”:"#12:0",“2”:“nodeKey1”}

This record is never deleted even if I’ll delete node and eneity records. This causes end of disk space after few weeks.

Is this work as designed? For me this is a defect.