Skip to content

Commit

Permalink
debug exist index label
Browse files Browse the repository at this point in the history
Change-Id: Iecce2bd9482a136b85cdca9f01615a701fcf1af9
  • Loading branch information
javeme committed Jan 10, 2022
1 parent 28a450d commit 783a9c6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@

public abstract class AbstractBuilder {

private final SchemaTransaction transaction;
protected final SchemaTransaction transaction;
private final HugeGraph graph;

public AbstractBuilder(SchemaTransaction transaction, HugeGraph graph) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
import com.baidu.hugegraph.schema.SchemaLabel;
import com.baidu.hugegraph.schema.Userdata;
import com.baidu.hugegraph.schema.VertexLabel;
import com.baidu.hugegraph.testutil.Whitebox;
import com.baidu.hugegraph.type.HugeType;
import com.baidu.hugegraph.type.define.Action;
import com.baidu.hugegraph.type.define.CollectionType;
Expand Down Expand Up @@ -182,10 +183,19 @@ public SchemaElement.TaskWithSchema createWithTask() {
this.checkSchemaName(this.name);

return this.lockCheckAndCreateSchema(type, this.name, name -> {
Id prefixedName = IdGenerator.of(type.string()
+ "-" + name);
Object cache = Whitebox.invoke(this.transaction, "nameCache", new Class[]{Object.class},
"get", prefixedName);
IndexLabel indexLabel = this.indexLabelOrNull(name);
if (indexLabel != null) {
if (this.checkExist || !hasSameProperties(indexLabel)) {
throw new ExistedException(type, name);
Whitebox.invoke(this.transaction, "nameCache", new Class[]{Object.class},
"invalidate", prefixedName);
IndexLabel indexLabel2 = this.indexLabelOrNull(name);
throw new ExistedException(type, name +
" cache-before-invalidate="+cache+
",indexLabel-after-invalidate="+indexLabel2);
}
return new SchemaElement.TaskWithSchema(indexLabel,
IdGenerator.ZERO);
Expand Down

0 comments on commit 783a9c6

Please sign in to comment.