JanusGraph / JanusGraph/janusgraph

Rollback documentation and code inconsistency

Open
#1,077 2 comments 0 reactions 0 assignees View on GitHub
area/docs Hacktoberfest help wanted
Dominant language
Java
Stars
5.8k
Forks
1.2k
Avg merge
13h 53m
Merged PRs (30d)
6

Description

There is a sentence in the transactions' documentation:
> If a commit() transactions fails, it should be terminated manually with rollback() after catching the failure.

And there is a code of `commit()` implementation:
```
try {
if (this.hasModifications()) {
this.graph.commit(this.addedRelations.getAll(), this.deletedRelations.values(), this);
} else {
this.txHandle.commit();
}

success = true;
} catch (Exception var9) {
try {
this.txHandle.rollback();
} catch (BackendException var8) {
throw new JanusGraphException("Could not rollback after a failed commit", var9);
}

throw new JanusGraphException("Could not commit transaction due to exception during persistence", var9);
}
```
As I see here, the `rollback()` is called if `commit()` is failed.
I think that the documentation should say:
`If a commit() transactions fails, it will be terminated automatically with rollback()`
or something like that. Maybe some clarification should be put there.

Contributor guide

Open the contributing guide

Research direction

Start with the transactions documentation sentence and the commit() implementation shown in the issue. Confirm the documented behavior against the implementation, then revise the transaction guidance so it accurately describes failure handling; it is done when the documentation is consistent and clear.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
documentation
Issue type
Documentation
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.