Remove anki2-wal file

273 views
Skip to first unread message

Fost andy

unread,
Aug 30, 2014, 2:45:13 AM8/30/14
to anki-a...@googlegroups.com
Hi,

I understand the anki2-wal file and anki2-shm files are some sort of state files used by anki while it is open.

As per the FAQ I'm trying to copy my anki db back to my desktop so I can do some manipulations on it. But I cannot seem to make these files go away.

Closing anki (killing via task manager) or even restarting the phone does not make them go away. Is there a more reliable method?


Charles J. Daniels

unread,
Aug 30, 2014, 2:55:48 AM8/30/14
to anki-a...@googlegroups.com
What you could try is to make sure you're sync'd to ankiwed, delete your whole ankidroid folder, and then pull down a copy of your collection. But I might be missing something, since I don't understand why you're not just syncing through ankiweb to your desktop in the first place.


--
You received this message because you are subscribed to the Google Groups "AnkiDroid" group.
To unsubscribe from this group and stop receiving emails from it, send an email to anki-android...@googlegroups.com.
To post to this group, send email to anki-a...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/anki-android/4416dfef-f9b3-457f-a966-904fdce0dcbb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Tim

unread,
Aug 30, 2014, 4:26:51 AM8/30/14
to anki-a...@googlegroups.com
Strange, they should be removed when you close the app cleanly by pressing the hardware back button from the DeckPicker... What are the details of your hardware and Android version? Are you using external SD card?

Houssam Salem

unread,
Aug 31, 2014, 3:53:51 AM8/31/14
to anki-a...@googlegroups.com
You need to close AnkiDroid with the back button. That's the only way to make sure the files properly disappear. Killing the process will definitely leave them there, and they remain there intentionally to preserve the integrity of the database (deleting them yourself will almost certainly cause problems).

If you are closing AnkiDroid properly, check the AnkiDroid folder again with a file manager on the device itself.

Fost andy

unread,
Sep 4, 2014, 10:51:56 AM9/4/14
to anki-a...@googlegroups.com
I'm actually trying to memorise some commercial in confidence information and hence uncomfortable with syncing to ankiweb.

Fost andy

unread,
Sep 4, 2014, 10:52:53 AM9/4/14
to anki-a...@googlegroups.com
SGS4 running 4.3 - it's a modified ROM so I suppose that is a candidate for weirdness?

I have an external SD card, but the anki deck is stored on the internal.

Fost andy

unread,
Sep 4, 2014, 10:54:03 AM9/4/14
to anki-a...@googlegroups.com
I am attempting to close it with the back button first. I'll attempt to check the AnkiDroid folder with a file manager on the device as you've suggested (so far I've been checking using the usb connection or a wifi-file-transfer app)

Houssam Salem

unread,
Sep 4, 2014, 12:47:13 PM9/4/14
to anki-a...@googlegroups.com
I ask that because some devices use MTP when you connect over USB, and I've had a lot of problems (at least on Linux) with file managers not correctly showing the contents of a folder if the contents change on the device (even after reconnecting it).

Charles J. Daniels

unread,
Sep 4, 2014, 2:12:12 PM9/4/14
to anki-a...@googlegroups.com
Perhaps you can:

1) make a backup copy of your AnkiDroid folder
2) restore from a backup in that AnkiDroid folder

This may leave you a clean collection without wal files.


--
You received this message because you are subscribed to the Google Groups "AnkiDroid" group.
To unsubscribe from this group and stop receiving emails from it, send an email to anki-android...@googlegroups.com.
To post to this group, send email to anki-a...@googlegroups.com.

Xiao Sun

unread,
Sep 5, 2014, 3:57:55 AM9/5/14
to anki-a...@googlegroups.com
Does anyone know a more private alternative sync method to AnkiWeb? I can't sync confidential and personal information either because AnkiWeb term and conditions states that the creator has access to our decks/history for research or investigation.

I tried, Google Drive, but it resync the whole collection instead of the changes like how it is done using AnkiWeb. What is the technology behind AnkiWeb? Would it be possible to build a more private network for those of use who wants more privacy?

Charles J. Daniels

unread,
Sep 5, 2014, 6:04:53 AM9/5/14
to anki-a...@googlegroups.com
Some may pipe up with the specifics (or corrections), but I heard that 1) there are personal anki server setups out there, 2) it takes a simple code change that hasn't been done to allow the sync url to be customized, and 3) it's been requested before.


Xiao Sun

unread,
Sep 5, 2014, 6:32:12 AM9/5/14
to anki-a...@googlegroups.com
Any link to the how-to would be great.

Xiao Sun

unread,
Sep 19, 2014, 5:29:32 AM9/19/14
to anki-a...@googlegroups.com
You are right, WAL and SHM can't be terminated. And when you put the collection into desktop folder, anki crashes.

Tim Rae

unread,
Sep 19, 2014, 5:33:33 AM9/19/14
to anki-a...@googlegroups.com
The latest alpha version has export function, so this procedure is no longer necessary. From version 2.3 you should never touch the .anki2 file

On Fri, Sep 19, 2014 at 6:29 PM, Xiao Sun <financia...@gmail.com> wrote:
You are right, WAL and SHM can't be terminated. And when you put the collection into desktop folder, anki crashes.

--
You received this message because you are subscribed to a topic in the Google Groups "AnkiDroid" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/anki-android/vnX7ftzqTGU/unsubscribe.
To unsubscribe from this group and all its topics, send an email to anki-android...@googlegroups.com.

To post to this group, send email to anki-a...@googlegroups.com.

Xiao Sun

unread,
Sep 19, 2014, 5:43:08 AM9/19/14
to anki-a...@googlegroups.com
Okay I'm exporting, I have a large deck, about 60 MB, how long will it take?

Tim Rae

unread,
Sep 19, 2014, 5:44:32 AM9/19/14
to anki-a...@googlegroups.com

Try and see...

On 19/09/2014 6:43 PM, "Xiao Sun" <financia...@gmail.com> wrote:
Okay I'm exporting, I have a large deck, about 60 MB, how long will it take?

--
You received this message because you are subscribed to a topic in the Google Groups "AnkiDroid" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/anki-android/vnX7ftzqTGU/unsubscribe.
To unsubscribe from this group and all its topics, send an email to anki-android...@googlegroups.com.
To post to this group, send email to anki-a...@googlegroups.com.

Xiao Sun

unread,
Sep 19, 2014, 5:47:34 AM9/19/14
to anki-a...@googlegroups.com
It done in 3 minutes, very good. Is there a way to specify export destination?

Tim Rae

unread,
Sep 19, 2014, 5:51:00 AM9/19/14
to anki-a...@googlegroups.com

No, it always exports to AnkiDroid folder. I'm planning on making a dialog that asks if you want to email the apkg file.

On 19/09/2014 6:47 PM, "Xiao Sun" <financia...@gmail.com> wrote:
It done in 3 minutes, very good. Is there a way to specify export destination?

--
You received this message because you are subscribed to a topic in the Google Groups "AnkiDroid" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/anki-android/vnX7ftzqTGU/unsubscribe.
To unsubscribe from this group and all its topics, send an email to anki-android...@googlegroups.com.
To post to this group, send email to anki-a...@googlegroups.com.

Xiao Sun

unread,
Sep 19, 2014, 7:00:41 AM9/19/14
to anki-a...@googlegroups.com
Regarding to the WAL file issue. 

I realised that if WAL and other files are not terminated, meaning AnkiDroid is not shut down probably, which means no backups are made. And I confirm this. 

My number of backup are set to 3. and they are dated

10 sep
15 sep
18 sep

So in the last nine days, AnkiDroid only closed a total of three time. 

So basically this issue effectively mean that backup function is now broken?

Xiao Sun

unread,
Sep 19, 2014, 7:02:28 AM9/19/14
to anki-a...@googlegroups.com
ps. I want to the fact that I shut down my phone almost every day to change battery. So you can see that shutting down and restarting does not shut down AnkiDroid? 

Tim Rae

unread,
Sep 19, 2014, 7:04:37 AM9/19/14
to anki-a...@googlegroups.com

Thanks for the bug report... I recently changed some stuff surrounding closing the db, please add to the issue tracker and I'll deff fix it once I'm back home next week

Tim Rae

unread,
Sep 19, 2014, 7:09:14 AM9/19/14
to anki-a...@googlegroups.com

Android automatically decides when to remove apps from memory... there's no reason to force close AnkiDroid, or worry about when it's closed, as your changes are automatically saved.

Xiao Sun

unread,
Sep 19, 2014, 7:22:04 AM9/19/14
to anki-a...@googlegroups.com
Yes, I know changes are saved in the collection file, but what about the backups? What if I just !@#$ed up something in my collection and I want to restore it back to what it was an hour ago and released that the latest backup is five days old. The insurance of backups are gone.

Xiao Sun

unread,
Sep 19, 2014, 7:22:51 AM9/19/14
to anki-a...@googlegroups.com
realise*

Houssam Salem

unread,
Sep 19, 2014, 7:30:21 AM9/19/14
to anki-a...@googlegroups.com
Yeah the backup thing is definitely a recent problem from those changes that Tim mentioned earlier. We'll look into it soon.

The presence of the WAL file is not really a problem if you aren't copying the database file manually. You can think of it as a list of changes that haven't been merged back into the main database yet. They will be merged once you start the application again, but it does mean you can't copy the main database.

There might be some things we can do when the application is closed to properly flush those changes. I'll see what I can do.

On Friday, September 19, 2014 9:22:04 PM UTC+10, Xiao Sun wrote:

Xiao Sun

unread,
Sep 19, 2014, 8:38:47 AM9/19/14
to anki-a...@googlegroups.com
Okay so at the moment with this WAL and SHM files constantly open. 

I use the export function to open the collection on PC, and when I'm done with the review on PC, can I drag it back to the AnkiDroid while the WAL and SHM are still there?

Will changes stored in WAL be merged in the future with the file that I dragged from PC?

Tim Rae

unread,
Sep 19, 2014, 8:41:09 AM9/19/14
to anki-a...@googlegroups.com

Yes you can import your collection.apkg back into AnkiDroid, only backup should be broken

Houssam Salem

unread,
Sep 19, 2014, 8:43:16 AM9/19/14
to anki-a...@googlegroups.com
If you export and import the entire collection it should work. Moving the files around with the WAL file present will probably corrupt your database (or at least it will refuse to open it).

Xiao Sun

unread,
Sep 19, 2014, 4:25:20 PM9/19/14
to anki-a...@googlegroups.com
No, I'm not talking about the collection apkg, I'm talking about collection.anki2.

So why it is that when WAL & SHM exist in AD, drag & drop collection.anki2 from Anki to AD, AD can open it. 

But drag and & drop from collection.anki2 from AD to Anki when WAL & SHM exist in AD, will cause Anki to crash?

Tim Rae

unread,
Sep 19, 2014, 5:33:01 PM9/19/14
to anki-a...@googlegroups.com

Modifying .anki2 file is unsupported

Charles J. Daniels

unread,
Sep 19, 2014, 7:28:28 PM9/19/14
to anki-a...@googlegroups.com
Since we're talking about backups, I just want to point out a fear of mine: too many recent backups that eat up all our backups.

By default, I'd like to see a behavior that always keeps around at least one week old backup. The reason is many people run into issues (lately it seems especially) and then they open and close open and close, and by the time they realize backups may help they may have overwritten them all. So since it looks like backup code is going to be touched, I'd just like to throw out this idea of not just blinding taking x backups. Perhaps if backups are enabled, always have a month old backup, a week old backup, a 24hour minimum backup, and then x recent backups of the last closes. This would be much more robust.



--
You received this message because you are subscribed to the Google Groups "AnkiDroid" group.
To unsubscribe from this group and stop receiving emails from it, send an email to anki-android...@googlegroups.com.

To post to this group, send email to anki-a...@googlegroups.com.

Xiao Sun

unread,
Sep 19, 2014, 7:44:40 PM9/19/14
to anki-a...@googlegroups.com
That's the same issue I have with Anki as well, they should have two types of backups, one is backup the collection at a user defined schedule, once a day or a week etc. And another backup every time anki is closed or synced for those accidental mistakes. 

Tim Rae

unread,
Sep 19, 2014, 9:50:36 PM9/19/14
to anki-a...@googlegroups.com

I was just planning on increasing default number of backups, but that seems like a better way.

We could have 4 backup levels: hourly, daily, weekly, monthly, and keep 3 backups for each level by default. That would be 12 files, but they would be stored as apkgs so shouldn't be too bad.

I want to make the backup run completely in the background; no need to show any dialog which blocks the user from using the app. Maybe for the alphas I'll show a toast when a backup is created so that everyone can build some trust in the new system.



Xiao Sun

unread,
Sep 20, 2014, 4:15:56 AM9/20/14
to anki-a...@googlegroups.com
The export file is compressed, can you give us the option to export uncompressed apkg? Then it won't have to take minutes for large collections. 

Tim Rae

unread,
Sep 20, 2014, 4:22:18 AM9/20/14
to anki-a...@googlegroups.com

Not really something I'd volunteer to implement sorry

Xiao Sun

unread,
Sep 20, 2014, 4:25:59 AM9/20/14
to anki-a...@googlegroups.com
Is there a way at all to just completely replace the collection on AD with the apkg file from Anki? Not import but like a full sync without Ankiweb?

Houssam Salem

unread,
Sep 20, 2014, 4:28:50 AM9/20/14
to anki-a...@googlegroups.com
Anki on the desktop requires the database to be opened in a different mode which is determined by a flag in the database itself. If you copy it straight from AD then the wrong flag is set and it crashes because it can't open it. AnkiDroid (in the alpha builds) is always leaving the database partially open, so this is going to happen. We might need to rethink this as I don't like it too much either.

Houssam Salem

unread,
Sep 20, 2014, 4:30:47 AM9/20/14
to anki-a...@googlegroups.com
The current backup code won't make a backup unless it has been 5 hours more than the last backup. So repeatedly opening and closing AnkiDroid won't overwrite everything, but it will over a few days. Simply increasing the number of backups might be enough for the time being before trying any more elaborate backup techniques.


On Saturday, September 20, 2014 9:28:28 AM UTC+10, chajadan wrote:

Houssam Salem

unread,
Sep 20, 2014, 4:32:09 AM9/20/14
to anki-a...@googlegroups.com
Importing a full export (collection.apkg) does exactly this. It replaces your entire collection with the imported one so it's like a full sync.

Tim Rae

unread,
Sep 20, 2014, 4:35:29 AM9/20/14
to anki-a...@googlegroups.com

Yes, the way in the faq

Xiao Sun

unread,
Sep 20, 2014, 4:40:22 AM9/20/14
to anki-a...@googlegroups.com
it's didn't, it just imported note and cards (there was % counter), it was still the same old collection on AD with few extra cards I made on desktop.

Tim Rae

unread,
Sep 20, 2014, 4:41:50 AM9/20/14
to anki-a...@googlegroups.com

Was it named "collection.apkg"?

Xiao Sun

unread,
Sep 20, 2014, 4:53:14 AM9/20/14
to anki-a...@googlegroups.com
No, it wasn't. It works now. Thanks.

Xiao Sun

unread,
Sep 20, 2014, 5:02:02 AM9/20/14
to anki-a...@googlegroups.com
Now I can finally go completely AnkiWeb free! Freedom!

Xiao Sun

unread,
Sep 20, 2014, 11:15:33 AM9/20/14
to anki-a...@googlegroups.com
Actually, that WAL and SMH must both be deleted also in order for collection to make a 100% accurate replacement. Otherwise, the collection will incorporate the changes. 

Hopefully you guys can pick this WAL/SMH file issue.

Tim Rae

unread,
Sep 20, 2014, 11:17:59 AM9/20/14
to anki-a...@googlegroups.com

Are you theorizing or do you have some evidence of this? I believe that we close the db before importing and this automatically flushes any changes

Xiao Sun

unread,
Sep 20, 2014, 11:36:13 AM9/20/14
to anki-a...@googlegroups.com
I have evidence, I just did it before posting. I don't report bugs based on speculation or theory.

Basically when I move the apkg from Anki to AD and open it in AD, the card count is different from the desktop. So I deleted WAL, SHM and collection (BACK file) from AD folder, copy collection.apkg again. Then I was able to get a identical copy.

You should be able to reproduce it.

Xiao Sun

unread,
Sep 20, 2014, 11:41:18 AM9/20/14
to anki-a...@googlegroups.com
I could be the BACK file too, I never seen it before. Why does AD create so many files?

Xiao Sun

unread,
Sep 20, 2014, 11:52:47 AM9/20/14
to anki-a...@googlegroups.com
Okay, I can not reproduce it any more with WAL and SHM in the folder, so it is most probably the collection.BACK file or something caused them to merge? (not backup apkgs).

I just want to report it happened, I can not pin-point the exact cause.

Tim

unread,
Sep 22, 2014, 1:12:06 AM9/22/14
to anki-a...@googlegroups.com
OK I think I've fixed the backups, they should be occurring in the background a max of every 5 hours, whenever the main screen is opened. A message will pop up telling you that the backup has started; please test it out well in alpha 30. 

Re: daily/weekly backups etc, I think this is a good idea, but as  Houssam suggested, for now I've simply increased the default number of backups to 8, and we can think about using a better scheme in 2.4

Xiao Sun

unread,
Sep 22, 2014, 3:56:02 AM9/22/14
to anki-a...@googlegroups.com
I have not test it, but I don't like the idea of having a pop up every time there is a backup creation.

Tim Rae

unread,
Sep 22, 2014, 3:58:10 AM9/22/14
to anki-a...@googlegroups.com

It's just a toast message, not a dialog. Happy to remove when we go to beta phase if that is the consensus

Houssam Salem

unread,
Sep 26, 2014, 9:54:48 PM9/26/14
to anki-a...@googlegroups.com
I don't think the toast message is necessary. It gives the impression that the user has triggered something.
Reply all
Reply to author
Forward
0 new messages