Well, the latest on this thread is that things work fine when I am
INSERTing data that does not already exist, and it fails when I try to
UPDATE data that does exist. I'm using a Javascript function to do the
work, and I'm providing a single string (a JSON data payload as a single
record in string format) as an input parameter (param name = "data"). Here
is the part of the function that is failing. Perhaps someone can tell me
what I'm doing wrong. (By the way, I have a UNIQUE_HASH_INDEX on Id).
var cmd;
var result;
var dataJson = JSON.parse(data);
var srcId = dataJson["Id"];
devlogInfo("srcId=" + srcId);
try {
// Before doing anything else, persist the input document
if (vertexExistsInClass("Account", srcId)) {
// The vertex already exists, so this becomes an UPDATE operation
cmd = "UPDATE Account CONTENT " + data + " WHERE Id = '" + srcId + "'"
;
devlogInfo(cmd);
db.begin();
result = db.command(cmd); // <== THIS OPERATION PRODUCES WHAT ACTS
LIKE AN UNRECOVERABLE DEADLOCK, REQUIRING SERVER SHUTDOWN/RESTART
} else {
devlogInfo("CREATED VERTEX, Id = " + srcId);
db.begin();
result = db.save(data); // <== THIS OPERATION WORKS GREAT
}
// Proceed with creation of Edges going out from this vertex, including
creation of destination vertices if needed.
By replacing that code with the following, I am no longer seeing the
deadlock.
// Before doing anything else, persist the input document
cmd = "UPDATE Client CONTENT " + data + " UPSERT WHERE Id = '" + srcId +
"'";
result = db.command(cmd);
Now, I have a result object, but because it is an UPDATE command, I can't
get the RID out of the response object. Is there an easy way to do that in
Javascript? With the RID, I should be able to query for the RID of the
destination vertex and then make a call to determine whether or not an edge
between the two nodes exists.
Does anyone have javascript code handy that does that efficiently?
Thanks,
Patrick
On Wednesday, April 1, 2015 at 5:55:28 AM UTC-6, Emanuele wrote:
>
> Be aware that we have another thread that read on the same channel for
> handle the push request, that main thread is parked there waiting that the
> Async client thread get the data from the network, understand that it's
> not is data, an give it back to the main thread.
>
> so no deadlock there ;)
>
>
> On 30/03/15 21:02, Patrick Hoeffel wrote:
>
>
> <https://lh3.googleusercontent.com/-ebTSvLLuih4/VRmrhCh1nCI/AAAAAAAAQ3c/JYGQAngQ8dg/s1600/OrientDB%2BDeadlock.PNG>
> OrientDB 2.0.5 on Windows Server 2012, client connecting from Win 7 Pro
>
> I have a Java class that is inserting a vertex and then adding outbound
> edges. I'm doing queries to figure out what intermediate data needs to also
> be created in order for my edges to be built properly, but something is
> causing a deadlock, and I can only get it to clear by restarting OrientDB.
> Here is the stack trace from Eclipse when this happens:
>
> If anyone has seen this before, please let me know.
>
> Thanks,
>
> Patrick
> --
>
> ---
> 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] <javascript:>.
> For more options, visit https://groups.google.com/d/optout.
>
>
>
--
---
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.