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

Abort and clean up pending transactions when a database is [closed] #210

Open
brodycj opened this issue Mar 18, 2015 · 1 comment
Open

Comments

@brodycj
Copy link
Contributor

brodycj commented Mar 18, 2015

Right now, the plugin still keeps some state (including transactions still in the queue) even when a database file is closed or deleted. If the same database file is created or otherwise opened again, at some point the old pending transactions may fire off. It would be better to abort the transactions and clean up the internal memory resources.

IMPLEMENTATION NOTES:

The following alternatives may be applied to determine when a db is closed and what pending transactions to abort:

Also, if there is already a transaction in progress for a db that is closed or deleted (which has not been committed or aborted), then it should be possible to abort (and ROLLACK) the transaction.

brodycj pushed a commit that referenced this issue Mar 18, 2015
Clean separation between SQL tests (which should apply to both Web SQL and this plugin) and plugin-specific tests.

Add reproduction of minor bug #204.

Move reproduction of #209 to section with plugin-specific tests.

Mark some plugin db tests that were added by Mark Oppenheim (mailto:[email protected]) as "Needed to support some large-scale applications".

Test repeatedly open and close db two ways (whether or not to wait for open callback before closing db)

Add another test of repeatedly open and delete db (wait for open callback before deleting db)

Needed for #184/#204/#209/#210/#211/#213.
brodycj pushed a commit that referenced this issue Mar 18, 2015
…ase that is being opened (#184).

Document related txLocks & openDBs map objects.

Mark other bugs to be fixed (#204/#209/#210).
brodycj pushed a commit that referenced this issue Mar 18, 2015
CHANGES:
- Use per-db state to properly handle transactions requested on a database that is being opened (#184).
- Report an error upon attempt to close database multiple times.

TEST:
- Reproduce BUGs #204/#209
- Expand some existing scenarios
- Prepare test suite for upcoming fixes and improvements (#184/#204/#209/#210/#211/#213)
brodycj pushed a commit that referenced this issue Mar 18, 2015
CHANGES:
- Use per-db state to properly handle transactions requested on a database that is being opened (#184).
- Report an error upon attempt to close database multiple times.

TEST:
- Reproduce BUGs #204/#209
- Expand some existing scenarios
- Prepare test suite for upcoming fixes and improvements (#184/#204/#209/#210/#211/#213)
@brodycj brodycj changed the title Abort and clean up pending transactions when a database is closed or deleted Abort and clean up pending transactions when a database is [closed] Oct 19, 2015
@brodycj
Copy link
Contributor Author

brodycj commented Oct 19, 2015

As I said in #367 (comment) it would become more complex to abort all pending transactions when deleting a database. Instead, we should simply fix this issue in case of closing a database, and tell the user to close the database before deleting it. If someone tries to delete a database while there are pending (TBD open?) transactions, we should simply call the error callback (or perhaps throw an exception).

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

No branches or pull requests

1 participant