xar.zax
(Xar Zax)
March 31, 2024, 6:54pm
1
Hello guys,
public void rollbackTest()
{
final Driver driver = ...;
final String cypherQuery = "CALL gds.beta.pipeline.linkPrediction.create('pipe');";
try (final Session session = driver.session())
{
final Transaction transaction = session.beginTransaction();
transaction.run(cypherQuery);
transaction.rollback();
}
catch (final Exception e)
{
e.printStackTrace();
}
}
after executing this code the transaction doesn't rollback, when i manually execute
CALL gds.pipeline.list
the pipeline is added on the catalog. Does anybody have a clue?
Another way to rollback is to auto-close the transaction without committing it:
public void rollbackTest()
{
final Driver driver = ...;
final String cypherQuery = "CALL gds.beta.pipeline.linkPrediction.create('pipe');";
try (final Session session = driver.session();
final Transaction transaction = session.beginTransaction())
{
transaction.run(cypherQuery);
}
catch (final Exception e)
{
e.printStackTrace();
}
}
xar.zax
(Xar Zax)
April 3, 2024, 10:27am
4
Thanks for the reply, the output is still the same. Seems like there is no rollback for graph algorithms.
Ah yes, sorry. It depends on what the procedure is doing.
It may spawn its own transaction, for which you will indeed have no control.
The procedure in question writes directly into a static map when invoked. There is no transactional interaction with the database itself.
Using procedures that interacts with the database, using the ongoing transaction, will respect the rollback.
If you're ok with it, this question can/should be moved into the GDS sub-forum.