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

Unclear exception and wrong exceptions order #7538

Closed
PhantomYdn opened this issue Jul 9, 2017 · 4 comments
Closed

Unclear exception and wrong exceptions order #7538

PhantomYdn opened this issue Jul 9, 2017 · 4 comments
Assignees
Milestone

Comments

@PhantomYdn
Copy link
Contributor

OrientDB Version: 2.2.22

Java Version: 8+

I have the following SQL:

insert into Report from select sum(amount) as value, project, expedentureType as account from Payment group by project, expedentureType

Execution failed, but instead of meaningful exception I see the following:

$ANSI{green {db=Orienteer}} Exception `5067255D` in storage `Orienteer`
com.orientechnologies.orient.core.exception.OConfigurationException: Cannot undo the document because tracking of changes is disabled
	DB name="Orienteer"
	at com.orientechnologies.orient.core.record.impl.ODocument.undo(ODocument.java:1588)
	at com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx.save(ODatabaseDocumentTx.java:2740)
	at com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx.save(ODatabaseDocumentTx.java:102)
	at com.orientechnologies.orient.core.record.impl.ODocument.save(ODocument.java:1805)
	at com.orientechnologies.orient.core.record.impl.ODocument.save(ODocument.java:1796)
	at com.orientechnologies.orient.core.record.impl.ODocument.save(ODocument.java:63)
	at com.orientechnologies.orient.core.sql.OCommandExecutorSQLInsert.saveRecord(OCommandExecutorSQLInsert.java:330)
	at com.orientechnologies.orient.core.sql.OCommandExecutorSQLInsert.result(OCommandExecutorSQLInsert.java:289)
	at com.orientechnologies.orient.core.sql.OCommandExecutorSQLResultsetAbstract.pushResult(OCommandExecutorSQLResultsetAbstract.java:285)
	at com.orientechnologies.orient.core.sql.OCommandExecutorSQLResultsetAbstract.getResult(OCommandExecutorSQLResultsetAbstract.java:265)
	at com.orientechnologies.orient.core.sql.OCommandExecutorSQLSelect.execute(OCommandExecutorSQLSelect.java:495)
	at com.orientechnologies.orient.core.sql.OCommandExecutorSQLDelegate.execute(OCommandExecutorSQLDelegate.java:74)

By digging into the code I found a place where real exception is being lost:

//ODocument line 2737
    try {
      doc.validate();
    } catch (OValidationException ex) {
      doc.undo();
      throw ex;
    }

As you can see error during doc.undo() overriding real exception.
In my case validation error was about wrong type of a link for field account.
Please consider making original exception available for a user instead of secondary generated.

@tglman
Copy link
Member

tglman commented Jul 17, 2017

hi @PhantomYdn,

Do you have an example query that produce this issue ? I understood the problem and I'm aware of how to fix it, but I haven't reproduced it yet, I would prefer to have the test case with for the fix.

Regards.

@tglman
Copy link
Member

tglman commented Jul 17, 2017

hi @PhantomYdn,

I wrote the test, reproduced and fixed, it will be released with 2.2.24 and 3.0.0, closing this.

Regards

@tglman tglman closed this as completed Jul 17, 2017
@santo-it santo-it added this to the 2.2.24 milestone Jul 17, 2017
@marktshaw
Copy link

@luigidellaquila Has this been released? I'm not finding it any of the release notes. assuming that I didn't miss it.

Thanks!

@luigidellaquila
Copy link
Member

Hi @marktshaw

It was released with 2.2.24, probably it was not properly added to the release notes

Thanks

Luigi

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

No branches or pull requests

5 participants