Skip to content

Commit

Permalink
improve
Browse files Browse the repository at this point in the history
Change-Id: I57331425089e18582f5938536c5026e703ce34c6
  • Loading branch information
zhoney committed Oct 27, 2020
1 parent e81ea88 commit 381aefe
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,11 @@
import com.baidu.hugegraph.schema.EdgeLabel;
import com.baidu.hugegraph.schema.IndexLabel;
import com.baidu.hugegraph.schema.PropertyKey;
import com.baidu.hugegraph.schema.SchemaElement;
import com.baidu.hugegraph.schema.VertexLabel;
import com.baidu.hugegraph.type.HugeType;
import com.baidu.hugegraph.type.define.GraphMode;
import com.baidu.hugegraph.type.define.SchemaStatus;
import com.baidu.hugegraph.util.E;
import com.baidu.hugegraph.util.LockUtil;

Expand Down Expand Up @@ -77,6 +79,11 @@ protected <V> V lockCheckAndCreateSchema(HugeType type, String name,
}
}

protected void updateSchemaStatus(SchemaElement element,
SchemaStatus status) {
this.transaction.updateSchemaStatus(element, status);
}

protected void checkSchemaIdIfRestoringMode(HugeType type, Id id) {
if (this.transaction.graphMode() == GraphMode.RESTORING) {
E.checkArgument(id != null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -231,8 +231,7 @@ public IndexLabel.CreatedIndexLabel createWithTask() {
return new IndexLabel.CreatedIndexLabel(indexLabel,
rebuildTask);
} catch (Throwable e) {
indexLabel.status(SchemaStatus.INVALID);
this.graph().addIndexLabel(schemaLabel, indexLabel);
this.updateSchemaStatus(indexLabel, SchemaStatus.INVALID);
throw e;
}
});
Expand Down

0 comments on commit 381aefe

Please sign in to comment.