Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support unique index #636

Merged
merged 7 commits into from
Aug 19, 2019
Merged

support unique index #636

merged 7 commits into from
Aug 19, 2019

Conversation

zhoney
Copy link
Contributor

@zhoney zhoney commented Aug 11, 2019

implemented: #633

Change-Id: I753a81d0d47b0d7979563d5a9f41d368e06a5b33

@codecov
Copy link

codecov bot commented Aug 12, 2019

Codecov Report

Merging #636 into master will increase coverage by 0.18%.
The diff coverage is 88.59%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master     #636      +/-   ##
============================================
+ Coverage     72.17%   72.35%   +0.18%     
- Complexity     3740     3780      +40     
============================================
  Files           218      218              
  Lines         17334    17420      +86     
  Branches       2447     2462      +15     
============================================
+ Hits          12510    12604      +94     
+ Misses         3530     3521       -9     
- Partials       1294     1295       +1
Impacted Files Coverage Δ Complexity Δ
.../hugegraph/backend/serializer/TableSerializer.java 81.34% <ø> (ø) 52 <0> (ø) ⬇️
...in/java/com/baidu/hugegraph/schema/IndexLabel.java 69.11% <ø> (ø) 25 <0> (ø) ⬇️
...hugegraph/backend/serializer/BinarySerializer.java 81.01% <0%> (-0.15%) 100 <0> (+1)
...raph/backend/store/rocksdbsst/RocksDBSstStore.java 0% <0%> (ø) 0 <0> (ø) ⬇️
...idu/hugegraph/backend/store/hbase/HbaseTables.java 88.57% <100%> (+0.33%) 0 <0> (ø) ⬇️
...ackend/store/cassandra/CassandraStoreProvider.java 100% <100%> (ø) 6 <1> (ø) ⬇️
...aidu/hugegraph/backend/store/mysql/MysqlStore.java 79.21% <100%> (+0.11%) 37 <0> (ø) ⬇️
...kend/store/postgresql/PostgresqlStoreProvider.java 92.1% <100%> (+0.21%) 5 <1> (ø) ⬇️
...hugegraph/backend/store/rocksdb/RocksDBTables.java 68.33% <100%> (+0.81%) 0 <0> (ø) ⬇️
...du/hugegraph/schema/builder/IndexLabelBuilder.java 87.8% <100%> (+0.94%) 85 <3> (+8) ⬆️
... and 24 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2147625...b777c76. Read the comment docs.

query.eq(HugeKeys.INDEX_LABEL_ID, indexLabel.id());
query.eq(HugeKeys.FIELD_VALUES, value);
query.limit(1L);
return this.query(query).hasNext();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LOG.warn for results size > 1

query.limit(1L);
return this.query(query).hasNext();
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

move to private methods block

value = INDEX_EMPTY_SYM;
}
Id id = element.id();
if (!removed && this.existUniqueValue(indexLabel, value, id)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO: add lock for updating unique index

allPropValues.add(property.value());
}
if (!hasNull) {
firstNullField++;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if(firstNullField == -1) firstNullField = allPropValues.size()

Copy link
Contributor

@javeme javeme left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/*
* If existed label is prefix of new created label,
* remove the existed label.
*/
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why deleted

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not adaptable for unique index

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add more comments

implemented: #633

Change-Id: I753a81d0d47b0d7979563d5a9f41d368e06a5b33
Change-Id: Iefb72b889fbf81e4d7b048ec9bca5dcf8b91c81d
Change-Id: If7c96c79b74ca21f5e26dd399c275bbed3f88081
Change-Id: Ib160efb5a2872915bbfb6a5492e4b55a1f1ce112
Change-Id: I59379d25b1f3934abcb0ddd10c7cc5e3114207a8
Change-Id: If93f13d35e56af708459d5ebdd7e67182839d8b0
/*
* If existed label is prefix of new created label,
* remove the existed label.
*/
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add more comments

if (entry.type().isUniqueIndex() &&
originAction == Action.APPEND) {
throw new IllegalArgumentException(String.format(
"Unique constraint conflict is found in tx " +
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in transaction

"fields %s of existed index label '%s'",
newFields, this.name, oldFields, old.name());
E.checkArgument(!predicate.test(newFields, oldFields),
"Repeat new index label %s(%s) with fields %s " +
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Repeated

Change-Id: I84520193a196ad586487bd05a96495c86c030ff0
@Linary Linary merged commit 1e01920 into master Aug 19, 2019
@Linary Linary deleted the unique branch August 19, 2019 13:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants