Would it be possible to implement a Page level locking system using sqlite?
I seem to recall a commercial product Ingress that utilized a page level
locking scheme that would escalte to a table level lock when over a certain %
of a tables pages were locked.
This obviously would be very beneficial for those of us who are implementing
threaded applications using sqlite. The shared cache concept would need to be
extended so that a global context for the shared cache would be maintained,
allowing each individual thread that connects (sqlite3_open) to utilize the
shared cache for that DB.
The benefit would be to move the Locking from the DB level down to the page
level. Keep a list of the before image pages in memory so that readers are not
blocked by the writers (lock holders) of the pages.
When the writer txn completes, Mark it txn as completed in the journal.
I think it would be beneficial to visit the journal design as well for this.
Mainly don't open/close journals, since a journal is always part of the DB
pre-build the journal and allow multiple threads of writers into the journal.
This should also help with some of the areas inside the pager/journal code
where a random checksum is used to validate the journal upon crash recovery.
Just some ideas to improve concurrency that I had and wanted to jot down.
DRH,
just reviewd the tokenize.c and pager.c, I concurr that Yacc/bison have the
token passing incorrect. Your implementation of tokenize is very interesting,
what an excelent technique to embedd the tokens using overlapping strings.
Can you send me an email address, I have some code that you might find
intersting to utilze in the pager.c for the checksums.
Ken