JanusGraph/janusgraph

Rollback documentation and code inconsistency

Open

#1.077 aberto em 21 de mai. de 2018

Ver no GitHub
 (2 comments) (0 reactions) (0 assignees)Java (1.137 forks)batch import
Hacktoberfestarea/docshelp wanted

Métricas do repositório

Stars
 (4.985 stars)
Métricas de merge de PR
 (Mesclagem média 3d 18h) (12 fundiu PRs em 30d)

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.

Guia do colaborador