You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by ju...@apache.org on 2015/11/02 17:45:33 UTC
svn commit: r1712080 [1/2] - in /subversion/branches/move-tracking-2: ./
notes/api-errata/1.9/ subversion/ subversion/include/
subversion/libsvn_client/ subversion/libsvn_fs/ subversion/libsvn_fs_fs/
subversion/libsvn_fs_x/ subversion/libsvn_ra_serf/ s...
Author: julianfoad
Date: Mon Nov 2 16:45:32 2015
New Revision: 1712080
URL: http://svn.apache.org/viewvc?rev=1712080&view=rev
Log:
On the 'move-tracking-2' branch: catch up to trunk@1712079.
Modified:
subversion/branches/move-tracking-2/ (props changed)
subversion/branches/move-tracking-2/notes/api-errata/1.9/fs001.txt
subversion/branches/move-tracking-2/subversion/ (props changed)
subversion/branches/move-tracking-2/subversion/include/svn_base64.h
subversion/branches/move-tracking-2/subversion/include/svn_fs.h
subversion/branches/move-tracking-2/subversion/include/svn_ra.h
subversion/branches/move-tracking-2/subversion/include/svn_repos.h
subversion/branches/move-tracking-2/subversion/libsvn_client/externals.c
subversion/branches/move-tracking-2/subversion/libsvn_fs/deprecated.c
subversion/branches/move-tracking-2/subversion/libsvn_fs/fs-loader.c
subversion/branches/move-tracking-2/subversion/libsvn_fs_fs/dag.c
subversion/branches/move-tracking-2/subversion/libsvn_fs_fs/tree.c
subversion/branches/move-tracking-2/subversion/libsvn_fs_x/ (props changed)
subversion/branches/move-tracking-2/subversion/libsvn_fs_x/batch_fsync.c
subversion/branches/move-tracking-2/subversion/libsvn_fs_x/fs.c
subversion/branches/move-tracking-2/subversion/libsvn_fs_x/fs_x.c
subversion/branches/move-tracking-2/subversion/libsvn_fs_x/fs_x.h
subversion/branches/move-tracking-2/subversion/libsvn_fs_x/hotcopy.c
subversion/branches/move-tracking-2/subversion/libsvn_fs_x/pack.c
subversion/branches/move-tracking-2/subversion/libsvn_fs_x/recovery.c
subversion/branches/move-tracking-2/subversion/libsvn_fs_x/revprops.c
subversion/branches/move-tracking-2/subversion/libsvn_fs_x/revprops.h
subversion/branches/move-tracking-2/subversion/libsvn_fs_x/transaction.c
subversion/branches/move-tracking-2/subversion/libsvn_fs_x/util.c
subversion/branches/move-tracking-2/subversion/libsvn_fs_x/util.h
subversion/branches/move-tracking-2/subversion/libsvn_ra_serf/update.c
subversion/branches/move-tracking-2/subversion/libsvn_repos/delta.c
subversion/branches/move-tracking-2/subversion/libsvn_repos/reporter.c
subversion/branches/move-tracking-2/subversion/libsvn_repos/repos.c
subversion/branches/move-tracking-2/subversion/libsvn_repos/rev_hunt.c
subversion/branches/move-tracking-2/subversion/libsvn_subr/base64.c
subversion/branches/move-tracking-2/subversion/libsvn_subr/deprecated.c
subversion/branches/move-tracking-2/subversion/mod_dav_svn/util.c
subversion/branches/move-tracking-2/subversion/svnbench/null-list-cmd.c
subversion/branches/move-tracking-2/subversion/svnbench/svnbench.c
subversion/branches/move-tracking-2/subversion/svnlook/svnlook.c
subversion/branches/move-tracking-2/subversion/tests/cmdline/svnadmin_tests.py
subversion/branches/move-tracking-2/subversion/tests/libsvn_delta/svndiff-test.c
subversion/branches/move-tracking-2/subversion/tests/libsvn_fs/fs-test.c
subversion/branches/move-tracking-2/subversion/tests/libsvn_fs_x/fs-x-pack-test.c
subversion/branches/move-tracking-2/subversion/tests/libsvn_subr/stream-test.c
subversion/branches/move-tracking-2/subversion/tests/svn_test_fs.c
subversion/branches/move-tracking-2/win-tests.py (contents, props changed)
Propchange: subversion/branches/move-tracking-2/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Nov 2 16:45:32 2015
@@ -94,4 +94,4 @@
/subversion/branches/verify-at-commit:1462039-1462408
/subversion/branches/verify-keep-going:1439280-1546110
/subversion/branches/wc-collate-path:1402685-1480384
-/subversion/trunk:1606692-1710529
+/subversion/trunk:1606692-1712079
Modified: subversion/branches/move-tracking-2/notes/api-errata/1.9/fs001.txt
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/notes/api-errata/1.9/fs001.txt?rev=1712080&r1=1712079&r2=1712080&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/notes/api-errata/1.9/fs001.txt (original)
+++ subversion/branches/move-tracking-2/notes/api-errata/1.9/fs001.txt Mon Nov 2 16:45:32 2015
@@ -3,9 +3,22 @@ API ERRATA -- $Id$
Root Cause of Errata: implementation/docstring mismatch
Library(s) Affected: libsvn_fs_fs, libsvn_fs_base
Function(s) Affected: svn_fs_props_changed, svn_fs_contents_changed
- New Behavior in: 1.9
- Related Issues: n/a
+ New Behavior in: 1.9.0-1.9.2 (only, see note below)
+ Related Issues: 4598
+[ Note: This only applies to Subversion 1.9.0-1.9.2; later versions
+ restore the original behavior of svn_fs_props_changed and
+ svn_fs_contents_changed. The new svn_fs_props_different
+ svn_fs_contents_different functions are available for the
+ API users as well.
+
+ References:
+
+ https://issues.apache.org/jira/browse/SVN-4598
+ https://mail-archives.apache.org/mod_mbox/subversion-dev/201509.mbox/%3CCAB84uBVe8QnEpbPVAb__yQjiDDoYjFn2+M9mPcdBXZCwMCpOLw@mail.gmail.com%3E
+ ("No-op changes no longer dumped by 'svnadmin dump' in 1.9")
+ https://mail-archives.apache.org/mod_mbox/subversion-dev/201302.mbox/%3C510B6AE9.9070106@collab.net%3E
+ ("Re: Reintegrate-like merges and diff_ignore_ancestry") ]
== Details ==
Propchange: subversion/branches/move-tracking-2/subversion/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Nov 2 16:45:32 2015
@@ -82,4 +82,4 @@
/subversion/branches/verify-at-commit/subversion:1462039-1462408
/subversion/branches/verify-keep-going/subversion:1439280-1546110
/subversion/branches/wc-collate-path/subversion:1402685-1480384
-/subversion/trunk/subversion:1606692-1710529
+/subversion/trunk/subversion:1606692-1712079
Modified: subversion/branches/move-tracking-2/subversion/include/svn_base64.h
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/include/svn_base64.h?rev=1712080&r1=1712079&r2=1712080&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/include/svn_base64.h (original)
+++ subversion/branches/move-tracking-2/subversion/include/svn_base64.h Mon Nov 2 16:45:32 2015
@@ -46,11 +46,24 @@ extern "C" {
*/
/** Return a writable generic stream which will encode binary data in
- * base64 format and write the encoded data to @a output. Be sure to
- * close the stream when done writing in order to squeeze out the last
- * bit of encoded data. The stream is allocated in @a pool.
+ * base64 format and write the encoded data to @a output. If @a break_lines
+ * is true, newlines will be inserted periodically; otherwise the output
+ * stream will only consist of base64 encoding characters. Be sure to close
+ * the stream when done writing in order to squeeze out the last bit of
+ * encoded data. The stream is allocated in @a pool.
*/
svn_stream_t *
+svn_base64_encode2(svn_stream_t *output,
+ svn_boolean_t break_lines,
+ apr_pool_t *pool);
+
+/**
+ * Same as svn_base64_encode2, but with @a break_lines always TRUE.
+ *
+ * @deprecated Provided for backward compatibility with the 1.9 API.
+ */
+SVN_DEPRECATED
+svn_stream_t *
svn_base64_encode(svn_stream_t *output,
apr_pool_t *pool);
Modified: subversion/branches/move-tracking-2/subversion/include/svn_fs.h
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/include/svn_fs.h?rev=1712080&r1=1712079&r2=1712080&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/include/svn_fs.h (original)
+++ subversion/branches/move-tracking-2/subversion/include/svn_fs.h Mon Nov 2 16:45:32 2015
@@ -269,11 +269,13 @@ svn_fs_set_warning_func(svn_fs_t *fs,
* @c NULL, the options it contains modify the behavior of the
* filesystem. The interpretation of @a fs_config is specific to the
* filesystem back-end. The new filesystem may be closed by
- * destroying @a pool.
+ * destroying @a result_pool.
+ *
+ * Use @a scratch_pool for temporary allocations.
*
* @note The lifetime of @a fs_config must not be shorter than @a
- * pool's. It's a good idea to allocate @a fs_config from @a pool or
- * one of its ancestors.
+ * result_pool's. It's a good idea to allocate @a fs_config from
+ * @a result_pool or one of its ancestors.
*
* If @a fs_config contains a value for #SVN_FS_CONFIG_FS_TYPE, that
* value determines the filesystem type for the new filesystem.
@@ -289,8 +291,22 @@ svn_fs_set_warning_func(svn_fs_t *fs,
* though the caller should not rely upon any particular default if they
* wish to ensure that a filesystem of a specific type is created.
*
+ * @since New in 1.10.
+ */
+svn_error_t *
+svn_fs_create2(svn_fs_t **fs_p,
+ const char *path,
+ apr_hash_t *fs_config,
+ apr_pool_t *result_pool,
+ apr_pool_t *scratch_pool);
+
+/**
+ * Like svn_fs_create2(), but without @a scratch_pool.
+ *
+ * @deprecated Provided for backward compatibility with the 1.9 API.
* @since New in 1.1.
*/
+SVN_DEPRECATED
svn_error_t *
svn_fs_create(svn_fs_t **fs_p,
const char *path,
@@ -1858,6 +1874,15 @@ svn_fs_change_node_prop(svn_fs_root_t *r
* both roots must be in the same filesystem.
* Do any necessary temporary allocation in @a scratch_pool.
*
+ * @note For the purposes of preserving accurate history, certain bits of
+ * code (such as the repository dump code) need to care about the distinction
+ * between situations when the properties are "different" and "have changed
+ * across two points in history". We have a pair of functions that can
+ * answer both of these questions, svn_fs_props_different() and
+ * svn_fs_props_changed(). See issue 4598 for more details.
+ *
+ * @see svn_fs_props_changed
+ *
* @since New in 1.9.
*/
svn_error_t *
@@ -1869,9 +1894,7 @@ svn_fs_props_different(svn_boolean_t *di
apr_pool_t *scratch_pool);
-/** Determine if the properties of two path/root combinations are different.
- * In contrast to #svn_fs_props_different, we only perform a quick test and
- * allow for false positives.
+/** Determine if the properties of two path/root combinations have changed.
*
* Set @a *changed_p to #TRUE if the properties at @a path1 under @a root1
* differ from those at @a path2 under @a root2, or set it to #FALSE if they
@@ -1879,15 +1902,19 @@ svn_fs_props_different(svn_boolean_t *di
* both roots must be in the same filesystem.
* Do any necessary temporary allocation in @a pool.
*
- * @note The behavior is implementation dependent in that the false
- * positives reported may differ from release to release and backend to
- * backend. There is also no guarantee that there will be false positives
- * at all.
- *
- * @note Prior to Subversion 1.9, this function would return false negatives
- * for FSFS: If @a root1 and @a root2 were both transaction roots
- * and the proplists of both paths had been changed in their respective
- * transactions, @a changed_p would be set to #FALSE.
+ * @note For the purposes of preserving accurate history, certain bits of
+ * code (such as the repository dump code) need to care about the distinction
+ * between situations when the properties are "different" and "have changed
+ * across two points in history". We have a pair of functions that can
+ * answer both of these questions, svn_fs_props_different() and
+ * svn_fs_props_changed(). See issue 4598 for more details.
+ *
+ * @note This function can currently return false negatives for FSFS:
+ * If @a root1 and @a root2 were both transaction roots and the proplists
+ * of both paths had been changed in their respective transactions,
+ * @a changed_p would be set to #FALSE.
+ *
+ * @see svn_fs_props_different
*/
svn_error_t *
svn_fs_props_changed(svn_boolean_t *changed_p,
@@ -2407,7 +2434,7 @@ svn_fs_apply_text(svn_stream_t **content
apr_pool_t *pool);
-/** Check if the contents of two root/path combos have changed.
+/** Check if the contents of two root/path combos are different.
*
* Set @a *different_p to #TRUE if the file contents at @a path1 under
* @a root1 differ from those at @a path2 under @a root2, or set it to
@@ -2415,6 +2442,16 @@ svn_fs_apply_text(svn_stream_t **content
* respective roots, and both roots must be in the same filesystem.
* Do any necessary temporary allocation in @a scratch_pool.
*
+ * @note For the purposes of preserving accurate history, certain bits of
+ * code (such as the repository dump code) need to care about the distinction
+ * between situations when two files have "different" content and when the
+ * contents of a given file "have changed" across two points in its history.
+ * We have a pair of functions that can answer both of these questions,
+ * svn_fs_contents_different() and svn_fs_contents_changed(). See issue
+ * 4598 for more details.
+ *
+ * @see svn_fs_contents_changed
+ *
* @since New in 1.9.
*/
svn_error_t *
@@ -2425,9 +2462,7 @@ svn_fs_contents_different(svn_boolean_t
const char *path2,
apr_pool_t *scratch_pool);
-/** Check if the contents of two root/path combos have changed. In
- * contrast to #svn_fs_contents_different, we only perform a quick test
- * and allow for false positives.
+/** Check if the contents of two root/path combos have changed.
*
* Set @a *changed_p to #TRUE if the file contents at @a path1 under
* @a root1 differ from those at @a path2 under @a root2, or set it to
@@ -2435,10 +2470,18 @@ svn_fs_contents_different(svn_boolean_t
* respective roots, and both roots must be in the same filesystem.
* Do any necessary temporary allocation in @a pool.
*
- * @note The behavior is implementation dependent in that the false
- * positives reported may differ from release to release and backend to
- * backend. There is also no guarantee that there will be false positives
- * at all.
+ * @note svn_fs_contents_changed() was not designed to be used to detect
+ * when two files have different content, but really to detect when the
+ * contents of a given file have changed across two points in its history.
+ * For the purposes of preserving accurate history, certain bits of code
+ * (such as the repository dump code) need to care about this distinction.
+ * For example, it's not an error from the FS API point of view to call
+ * svn_fs_apply_textdelta() and explicitly set a file's contents to exactly
+ * what they were before the edit was made. We have a pair of functions
+ * that can answer both of these questions, svn_fs_contents_changed() and
+ * svn_fs_contents_different(). See issue 4598 for more details.
+ *
+ * @see svn_fs_contents_different
*/
svn_error_t *
svn_fs_contents_changed(svn_boolean_t *changed_p,
Modified: subversion/branches/move-tracking-2/subversion/include/svn_ra.h
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/include/svn_ra.h?rev=1712080&r1=1712079&r2=1712080&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/include/svn_ra.h (original)
+++ subversion/branches/move-tracking-2/subversion/include/svn_ra.h Mon Nov 2 16:45:32 2015
@@ -1797,10 +1797,11 @@ svn_ra_get_location_segments(svn_ra_sess
* to support reversion of the revision range for @a include_merged_revision
* @c FALSE reporting by switching @a end with @a start.
*
- * @note In Subversion 1.9.0-1.9.2, the delta handler / baton return
- * arguments passed to @a handler were set to #NULL in case of an empty
- * text delta. All other versions may request delta handlers from
- * @a handler even for empty text deltas.
+ * @note Prior to Subversion 1.9, this function may request delta handlers
+ * from @a handler even for empty text deltas. Starting with 1.9, the
+ * delta handler / baton return arguments passed to @a handler will be
+ * #NULL unless there is an actual difference in the file contents between
+ * the current and the previous call.
*
* @since New in 1.5.
*/
Modified: subversion/branches/move-tracking-2/subversion/include/svn_repos.h
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/include/svn_repos.h?rev=1712080&r1=1712079&r2=1712080&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/include/svn_repos.h (original)
+++ subversion/branches/move-tracking-2/subversion/include/svn_repos.h Mon Nov 2 16:45:32 2015
@@ -2093,10 +2093,11 @@ svn_repos_fs_get_mergeinfo(svn_mergeinfo
* the revision range for @a include_merged_revision @c FALSE reporting by
* switching @a start with @a end.
*
- * @note In Subversion 1.9.0-1.9.2, the delta handler / baton return
- * arguments passed to @a handler were set to #NULL in case of an empty
- * text delta. All other versions may request delta handlers from
- * @a handler even for empty text deltas.
+ * @note Prior to Subversion 1.9, this function may request delta handlers
+ * from @a handler even for empty text deltas. Starting with 1.9, the
+ * delta handler / baton return arguments passed to @a handler will be
+ * #NULL unless there is an actual difference in the file contents between
+ * the current and the previous call.
*
* @since New in 1.5.
*/
Modified: subversion/branches/move-tracking-2/subversion/libsvn_client/externals.c
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/libsvn_client/externals.c?rev=1712080&r1=1712079&r2=1712080&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/libsvn_client/externals.c (original)
+++ subversion/branches/move-tracking-2/subversion/libsvn_client/externals.c Mon Nov 2 16:45:32 2015
@@ -252,8 +252,10 @@ switch_dir_external(const char *local_ab
svn_error_clear(err);
err = NULL;
}
+ else if (err)
+ return svn_error_trace(err);
- return svn_error_createf(SVN_ERR_WC_PATH_UNEXPECTED_STATUS, err,
+ return svn_error_createf(SVN_ERR_WC_PATH_UNEXPECTED_STATUS, NULL,
_("The external '%s' defined in %s at '%s' "
"cannot be checked out because '%s' is "
"already a versioned path."),
Modified: subversion/branches/move-tracking-2/subversion/libsvn_fs/deprecated.c
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/libsvn_fs/deprecated.c?rev=1712080&r1=1712079&r2=1712080&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/libsvn_fs/deprecated.c (original)
+++ subversion/branches/move-tracking-2/subversion/libsvn_fs/deprecated.c Mon Nov 2 16:45:32 2015
@@ -103,6 +103,55 @@ svn_fs_get_locks(svn_fs_t *fs, const cha
pool));
}
+svn_error_t *
+svn_fs_create(svn_fs_t **fs_p,
+ const char *path,
+ apr_hash_t *fs_config,
+ apr_pool_t *pool)
+{
+ return svn_fs_create2(fs_p, path, fs_config, pool, pool);
+}
+
+svn_error_t *
+svn_fs_open(svn_fs_t **fs_p,
+ const char *path,
+ apr_hash_t *fs_config,
+ apr_pool_t *pool)
+{
+ return svn_fs_open2(fs_p, path, fs_config, pool, pool);
+}
+
+svn_error_t *
+svn_fs_node_history(svn_fs_history_t **history_p, svn_fs_root_t *root,
+ const char *path, apr_pool_t *pool)
+{
+ return svn_error_trace(svn_fs_node_history2(history_p, root, path,
+ pool, pool));
+}
+
+svn_error_t *
+svn_fs_get_mergeinfo(svn_mergeinfo_catalog_t *catalog,
+ svn_fs_root_t *root,
+ const apr_array_header_t *paths,
+ svn_mergeinfo_inheritance_t inherit,
+ svn_boolean_t include_descendants,
+ apr_pool_t *pool)
+{
+ return svn_error_trace(svn_fs_get_mergeinfo2(catalog, root, paths,
+ inherit,
+ include_descendants,
+ TRUE, pool, pool));
+}
+
+svn_error_t *
+svn_fs_history_prev(svn_fs_history_t **prev_history_p,
+ svn_fs_history_t *history, svn_boolean_t cross_copies,
+ apr_pool_t *pool)
+{
+ return svn_error_trace(svn_fs_history_prev2(prev_history_p, history,
+ cross_copies, pool, pool));
+}
+
/*** From access.c ***/
svn_error_t *
svn_fs_access_add_lock_token(svn_fs_access_t *access_ctx,
Modified: subversion/branches/move-tracking-2/subversion/libsvn_fs/fs-loader.c
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/libsvn_fs/fs-loader.c?rev=1712080&r1=1712079&r2=1712080&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/libsvn_fs/fs-loader.c (original)
+++ subversion/branches/move-tracking-2/subversion/libsvn_fs/fs-loader.c Mon Nov 2 16:45:32 2015
@@ -506,11 +506,13 @@ svn_fs_set_warning_func(svn_fs_t *fs, sv
}
svn_error_t *
-svn_fs_create(svn_fs_t **fs_p, const char *path, apr_hash_t *fs_config,
- apr_pool_t *pool)
+svn_fs_create2(svn_fs_t **fs_p,
+ const char *path,
+ apr_hash_t *fs_config,
+ apr_pool_t *result_pool,
+ apr_pool_t *scratch_pool)
{
fs_library_vtable_t *vtable;
- apr_pool_t *scratch_pool = svn_pool_create(pool);
const char *fs_type = svn_hash__get_cstring(fs_config,
SVN_FS_CONFIG_FS_TYPE,
@@ -522,13 +524,12 @@ svn_fs_create(svn_fs_t **fs_p, const cha
SVN_ERR(write_fs_type(path, fs_type, scratch_pool));
/* Perform the actual creation. */
- *fs_p = fs_new(fs_config, pool);
+ *fs_p = fs_new(fs_config, result_pool);
SVN_ERR(vtable->create(*fs_p, path, common_pool_lock, scratch_pool,
common_pool));
SVN_ERR(vtable->set_svn_fs_open(*fs_p, svn_fs_open2));
- svn_pool_destroy(scratch_pool);
return SVN_NO_ERROR;
}
@@ -549,15 +550,6 @@ svn_fs_open2(svn_fs_t **fs_p, const char
}
svn_error_t *
-svn_fs_open(svn_fs_t **fs_p,
- const char *path,
- apr_hash_t *fs_config,
- apr_pool_t *pool)
-{
- return svn_fs_open2(fs_p, path, fs_config, pool, pool);
-}
-
-svn_error_t *
svn_fs_upgrade2(const char *path,
svn_fs_upgrade_notify_t notify_func,
void *notify_baton,
@@ -1103,14 +1095,6 @@ svn_fs_node_history2(svn_fs_history_t **
}
svn_error_t *
-svn_fs_node_history(svn_fs_history_t **history_p, svn_fs_root_t *root,
- const char *path, apr_pool_t *pool)
-{
- return svn_error_trace(root->vtable->node_history(history_p, root, path,
- pool, pool));
-}
-
-svn_error_t *
svn_fs_is_dir(svn_boolean_t *is_dir, svn_fs_root_t *root, const char *path,
apr_pool_t *pool)
{
@@ -1271,20 +1255,6 @@ svn_fs_get_mergeinfo2(svn_mergeinfo_cata
}
svn_error_t *
-svn_fs_get_mergeinfo(svn_mergeinfo_catalog_t *catalog,
- svn_fs_root_t *root,
- const apr_array_header_t *paths,
- svn_mergeinfo_inheritance_t inherit,
- svn_boolean_t include_descendants,
- apr_pool_t *pool)
-{
- return svn_error_trace(root->vtable->get_mergeinfo(catalog, root, paths,
- inherit,
- include_descendants,
- TRUE, pool, pool));
-}
-
-svn_error_t *
svn_fs__get_mergeinfo_for_path(svn_mergeinfo_t *mergeinfo,
svn_fs_root_t *root,
const char *path,
@@ -1883,15 +1853,6 @@ svn_fs_history_prev2(svn_fs_history_t **
}
svn_error_t *
-svn_fs_history_prev(svn_fs_history_t **prev_history_p,
- svn_fs_history_t *history, svn_boolean_t cross_copies,
- apr_pool_t *pool)
-{
- return svn_error_trace(history->vtable->prev(prev_history_p, history,
- cross_copies, pool, pool));
-}
-
-svn_error_t *
svn_fs_history_location(const char **path, svn_revnum_t *revision,
svn_fs_history_t *history, apr_pool_t *pool)
{
Modified: subversion/branches/move-tracking-2/subversion/libsvn_fs_fs/dag.c
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/libsvn_fs_fs/dag.c?rev=1712080&r1=1712079&r2=1712080&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/libsvn_fs_fs/dag.c (original)
+++ subversion/branches/move-tracking-2/subversion/libsvn_fs_fs/dag.c Mon Nov 2 16:45:32 2015
@@ -1319,9 +1319,6 @@ svn_fs_fs__dag_things_different(svn_bool
{
/* In strict mode, compare text and property representations in the
svn_fs_contents_different() / svn_fs_props_different() manner.
- These functions are currently not being used in our codebase, but
- we released them as a part of 1.9, and keep them for compatibility
- reasons.
See the "No-op changes no longer dumped by 'svnadmin dump' in 1.9"
discussion (http://svn.haxx.se/dev/archive-2015-09/0269.shtml) and
Modified: subversion/branches/move-tracking-2/subversion/libsvn_fs_fs/tree.c
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/libsvn_fs_fs/tree.c?rev=1712080&r1=1712079&r2=1712080&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/libsvn_fs_fs/tree.c (original)
+++ subversion/branches/move-tracking-2/subversion/libsvn_fs_fs/tree.c Mon Nov 2 16:45:32 2015
@@ -1929,6 +1929,7 @@ merge(svn_stringbuf_t *conflict_p,
*/
{
node_revision_t *tgt_nr, *anc_nr, *src_nr;
+ svn_boolean_t same;
apr_pool_t *scratch_pool;
/* Get node revisions for our id's. */
@@ -1945,16 +1946,15 @@ merge(svn_stringbuf_t *conflict_p,
/* Now compare the prop-keys of the skels. Note that just because
the keys are different -doesn't- mean the proplists have
- different contents. But merge() isn't concerned with contents;
- it doesn't do a brute-force comparison on textual contents, so
- it won't do that here either. Checking to see if the propkey
- atoms are `equal' is enough. */
- if (! svn_fs_fs__noderev_same_rep_key(src_nr->prop_rep, anc_nr->prop_rep))
+ different contents. */
+ SVN_ERR(svn_fs_fs__prop_rep_equal(&same, fs, src_nr, anc_nr, pool));
+ if (! same)
return conflict_err(conflict_p, target_path);
/* The directory entries got changed in the repository but the directory
properties did not. */
- if (! svn_fs_fs__noderev_same_rep_key(tgt_nr->prop_rep, anc_nr->prop_rep))
+ SVN_ERR(svn_fs_fs__prop_rep_equal(&same, fs, tgt_nr, anc_nr, pool));
+ if (! same)
{
/* There is an incoming prop change for this directory.
We will accept it only if the directory changes were mere updates
@@ -3235,23 +3235,18 @@ fs_contents_changed(svn_boolean_t *chang
(SVN_ERR_FS_GENERAL, NULL,
_("Cannot compare file contents between two different filesystems"));
- /* Check that both paths are files. */
- {
- svn_node_kind_t kind;
-
- SVN_ERR(svn_fs_fs__check_path(&kind, root1, path1, pool));
- if (kind != svn_node_file)
- return svn_error_createf
- (SVN_ERR_FS_GENERAL, NULL, _("'%s' is not a file"), path1);
-
- SVN_ERR(svn_fs_fs__check_path(&kind, root2, path2, pool));
- if (kind != svn_node_file)
- return svn_error_createf
- (SVN_ERR_FS_GENERAL, NULL, _("'%s' is not a file"), path2);
- }
-
SVN_ERR(get_dag(&node1, root1, path1, pool));
+ /* Make sure that path is file. */
+ if (svn_fs_fs__dag_node_kind(node1) != svn_node_file)
+ return svn_error_createf
+ (SVN_ERR_FS_NOT_FILE, NULL, _("'%s' is not a file"), path1);
+
SVN_ERR(get_dag(&node2, root2, path2, pool));
+ /* Make sure that path is file. */
+ if (svn_fs_fs__dag_node_kind(node2) != svn_node_file)
+ return svn_error_createf
+ (SVN_ERR_FS_NOT_FILE, NULL, _("'%s' is not a file"), path2);
+
return svn_fs_fs__dag_things_different(NULL, changed_p,
node1, node2, strict, pool);
}
Propchange: subversion/branches/move-tracking-2/subversion/libsvn_fs_x/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Nov 2 16:45:32 2015
@@ -94,4 +94,4 @@
/subversion/branches/verify-keep-going/subversion/libsvn_fs_x:1439280-1492639,1546002-1546110
/subversion/branches/wc-collate-path/subversion/libsvn_fs_x:1402685-1480384
/subversion/trunk/subversion/libsvn_fs_fs:1415133-1596500,1596567,1597414,1597989,1598273,1599140,1600872,1601633,1603485-1603487,1603499,1603605,1604128,1604188,1604413-1604414,1604416-1604417,1604421,1604442,1604700,1604717,1604720,1604726,1604755,1604794,1604802,1604824,1604836,1604844,1604902-1604903,1604911,1604925,1604933,1604947,1605059-1605060,1605064-1605065,1605068,1605071-1605073,1605075,1605123,1605188-1605189,1605191,1605197,1605444,1605633,1606132,1606142,1606144,1606514,1606526,1606528,1606551,1606554,1606564,1606598-1606599,1606656,1606658,1606662,1606744,1606840,1607085,1607572,1612407,1612810,1613339,1613872,1614611,1615348,1615351-1615352,1615356,1616338-1616339,1616613,1617586,1617688,1618138,1618151,1618153,1618226,1618641,1618653,1618662,1619068,1619358,1619413,1619769,1619774,1620602,1620909,1620912,1620928,1620930,1621275,1621635,1622931,1622937,1622942,1622946,1622959-1622960,1622963,1622987,1623007,1623368,1623373,1623377,1623379,1623381,1623398,1623402,162
4011,1624265,1624512,1626246,1626871,1626873,1626886,1627497-1627498,1627502,1627947-1627949,1627966,1628083,1628093,1628158-1628159,1628161,1628392-1628393,1628415,1628427,1628676,1628738,1628762,1628764,1629854-1629855,1629857,1629865,1629873,1629875,1629879,1630067,1630070,1631049-1631051,1631075,1631115,1631171,1631180,1631185-1631186,1631196-1631197,1631239-1631240,1631548,1631550,1631563,1631567,1631588,1631598,1632646,1632776,1632849,1632851-1632853,1632856-1632857,1632868,1632908,1632926,1633232,1633617-1633618,1634872,1634875,1634879-1634880,1634920,1636478,1636483,1636629,1636644,1637184,1637186,1637330,1637358,1637363,1637393,1639319,1639322,1639335,1639348,1639352,1639355,1639358,1639414,1639419,1639426,1639430,1639436,1639440,1639549,1640061-1640062,1640197,1640915,1640966,1641013,1643139,1643233,1645567,1646021,1646712,1646716,1647537,1647540-1647541,1647820,1647905,1648230,1648238,1648241-1648243,1648253,1648272,1648532,1648537-1648539,1648542,1648591,1648612,1649590,
1651567,1652068,1652076,1652441,1652451,1653608,1654932,1654934,1654937,1655635,1655649,1655651,1655664,1656176,1657525,1657972,1657978,1658482,1659212,1659217,1659314,1659509,1662668,1665318,1665854,1665894,1667090,1667101,1667538,1669743,1669746,1669749,1669945,1670139,1670953,1673170,1673197,1673202,1673204,1673445,1673454,1673685,1673689,1673875,1674165,1674341,1674400,1674404,1674631,1674669,1674673,1675396,1676667,1677431,1678149,1678151,1678718,1678725,1679169,1679907,1679920-1679924,1679926,1680347,1680460,1680464,1680476,1680819,1681949,1681966,1681974,1681994,1682008,1682076,1682086,1682093,1682259,1682265,1682739,1682864,1683311,1683330,1683378,1683544,1683553,1684047,1686232,1686542,1686546,1686554,1686557,1687061,1687064,1687070-1687071,1687074,1687078-1687079,1688270,1688425,1692650,1693886,1694489,1694848,1696171,1696185,1696627-1696628,1696630,1696758,1697372,1697381,1697387,1697393,1697403,1697405,1701017,1701053,1702600,1702922,1703069,1703142,1703237,1703240,17052
66,1705638,1705643,1705646,1705724,1705730,1705739,1706612,1706615,1706617,1706619,1706675-1706676,1706679,1706979-1706980,1707308,1707971-1707973,1707986,1707988-1707989,1708004
-/subversion/trunk/subversion/libsvn_fs_x:1414756-1509914,1606692-1710529
+/subversion/trunk/subversion/libsvn_fs_x:1414756-1509914,1606692-1712079
Modified: subversion/branches/move-tracking-2/subversion/libsvn_fs_x/batch_fsync.c
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/libsvn_fs_x/batch_fsync.c?rev=1712080&r1=1712079&r2=1712080&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/libsvn_fs_x/batch_fsync.c (original)
+++ subversion/branches/move-tracking-2/subversion/libsvn_fs_x/batch_fsync.c Mon Nov 2 16:45:32 2015
@@ -327,6 +327,8 @@ internal_open_file(apr_file_t **file,
svn_error_t *err;
apr_pool_t *pool;
to_sync_t *to_sync;
+ svn_node_kind_t kind;
+ svn_boolean_t is_new_file;
/* If we already have a handle for PATH, return that. */
to_sync = svn_hash_gets(batch->files, path);
@@ -336,9 +338,30 @@ internal_open_file(apr_file_t **file,
return SVN_NO_ERROR;
}
+ /* Calling fsync in PATH is going to be expensive in any case, so we can
+ * allow for some extra overhead figuring out whether the file already
+ * exists. If it doesn't, be sure to schedule parent folder updates, if
+ * required on this platform.
+ *
+ * See svn_fs_x__batch_fsync_new_path() for when such extra fsyncs may be
+ * needed at all. */
+
+#ifdef SVN_ON_POSIX
+
+ is_new_file = FALSE;
+ if (flags & APR_CREATE)
+ {
+ /* We might actually be about to create a new file.
+ * Check whether the file already exists. */
+ SVN_ERR(svn_io_check_path(path, &kind, scratch_pool));
+ is_new_file = kind == svn_node_none;
+ }
+
+#endif
+
/* To be able to process each file in a separate thread, they must use
* separate, thread-safe pools. Allocating a sub-pool from the standard
- * thread-pool achieves exactly that. */
+ * memory pool achieves exactly that. */
pool = svn_pool_create(NULL);
err = svn_io_file_open(file, path, flags, APR_OS_DEFAULT, pool);
if (err)
@@ -357,6 +380,16 @@ internal_open_file(apr_file_t **file,
apr_pstrdup(apr_hash_pool_get(batch->files), path),
to_sync);
+ /* If we just created a new file, schedule any additional necessary fsyncs.
+ * Note that this can only recurse once since the parent folder already
+ * exists on disk. */
+#ifdef SVN_ON_POSIX
+
+ if (is_new_file)
+ SVN_ERR(svn_fs_x__batch_fsync_new_path(batch, path, scratch_pool));
+
+#endif
+
return SVN_NO_ERROR;
}
@@ -468,20 +501,26 @@ svn_fs_x__batch_fsync_run(svn_fs_x__batc
#if APR_HAS_THREADS
- apr_status_t status = APR_SUCCESS;
- status = apr_thread_pool_push(thread_pool, flush_task, to_sync,
- 0, NULL);
- if (status)
- to_sync->result = svn_error_wrap_apr(status, _("Can't push task"));
+ /* If there are multiple fsyncs to perform, run them in parallel.
+ * Otherwise, skip the thread-pool and synchronization overhead. */
+ if (apr_hash_count(batch->files) > 1)
+ {
+ apr_status_t status = APR_SUCCESS;
+ status = apr_thread_pool_push(thread_pool, flush_task, to_sync,
+ 0, NULL);
+ if (status)
+ to_sync->result = svn_error_wrap_apr(status, _("Can't push task"));
+ else
+ tasks++;
+ }
else
- tasks++;
-
-#else
-
- to_sync->result = svn_error_trace(svn_io_file_flush_to_disk
- (to_sync->file, to_sync->pool));
#endif
+
+ {
+ to_sync->result = svn_error_trace(svn_io_file_flush_to_disk
+ (to_sync->file, to_sync->pool));
+ }
}
/* Wait for all outstanding flush operations to complete. */
Modified: subversion/branches/move-tracking-2/subversion/libsvn_fs_x/fs.c
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/libsvn_fs_x/fs.c?rev=1712080&r1=1712079&r2=1712080&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/libsvn_fs_x/fs.c (original)
+++ subversion/branches/move-tracking-2/subversion/libsvn_fs_x/fs.c Mon Nov 2 16:45:32 2015
@@ -265,7 +265,8 @@ x_set_uuid(svn_fs_t *fs,
{
/* Whenever we set a new UUID, imply that FS will also be a different
* instance (on formats that support this). */
- return svn_error_trace(svn_fs_x__set_uuid(fs, uuid, NULL, scratch_pool));
+ return svn_error_trace(svn_fs_x__set_uuid(fs, uuid, NULL, TRUE,
+ scratch_pool));
}
/* Wrapper around svn_fs_x__begin_txn() providing the scratch pool. */
Modified: subversion/branches/move-tracking-2/subversion/libsvn_fs_x/fs_x.c
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/libsvn_fs_x/fs_x.c?rev=1712080&r1=1712079&r2=1712080&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/libsvn_fs_x/fs_x.c (original)
+++ subversion/branches/move-tracking-2/subversion/libsvn_fs_x/fs_x.c Mon Nov 2 16:45:32 2015
@@ -856,12 +856,11 @@ static svn_error_t *
write_revision_zero(svn_fs_t *fs,
apr_pool_t *scratch_pool)
{
- /* Use an explicit sub-pool to have full control over temp file lifetimes.
- * Since we have it, use it for everything else as well. */
- apr_pool_t *subpool = svn_pool_create(scratch_pool);
- const char *path_revision_zero = svn_fs_x__path_rev(fs, 0, subpool);
+ const char *path_revision_zero = svn_fs_x__path_rev(fs, 0, scratch_pool);
apr_hash_t *proplist;
svn_string_t date;
+ svn_stream_t *stream;
+ svn_stringbuf_t *revprops;
apr_array_header_t *index_entries;
svn_fs_x__p2l_entry_t *entry;
@@ -877,63 +876,73 @@ write_revision_zero(svn_fs_t *fs,
"count: 0\n"
"cpath: /\n"
"\n",
- subpool);
+ scratch_pool);
svn_string_t *changes_str = svn_string_create("\n",
- subpool);
- svn_string_t *r0 = svn_string_createf(subpool, "%s%s",
+ scratch_pool);
+ svn_string_t *r0 = svn_string_createf(scratch_pool, "%s%s",
noderev_str->data,
changes_str->data);
/* Write skeleton r0 to disk. */
- SVN_ERR(svn_io_file_create(path_revision_zero, r0->data, subpool));
+ SVN_ERR(svn_io_file_create(path_revision_zero, r0->data, scratch_pool));
/* Construct the index P2L contents: describe the 2 items we have.
Be sure to create them in on-disk order. */
- index_entries = apr_array_make(subpool, 2, sizeof(entry));
+ index_entries = apr_array_make(scratch_pool, 2, sizeof(entry));
- entry = apr_pcalloc(subpool, sizeof(*entry));
+ entry = apr_pcalloc(scratch_pool, sizeof(*entry));
entry->offset = 0;
entry->size = (apr_off_t)noderev_str->len;
entry->type = SVN_FS_X__ITEM_TYPE_NODEREV;
entry->item_count = 1;
- entry->items = apr_pcalloc(subpool, sizeof(*entry->items));
+ entry->items = apr_pcalloc(scratch_pool, sizeof(*entry->items));
entry->items[0].change_set = 0;
entry->items[0].number = SVN_FS_X__ITEM_INDEX_ROOT_NODE;
APR_ARRAY_PUSH(index_entries, svn_fs_x__p2l_entry_t *) = entry;
- entry = apr_pcalloc(subpool, sizeof(*entry));
+ entry = apr_pcalloc(scratch_pool, sizeof(*entry));
entry->offset = (apr_off_t)noderev_str->len;
entry->size = (apr_off_t)changes_str->len;
entry->type = SVN_FS_X__ITEM_TYPE_CHANGES;
entry->item_count = 1;
- entry->items = apr_pcalloc(subpool, sizeof(*entry->items));
+ entry->items = apr_pcalloc(scratch_pool, sizeof(*entry->items));
entry->items[0].change_set = 0;
entry->items[0].number = SVN_FS_X__ITEM_INDEX_CHANGES;
APR_ARRAY_PUSH(index_entries, svn_fs_x__p2l_entry_t *) = entry;
/* Now re-open r0, create proto-index files from our entries and
- rewrite the index section of r0. */
+ rewrite the index section of r0. */
SVN_ERR(svn_fs_x__rev_file_open_writable(&rev_file, fs, 0,
- subpool, subpool));
+ scratch_pool, scratch_pool));
SVN_ERR(svn_fs_x__p2l_index_from_p2l_entries(&p2l_proto_index, fs,
rev_file, index_entries,
- subpool, subpool));
+ scratch_pool, scratch_pool));
SVN_ERR(svn_fs_x__l2p_index_from_p2l_entries(&l2p_proto_index, fs,
index_entries,
- subpool, subpool));
+ scratch_pool, scratch_pool));
SVN_ERR(svn_fs_x__rev_file_get(&apr_file, rev_file));
SVN_ERR(svn_fs_x__add_index_data(fs, apr_file, l2p_proto_index,
- p2l_proto_index, 0, subpool));
+ p2l_proto_index, 0, scratch_pool));
SVN_ERR(svn_fs_x__close_revision_file(rev_file));
- SVN_ERR(svn_io_set_file_read_only(path_revision_zero, FALSE, fs->pool));
+ SVN_ERR(svn_io_set_file_read_only(path_revision_zero, FALSE, scratch_pool));
/* Set a date on revision 0. */
- date.data = svn_time_to_cstring(apr_time_now(), fs->pool);
+ date.data = svn_time_to_cstring(apr_time_now(), scratch_pool);
date.len = strlen(date.data);
- proplist = apr_hash_make(fs->pool);
+ proplist = apr_hash_make(scratch_pool);
svn_hash_sets(proplist, SVN_PROP_REVISION_DATE, &date);
- return svn_fs_x__set_revision_proplist(fs, 0, proplist, fs->pool);
+
+ revprops = svn_stringbuf_create_empty(scratch_pool);
+ stream = svn_stream_from_stringbuf(revprops, scratch_pool);
+ SVN_ERR(svn_hash_write2(proplist, stream, SVN_HASH_TERMINATOR,
+ scratch_pool));
+ SVN_ERR(svn_stream_close(stream));
+
+ SVN_ERR(svn_io_file_create(svn_fs_x__path_revprops(fs, 0, scratch_pool),
+ revprops->data, scratch_pool));
+
+ return SVN_NO_ERROR;
}
svn_error_t *
@@ -967,14 +976,13 @@ svn_fs_x__create_file_tree(svn_fs_t *fs,
scratch_pool));
/* Create the 'current' file. */
- SVN_ERR(svn_io_file_create_empty(svn_fs_x__path_current(fs, scratch_pool),
- scratch_pool));
- SVN_ERR(svn_fs_x__write_current(fs, 0, scratch_pool));
+ SVN_ERR(svn_io_file_create(svn_fs_x__path_current(fs, scratch_pool),
+ "0\n", scratch_pool));
/* Create the 'uuid' file. */
SVN_ERR(svn_io_file_create_empty(svn_fs_x__path_lock(fs, scratch_pool),
scratch_pool));
- SVN_ERR(svn_fs_x__set_uuid(fs, NULL, NULL, scratch_pool));
+ SVN_ERR(svn_fs_x__set_uuid(fs, NULL, NULL, FALSE, scratch_pool));
/* Create the fsfs.conf file. */
SVN_ERR(write_config(fs, scratch_pool));
@@ -1056,6 +1064,7 @@ svn_error_t *
svn_fs_x__set_uuid(svn_fs_t *fs,
const char *uuid,
const char *instance_id,
+ svn_boolean_t overwrite,
apr_pool_t *scratch_pool)
{
svn_fs_x__data_t *ffd = fs->fsap_data;
@@ -1074,11 +1083,23 @@ svn_fs_x__set_uuid(svn_fs_t *fs,
svn_stringbuf_appendcstr(contents, "\n");
/* We use the permissions of the 'current' file, because the 'uuid'
- file does not exist during repository creation. */
- SVN_ERR(svn_io_write_atomic2(uuid_path, contents->data, contents->len,
- /* perms */
- svn_fs_x__path_current(fs, scratch_pool),
- TRUE, scratch_pool));
+ file does not exist during repository creation.
+
+ svn_io_write_atomic2() does a load of magic to allow it to
+ replace version files that already exist. We only need to do
+ that when we're allowed to overwrite an existing file. */
+ if (! overwrite)
+ {
+ /* Create the file */
+ SVN_ERR(svn_io_file_create(uuid_path, contents->data, scratch_pool));
+ }
+ else
+ {
+ SVN_ERR(svn_io_write_atomic2(uuid_path, contents->data, contents->len,
+ /* perms */
+ svn_fs_x__path_current(fs, scratch_pool),
+ TRUE, scratch_pool));
+ }
fs->uuid = apr_pstrdup(fs->pool, uuid);
ffd->instance_id = apr_pstrdup(fs->pool, instance_id);
Modified: subversion/branches/move-tracking-2/subversion/libsvn_fs_x/fs_x.h
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/libsvn_fs_x/fs_x.h?rev=1712080&r1=1712079&r2=1712080&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/libsvn_fs_x/fs_x.h (original)
+++ subversion/branches/move-tracking-2/subversion/libsvn_fs_x/fs_x.h Mon Nov 2 16:45:32 2015
@@ -148,11 +148,16 @@ svn_fs_x__create(svn_fs_t *fs,
/* Set the uuid of repository FS to UUID and the instance ID to INSTANCE_ID.
If any of them is NULL, use a newly generated UUID / ID instead.
+
+ If OVERWRITE is not set, the uuid file must not exist yet implying this
+ is a fresh repository.
+
Perform temporary allocations in SCRATCH_POOL. */
svn_error_t *
svn_fs_x__set_uuid(svn_fs_t *fs,
const char *uuid,
const char *instance_id,
+ svn_boolean_t overwrite,
apr_pool_t *scratch_pool);
/* Read the format number and maximum number of files per directory
Modified: subversion/branches/move-tracking-2/subversion/libsvn_fs_x/hotcopy.c
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/libsvn_fs_x/hotcopy.c?rev=1712080&r1=1712079&r2=1712080&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/libsvn_fs_x/hotcopy.c (original)
+++ subversion/branches/move-tracking-2/subversion/libsvn_fs_x/hotcopy.c Mon Nov 2 16:45:32 2015
@@ -750,7 +750,8 @@ svn_fs_x__hotcopy(svn_fs_t *src_fs,
/* Copy the UUID. Hotcopy destination receives a new instance ID, but
* has the same filesystem UUID as the source. */
- SVN_ERR(svn_fs_x__set_uuid(dst_fs, src_fs->uuid, NULL, scratch_pool));
+ SVN_ERR(svn_fs_x__set_uuid(dst_fs, src_fs->uuid, NULL, TRUE,
+ scratch_pool));
/* Remove revision 0 contents. Otherwise, it may not get overwritten
* due to having a newer timestamp. */
Modified: subversion/branches/move-tracking-2/subversion/libsvn_fs_x/pack.c
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/libsvn_fs_x/pack.c?rev=1712080&r1=1712079&r2=1712080&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/libsvn_fs_x/pack.c (original)
+++ subversion/branches/move-tracking-2/subversion/libsvn_fs_x/pack.c Mon Nov 2 16:45:32 2015
@@ -244,6 +244,7 @@ initialize_pack_context(pack_context_t *
const char *shard_dir,
svn_revnum_t shard_rev,
int max_items,
+ svn_fs_x__batch_fsync_t *batch,
svn_cancel_func_t cancel_func,
void *cancel_baton,
apr_pool_t *pool)
@@ -272,9 +273,9 @@ initialize_pack_context(pack_context_t *
context->pack_file_dir = pack_file_dir;
context->pack_file_path
= svn_dirent_join(pack_file_dir, PATH_PACKED, pool);
- SVN_ERR(svn_io_file_open(&context->pack_file, context->pack_file_path,
- APR_WRITE | APR_BUFFERED | APR_BINARY | APR_EXCL
- | APR_CREATE, APR_OS_DEFAULT, pool));
+
+ SVN_ERR(svn_fs_x__batch_fsync_open_file(&context->pack_file, batch,
+ context->pack_file_path, pool));
/* Proto index files */
SVN_ERR(svn_fs_x__l2p_proto_index_open(
@@ -379,10 +380,6 @@ close_pack_context(pack_context_t *conte
SVN_ERR(svn_io_remove_file2(proto_l2p_index_path, FALSE, scratch_pool));
SVN_ERR(svn_io_remove_file2(proto_p2l_index_path, FALSE, scratch_pool));
- /* Ensure that packed file is written to disk.*/
- SVN_ERR(svn_io_file_flush_to_disk(context->pack_file, scratch_pool));
- SVN_ERR(svn_io_file_close(context->pack_file, scratch_pool));
-
return SVN_NO_ERROR;
}
@@ -1916,6 +1913,7 @@ append_revision(pack_context_t *context,
* SHARD_DIR into the PACK_FILE_DIR, using SCRATCH_POOL for temporary
* allocations. Limit the extra memory consumption to MAX_MEM bytes.
* CANCEL_FUNC and CANCEL_BATON are what you think they are.
+ * Schedule necessary fsync calls in BATCH.
*/
static svn_error_t *
pack_log_addressed(svn_fs_t *fs,
@@ -1923,6 +1921,7 @@ pack_log_addressed(svn_fs_t *fs,
const char *shard_dir,
svn_revnum_t shard_rev,
apr_size_t max_mem,
+ svn_fs_x__batch_fsync_t *batch,
svn_cancel_func_t cancel_func,
void *cancel_baton,
apr_pool_t *scratch_pool)
@@ -1949,7 +1948,7 @@ pack_log_addressed(svn_fs_t *fs,
/* set up a pack context */
SVN_ERR(initialize_pack_context(&context, fs, pack_file_dir, shard_dir,
- shard_rev, max_items, cancel_func,
+ shard_rev, max_items, batch, cancel_func,
cancel_baton, scratch_pool));
/* phase 1: determine the size of the revisions to pack */
@@ -2006,7 +2005,7 @@ pack_log_addressed(svn_fs_t *fs,
* MAX_FILES_PER_DIR revisions from SHARD_PATH into the PACK_FILE_DIR,
* using SCRATCH_POOL for temporary allocations. Try to limit the amount of
* temporary memory needed to MAX_MEM bytes. CANCEL_FUNC and CANCEL_BATON
- * are what you think they are.
+ * are what you think they are. Schedule necessary fsync calls in BATCH.
*
* If for some reason we detect a partial packing already performed, we
* remove the pack file and start again.
@@ -2020,6 +2019,7 @@ pack_rev_shard(svn_fs_t *fs,
apr_int64_t shard,
int max_files_per_dir,
apr_size_t max_mem,
+ svn_fs_x__batch_fsync_t *batch,
svn_cancel_func_t cancel_func,
void *cancel_baton,
apr_pool_t *scratch_pool)
@@ -2036,10 +2036,11 @@ pack_rev_shard(svn_fs_t *fs,
/* Create the new directory and pack file. */
SVN_ERR(svn_io_dir_make(pack_file_dir, APR_OS_DEFAULT, scratch_pool));
+ SVN_ERR(svn_fs_x__batch_fsync_new_path(batch, pack_file_dir, scratch_pool));
/* Index information files */
SVN_ERR(pack_log_addressed(fs, pack_file_dir, shard_path, shard_rev,
- max_mem, cancel_func, cancel_baton,
+ max_mem, batch, cancel_func, cancel_baton,
scratch_pool));
SVN_ERR(svn_io_copy_perms(shard_path, pack_file_dir, scratch_pool));
@@ -2072,45 +2073,39 @@ pack_shard(const char *dir,
apr_pool_t *scratch_pool)
{
svn_fs_x__data_t *ffd = fs->fsap_data;
- const char *rev_shard_path, *rev_pack_file_dir;
- const char *revprops_shard_path, *revprops_pack_file_dir;
+ const char *shard_path, *pack_file_dir;
+ svn_fs_x__batch_fsync_t *batch;
/* Notify caller we're starting to pack this shard. */
if (notify_func)
SVN_ERR(notify_func(notify_baton, shard, svn_fs_pack_notify_start,
scratch_pool));
+ /* Perform all fsyncs through this instance. */
+ SVN_ERR(svn_fs_x__batch_fsync_create(&batch, scratch_pool));
+
/* Some useful paths. */
- rev_pack_file_dir = svn_dirent_join(dir,
+ pack_file_dir = svn_dirent_join(dir,
apr_psprintf(scratch_pool,
"%" APR_INT64_T_FMT PATH_EXT_PACKED_SHARD,
shard),
scratch_pool);
- rev_shard_path = svn_dirent_join(dir,
+ shard_path = svn_dirent_join(dir,
apr_psprintf(scratch_pool, "%" APR_INT64_T_FMT, shard),
scratch_pool);
/* pack the revision content */
- SVN_ERR(pack_rev_shard(fs, rev_pack_file_dir, rev_shard_path,
- shard, max_files_per_dir, DEFAULT_MAX_MEM,
+ SVN_ERR(pack_rev_shard(fs, pack_file_dir, shard_path,
+ shard, max_files_per_dir, DEFAULT_MAX_MEM, batch,
cancel_func, cancel_baton, scratch_pool));
/* pack the revprops in an equivalent way */
- revprops_pack_file_dir = svn_dirent_join(dir,
- apr_psprintf(scratch_pool,
- "%" APR_INT64_T_FMT PATH_EXT_PACKED_SHARD,
- shard),
- scratch_pool);
- revprops_shard_path = svn_dirent_join(dir,
- apr_psprintf(scratch_pool, "%" APR_INT64_T_FMT, shard),
- scratch_pool);
-
SVN_ERR(svn_fs_x__pack_revprops_shard(fs,
- revprops_pack_file_dir,
- revprops_shard_path,
+ pack_file_dir,
+ shard_path,
shard, max_files_per_dir,
(int)(0.9 * max_pack_size),
- compression_level,
+ compression_level, batch,
cancel_func, cancel_baton,
scratch_pool));
@@ -2120,8 +2115,11 @@ pack_shard(const char *dir,
scratch_pool));
ffd->min_unpacked_rev = (svn_revnum_t)((shard + 1) * max_files_per_dir);
+ /* Ensure that packed file is written to disk.*/
+ SVN_ERR(svn_fs_x__batch_fsync_run(batch, scratch_pool));
+
/* Finally, remove the existing shard directories. */
- SVN_ERR(svn_io_remove_dir2(rev_shard_path, TRUE,
+ SVN_ERR(svn_io_remove_dir2(shard_path, TRUE,
cancel_func, cancel_baton, scratch_pool));
/* Notify caller we're starting to pack this shard. */
Modified: subversion/branches/move-tracking-2/subversion/libsvn_fs_x/recovery.c
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/libsvn_fs_x/recovery.c?rev=1712080&r1=1712079&r2=1712080&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/libsvn_fs_x/recovery.c (original)
+++ subversion/branches/move-tracking-2/subversion/libsvn_fs_x/recovery.c Mon Nov 2 16:45:32 2015
@@ -134,7 +134,7 @@ recover_body(void *baton,
/* The admin may have created a plain copy of this repo before attempting
to recover it (hotcopy may or may not work with corrupted repos).
Bump the instance ID. */
- SVN_ERR(svn_fs_x__set_uuid(fs, fs->uuid, NULL, scratch_pool));
+ SVN_ERR(svn_fs_x__set_uuid(fs, fs->uuid, NULL, TRUE, scratch_pool));
/* We need to know the largest revision in the filesystem. */
SVN_ERR(recover_get_largest_revision(fs, &max_rev, scratch_pool));
Modified: subversion/branches/move-tracking-2/subversion/libsvn_fs_x/revprops.c
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/libsvn_fs_x/revprops.c?rev=1712080&r1=1712079&r2=1712080&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/libsvn_fs_x/revprops.c (original)
+++ subversion/branches/move-tracking-2/subversion/libsvn_fs_x/revprops.c Mon Nov 2 16:45:32 2015
@@ -149,7 +149,7 @@ write_revprop_generation_file(svn_fs_t *
buffer = svn_stringbuf_createf(scratch_pool, "%" APR_INT64_T_FMT "\n",
current);
SVN_ERR(svn_io_write_atomic2(path, buffer->data, buffer->len,
- path /* copy_perms */, TRUE,
+ path /* copy_perms */, FALSE,
scratch_pool));
/* Remember it to spare us the re-read. */
@@ -892,7 +892,7 @@ svn_fs_x__get_revision_proplist(apr_hash
/* Serialize the revision property list PROPLIST of revision REV in
* filesystem FS to a non-packed file. Return the name of that temporary
* file in *TMP_PATH and the file path that it must be moved to in
- * *FINAL_PATH.
+ * *FINAL_PATH. Schedule necessary fsync calls in BATCH.
*
* Allocate *FINAL_PATH and *TMP_PATH in RESULT_POOL. Use SCRATCH_POOL
* for temporary allocations.
@@ -903,6 +903,7 @@ write_non_packed_revprop(const char **fi
svn_fs_t *fs,
svn_revnum_t rev,
apr_hash_t *proplist,
+ svn_fs_x__batch_fsync_t *batch,
apr_pool_t *result_pool,
apr_pool_t *scratch_pool)
{
@@ -910,28 +911,20 @@ write_non_packed_revprop(const char **fi
svn_stream_t *stream;
*final_path = svn_fs_x__path_revprops(fs, rev, result_pool);
- /* ### do we have a directory sitting around already? we really shouldn't
- ### have to get the dirname here. */
- SVN_ERR(svn_io_open_unique_file3(&file, tmp_path,
- svn_dirent_dirname(*final_path,
- scratch_pool),
- svn_io_file_del_none,
- scratch_pool, scratch_pool));
+ *tmp_path = apr_pstrcat(result_pool, *final_path, ".tmp", SVN_VA_NULL);
+ SVN_ERR(svn_fs_x__batch_fsync_open_file(&file, batch, *tmp_path,
+ scratch_pool));
stream = svn_stream_from_aprfile2(file, TRUE, scratch_pool);
SVN_ERR(svn_hash_write2(proplist, stream, SVN_HASH_TERMINATOR,
scratch_pool));
SVN_ERR(svn_stream_close(stream));
- /* Flush temporary file to disk and close it. */
- SVN_ERR(svn_io_file_flush_to_disk(file, scratch_pool));
- SVN_ERR(svn_io_file_close(file, scratch_pool));
-
return SVN_NO_ERROR;
}
/* After writing the new revprop file(s), call this function to move the
* file at TMP_PATH to FINAL_PATH and give it the permissions from
- * PERMS_REFERENCE.
+ * PERMS_REFERENCE. Schedule necessary fsync calls in BATCH.
*
* If indicated in BUMP_GENERATION, increase FS' revprop generation.
* Finally, delete all the temporary files given in FILES_TO_DELETE.
@@ -946,6 +939,7 @@ switch_to_new_revprop(svn_fs_t *fs,
const char *perms_reference,
apr_array_header_t *files_to_delete,
svn_boolean_t bump_generation,
+ svn_fs_x__batch_fsync_t *batch,
apr_pool_t *scratch_pool)
{
/* Now, we may actually be replacing revprops. Make sure that all other
@@ -953,8 +947,14 @@ switch_to_new_revprop(svn_fs_t *fs,
if (bump_generation)
SVN_ERR(begin_revprop_change(fs, scratch_pool));
+ /* Ensure the new file contents makes it to disk before switching over to
+ * it. */
+ SVN_ERR(svn_fs_x__batch_fsync_run(batch, scratch_pool));
+
+ /* Make the revision visible to all processes and threads. */
SVN_ERR(svn_fs_x__move_into_place(tmp_path, final_path, perms_reference,
- scratch_pool));
+ batch, scratch_pool));
+ SVN_ERR(svn_fs_x__batch_fsync_run(batch, scratch_pool));
/* Indicate that the update (if relevant) has been completed. */
if (bump_generation)
@@ -1089,8 +1089,6 @@ repack_revprops(svn_fs_t *fs,
/* finally, write the content to the target file, flush and close it */
SVN_ERR(svn_io_file_write_full(file, compressed->data, compressed->len,
NULL, scratch_pool));
- SVN_ERR(svn_io_file_flush_to_disk(file, scratch_pool));
- SVN_ERR(svn_io_file_close(file, scratch_pool));
return SVN_NO_ERROR;
}
@@ -1100,7 +1098,8 @@ repack_revprops(svn_fs_t *fs,
* of REVPROPS->MANIFEST. Add the name of old file to FILES_TO_DELETE,
* auto-create that array if necessary. Return an open file *FILE that is
* allocated in RESULT_POOL. Allocate the paths in *FILES_TO_DELETE from
- * the same pool that contains the array itself.
+ * the same pool that contains the array itself. Schedule necessary fsync
+ * calls in BATCH.
*
* Use SCRATCH_POOL for temporary allocations.
*/
@@ -1111,6 +1110,7 @@ repack_file_open(apr_file_t **file,
int start,
int end,
apr_array_header_t **files_to_delete,
+ svn_fs_x__batch_fsync_t *batch,
apr_pool_t *result_pool,
apr_pool_t *scratch_pool)
{
@@ -1152,11 +1152,11 @@ repack_file_open(apr_file_t **file,
= new_filename->data;
/* open the file */
- SVN_ERR(svn_io_file_open(file, svn_dirent_join(revprops->folder,
- new_filename->data,
- scratch_pool),
- APR_WRITE | APR_CREATE, APR_OS_DEFAULT,
- result_pool));
+ SVN_ERR(svn_fs_x__batch_fsync_open_file(file, batch,
+ svn_dirent_join(revprops->folder,
+ new_filename->data,
+ scratch_pool),
+ scratch_pool));
return SVN_NO_ERROR;
}
@@ -1165,6 +1165,7 @@ repack_file_open(apr_file_t **file,
* PROPLIST. Return a new file in *TMP_PATH that the caller shall move
* to *FINAL_PATH to make the change visible. Files to be deleted will
* be listed in *FILES_TO_DELETE which may remain unchanged / unallocated.
+ * Schedule necessary fsync calls in BATCH.
*
* Allocate output values in RESULT_POOL and temporaries from SCRATCH_POOL.
*/
@@ -1175,6 +1176,7 @@ write_packed_revprop(const char **final_
svn_fs_t *fs,
svn_revnum_t rev,
apr_hash_t *proplist,
+ svn_fs_x__batch_fsync_t *batch,
apr_pool_t *result_pool,
apr_pool_t *scratch_pool)
{
@@ -1219,9 +1221,9 @@ write_packed_revprop(const char **final_
*final_path = svn_dirent_join(revprops->folder, revprops->filename,
result_pool);
- SVN_ERR(svn_io_open_unique_file3(&file, tmp_path, revprops->folder,
- svn_io_file_del_none, result_pool,
- scratch_pool));
+ *tmp_path = apr_pstrcat(result_pool, *final_path, ".tmp", SVN_VA_NULL);
+ SVN_ERR(svn_fs_x__batch_fsync_open_file(&file, batch, *tmp_path,
+ scratch_pool));
SVN_ERR(repack_revprops(fs, revprops, 0, revprops->sizes->nelts,
changed_index, serialized, new_total_size,
file, scratch_pool));
@@ -1277,7 +1279,7 @@ write_packed_revprop(const char **final_
if (left_count)
{
SVN_ERR(repack_file_open(&file, fs, revprops, 0,
- left_count, files_to_delete,
+ left_count, files_to_delete, batch,
scratch_pool, scratch_pool));
SVN_ERR(repack_revprops(fs, revprops, 0, left_count,
changed_index, serialized, new_total_size,
@@ -1288,7 +1290,7 @@ write_packed_revprop(const char **final_
{
SVN_ERR(repack_file_open(&file, fs, revprops, changed_index,
changed_index + 1, files_to_delete,
- scratch_pool, scratch_pool));
+ batch, scratch_pool, scratch_pool));
SVN_ERR(repack_revprops(fs, revprops, changed_index,
changed_index + 1,
changed_index, serialized, new_total_size,
@@ -1300,8 +1302,8 @@ write_packed_revprop(const char **final_
SVN_ERR(repack_file_open(&file, fs, revprops,
revprops->sizes->nelts - right_count,
revprops->sizes->nelts,
- files_to_delete, scratch_pool,
- scratch_pool));
+ files_to_delete, batch,
+ scratch_pool, scratch_pool));
SVN_ERR(repack_revprops(fs, revprops,
revprops->sizes->nelts - right_count,
revprops->sizes->nelts, changed_index,
@@ -1312,9 +1314,10 @@ write_packed_revprop(const char **final_
/* write the new manifest */
*final_path = svn_dirent_join(revprops->folder, PATH_MANIFEST,
result_pool);
- SVN_ERR(svn_io_open_unique_file3(&file, tmp_path, revprops->folder,
- svn_io_file_del_none, result_pool,
- scratch_pool));
+ *tmp_path = apr_pstrcat(result_pool, *final_path, ".tmp", SVN_VA_NULL);
+ SVN_ERR(svn_fs_x__batch_fsync_open_file(&file, batch, *tmp_path,
+ scratch_pool));
+
stream = svn_stream_from_aprfile2(file, TRUE, scratch_pool);
for (i = 0; i < revprops->manifest->nelts; ++i)
{
@@ -1323,8 +1326,6 @@ write_packed_revprop(const char **final_
SVN_ERR(svn_stream_printf(stream, scratch_pool, "%s\n", filename));
}
SVN_ERR(svn_stream_close(stream));
- SVN_ERR(svn_io_file_flush_to_disk(file, scratch_pool));
- SVN_ERR(svn_io_file_close(file, scratch_pool));
}
return SVN_NO_ERROR;
@@ -1344,9 +1345,13 @@ svn_fs_x__set_revision_proplist(svn_fs_t
const char *tmp_path;
const char *perms_reference;
apr_array_header_t *files_to_delete = NULL;
+ svn_fs_x__batch_fsync_t *batch;
SVN_ERR(svn_fs_x__ensure_revision_exists(rev, fs, scratch_pool));
+ /* Perform all fsyncs through this instance. */
+ SVN_ERR(svn_fs_x__batch_fsync_create(&batch, scratch_pool));
+
/* this info will not change while we hold the global FS write lock */
is_packed = svn_fs_x__is_packed_revprop(fs, rev);
@@ -1369,12 +1374,12 @@ svn_fs_x__set_revision_proplist(svn_fs_t
/* Serialize the new revprop data */
if (is_packed)
SVN_ERR(write_packed_revprop(&final_path, &tmp_path, &files_to_delete,
- fs, rev, proplist, scratch_pool,
+ fs, rev, proplist, batch, scratch_pool,
scratch_pool));
else
SVN_ERR(write_non_packed_revprop(&final_path, &tmp_path,
- fs, rev, proplist, scratch_pool,
- scratch_pool));
+ fs, rev, proplist, batch,
+ scratch_pool, scratch_pool));
/* We use the rev file of this revision as the perms reference,
* because when setting revprops for the first time, the revprop
@@ -1385,7 +1390,7 @@ svn_fs_x__set_revision_proplist(svn_fs_t
/* Now, switch to the new revprop data. */
SVN_ERR(switch_to_new_revprop(fs, final_path, tmp_path, perms_reference,
- files_to_delete, bump_generation,
+ files_to_delete, bump_generation, batch,
scratch_pool));
return SVN_NO_ERROR;
@@ -1477,7 +1482,7 @@ svn_fs_x__packed_revprop_available(svn_b
* COMPRESSION_LEVEL defines how well the resulting pack file shall be
* compressed or whether is shall be compressed at all. TOTAL_SIZE is
* a hint on which initial buffer size we should use to hold the pack file
- * content.
+ * content. Schedule necessary fsync calls in BATCH.
*
* CANCEL_FUNC and CANCEL_BATON are used as usual. Temporary allocations
* are done in SCRATCH_POOL.
@@ -1492,6 +1497,7 @@ copy_revprops(svn_fs_t *fs,
apr_array_header_t *sizes,
apr_size_t total_size,
int compression_level,
+ svn_fs_x__batch_fsync_t *batch,
svn_cancel_func_t cancel_func,
void *cancel_baton,
apr_pool_t *scratch_pool)
@@ -1512,12 +1518,12 @@ copy_revprops(svn_fs_t *fs,
SVN_ERR(serialize_revprops_header(pack_stream, start_rev, sizes, 0,
sizes->nelts, iterpool));
- /* Some useful paths. */
- SVN_ERR(svn_io_file_open(&pack_file, svn_dirent_join(pack_file_dir,
- pack_filename,
- scratch_pool),
- APR_WRITE | APR_CREATE, APR_OS_DEFAULT,
- scratch_pool));
+ /* Create the auto-fsync'ing pack file. */
+ SVN_ERR(svn_fs_x__batch_fsync_open_file(&pack_file, batch,
+ svn_dirent_join(pack_file_dir,
+ pack_filename,
+ scratch_pool),
+ scratch_pool));
/* Iterate over the revisions in this shard, squashing them together. */
for (rev = start_rev; rev <= end_rev; rev++)
@@ -1547,9 +1553,6 @@ copy_revprops(svn_fs_t *fs,
/* write the pack file content to disk */
SVN_ERR(svn_io_file_write_full(pack_file, compressed->data, compressed->len,
NULL, scratch_pool));
- SVN_ERR(svn_io_file_flush_to_disk(pack_file, scratch_pool));
- SVN_ERR(svn_io_file_close(pack_file, scratch_pool));
-
svn_pool_destroy(iterpool);
return SVN_NO_ERROR;
@@ -1563,6 +1566,7 @@ svn_fs_x__pack_revprops_shard(svn_fs_t *
int max_files_per_dir,
apr_off_t max_pack_size,
int compression_level,
+ svn_fs_x__batch_fsync_t *batch,
svn_cancel_func_t cancel_func,
void *cancel_baton,
apr_pool_t *scratch_pool)
@@ -1580,10 +1584,8 @@ svn_fs_x__pack_revprops_shard(svn_fs_t *
scratch_pool);
/* Create the manifest file stream. */
-
- SVN_ERR(svn_io_file_open(&manifest_file, manifest_file_path,
- APR_WRITE | APR_BUFFERED | APR_CREATE | APR_EXCL,
- APR_OS_DEFAULT, scratch_pool));
+ SVN_ERR(svn_fs_x__batch_fsync_open_file(&manifest_file, batch,
+ manifest_file_path, scratch_pool));
manifest_stream = svn_stream_from_aprfile2(manifest_file, TRUE,
scratch_pool);
@@ -1630,7 +1632,7 @@ svn_fs_x__pack_revprops_shard(svn_fs_t *
SVN_ERR(copy_revprops(fs, pack_file_dir, pack_filename,
shard_path, start_rev, rev-1,
sizes, (apr_size_t)total_size,
- compression_level, cancel_func,
+ compression_level, batch, cancel_func,
cancel_baton, iterpool));
/* next pack file starts empty again */
@@ -1657,14 +1659,11 @@ svn_fs_x__pack_revprops_shard(svn_fs_t *
SVN_ERR(copy_revprops(fs, pack_file_dir, pack_filename, shard_path,
start_rev, rev-1, sizes,
(apr_size_t)total_size, compression_level,
- cancel_func, cancel_baton, iterpool));
+ batch, cancel_func, cancel_baton, iterpool));
- /* flush the manifest file to disk and update permissions */
+ /* flush all data to disk and update permissions */
SVN_ERR(svn_stream_close(manifest_stream));
- SVN_ERR(svn_io_file_flush_to_disk(manifest_file, iterpool));
- SVN_ERR(svn_io_file_close(manifest_file, iterpool));
SVN_ERR(svn_io_copy_perms(shard_path, pack_file_dir, iterpool));
-
svn_pool_destroy(iterpool);
return SVN_NO_ERROR;
Modified: subversion/branches/move-tracking-2/subversion/libsvn_fs_x/revprops.h
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/libsvn_fs_x/revprops.h?rev=1712080&r1=1712079&r2=1712080&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/libsvn_fs_x/revprops.h (original)
+++ subversion/branches/move-tracking-2/subversion/libsvn_fs_x/revprops.h Mon Nov 2 16:45:32 2015
@@ -25,6 +25,8 @@
#include "svn_fs.h"
+#include "batch_fsync.h"
+
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
@@ -85,7 +87,7 @@ svn_fs_x__packed_revprop_available(svn_b
/* For the revprop SHARD at SHARD_PATH with exactly MAX_FILES_PER_DIR
* revprop files in it, create a packed shared at PACK_FILE_DIR in
- * filesystem FS.
+ * filesystem FS. Schedule necessary fsync calls in BATCH.
*
* COMPRESSION_LEVEL defines how well the resulting pack file shall be
* compressed or whether is shall be compressed at all. Individual pack
@@ -103,6 +105,7 @@ svn_fs_x__pack_revprops_shard(svn_fs_t *
int max_files_per_dir,
apr_off_t max_pack_size,
int compression_level,
+ svn_fs_x__batch_fsync_t *batch,
svn_cancel_func_t cancel_func,
void *cancel_baton,
apr_pool_t *scratch_pool);
Modified: subversion/branches/move-tracking-2/subversion/libsvn_fs_x/transaction.c
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/libsvn_fs_x/transaction.c?rev=1712080&r1=1712079&r2=1712080&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/libsvn_fs_x/transaction.c (original)
+++ subversion/branches/move-tracking-2/subversion/libsvn_fs_x/transaction.c Mon Nov 2 16:45:32 2015
@@ -1287,10 +1287,9 @@ bump_txn_key(svn_fs_t *fs,
/* Increment the key and add a trailing \n to the string so the
txn-current file has a newline in it. */
- SVN_ERR(svn_io_file_rename2(txn_next_path, txn_current_path, FALSE,
- scratch_pool));
- SVN_ERR(svn_fs_x__batch_fsync_new_path(batch, txn_current_path,
- scratch_pool));
+ SVN_ERR(svn_fs_x__move_into_place(txn_next_path, txn_current_path,
+ txn_current_path, batch,
+ scratch_pool));
return SVN_NO_ERROR;
}
@@ -3487,7 +3486,6 @@ write_final_revprop(const char **path,
/* Create a file at the final revprops location. */
*path = svn_fs_x__path_revprops(txn->fs, revision, result_pool);
SVN_ERR(svn_fs_x__batch_fsync_open_file(&file, batch, *path, scratch_pool));
- SVN_ERR(svn_fs_x__batch_fsync_new_path(batch, *path, scratch_pool));
/* Write the new contents to the final revprops file. */
stream = svn_stream_from_aprfile2(file, TRUE, scratch_pool);
@@ -3652,7 +3650,6 @@ write_next_file(svn_fs_t *fs,
/* Create / open the 'next' file. */
SVN_ERR(svn_fs_x__batch_fsync_open_file(&file, batch, path, scratch_pool));
- SVN_ERR(svn_fs_x__batch_fsync_new_path(batch, path, scratch_pool));
/* Write its contents. */
buf = apr_psprintf(scratch_pool, "%ld\n", revision);
@@ -3692,10 +3689,9 @@ bump_ids(void *baton,
/* Make the revision visible to all processes and threads. */
current_filename = svn_fs_x__path_current(b->fs, scratch_pool);
- SVN_ERR(svn_io_file_rename2(svn_fs_x__path_next(b->fs, scratch_pool),
- current_filename, FALSE, scratch_pool));
- SVN_ERR(svn_fs_x__batch_fsync_new_path(b->batch, current_filename,
- scratch_pool));
+ SVN_ERR(svn_fs_x__move_into_place(svn_fs_x__path_next(b->fs, scratch_pool),
+ current_filename, current_filename,
+ b->batch, scratch_pool));
/* Bump txn id. */
SVN_ERR(bump_txn_key(b->fs, b->batch, scratch_pool));
Modified: subversion/branches/move-tracking-2/subversion/libsvn_fs_x/util.c
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/libsvn_fs_x/util.c?rev=1712080&r1=1712079&r2=1712080&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/libsvn_fs_x/util.c (original)
+++ subversion/branches/move-tracking-2/subversion/libsvn_fs_x/util.c Mon Nov 2 16:45:32 2015
@@ -598,7 +598,13 @@ svn_fs_x__write_current(svn_fs_t *fs,
scratch_pool));
SVN_ERR(svn_io_file_close(file, scratch_pool));
- return svn_fs_x__move_into_place(tmp_name, name, name, scratch_pool);
+ /* Copying permissions is a no-op on WIN32. */
+ SVN_ERR(svn_io_copy_perms(name, tmp_name, scratch_pool));
+
+ /* Move the file into place. */
+ SVN_ERR(svn_io_file_rename2(tmp_name, name, TRUE, scratch_pool));
+
+ return SVN_NO_ERROR;
}
@@ -720,50 +726,30 @@ svn_error_t *
svn_fs_x__move_into_place(const char *old_filename,
const char *new_filename,
const char *perms_reference,
+ svn_fs_x__batch_fsync_t *batch,
apr_pool_t *scratch_pool)
{
- svn_error_t *err;
- apr_file_t *file;
-
/* Copying permissions is a no-op on WIN32. */
SVN_ERR(svn_io_copy_perms(perms_reference, old_filename, scratch_pool));
+ /* We use specific 'fsyncing move' Win32 API calls on Windows while the
+ * directory update fsync is POSIX-only. Moreover, there tend to be only
+ * a few moved files (1 or 2) per batch.
+ *
+ * Therefore, we use the platform-optimized "immediate" fsyncs on all
+ * non-POSIX platforms and the "scheduled" fsyncs on POSIX only.
+ */
+#if defined(SVN_ON_POSIX)
/* Move the file into place. */
- err = svn_io_file_rename2(old_filename, new_filename, TRUE, scratch_pool);
- if (err && APR_STATUS_IS_EXDEV(err->apr_err))
- {
- /* Can't rename across devices; fall back to copying. */
- svn_error_clear(err);
- SVN_ERR(svn_io_copy_file(old_filename, new_filename, TRUE,
- scratch_pool));
-
- /* Flush the target of the copy to disk.
- ### The code below is duplicates svn_io_file_rename2(), because
- currently we don't have the svn_io_copy_file2() function with
- a flush_to_disk argument. */
- SVN_ERR(svn_io_file_open(&file, new_filename, APR_WRITE,
- APR_OS_DEFAULT, scratch_pool));
- SVN_ERR(svn_io_file_flush_to_disk(file, scratch_pool));
- SVN_ERR(svn_io_file_close(file, scratch_pool));
-
-#ifdef SVN_ON_POSIX
- {
- /* On POSIX, the file name is stored in the file's directory entry.
- Hence, we need to fsync() that directory as well.
- On other operating systems, we'd only be asking for trouble
- by trying to open and fsync a directory. */
- const char *dirname;
+ SVN_ERR(svn_io_file_rename2(old_filename, new_filename, FALSE,
+ scratch_pool));
- dirname = svn_dirent_dirname(new_filename, scratch_pool);
- SVN_ERR(svn_io_file_open(&file, dirname, APR_READ, APR_OS_DEFAULT,
- scratch_pool));
- SVN_ERR(svn_io_file_flush_to_disk(file, scratch_pool));
- SVN_ERR(svn_io_file_close(file, scratch_pool));
- }
+ /* Schedule for synchronization. */
+ SVN_ERR(svn_fs_x__batch_fsync_new_path(batch, new_filename, scratch_pool));
+#else
+ SVN_ERR(svn_io_file_rename2(old_filename, new_filename, TRUE,
+ scratch_pool));
#endif
- }
- else if (err)
- return svn_error_trace(err);
return SVN_NO_ERROR;
}
Modified: subversion/branches/move-tracking-2/subversion/libsvn_fs_x/util.h
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/libsvn_fs_x/util.h?rev=1712080&r1=1712079&r2=1712080&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/libsvn_fs_x/util.h (original)
+++ subversion/branches/move-tracking-2/subversion/libsvn_fs_x/util.h Mon Nov 2 16:45:32 2015
@@ -25,6 +25,7 @@
#include "svn_fs.h"
#include "id.h"
+#include "batch_fsync.h"
/* Functions for dealing with recoverable errors on mutable files
*
@@ -454,10 +455,12 @@ svn_fs_x__read_number_from_stream(apr_in
svn_stream_t *stream,
apr_pool_t *scratch_pool);
-/* Move a file into place from OLD_FILENAME in the transactions
- directory to its final location NEW_FILENAME in the repository. On
- Unix, match the permissions of the new file to the permissions of
- PERMS_REFERENCE. Temporary allocations are from SCRATCH_POOL.
+/* Move a file into place from temporary OLD_FILENAME to its final
+ location NEW_FILENAME, which must be on to the same volume. Schedule
+ any necessary fsync calls in BATCH. On Unix, match the permissions
+ of the new file to the permissions of PERMS_REFERENCE.
+
+ Temporary allocations are from SCRATCH_POOL.
This function almost duplicates svn_io_file_move(), but it tries to
guarantee a flush. */
@@ -465,6 +468,7 @@ svn_error_t *
svn_fs_x__move_into_place(const char *old_filename,
const char *new_filename,
const char *perms_reference,
+ svn_fs_x__batch_fsync_t *batch,
apr_pool_t *scratch_pool);
#endif
Modified: subversion/branches/move-tracking-2/subversion/libsvn_ra_serf/update.c
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/libsvn_ra_serf/update.c?rev=1712080&r1=1712079&r2=1712080&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/libsvn_ra_serf/update.c (original)
+++ subversion/branches/move-tracking-2/subversion/libsvn_ra_serf/update.c Mon Nov 2 16:45:32 2015
@@ -941,8 +941,17 @@ headers_fetch(serf_bucket_t *headers,
{
serf_bucket_headers_setn(headers, SVN_DAV_DELTA_BASE_HEADER,
fetch_ctx->delta_base);
- serf_bucket_headers_setn(headers, "Accept-Encoding",
- "svndiff1;q=0.9,svndiff;q=0.8");
+ if (fetch_ctx->using_compression)
+ {
+ serf_bucket_headers_setn(headers, "Accept-Encoding",
+ "svndiff1;q=0.9,svndiff;q=0.8");
+ }
+ else
+ {
+ /* Do not advertise svndiff1 support if we're not interested in
+ compression. */
+ serf_bucket_headers_setn(headers, "Accept-Encoding", "svndiff");
+ }
}
else if (fetch_ctx->using_compression)
{
@@ -2351,8 +2360,9 @@ setup_update_report_headers(serf_bucket_
}
else
{
- serf_bucket_headers_setn(headers, "Accept-Encoding",
- "svndiff1;q=0.9,svndiff;q=0.8");
+ /* Do not advertise svndiff1 support if we're not interested in
+ compression. */
+ serf_bucket_headers_setn(headers, "Accept-Encoding", "svndiff");
}
return SVN_NO_ERROR;
Modified: subversion/branches/move-tracking-2/subversion/libsvn_repos/delta.c
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/libsvn_repos/delta.c?rev=1712080&r1=1712079&r2=1712080&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/libsvn_repos/delta.c (original)
+++ subversion/branches/move-tracking-2/subversion/libsvn_repos/delta.c Mon Nov 2 16:45:32 2015
@@ -530,8 +530,8 @@ delta_proplists(struct context *c,
svn_boolean_t changed;
/* Is this deltification worth our time? */
- SVN_ERR(svn_fs_props_changed(&changed, c->target_root, target_path,
- c->source_root, source_path, subpool));
+ SVN_ERR(svn_fs_props_different(&changed, c->target_root, target_path,
+ c->source_root, source_path, subpool));
if (! changed)
goto cleanup;
@@ -611,62 +611,8 @@ svn_repos__compare_files(svn_boolean_t *
const char *path2,
apr_pool_t *pool)
{
- svn_filesize_t size1, size2;
- svn_checksum_t *checksum1, *checksum2;
- svn_stream_t *stream1, *stream2;
- svn_boolean_t same;
-
- /* If the filesystem claims the things haven't changed, then they
- haven't changed. */
- SVN_ERR(svn_fs_contents_changed(changed_p, root1, path1,
- root2, path2, pool));
- if (!*changed_p)
- return SVN_NO_ERROR;
-
- /* If the SHA1 checksums match for these things, we'll claim they
- have the same contents. (We don't give quite as much weight to
- MD5 checksums.) */
- SVN_ERR(svn_fs_file_checksum(&checksum1, svn_checksum_sha1,
- root1, path1, FALSE, pool));
- SVN_ERR(svn_fs_file_checksum(&checksum2, svn_checksum_sha1,
- root2, path2, FALSE, pool));
- if (checksum1 && checksum2)
- {
- *changed_p = !svn_checksum_match(checksum1, checksum2);
- return SVN_NO_ERROR;
- }
-
- /* From this point on, our default answer is "Nothing's changed". */
- *changed_p = FALSE;
-
- /* Different filesizes means the contents are different. */
- SVN_ERR(svn_fs_file_length(&size1, root1, path1, pool));
- SVN_ERR(svn_fs_file_length(&size2, root2, path2, pool));
- if (size1 != size2)
- {
- *changed_p = TRUE;
- return SVN_NO_ERROR;
- }
-
- /* Different MD5 checksums means the contents are different. */
- SVN_ERR(svn_fs_file_checksum(&checksum1, svn_checksum_md5, root1, path1,
- FALSE, pool));
- SVN_ERR(svn_fs_file_checksum(&checksum2, svn_checksum_md5, root2, path2,
- FALSE, pool));
- if (!svn_checksum_match(checksum1, checksum2))
- {
- *changed_p = TRUE;
- return SVN_NO_ERROR;
- }
-
- /* And finally, different contents means the ... uh ... contents are
- different. */
- SVN_ERR(svn_fs_file_contents(&stream1, root1, path1, pool));
- SVN_ERR(svn_fs_file_contents(&stream2, root2, path2, pool));
- SVN_ERR(svn_stream_contents_same2(&same, stream1, stream2, pool));
- *changed_p = !same;
-
- return SVN_NO_ERROR;
+ return svn_error_trace(svn_fs_contents_different(changed_p, root1, path1,
+ root2, path2, pool));
}
@@ -693,19 +639,7 @@ delta_files(struct context *c,
if (source_path)
{
- /* Is this delta calculation worth our time? If we are ignoring
- ancestry, then our editor implementor isn't concerned by the
- theoretical differences between "has contents which have not
- changed with respect to" and "has the same actual contents
- as". We'll do everything we can to avoid transmitting even
- an empty text-delta in that case. */
- if (c->ignore_ancestry)
- SVN_ERR(svn_repos__compare_files(&changed,
- c->target_root, target_path,
- c->source_root, source_path,
- subpool));
- else
- SVN_ERR(svn_fs_contents_changed(&changed,
+ SVN_ERR(svn_fs_contents_different(&changed,
c->target_root, target_path,
c->source_root, source_path,
subpool));