Hi there,

Sorry if this has been asked before but what is the proper way to handle a 
DuplicateKey exception when using the following TinkerPop API to add a new 
Vertex?

Vertex server = traversal.V().hasLabel("Servers")
        .has("name", serverId)
        .tryNext().orElseGet(
                () -> traversal.addV(T.label, "Servers", "name", 
serverId).next());

I have multiple processes running trying to insert data in the database but 
sometimes this fails cause as I suspect (can be wrong) an insert is attempted 
but an insert has been made already by a different process.
I am bulk-loading concurrently a bunch of data, per process insertion is done 
in serial form (that is one record at a time aka no multiple threads)  and each 
process share different subset of data. It just happen to kick them both  at 
the same time with an empty database beforehand.

In particular I am getting the following exception
com.orientechnologies.orient.core.storage.ORecordDuplicatedException: Cannot 
index record Servers{name:server1}: found duplicated key 'server1' in index 
'Servers.name' previously assigned to the record #34:0

I am just getting started with TinkerPop3 API and using the M1 release of 
OrientDB (orientdb-community-tp3-3.0.0m1) for experimentation.

Thank you in advance.

-
Christos



-- 

--- 
You received this message because you are subscribed to the Google Groups 
"OrientDB" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to