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

Switch sqlite temp storage to disk; fix failures in V16 #11600

Merged
merged 1 commit into from
Jun 13, 2022

Conversation

dae
Copy link
Contributor

@dae dae commented Jun 11, 2022

Original fix attempt and discussion at ankidroid/Anki-Android-Backend#193

Depends on #11581

@@ -27,6 +28,10 @@ object DroidBackendFactory {

@JvmStatic
fun getInstance(): DroidBackend {
// Prevent sqlite throwing error 6410 due to the lack of /tmp
val dir = AnkiDroidApp.getInstance().applicationContext.cacheDir
Os.setenv("TMPDIR", dir.path, false)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Discussion began here: ankitects/anki@f15e294#r75810592

I'm +1 on this change I think it is the only way to be sure we won't overflow JVM heap on android

@dae
Copy link
Contributor Author

dae commented Jun 13, 2022

I've updated this so it will apply cleanly without the Java backend change.

Copy link
Member

@mikehardy mikehardy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, this looks good to go all by itself and having read related issues I think it's a necessary change for reliability

@mikehardy
Copy link
Member

Pulled locally:

  1. passed jacocoTestReport with API31 + API25 emulators up and V11 schema
  2. I test V16 by switching V16 on:
mike@bistromath:~/work/AnkiDroid/Anki-Android-Upstream (tmp-fix *) % git stash show -p
diff --git a/AnkiDroid/src/main/java/com/ichi2/anki/AnkiDroidApp.java b/AnkiDroid/src/main/java/com/ichi2/anki/AnkiDroidApp.java
index fcb25ce71..aff48859f 100644
--- a/AnkiDroid/src/main/java/com/ichi2/anki/AnkiDroidApp.java
+++ b/AnkiDroid/src/main/java/com/ichi2/anki/AnkiDroidApp.java
@@ -87,7 +87,7 @@ public class AnkiDroidApp extends Application {
      *
      * Set this and {@link com.ichi2.libanki.Consts#SCHEMA_VERSION} to 16.
      */
-    public static boolean TESTING_USE_V16_BACKEND = false;
+    public static boolean TESTING_USE_V16_BACKEND = true;
 
     public static final String XML_CUSTOM_NAMESPACE = "http://arbitrary.app.namespace/com.ichi2.anki";
 
diff --git a/AnkiDroid/src/main/java/com/ichi2/libanki/Consts.kt b/AnkiDroid/src/main/java/com/ichi2/libanki/Consts.kt
index 495b5ec00..b79144952 100644
--- a/AnkiDroid/src/main/java/com/ichi2/libanki/Consts.kt
+++ b/AnkiDroid/src/main/java/com/ichi2/libanki/Consts.kt
@@ -106,7 +106,7 @@ object Consts {
 
     // deck schema & syncing vars
     @JvmField
-    var SCHEMA_VERSION = 11
+    var SCHEMA_VERSION = 16
 
     /** The database schema version that we can downgrade from  */
     const val SCHEMA_DOWNGRADE_SUPPORTED_VERSION = 16

...and that fails ./gradlew jacocoTestReport on the emulators, until I shell on to them and rm -fr /sdcard/AnkiDroid, then ./gradlew jacocoTestReport works except for some testing failures

That's not a regression, it is what I see on main (running V16 test on existing V11 collection not working for me) so this seems good

Definitely not a regression for V11 folks not doing V16-experimental stuff on main

@mikehardy mikehardy merged commit a29f967 into ankidroid:main Jun 13, 2022
@mikehardy mikehardy added Backend Related May have something to do with Rust, related to Anki-Android-Backend and removed Blocked by dependency Currently blocked by some other dependent / related change labels Jun 13, 2022
@github-actions github-actions bot added this to the 2.16 release milestone Jun 13, 2022
@dae dae deleted the tmp-fix branch June 14, 2022 00:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Backend Related May have something to do with Rust, related to Anki-Android-Backend
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants