Open Bug 1143308 Opened 5 years ago Updated 2 months ago

Use SQLite's mmap'ed I/O mode for IndexedDB

Categories

(Core :: DOM: IndexedDB, defect, P3)

defect

Tracking

()

People

(Reporter: bent.mozilla, Unassigned, NeedInfo)

Details

Attachments

(1 file)

Attached patch Patch, v1Splinter Review
This gives us some speed wins in my perf testing. Talked about the risks with sicking and he's ok with them. Details at https://www.sqlite.org/mmap.html
Attachment #8577618 - Flags: review?(Jan.Varga)
I was under the impression that especially on 32-bit windows we're experiencing address space shortages and fragmentation problems, especially with video card drivers doing video memory mmaps in our address space.  Maybe it'd be a good idea to check on dev-platform if this is something that should only be enabled when we're running 64-bit for desktop builds?
Comment on attachment 8577618 [details] [diff] [review]
Patch, v1

Review of attachment 8577618 [details] [diff] [review]:
-----------------------------------------------------------------

Do you know how it affects quota handling ?
(In reply to Andrew Sutherland [:asuth] from comment #1)
> should only be enabled when we're running 64-bit for desktop builds?

Yeah, this could be 64bit only.

(In reply to Jan Varga [:janv] from comment #2)
> Do you know how it affects quota handling ?

It doesn't, this all happens below our quota VFS layer.
Attachment #8577618 - Flags: review?(Jan.Varga) → review+
"An I/O error on a memory-mapped file cannot be caught and dealt with by SQLite. Instead, the I/O error causes a signal which, if not caught by the application, results in a program crash."

What kind of IO errors are we talking here?  Is it something as mundane as sqlite wanted to remove a temp file, but windows has it locked?
No, this is about the way POSIX deals with mmap'd I/O errors via the SIGBUS signal.
There's a Windows flavor of the problem too, but it's still just about I/O errors reading/writing a mapped file.
Comment on attachment 8577618 [details] [diff] [review]
Patch, v1

SQLite has a Windows bug in mmap mode where database size isn't set correctly in xTruncate, which causes our quota handling to go haywire. This will need to wait for a SQLite fix.
Attachment #8577618 - Flags: review+
Priority: -- → P3

(In reply to Ben Turner (not reading bugmail, use the needinfo flag!) from comment #7)

Comment on attachment 8577618 [details] [diff] [review]
Patch, v1

SQLite has a Windows bug in mmap mode where database size isn't set
correctly in xTruncate, which causes our quota handling to go haywire. This
will need to wait for a SQLite fix.

Has this SQLite bug been fixed in the meantime? I couldn't find any related issue in the SQLite issue tracker.

Flags: needinfo?(jvarga)
You need to log in before you can comment on or make changes to this bug.