geoserver / geoserver-cloud

Cloud Native GeoServer is GeoServer ready to use in the cloud through dockerized microservices.
http://geoserver.org/geoserver-cloud
Other
244 stars 73 forks source link

Fix RepositoryCatalogFacadeImpl's query of PublishedInfo.class #476

Closed groldan closed 3 months ago

groldan commented 3 months ago

The webui layer preview page, and possibly other code paths, lead to querying the PublishedInfo super interface for LayerInfo and LayerGroupInfo.

These queries must be delegated to the layer and layer group queries. The DefaultCatalogFacade in GeoServer does it and builds an in-memory list of the results.

Our RepositoryCatalogFacadeImpl does it in a streaming fashion, but it wasn't respecting the limits, resulting in wrong results for the layer preview page.

Now it queries LayerRepository and LayerGroupRepository, and returns a merge-sorted stream.

If the query does not specify a sort order, the id property is used to provide predictable order for the merge-sort algorithm.

When the returned stream is closed, it'll close the two underlying streams.