JanusGraph/janusgraph

updateIndex() should make error cases easier to understand

オープン

#1,378 opened on 2019/01/14

 (0 件のコメント) (0 件のリアクション) (0 人の担当者)Java (1,137 件のフォーク)batch import
help wantedkind/enhancement

Repository metrics

Stars
 (4,985 個のスター)
PR merge metrics
 (平均マージ 3d 18h) (30d で 12 merged PRs)

説明

ManagementSystem.updateIndex() returns null if the provided SchemaAction is not applicable for the current status of the index:

if (!updateAction.isApplicableStatus(schemaVertex.getStatus()))
    return null;

Source

This is confusing and the API docs also don't mention this behaviour:

/**
 * Updates the provided index according to the given {@link SchemaAction}
 *
 * @param index
 * @param updateAction
 * @return a future that completes when the index action is done
 */
IndexJobFuture updateIndex(Index index, SchemaAction updateAction);

The method should either throw an exception in this case or at least document this behaviour in the API docs.

When a user doesn't know about this behaviour, then all they're getting is a NullPointerException by calling get() on the returned IndexJobFuture (see #1359).

コントリビューターガイド