Author: stefan2 Date: Sun Jul 30 15:29:15 2017 New Revision: 1803435 URL: http://svn.apache.org/viewvc?rev=1803435&view=rev Log: On the 1.8.x-fsfs-txn-access branch: Don't use caches for the in-txn portion of data when reading in-txn file contents in FSFS. The issue has been dormant ever since in 1.8 but got triggered now by the recently added SHA1 collision checks.
The problem is that we don't create unique cache keys for that in-txn data and that leads to the wrong data being returned from cache. AFAICS, only the tx-delta window caches are affected and all others have already been disabled / skipped for in-txn data. In theory, the problem can also be provoked by any process returning file contents from multiple transactions over its lifetime. Because hook scripts are per-txn/rev, that constallation should be uncommon. User-list report: https://lists.apache.org/thread.html/b475d74442bdf93b21c8656ab2289b4c61e0d90efdafc8a16ddca694@%3Cusers.subversion.apache.org%3E * subversion/libsvn_fs_fs/fs_fs.c (create_rep_state_body): Enable window caches for committed data only. Modified: subversion/branches/1.8.x-fsfs-txn-access/subversion/libsvn_fs_fs/fs_fs.c Modified: subversion/branches/1.8.x-fsfs-txn-access/subversion/libsvn_fs_fs/fs_fs.c URL: http://svn.apache.org/viewvc/subversion/branches/1.8.x-fsfs-txn-access/subversion/libsvn_fs_fs/fs_fs.c?rev=1803435&r1=1803434&r2=1803435&view=diff ============================================================================== --- subversion/branches/1.8.x-fsfs-txn-access/subversion/libsvn_fs_fs/fs_fs.c (original) +++ subversion/branches/1.8.x-fsfs-txn-access/subversion/libsvn_fs_fs/fs_fs.c Sun Jul 30 15:29:15 2017 @@ -4524,9 +4524,10 @@ create_rep_state_body(struct rep_state * if (rev_hint) *rev_hint = rep->revision; - /* continue constructing RS and RA */ - rs->window_cache = ffd->txdelta_window_cache; - rs->combined_cache = ffd->combined_window_cache; + /* Continue constructing RS and RA. + * Note that we must disable caching for in-txn data. */ + rs->window_cache = rep->txn_id ? NULL : ffd->txdelta_window_cache; + rs->combined_cache = rep->txn_id ? NULL : ffd->combined_window_cache; SVN_ERR(read_rep_line(&ra, rs->file, pool)); SVN_ERR(get_file_offset(&rs->start, rs->file, pool));
