Don't use WAL on devices where it's not supported (#5162)

(i.e., truly ancient kernels and weird FS).

In which case, we use TRUNCATE, which might be a tad less terrible than
DELETE on said weird crap FS.
pull/5165/head
NiLuJe 5 years ago committed by GitHub
parent c6c8c5a037
commit e2961097e7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -39,6 +39,7 @@ local Device = {
hasBGRFrameBuffer = no,
canToggleGSensor = no,
canToggleMassStorage = no,
canUseWAL = yes, -- requires mmap'ed I/O on the target FS
-- use these only as a last resort. We should abstract the functionality
-- and have device dependent implementations in the corresponting

@ -237,6 +237,7 @@ local Kindle2 = Kindle:new{
hasDPad = yes,
canHWInvert = no,
canUseCBB = no, -- 4bpp
canUseWAL = no, -- Kernel too old to support mmap'ed I/O on /mnt/us
}
local KindleDXG = Kindle:new{
@ -246,6 +247,7 @@ local KindleDXG = Kindle:new{
hasDPad = yes,
canHWInvert = no,
canUseCBB = no, -- 4bpp
canUseWAL = no, -- Kernel too old to support mmap'ed I/O on /mnt/us
}
local Kindle3 = Kindle:new{

@ -1,5 +1,6 @@
local Blitbuffer = require("ffi/blitbuffer")
local DataStorage = require("datastorage")
local Device = require("device")
local DocumentRegistry = require("document/documentregistry")
local RenderImage = require("ui/renderimage")
local SQ3 = require("lua-ljsqlite3/init")
@ -138,8 +139,12 @@ end
function BookInfoManager:createDB()
local db_conn = SQ3.open(self.db_location)
-- Make it WAL
db_conn:exec("PRAGMA journal_mode=WAL;")
-- Make it WAL, if possible
if Device:canUseWAL() then
db_conn:exec("PRAGMA journal_mode=WAL;")
else
db_conn:exec("PRAGMA journal_mode=TRUNCATE;")
end
-- Less error cases to check if we do it that way
-- Create it (noop if already there)
db_conn:exec(BOOKINFO_DB_SCHEMA)

@ -1,6 +1,7 @@
local BookStatusWidget = require("ui/widget/bookstatuswidget")
local ConfirmBox = require("ui/widget/confirmbox")
local DataStorage = require("datastorage")
local Device = require("device")
local DocSettings = require("docsettings")
local InfoMessage = require("ui/widget/infomessage")
local KeyValuePage = require("ui/widget/keyvaluepage")
@ -294,8 +295,12 @@ function ReaderStatistics:partialMd5(file)
end
function ReaderStatistics:createDB(conn)
-- Make it WAL
conn:exec("PRAGMA journal_mode=WAL;")
-- Make it WAL, if possible
if Device:canUseWAL() then
conn:exec("PRAGMA journal_mode=WAL;")
else
conn:exec("PRAGMA journal_mode=TRUNCATE;")
end
local sql_stmt = [[
CREATE TABLE IF NOT EXISTS book
(

Loading…
Cancel
Save