Optimistic tx semantics #52

Merged
merged 22 commits into from Apr 21, 2014

Conversation

Projects
None yet
3 participants
Member

snoopdave commented Feb 13, 2014

Work complete for optimistic transaction semantics
https://issues.apache.org/jira/browse/USERGRID-52

Dave Johnson added some commits Jan 21, 2014

Merge branch 'two-dot-o' into optimistic-tx-semantics
Conflicts:
	stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/guice/CollectionModule.java
	stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/impl/EntityCollectionManagerImpl.java
Merge branch 'two-dot-o' into optimistic-tx-semantics
Conflicts:
	stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/guice/CollectionModule.java
	stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/impl/EntityCollectionManagerImpl.java

zznate commented Feb 13, 2014

@snoopdave take a look at:

http://aphyr.com/posts/281-call-me-maybe-carly-rae-jepsen-and-the-perils-of-network-partitions

https://github.com/aphyr/jepsen

A lot there, but does describe in detail an excellent way to break test transactional stuff.

Dave Johnson added some commits Mar 11, 2014

Merge branch 'two-dot-o' into optimistic-tx-semantics
Conflicts:
	stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/impl/EntityCollectionManagerImpl.java
	stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/guice/TestCollectionModule.java
We now cleanup and unique values on version conflict; also, added bet…
…ter tests for optimistic and unique verification.

What about the deletes of the unique properties as well? I think we'll need to do them too, otherwise you'll get incorrect duplicate property exceptions if you try to write again <= timeout on the columns of unique properties

Member

snoopdave replied Mar 12, 2014

That's there now. Take a look at the previous commits.

Dave Johnson added some commits Mar 13, 2014

Merge branch 'two-dot-o' into optimistic-tx-semantics
Conflicts:
	stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/guice/CollectionModule.java
	stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/impl/EntityCollectionManagerImpl.java
	stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/mvcc/stage/write/WriteOptimisticVerify.java
	stack/corepersistence/collection/src/main/java/org/apache/usergrid/persistence/collection/mvcc/stage/write/WriteUniqueVerify.java
	stack/corepersistence/collection/src/test/java/org/apache/usergrid/persistence/collection/util/EntityBuilder.java
	stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/legacy/EntityManagerFacade.java
	stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/utils/EntityBuilder.java
	stack/corepersistence/queryindex/src/test/java/org/apache/usergrid/persistence/index/impl/EntityCollectionIndexTest.java
	stack/corepersistence/queryindex/src/test/java/org/apache/usergrid/persistence/index/legacy/EntityBuilder.java
Member

snoopdave commented Apr 16, 2014

@tnine the RollbackAction is now hooked in via RxJava and I think this is ready to merge with two-dot-o. Please take another look when you get a chance.

+
+ uniqueFieldCount++;
+
+ Observable<FieldDeleteResult> result = Observable.from(field)
@tnine

tnine Apr 18, 2014

Rather than do this in parallel for each rollback, it would actually probably be more performant to roll them all into 1 single mutation batch for a single network call. Then you wouldn't need to mess with the observables here in this state since it would be a single network call. Thoughts?

+ Observable.zip(results, zipFunction).toBlockingObservable().last();
+ }
+
+ logEntryStrat.delete( scope, entity.getId(), entity.getVersion() );
@tnine

tnine Apr 18, 2014

The mutation needs executed here. Again, this could be rolled in the batch with all the unique fields.

+ } catch ( WriteUniqueVerifyException e ) {
+ // verify two unique value violations
+ assertEquals( 2, e.getVioliations().size() );
+ }
@tnine

tnine Apr 18, 2014

Might want to attempt to update the original entity here. Just to ensure all the unique values were removed from the CF's and that nothing is blocking an update.

Dave Johnson added some commits Apr 21, 2014

Merge branch 'two-dot-o' into optimistic-tx-semantics
Conflicts:
	stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/legacy/EntityManagerFacade.java
Merge branch 'two-dot-o' into optimistic-tx-semantics
Conflicts:
	stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/legacy/EntityManagerFacade.java
Member

snoopdave commented Apr 21, 2014

Thanks @tnine. I made those suggested changes.

tnine added a commit that referenced this pull request Apr 21, 2014

@tnine tnine merged commit d23254c into two-dot-o Apr 21, 2014

@tnine tnine deleted the optimistic-tx-semantics branch Apr 21, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment