openmicroscopy/openmicroscopy — pull request #3219 by manics (2014-11-25 10:30:15+00:00)
Title: Tables metadata check size after close (rebased onto dev_5_0)

This is the same as gh-3194 but rebased onto dev_5_0.

----

This should fix the corruption in https://trac.openmicroscopy.org.uk/ome/ticket/12606
(Note it doesn't fix `tables.setAllMetadata`)

Previously the file size was being checked before `hdffile.close()` (via `cleanup()`) had been called. `hdffile.flush()` is already called after any modification but this doesn't seem to be enough. As a result `TableI.close()` was sometimes [truncating the file](https://github.com/openmicroscopy/openmicroscopy/blob/9603945360d3c4af0d04f566f6b498e0afbff394/components/tools/OmeroPy/src/omero/tables.py#L663). In practice I think this is likely to occur with small writes where pytables hasn't allocated any additional space, which means this bug may not be fully reproducible (I've added a test anyway).

To test, try running the example in [the ticket](https://trac.openmicroscopy.org.uk/ome/ticket/12606) with/without this PR.