Opened 9 years ago

Closed 9 years ago

#4363 closed defect (fixed)

georaster - calling FlushCache is irelevant

Reported by: ilucena Owned by: ilucena
Priority: normal Milestone: 1.10.0
Component: GDAL_Raster Version: svn-trunk
Severity: normal Keywords: georaster


A call to FlushCash? on GeoRaster GDALDataset is not firing the method that update the GeoRaster XML metadata. The problem is noticed by applications that use GDAL Java API and need to wait for the garbage collector to call the class destructor to finalize the object. The problem is that in Java we never know when the garbage collector will destroy that object and in the mean time the object is not consistent in the database.

Change History (6)

comment:1 Changed 9 years ago by Even Rouault

Note : it is documented that a Dataset object must be explicitely destroyed with the delete() method ( see ). You can never rely on the garbage collector, never : not only you don't know *when* it will be called, but you cannot even ensure *if* it will be called. If there's no memory pressure, there's no reason for it to garbage collect objects. delete() is the only way to go. So IMHO, it is not a problem of the georaster driver, but in the Java code. If you workaround it in the GeoRaster driver, you will have issues with other drivers ( GeoTIFF comes to mind as some of the important work is done in the C++ destructor )

comment:2 Changed 9 years ago by ilucena

Yes, that is a good point, delete() should take care of calling the C++ GDALDataset destructor immediately. Independent of driver.

But the fact remains that the FlushCache? function in the GeoRaster driver has a problem and if fixed it can be used as a workaround by calling it before delete().

If you create a new ticket for GDAL Java on that delete() issue, please include me on Cc. Thanks.

comment:3 Changed 9 years ago by Even Rouault

Perhaps I haven't been very clear, because I'm not sure to understand what you mean by the delete() issue. I don't see any issue with it. You must call it, and if you call it, it will call the C++ destructor as expected.

comment:4 Changed 9 years ago by ilucena

But you are assuming that delete() has not been called. That is not the case.

comment:5 Changed 9 years ago by Even Rouault

Having not all the context, I'm a bit lost about what or where issues can be. I just wanted to draw attention on the particular case of delete() in case you were not aware of it. I let it to you to do what appropriate fixes are necessary in the GeoRaster driver ;-)

comment:6 Changed 9 years ago by ilucena

Resolution: fixed
Status: newclosed

The problem was solved on r23614. There was an error on the driver preventing the flush cache and flush metadata to coordinate properly. When the cache was too small to flush, it never flagged the metadata to be flush. If the metadata wasn't flush it would never check if there was a cache to be flushed.

Note: See TracTickets for help on using tickets.