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

Refresh the database before caching a connection handle to it #78

Merged
merged 1 commit into from Sep 20, 2014

Conversation

jmdh
Copy link
Member

@jmdh jmdh commented Sep 14, 2014

OpenGuides->new() caches a connection to the SQLite database. When
OpenGuides::Test::refresh_db() is called, it removes the database file
and reconnects to it. If that happens after OpenGuides->new(), the cached
handle becomes read-only as of SQLite 3.8.3. From its changelog:

Add SQLITE_READONLY_DBMOVED error code, returned at the beginning of
a transaction, to indicate that the underlying database file has been
renamed or moved out from under SQLite.

This causes test failures with error messages like

Unhandled error: [DBD::SQLite::st execute failed: attempt to write a readonly database at /usr/share/perl5/Wiki/Toolkit/Store/Database.pm line 567.
] at /usr/share/perl5/Wiki/Toolkit.pm line 849.

Moving the refresh_db() call earlier fixes these failures.

OpenGuides->new() caches a connection to the SQLite database.  When
OpenGuides::Test::refresh_db() is called, it removes the database file
and reconnects to it. If that happens after OpenGuides->new(), the cached
handle becomes read-only as of SQLite 3.8.3. From its changelog:

 Add SQLITE_READONLY_DBMOVED error code, returned at the beginning of
 a transaction, to indicate that the underlying database file has been
 renamed or moved out from under SQLite.

This causes test failures with error messages like

Unhandled error: [DBD::SQLite::st execute failed: attempt to write a readonly database at /usr/share/perl5/Wiki/Toolkit/Store/Database.pm line 567.
] at /usr/share/perl5/Wiki/Toolkit.pm line 849.

Moving the refresh_db() call earlier fixes these failures.
@rjw1
Copy link
Member

rjw1 commented Sep 14, 2014

Thanks. Looks good to me. Ill have a closer look tomorrow.
Ill also prod travis to work out why lucy is failing to install.

rjw1 added a commit that referenced this pull request Sep 20, 2014
Refresh the database before caching a connection handle to it
@rjw1 rjw1 merged commit 0c14a08 into master Sep 20, 2014
@rjw1 rjw1 deleted the fix_sqlite_test_failures branch September 20, 2014 12:24
@rjw1
Copy link
Member

rjw1 commented Sep 20, 2014

thanks. I hope to get this released today.

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.

None yet

3 participants