JanusGraph/janusgraph

Rollback documentation and code inconsistency

开放

#1,077 创建于 2018年5月21日

 (2 条评论) (0 个反应) (0 位负责人)Java (1,137 个派生)batch import
Hacktoberfestarea/docshelp wanted

仓库指标

星标
 (4,985 个星标)
PR 合并指标
 (PR 指标待抓取)

描述

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.

贡献者指南