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

Invalid rollback #229

Merged
merged 2 commits into from May 2, 2012

Conversation

Projects
None yet
3 participants
@tchak
Member

tchak commented Apr 26, 2012

Support rolling back from invalid state

@wycats

This comment has been minimized.

Show comment
Hide comment
@wycats

wycats May 2, 2012

Member

We're going to pull this pull request because it resolves a number of existing issues, but I want to call out some problems:

  • It seems like it should be illegal to rollback a transaction that has already started committing. In fact, maybe the term "transaction" is less accurate here than something like "job". The "rollback" command here is akin to "abort"ing a job, which obviously cannot happen while the job is in-process.
  • We need a way for the adapter to reject a job (transaction failed) without putting all of the records into the error state. For example, you could imagine committing 100 records, and the server rejects the entire thing because one of the records was invalid. The transaction will need to be retried, but the other 99 records are not "error" or "invalid".
Member

wycats commented May 2, 2012

We're going to pull this pull request because it resolves a number of existing issues, but I want to call out some problems:

  • It seems like it should be illegal to rollback a transaction that has already started committing. In fact, maybe the term "transaction" is less accurate here than something like "job". The "rollback" command here is akin to "abort"ing a job, which obviously cannot happen while the job is in-process.
  • We need a way for the adapter to reject a job (transaction failed) without putting all of the records into the error state. For example, you could imagine committing 100 records, and the server rejects the entire thing because one of the records was invalid. The transaction will need to be retried, but the other 99 records are not "error" or "invalid".

wycats added a commit that referenced this pull request May 2, 2012

@wycats wycats merged commit 7e87b29 into emberjs:master May 2, 2012

@tchak

This comment has been minimized.

Show comment
Hide comment
@tchak

tchak May 2, 2012

Member

It is impossible to rollback while saving a record, but once we pout the record in invalid state, it is again perfectly valid to rollback. By removing a record from inflight bucket when exiting from invalid state we do put it in a new transaction.

Your second point is already true, we call recordWasInvalid per record NOT per transaction...

Member

tchak commented May 2, 2012

It is impossible to rollback while saving a record, but once we pout the record in invalid state, it is again perfectly valid to rollback. By removing a record from inflight bucket when exiting from invalid state we do put it in a new transaction.

Your second point is already true, we call recordWasInvalid per record NOT per transaction...

@sly7-7

This comment has been minimized.

Show comment
Hide comment
@sly7-7

sly7-7 Oct 9, 2012

Contributor

The fact is you cannot rollback inflight record: Uncaught Error: DS.StateManager:ember1632 could not respond to event rollback in state rootState.loaded.updated.inFlight. Am I missing something ?

Contributor

sly7-7 commented on packages/ember-data/lib/system/transaction.js in f6068c6 Oct 9, 2012

The fact is you cannot rollback inflight record: Uncaught Error: DS.StateManager:ember1632 could not respond to event rollback in state rootState.loaded.updated.inFlight. Am I missing something ?

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