9

I understand that Spatialite is meant to be used by a single user/machine at a time. However if the data is stored on server, there is no guarantee that someone on another machine will not also open the same database and use it. Has anyone got any experience with how QGIS and spatialite react to being in a multiuser environment. In most cases, the layer would be a read only layer. QGIS allows multiple people to read the same shapefiles, which is a similar situation. What happens if multiple people have concurrent editing sessions open?

  • 1
    How many users are we talking about? – Nathan W Aug 6 '13 at 6:07
  • I would ask to not limit the scope of the question based on number of users. It would be useful to understand the mechanics, which probably don't change with number of users. – Scro Aug 6 '13 at 12:08
  • 3
    Which operating system? Over what kind of network? While SQLite allows multiple readers but only one writer, the OS may enforce its own level of locking. – scruss Aug 6 '13 at 14:31
  • I use Windows 7, Win XP is still also common in corporate environments and access would be via a Local Area Network. Some people might like to use clould storage too, but any system that synchronises or replicates would not be able to be used. As far as users go, I imagine up to ten users in some case. Unfortunately this is something that is hard to test without a team of helpers, hence the question. @scruss how does SQLite enforce database locking? – AndrewM Aug 7 '13 at 7:43
  • 4
    Like this: File Locking And Concurrency In SQLite Version 3. In summary, you can usually have multiple readers, but when a write is immediately pending, only the writer has access to the file/whole database. Windows tends to be very conservative IME, and can prevent any access to a file when another user has it open for reading. If QGIS waits and retries appropriately on getting a SQLITE_BUSY, this could work. I have no way of testing this here. – scruss Aug 7 '13 at 13:50
4

SQLite operates in a last edit wins model, which leads to issues with more weight than write blocks. There is no editing session tracking in the QGIS/SQLite relationship. So, even if you did get a single writer block (SQLITE_BUSY) QGIS will simply fail to edit and just return an error then submit the change again.

The below discusses the handling of this type of event, and how QGis handles the resubmit.

https://github.com/qgis/QGIS/blob/a3447dd9a346f6d5e08451b7c5666a37046435bc/src/core/spatialite/headers/spatialite/sqlite3.h#L1881-L1943

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.