Commit d27ade8e authored by Kirill Smelkov's avatar Kirill Smelkov

bigfile/zodb: Explain why we always mark ZBlk object changed if block data change

For ZBlk0 this is trivial, but for ZBlk1 it may seem that we could avoid
changing ZBlk object itself and mark only pointed-to ZData object as
changed. However that would be not correct to do if we consider
invalidations.

Noticed while working on WCFS.
parent d5e0d2f9
...@@ -552,7 +552,16 @@ class ZBigFile(LivePersistent): ...@@ -552,7 +552,16 @@ class ZBigFile(LivePersistent):
blkchanged = zblk.setblkdata(buf) blkchanged = zblk.setblkdata(buf)
if blkchanged: if blkchanged:
zblk._p_changed = True # if zblk was already in DB: _p_state -> CHANGED # if zblk was already in DB: _p_state -> CHANGED.
# do this unconditionally even e.g. for ZBlk1 for which only ZData inside changed:
#
# We cannot avoid committing ZBlk in all cases, because it is used to signal
# other DB clients that a ZBlk needs to be invalidated and this way associated
# fileh pages are invalidated too.
#
# This cannot work via ZData, because ZData don't have back-pointer to
# ZBlk1 or to corresponding zfile.
zblk._p_changed = True
zblk.bindzfile(self, blk) zblk.bindzfile(self, blk)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment