[gdal-dev] GDALOpenShared and open options

Matt Perry perrygeo at gmail.com
Thu Oct 6 07:51:56 PDT 2022


Hi all. I'm seeing some strange results when reading multiple open
datasets in shared mode. I'm using the TileDB driver which has an open
option, TILEDB_TIMESTAMP. Setting the timestamp should mean that it's
effectively treated as a different dataset since the pixel values will
differ. But what I'm seeing instead is that the timestamp of the first
open dataset takes precedence over any subsequent shared opens.

 I originally encountered this bug with Mapserver (which also uses
GDALOpenShared under the hood) but I've recreated the bug in python to
demonstrate more clearly:
https://gist.github.com/perrygeo/f3e5afcfe8ed9d4064598d6a041f85b9

Digging into the docs a bit, it looks like GDALOpenShared determines
the uniqueness of the dataset based on the file path alone. From
https://gdal.org/api/raster_c_api.html#_CPPv410GDALOpenExPKcjPPCKcPPCKcPPCKc

"if the GetDescription() name for one exactly matches the pszFilename
passed to GDALOpenEx() it will be referenced and returned"

Is the solution here to match on pszFilename AND the full set of open
options? Together, these define a logically-unique dataset. Not doing
so would impact any driver where open options could determine the
pixel values; not sure if any other drivers beside TileDB share this
characteristic.

Thanks for your input,
Matt Perry


More information about the gdal-dev mailing list