-
Notifications
You must be signed in to change notification settings - Fork 85
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
[Bug] LCP data base schema issue. #604
Comments
Unfortunately 2.0 is too old and can't even be tested on this monorepo (which starts from 2.1). We did have a migration from Anko to Room with a SQL schema change in 2.1, but there is an explicit SQL transaction and we didn't get any bug report about issues with it: readium/r2-lcp-kotlin#116 Apart from that, your error is very strange:
Does that ring a bell? Is the crash happening in production for all the users, or only some of them? Can you reproduce the issue yourself? |
You could also try upgrading to 2.1 and see if that helps, before upgrading to the newer versions. |
Currently we are using 2.4.0 in Production and 2.4.3 in development, are you use suggesting to downgrade to 2.1. because it may lead to lot of code changes right. |
I'm brainstorming ideas as I can't reproduce the issue. If it's acceptable to loose the license' passphrases (the users will be required to enter the passphrase again when opening the book), you could try removing the LCP database file if creating the You should be able to find the file using If you need to keep the user passphrase, try replicating the upgrade from your old app version on a development device and take a look at the SQLite database file to see what happened to the schema. To catch this kind of issues early you should always test an upgrade of your app from an older version before releasing to production. |
It looks like it didn't go through the migration for some reason. In the Room, it looks like it does a lookup for a Room master table, and if that doesn't exist and the schema isn't valid, it throws that error. I remember testing that whole migration process thoroughly. I tried to create a project using 2.0.0, but it's too old at this point with stuff going to jcenter and jitpack. |
A Room upgrade can have broken the migration path. I guess you could try to force a lower Room version in 2.4, not sure if we use new features. |
Describe the bug
We have released a new application to our client with upgrading readium from 2.0.0 to 2.4.0
While upgrading the client application, the LCP data base throwing issue by mentioning schema is incorrect.
Please find issue details below
Exception java.lang.IllegalStateException: Pre-packaged database has an invalid schema: passphrases(org.readium.r2.lcp.persistence.Passphrase).
Expected:
TableInfo{name='passphrases', columns={passphrase=Column{name='passphrase', type='TEXT', affinity='2', notNull=true, primaryKeyPosition=0, defaultValue='undefined'}, id=Column{name='id', type='INTEGER', affinity='3', notNull=false, primaryKeyPosition=1, defaultValue='undefined'}, provider=Column{name='provider', type='TEXT', affinity='2', notNull=false, primaryKeyPosition=0, defaultValue='undefined'}, user_id=Column{name='user_id', type='TEXT', affinity='2', notNull=false, primaryKeyPosition=0, defaultValue='undefined'}, license_id=Column{name='license_id', type='TEXT', affinity='2', notNull=false, primaryKeyPosition=0, defaultValue='undefined'}}, foreignKeys=[], indices=[]}
Found:
TableInfo{name='passphrases', columns={}, foreignKeys=[], indices=[]}
at androidx.room.RoomOpenHelper.checkIdentity (RoomOpenHelper.kt:158)
at androidx.room.RoomOpenHelper.onOpen (RoomOpenHelper.kt:127)
at androidx.sqlite.db.framework.FrameworkSQLiteOpenHelper$OpenHelper.onOpen (FrameworkSQLiteOpenHelper.kt:287)
at android.database.sqlite.SQLiteOpenHelper.getDatabaseLocked (SQLiteOpenHelper.java:447)
at android.database.sqlite.SQLiteOpenHelper.getWritableDatabase (SQLiteOpenHelper.java:332)
at androidx.sqlite.db.framework.FrameworkSQLiteOpenHelper$OpenHelper.getWritableOrReadableDatabase (FrameworkSQLiteOpenHelper.kt:232)
at androidx.sqlite.db.framework.FrameworkSQLiteOpenHelper$OpenHelper.innerGetDatabase (FrameworkSQLiteOpenHelper.kt:190)
at androidx.sqlite.db.framework.FrameworkSQLiteOpenHelper$OpenHelper.getSupportDatabase (FrameworkSQLiteOpenHelper.kt:151)
at androidx.sqlite.db.framework.FrameworkSQLiteOpenHelper.getWritableDatabase (FrameworkSQLiteOpenHelper.kt:104)
at androidx.room.RoomDatabase.inTransaction (RoomDatabase.kt:632)
at androidx.room.RoomDatabase.assertNotSuspendingTransaction (RoomDatabase.kt:451)
at androidx.room.RoomDatabase.query (RoomDatabase.kt:480)
at androidx.room.util.DBUtil.query (DBUtil.kt:75)
at org.readium.r2.lcp.persistence.LcpDao_Impl$12.call (LcpDao_Impl.java:379)
at org.readium.r2.lcp.persistence.LcpDao_Impl$12.call (LcpDao_Impl.java:375)
at androidx.room.CoroutinesRoom$Companion$execute$4$job$1.invokeSuspend (CoroutinesRoom.kt:87)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith (ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run (DispatchedTask.kt:106)
at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:641)
at java.lang.Thread.run (Thread.java:929)
How to reproduce?
Readium version
2.4.0
Android API version
34
Additional context
No response
The text was updated successfully, but these errors were encountered: