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

Does modifying an edge property delete the edge and create a new one? #934

Open
m-manseer opened this issue Feb 20, 2018 · 1 comment
Open

Comments

@m-manseer
Copy link

I was reading through this Stack Overflow post, which states that modifying edges will delete them and create new ones with the updated properties instead. In cassandra, this would effectively lead to tombstones due to the deletion.

Your latest documentation however suggests in 29.1.1.1. Forking Edges, that this behaviour is only seen when edge labels use ConsistencyModifier.FORK.

Which is true? This is the first I've heard of this potential issue; My application is heavily modifying edges, thus I need to know if such an approach is even scaleable.

Also, if the documentation says:

[...] would lead to conflict.

does that mean that the conflicting transaction would overwrite any results written by the previous one, or simply fail?

@li-boxuan
Copy link
Member

I am not 100% sure but I don't think edge update leads to tombstones (unless you are using ConsistencyModifier.FORK because that means you have to delete the old edge and create a new one with a different id).

See

/**
* Consolidates this mutation by removing redundant deletions. A deletion is considered redundant if
* it is identical to some addition under the provided conversion functions since we consider additions to apply logically after deletions.
* Hence, such a deletion would be applied and immediately overwritten by an addition. To avoid this
* inefficiency, consolidation should be called.
* <p>
* The provided conversion functions map additions and deletions into some object space V for comparison.
* An addition is considered identical to a deletion if both map to the same object (i.e. equals=true) with the respective
* conversion functions.
* <p>
* It needs to be ensured that V objects have valid hashCode() and equals() implementations.
*
* @param convertAdditions Function which maps additions onto comparison objects.
* @param convertDeletions Function which maps deletions onto comparison objects.
*/
public<V> void consolidate(Function<E,V> convertAdditions, Function<K,V> convertDeletions) {
if (hasDeletions() && hasAdditions()) {
Set<V> adds = new HashSet<>(additions.size());
for (final E add : additions) {
adds.add(convertAdditions.apply(add));
}
deletions.removeIf(k -> adds.contains(convertDeletions.apply(k)));
}
}

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

No branches or pull requests

2 participants