On Tue, Apr 18, 2023 at 3:00 PM Seba Oszlak <sosz...@gmail.com> wrote:

> Link to the exact line here:
> https://github.com/GeoWebCache/geowebcache/blob/main/geowebcache/core/src/main/java/org/geowebcache/storage/blobstore/file/FileBlobStore.java#L480
>
> That prevented the reading and writing of the metadata.properties.gz file
> and so we have no longer locks on that file.
>

Hum locks? Oh... Windows server! No wonder you're having problems.
Regardless of the different opinion on the merits of the platform, there is
one fact: none of the GeoServer developers deploys on it.
We have an automated build checking that the code builds on it, as a
safeguard, but that's it, the type of issues that one would
find only by running the software are not covered. The one that comes up
most, of course, Windows file locking, a construct that does not exist on
Linux.


> Would you be so kind to discuss with us about the need of that file, and
> possible consequences for disabling it? Do you think there could be a bug
> with the locks that causes the service to stop responding. Or in case that
> file is not absolutely necessary in all use cases, maybe there could be a
> flag to enable or disable it more easily without having to modify the
> source code?
>

I did not remember so I went to check in the code:

   - FileBlobStore.getParametersMapping is the method using that same file
   in read mode
   - That in turn is used by BlobStore.getParameters, which provides a Set
   of maps from parameters ids (hashes) to actual values, and also
   BlobStore.getParameterIds, providing just a list of the ids, and the
   BlobStore.purgeOrphans

These are in turn used by the following user reachable operations:

   - BlobStore.purgeOrphans is used by the TruncateOrphansRequest (through
   StorageBroker), one of the possible operational modes of the mass
   truncate
   
<https://www.geowebcache.org/docs/current/rest/masstruncate.html#purge-orphan-parameters-from-a-layer>
    operation.
   - BlobStore.getParameters is used by the TruncateBboxRequest (through
   StorageBroker), another possible mode of mass truncate (see above)
   - BlobStore.getParametersIds is used by TilePageCalculator, which in
   turn is used by disk quota

Long story short, without those files mass truncate won't be able to work
correctly, nor would disk quota.
Looking at how the call to persistParameterMap is used... it seems it
should only be called once when the tile folder is new?
But now it seems to be run at every tile creation instead, for no good
reason.

If that's the case, then a simple change would remove most of the
contention:

diff --git
a/geowebcache/core/src/main/java/org/geowebcache/storage/blobstore/file/FileBlobStore.java
b/geowebcache/core/src/main/java/org/geowebcache/storage/blobstore/file/FileBlobStore.java
index 42dd265a9..1ca73a9dc 100644
---
a/geowebcache/core/src/main/java/org/geowebcache/storage/blobstore/file/FileBlobStore.java
+++
b/geowebcache/core/src/main/java/org/geowebcache/storage/blobstore/file/FileBlobStore.java
@@ -530,8 +530,9 @@ private File getFileHandleTile(TileObject stObj,
Runnable onTileFolderCreation)
         if (onTileFolderCreation != null) {
             log.fine("Creating parent tile folder and updating
ParameterMap");
             File parent = tilePath.getParentFile();
-            mkdirs(parent, stObj);
-            onTileFolderCreation.run();
+            if (mkdirs(parent, stObj)) {
+                onTileFolderCreation.run();
+            }
         }

Please try out this one, and if it works properly, make a pull request
against the GWC repository.

Cheers
Andrea

PS: another possible approach is to keep these information in a database...
it used to be done like that, but
forcing the usage of an embedded database which prevented clustering
(exclusive lock on the database file,
only one instance could run). That model could be used again, although it
would mean we'd have to use
an external database, thus leading to a more complex installation procedure
and the need of an external
database. Maybe it could be used as an option only. See this document if
you're interested in getting it done:
https://github.com/geoserver/geoserver/wiki/Successfully-requesting-and-integrating-fixes,-improvements-and-new-features-in-GeoServer


==

GeoServer Professional Services from the experts!

Visit http://bit.ly/gs-services-us for more information.
==

Ing. Andrea Aime
@geowolf
Technical Lead

GeoSolutions Group
phone: +39 0584 962313

fax:     +39 0584 1660272

mob:   +39  339 8844549

https://www.geosolutionsgroup.com/

http://twitter.com/geosolutions_it

-------------------------------------------------------

Con riferimento alla normativa sul trattamento dei dati personali (Reg. UE
2016/679 - Regolamento generale sulla protezione dei dati “GDPR”), si
precisa che ogni circostanza inerente alla presente email (il suo
contenuto, gli eventuali allegati, etc.) è un dato la cui conoscenza è
riservata al/i solo/i destinatario/i indicati dallo scrivente. Se il
messaggio Le è giunto per errore, è tenuta/o a cancellarlo, ogni altra
operazione è illecita. Le sarei comunque grato se potesse darmene notizia.

This email is intended only for the person or entity to which it is
addressed and may contain information that is privileged, confidential or
otherwise protected from disclosure. We remind that - as provided by
European Regulation 2016/679 “GDPR” - copying, dissemination or use of this
e-mail or the information herein by anyone other than the intended
recipient is prohibited. If you have received this email by mistake, please
notify us immediately by telephone or e-mail
_______________________________________________
Geoserver-users mailing list

Please make sure you read the following two resources before posting to this 
list:
- Earning your support instead of buying it, but Ian Turton: 
http://www.ianturton.com/talks/foss4g.html#/
- The GeoServer user list posting guidelines: 
http://geoserver.org/comm/userlist-guidelines.html

If you want to request a feature or an improvement, also see this: 
https://github.com/geoserver/geoserver/wiki/Successfully-requesting-and-integrating-new-features-and-improvements-in-GeoServer


Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Reply via email to