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

Fix: batch update edge with edgeId and unmatched sortKeys will create a new edge #819

Merged
merged 3 commits into from
Feb 4, 2020

Conversation

Linary
Copy link
Contributor

@Linary Linary commented Jan 8, 2020

Fix #818

Change-Id: Ic929a4267fc411c156a32e5b381d314f382ebc9a

… a new edge

Fix #818

Change-Id: Ic929a4267fc411c156a32e5b381d314f382ebc9a
@codecov
Copy link

codecov bot commented Jan 8, 2020

Codecov Report

Merging #819 into master will decrease coverage by 0.08%.
The diff coverage is 80%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master     #819      +/-   ##
============================================
- Coverage     71.13%   71.04%   -0.09%     
- Complexity     4331     4337       +6     
============================================
  Files           283      283              
  Lines         20957    20969      +12     
  Branches       2957     2960       +3     
============================================
- Hits          14908    14898      -10     
- Misses         4568     4583      +15     
- Partials       1481     1488       +7
Impacted Files Coverage Δ Complexity Δ
...in/java/com/baidu/hugegraph/api/graph/EdgeAPI.java 57.77% <80%> (+28.56%) 0 <0> (ø) ⬇️
...egraph/backend/store/hbase/HbaseStoreProvider.java 100% <0%> (ø) 6% <0%> (ø) ⬇️
...raph/backend/store/postgresql/PostgresqlStore.java 0% <0%> (-100%) 0% <0%> (-2%)
...hugegraph/backend/store/hbase/HbaseSerializer.java 100% <0%> (ø) 1% <0%> (ø) ⬇️
...raph/backend/store/postgresql/PostgresqlTable.java 0% <0%> (-100%) 0% <0%> (-20%)
...kend/store/postgresql/PostgresqlStoreProvider.java 0% <0%> (-92.11%) 0% <0%> (-5%)
...idu/hugegraph/backend/store/hbase/HbaseTables.java 88.57% <0%> (ø) 0% <0%> (ø) ⬇️
...aph/backend/store/postgresql/PostgresqlTables.java 0% <0%> (-87.81%) 0% <0%> (-1%)
...backend/store/postgresql/PostgresqlSerializer.java 0% <0%> (-84.62%) 0% <0%> (-4%)
...u/hugegraph/backend/store/hbase/HbaseFeatures.java 84.21% <0%> (ø) 16% <0%> (ø) ⬇️
... and 39 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 ef68289...708cd4b. Read the comment docs.

sortKeyValue.equals(oldSortKeyValue),
"The value of sort key '%s' either be null " +
"or equal with origin '%s', but got '%s'",
sortKey, oldSortKeyValue, sortKeyValue);
Copy link
Contributor

Choose a reason for hiding this comment

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

compare the two ids

Change-Id: I0a100d72dd7572cec9cd30b36674eb1f271ddc98
if (newEdge.id != null) {
E.checkArgument(edgeId.equals(newEdge.id),
"The sort key values either be null " +
"or equal with origin");
Copy link
Contributor

Choose a reason for hiding this comment

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

equal to

public void testBatchUpdate() throws IOException {
String outVId = getVertexId("person", "name", "marko");
String inVId = getVertexId("person", "name", "josh");
// create
Copy link
Contributor

Choose a reason for hiding this comment

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

Create

String content = assertResponseStatus(201, r);
String id = parseId(content);

// update edge with edgeId
Copy link
Contributor

Choose a reason for hiding this comment

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

ditto

+ "\"create_if_not_exist\":true"
+ "}", id, outVId, inVId);
r = client().put(path + "batch", edge, ImmutableMap.of());
// Now allowed to modify sortkey values, the property date has changed
Copy link
Contributor

Choose a reason for hiding this comment

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

the property “date” has changed

+ "}", outVId, inVId);
r = client().put(path + "batch", edge, ImmutableMap.of());
// Add a new edge when sortkey value has changed
assertResponseStatus(200, r);
Copy link
Contributor

Choose a reason for hiding this comment

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

query to assert two different edges

Assert.assertTrue(content.contains(
"either be null or equal with origin"));

// update edge without edgeId
Copy link
Contributor

Choose a reason for hiding this comment

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

Update

zhoney
zhoney previously approved these changes Jan 9, 2020
javeme
javeme previously approved these changes Jan 9, 2020
@Linary Linary dismissed stale reviews from javeme and zhoney via cfded54 February 3, 2020 12:16
Change-Id: I21ce599336e8f894457756f61c5a0fb546290ac0
@zhoney zhoney merged commit 7e926ac into master Feb 4, 2020
@zhoney zhoney deleted the batch-update-edge-bug branch February 4, 2020 03:43
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.

Batch update edge with edgeId and unmatched sortKeys will create a new edge
3 participants