View Single Post
Old 11-15-2011, 05:45 PM   #317
Kolenka
<Insert Wit Here>
Kolenka ought to be getting tired of karma fortunes by now.Kolenka ought to be getting tired of karma fortunes by now.Kolenka ought to be getting tired of karma fortunes by now.Kolenka ought to be getting tired of karma fortunes by now.Kolenka ought to be getting tired of karma fortunes by now.Kolenka ought to be getting tired of karma fortunes by now.Kolenka ought to be getting tired of karma fortunes by now.Kolenka ought to be getting tired of karma fortunes by now.Kolenka ought to be getting tired of karma fortunes by now.Kolenka ought to be getting tired of karma fortunes by now.Kolenka ought to be getting tired of karma fortunes by now.
 
Kolenka's Avatar
 
Posts: 973
Karma: 1254645
Join Date: Jan 2008
Location: Puget Sound
Device: Sony T2, Kindle Paperwhite
Quote:
Originally Posted by salines View Post
Same problem with 0.8.26
Fix isn't in 0.8.26, so you have to wait for 0.8.27, sorry.

Kovid, thanks for looking at that. I wouldn't have been very good at catching it myself, due to the lack of familiarity with the Calibre interfaces (or without Tuttle's update on the bug that helped nail down a way to reproduce it).

Quote:
Originally Posted by dwanthny View Post
I can see how they may have done a better job coding the creation and error handling of the books.db file. I guess some odd glitch could have corrupted the file in a similar manner and when it found number out of range it should have scanned the card and built a fresh books.db file. If they had done this your problem would have been different, either way I'm sure Kolenka will sort out the needed numbering required for the SD card.
Here's the full scoop on the problem if you are interested:

- The T1 has two different books.db files. One on the internal partition, one on the SD card.
- The T1 loads and "merges" the two databases into a single entity/thing in the homescreen application.
- To ensure all ids are unique, the books.db for internal memory is given the the 0-2^32 range (0-4 billion). The books.db for the SD card is given the 4-8 billion range.

SQLite uses a special SQL table to tell it what id# to use next. The T1 creates the books.db file on the SD card and will configure this special SQL table to start at: (2^32+1).

The bug is that for some reason, the T1 isn't always doing this special configuration. But the driver assumes it has been done, and lets the database figure out what id# to use. If it hasn't, then you get two "0" ids.

And as above, since the T1 merges the two databases, the two books with '0' as their id collide and cause the symptoms.

I haven't had much time to spend in my code editor of choice lately to write up the work-around, but it is on my list to do in the next couple days. I suspect the Sony software will check for the special configuration before writing new entries (and fix the configuration if needed). I'll need to do similar in the Calibre driver.

EDIT: It is kinda interesting that Sony assumes you cannot fit more than 4 billion books into their 2GB internal memory. At least they are right that you can't.

Last edited by Kolenka; 11-15-2011 at 05:47 PM.
Kolenka is offline   Reply With Quote