airbusgeo / godal

golang wrapper for github.com/OSGEO/gdal
Apache License 2.0
130 stars 25 forks source link

Could not delete or restart the handle when used to connect to the AWS. #99

Closed Thzny closed 2 years ago

Thzny commented 2 years ago

Hello!when I was reading the pictures on AWS with godal, I found that the godal did not change when I changed the pictures, and the pictures read were before the modification. I looked at the code and found that as long as I re-registered the handle, I could read the latest one, but I couldn't delete the previously registered handle. Can you give me some advice?

tbonfort commented 2 years ago

This is related to the caching happening in osio, and is the expected behavior: objects accessed through osio are expected/required to be immutable throughout the lifetime of that osio handle. Departing from that rule will pull you in the rabbit hole of cache invalidation and is out of scope of godal/osio. Your safest option is to rework your application logic to ensure that your s3 objects are immutable, i.e. by creating a new object with a different name instead of overwriting an existing object. The unsafe option (which you will probably regret in the long run 😀 ) is to handle the cache invalidation yourself by passing in a cache backend to osio that you can explicitly purge when needed.