Denis Kovalchuk <>

r1878084, r1876054, r1875925, r1875921, r1875918

r1875918 | stsp | 2020-03-31 08:12:59 +0000 (Tue, 31 Mar 2020)

rep-cache.db insert optimization.

Use the 'IGNORE' conflict resolution algorithm [1] for STMT_SET_REP
and remove SVN_ERR_SQLITE_CONSTRAINT handling, because the error
should not occur now. It brings a slight performance improvement,
because we remove an extra svn_fs_fs__get_rep_reference() call.

The result of a synthetic benchmark, where 10000 identical entries
are inserted into a rep-cache.db which contains 250000 entries:
1) In the case of using the 'FAIL' algorithm: ~40000 microseconds.
2) In the case of using the 'IGNORE' algorithm: ~15000 microseconds.


* subversion/libsvn_fs_fs/rep-cache-db.sql
  (STMT_SET_REP): Use the 'IGNORE' conflict resolution algorithm.
* subversion/libsvn_fs_fs/rep-cache.c
  (svn_fs_fs__set_rep_reference): Remove SVN_ERR_SQLITE_CONSTRAINT handling.

Patch by: Denis Kovalchuk <>

r1875921 | stsp | 2020-03-31 08:53:55 +0000 (Tue, 31 Mar 2020)

Introduce 'svnadmin build-repcache' command.

Implement the 'svnadmin build-repcache' CLI and add an ioctl API for building
the representation cache.

The implementation iterates over revisions in the specified range and recursively
processes the changed nodes, starting from the corresponding revision roots.
For each changed node, it ensures that its data and property representations
exist in the rep-cache. The nodes are processed in the same order as when
committing a transaction (see write_final_rev() function in libsvn_fs_fs/transaction.c),
so that the rep-cache.db files are fully consistent.

* subversion/svnadmin/svnadmin.c
  (cmd_table): Add and document the 'build-repcache' command.
   build_rep_cache_progress_func): New.

* subversion/include/svn_error_codes.h

* subversion/include/private/svn_fs_fs_private.h

* subversion/libsvn_fs_fs/fs.c
  (fs_ioctl): Handle SVN_FS_FS__IOCTL_BUILD_REP_CACHE.

* subversion/libsvn_fs_fs/fs_fs.h
* subversion/libsvn_fs_fs/fs_fs.c
  (): Include 'low_level.h'.
   ensure_representation_sha1): New. Iterate over revisions and recursively
   process the changed nodes. For each changed node, ensure that its data
   and property representations exist in the rep-cache.

* subversion/tests/cmdline/
  (build_repcache): New test.
  (test_list): Add the new test.

* subversion/tests/libsvn_fs_fs/fs-fs-private-test.c
  (): Include 'libsvn_fs_fs/rep-cache.h' and 'libsvn_fs/fs-loader.h'.
  (build_rep_cache): New test.
  (test_funcs): Add the new test.

* tools/client-side/bash_completion
  (_svnadmin): Add the 'build-repcache' command.

Patch by: Denis Kovalchuk <>

r1875925 | stsp | 2020-03-31 10:47:50 +0000 (Tue, 31 Mar 2020)

Follow-up to r1875921: Add missing test decorator.

Skip build_repcache() test if read_rep_cache() is not supported
by Python-SQLite version.

* subversion/tests/cmdline/
  (build_repcache): Add missing SkipUnless decorator.

Patch by: Denis Kovalchuk <>
Found by: svn-windows-local buildbot

r1876054 | stsp | 2020-04-02 16:57:10 +0000 (Thu, 02 Apr 2020)

Fix undefined behavior when constructing ID for txn_node_cache in fsfs.

In make_txn_root() function, the txn variable of type svn_fs_fs__id_part_t *
is passed to apr_pstrcat() function, leading to the undefined behavior.
I can assume that originally it was planned to pass a textual representation
of the txn, instead of passing the txn itself.

Although ID is not used anywhere, except debug-only calls of
svn_cache__get_info() and svn_cache__format_info() functions, the improper call
to apr_pstrcat() may cause a potential crash, etc.

* subversion/libsvn_fs_fs/tree.c
  (make_txn_root): Pass a textual representation of the txn to apr_pstrcat()

Patch by: Denis Kovalchuk <>

r1878084 | hartmannathan | 2020-05-24 16:09:35 +0000 (Sun, 24 May 2020)

Fix an inefficient way to fill an array of inherited properties.

The code that obtains inherited properties for servers that don't support the
capability used an inefficient way of array filling. At each iteration, all
previously added properties were moved one position to the right to maintain
depth-first order. As a solution, walk the array of iprop requests from the
end and get rid of extra copying of array elements.

* subversion/libsvn_ra_serf/inherited_props.c
  (): Remove unused 'svn_sorts.h' and 'private/svn_sorts_private.h' includes.
  (get_iprops_via_more_requests): Walk the array of iprop requests from the

Patch by: Denis Kovalchuk <denis.kovalchuk{_AT_}>

Review by: brane