[Geoserver-devel] Follow up on GSIP-155: reducing duration of catalog write locks

Hi,
as you might know all UI and REST operations nowadays grab a global r/w lock
to protect the previously thread unsafe catalog facade from corruption.
The REST ones grab a read or write lock according to their nature (GET vs POST/PUT/DELETE),
the UI ones are opaque and thus always get a write lock.

The new catalog facade is thread safe, however, it’s still possible to get into
an inconsistent state because the catalog does not have transactions around its modifications.

Now, the global lock causes issues per se, because the config subsystem can be get locked
for extended amounts of times, for example:

  • When uploading a large file via REST on store creation resources
  • When computing a bbox in the UI, of a large database table
    This pull request tries to reduce the pain a bit by grabbing always a READ lock instead,
    and upgrading it to a WRITE lock on the first actual write operation:
    https://github.com/geoserver/geoserver/pull/2104

So the above cases are taken care of at least in part, allowing at least read only usage during
those operations instead of going full exclusive mode from the request start.

There is however a gotcha, the upgrade is now supported natively by the JVM, so one has
to release the read lock and get the write one, which might fail/timeout… if that happens
the operation will fail (I’ve extended the try period a bit, from 5 to 30 seconds, right
now the UI really shows the “busy page” too often, we also got complaints about that).

The change could maybe improved a bit further by also grabbing the read lock at the first
catalog read, but I’m not sure how much that would buy us, both the UI and REST
operations tend to grab something from the catalog anyways.

I believe I won’t have time to make it better than this before the release so…
take or leave, or pitch in something of yours :slight_smile:

Cheers
Andrea

···

==
GeoServer Professional Services from the experts! Visit
http://goo.gl/it488V for more information.

Ing. Andrea Aime

@geowolf
Technical Lead

GeoSolutions S.A.S.
Via di Montramito 3/A
55054 Massarosa (LU)
phone: +39 0584 962313

fax: +39 0584 1660272
mob: +39 339 8844549

http://www.geo-solutions.it
http://twitter.com/geosolutions_it

AVVERTENZE AI SENSI DEL D.Lgs. 196/2003

Le informazioni contenute in questo messaggio di posta elettronica e/o nel/i file/s allegato/i sono da considerarsi strettamente riservate. Il loro utilizzo è consentito esclusivamente al destinatario del messaggio, per le finalità indicate nel messaggio stesso. Qualora riceviate questo messaggio senza esserne il destinatario, Vi preghiamo cortesemente di darcene notizia via e-mail e di procedere alla distruzione del messaggio stesso, cancellandolo dal Vostro sistema. Conservare il messaggio stesso, divulgarlo anche in parte, distribuirlo ad altri soggetti, copiarlo, od utilizzarlo per finalità diverse, costituisce comportamento contrario ai principi dettati dal D.Lgs. 196/2003.

The information in this message and/or attachments, is intended solely for the attention and use of the named addressee(s) and may be confidential or proprietary in nature or covered by the provisions of privacy act (Legislative Decree June, 30 2003, no.196 - Italy’s New Data Protection Code).Any use not in accord with its purpose, any disclosure, reproduction, copying, distribution, or either dissemination, either whole or partial, is strictly forbidden except previous formal approval of the named addressee(s). If you are not the intended recipient, please contact immediately the sender by telephone, fax or e-mail and delete the information in this message that has been received in error. The sender does not give any warranty or accept liability as the content, accuracy or completeness of sent messages and accepts no responsibility for changes made after they were sent or for other risks which arise as a result of e-mail transmission, viruses, etc.