Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Strange transaction (Tx) behaviour for edges created within a Tx #8444

Closed
creisle opened this issue Jul 31, 2018 · 7 comments
Closed

Strange transaction (Tx) behaviour for edges created within a Tx #8444

creisle opened this issue Jul 31, 2018 · 7 comments
Assignees
Labels
Milestone

Comments

@creisle
Copy link

creisle commented Jul 31, 2018

OrientDB Version: 2.2.36 (also 3.0.4)

Java Version: 1.8.0_151

OS: centos07

Expected behavior

Expected the transaction to succeed.

Actual behavior

Works when not using the let statements inside a transaction. Does not work within a transaction. It appears to take issue with using the result assigned to a LET after edge creation in a subsequent statement

Steps to reproduce

create a new database

create property E.history link
create property V.history link

In the console attempt to perform the following transaction

script sql
BEGIN
    LET src = create vertex v set name = 'alice'
    LET tgt = create vertex v set name = 'bob'
    LET e1  = create edge e from $src to $tgt
    LET e2 = create edge e from $tgt to $src set history = $e1
COMMIT
end

you will see the following error

Error: com.orientechnologies.orient.core.exception.OValidationException: The field 'E.history' has been declared as LINK but the value is not a record or a record-id
	DB name="test_tx"
	DB name="test_tx"

However if you do the same thing without the transaction it works (18:0 is another edge and 9:0/12:0 are vertices)

create edge from #9:0 to #12:0 set name = 'manual second', history = #18:0 
@mbhulin
Copy link

mbhulin commented Sep 17, 2018

I have the same problem. However I get other error messages. When I run the script above with console I get this result:

orientdb> script sql
BEGIN
LET src = create vertex v set name = 'alice'
LET tgt = create vertex v set name = 'bob'
LET e1 = create edge e from $src to $tgt
LET e2 = create edge e from $tgt to $src set history = $e1
COMMIT
END
[Started multi-line command. Type just 'end' to finish and execute]

Error: java.lang.StringIndexOutOfBoundsException: String index out of range: -1

Error: java.lang.ClassCastException: com.orientechnologies.orient.core.tx.OTransactionNoTx cannot be cast to com.orientechnologies.orient.core.db.document.OTransactionOptimisticClient

Error: com.orientechnologies.orient.core.sql.OCommandSQLParsingException: Error parsing query:

Encountered " "BEGIN "" at line 1, column 1.
Was expecting one of:
<WHILE> ...
<IF> ...
<FOREACH> ...
";" ...

    DB name="DABS_01"
    Error Code="1"
    DB name="DABS_01"

Error: com.orientechnologies.orient.core.sql.OCommandSQLParsingException: Error parsing query:

Encountered " "BEGIN "" at line 1, column 1.
Was expecting one of:
<WHILE> ...
<IF> ...
<FOREACH> ...
";" ...

    DB name="DABS_01"
    Error Code="1"
    DB name="DABS_01"

...

@luigidellaquila
Copy link
Member

Hi

I think it's two different problems:

@mbhulin in your case you need a semicolon after each statement (I guess you are on v 3.0).

@creisle the tx problem could be related to something I fixed recentrly on v 3.0, anyway I'm checking it and I'll let you know asap

Thanks

Luigi

@mbhulin
Copy link

mbhulin commented Sep 17, 2018

Hi Luigi,

thank you for your answer. However I get the same error message with semicolons (I tried this first). All works fine with version 2.2.27, however I get the error mentioned above with version 3.0.7. See also issue #8419 with the same error message.

Martin

@luigidellaquila
Copy link
Member

Hi @creisle

I found and fixed the problem, the fix is already on 3.0.x branch and will be released with v 3.0.8

Thanks

Luigi

@luigidellaquila
Copy link
Member

Hi @mbhulin

probably the problem is with the CLI console (in Studio it seems to work fine), I'm checking it

Thanks

Luigi

@creisle
Copy link
Author

creisle commented Sep 18, 2018

thanks @luigidellaquila!

@mbhulin
Copy link

mbhulin commented Oct 10, 2018

Hi Luigi,

unfortunately the error is still present in 3.0.8 when executing a SQL-script in Console. It works fine when using the batch-mode in Studio.

Martin

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

3 participants