You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by sv...@apache.org on 2015/04/16 06:00:36 UTC
svn commit: r1673999 - in /subversion/branches/1.9.x: ./ STATUS
subversion/libsvn_fs_fs/transaction.c
subversion/tests/libsvn_fs_fs/fs-fs-pack-test.c
Author: svn-role
Date: Thu Apr 16 04:00:35 2015
New Revision: 1673999
URL: http://svn.apache.org/r1673999
Log:
Merge the r1669743 group from trunk:
* r1669743, r1669945
Restore FSFS representation sharing to its previous effectiveness.
Justification:
Without this patch, repositories may grow faster than necessary.
Effected users include those that use plain add instead of copy to
create branches and those that merge frequently between branches.
Notes:
r1669945 fixes the replacement condition and provides a test.
Votes:
+1: stefan2, danielsh, rhuijben
Modified:
subversion/branches/1.9.x/ (props changed)
subversion/branches/1.9.x/STATUS
subversion/branches/1.9.x/subversion/libsvn_fs_fs/transaction.c
subversion/branches/1.9.x/subversion/tests/libsvn_fs_fs/fs-fs-pack-test.c
Propchange: subversion/branches/1.9.x/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Apr 16 04:00:35 2015
@@ -90,4 +90,4 @@
/subversion/branches/verify-at-commit:1462039-1462408
/subversion/branches/verify-keep-going:1439280-1546110
/subversion/branches/wc-collate-path:1402685-1480384
-/subversion/trunk:1660545-1660547,1660549-1662901,1663003,1663183-1663184,1663338,1663347,1663355,1663374,1663450,1663697,1663706,1663738,1663749,1663791,1664078,1664080,1664084-1664085,1664187,1664191,1664193,1664200,1664344,1664476,1664480-1664481,1664483,1664489-1664490,1664507,1664520-1664521,1664523,1664526-1664527,1664531-1664532,1664588,1664653,1664684,1664927,1664938-1664940,1664978,1664984,1664997,1665164,1665195,1665318,1665437-1665438,1665611-1665612,1665845,1665850,1665852,1665886,1665894,1665896,1666096,1666270,1666272,1666379,1666449,1666690,1666851,1667101,1667106-1667107,1667233,1667235,1667301,1667941,1667976,1668320,1668598-1668600,1668602-1668603,1668607-1668608,1668618,1669746,1669749,1670139,1670149,1670152,1670329,1670337,1670347,1670353,1671164,1671388,1672311,1672372,1672404,1672511-1672512,1672578,1672728,1673044,1673062-1673063,1673065,1673228,1673282,1673445
+/subversion/trunk:1660545-1660547,1660549-1662901,1663003,1663183-1663184,1663338,1663347,1663355,1663374,1663450,1663697,1663706,1663738,1663749,1663791,1664078,1664080,1664084-1664085,1664187,1664191,1664193,1664200,1664344,1664476,1664480-1664481,1664483,1664489-1664490,1664507,1664520-1664521,1664523,1664526-1664527,1664531-1664532,1664588,1664653,1664684,1664927,1664938-1664940,1664978,1664984,1664997,1665164,1665195,1665318,1665437-1665438,1665611-1665612,1665845,1665850,1665852,1665886,1665894,1665896,1666096,1666270,1666272,1666379,1666449,1666690,1666851,1667101,1667106-1667107,1667233,1667235,1667301,1667941,1667976,1668320,1668598-1668600,1668602-1668603,1668607-1668608,1668618,1669743,1669746,1669749,1669945,1670139,1670149,1670152,1670329,1670337,1670347,1670353,1671164,1671388,1672311,1672372,1672404,1672511-1672512,1672578,1672728,1673044,1673062-1673063,1673065,1673228,1673282,1673445
Modified: subversion/branches/1.9.x/STATUS
URL: http://svn.apache.org/viewvc/subversion/branches/1.9.x/STATUS?rev=1673999&r1=1673998&r2=1673999&view=diff
==============================================================================
--- subversion/branches/1.9.x/STATUS (original)
+++ subversion/branches/1.9.x/STATUS Thu Apr 16 04:00:35 2015
@@ -175,17 +175,6 @@ Veto-blocked changes:
Approved changes:
=================
- * r1669743, r1669945
- Restore FSFS representation sharing to its previous effectiveness.
- Justification:
- Without this patch, repositories may grow faster than necessary.
- Effected users include those that use plain add instead of copy to
- create branches and those that merge frequently between branches.
- Notes:
- r1669945 fixes the replacement condition and provides a test.
- Votes:
- +1: stefan2, danielsh, rhuijben
-
* r1672295, r1673691
Fix Sqlite 3.8.9 query performance regression on externals
Justification:
Modified: subversion/branches/1.9.x/subversion/libsvn_fs_fs/transaction.c
URL: http://svn.apache.org/viewvc/subversion/branches/1.9.x/subversion/libsvn_fs_fs/transaction.c?rev=1673999&r1=1673998&r2=1673999&view=diff
==============================================================================
--- subversion/branches/1.9.x/subversion/libsvn_fs_fs/transaction.c (original)
+++ subversion/branches/1.9.x/subversion/libsvn_fs_fs/transaction.c Thu Apr 16 04:00:35 2015
@@ -2214,10 +2214,11 @@ get_shared_rep(representation_t **old_re
return SVN_NO_ERROR;
/* We don't want 0-length PLAIN representations to replace non-0-length
- ones (see issue #4554). Also, this doubles as a simple guard against
- general rep-cache induced corruption. */
+ ones (see issue #4554). Take into account that EXPANDED_SIZE may be
+ 0 in which case we have to check the on-disk SIZE. Also, this doubles
+ as a simple guard against general rep-cache induced corruption. */
if ( ((*old_rep)->expanded_size != rep->expanded_size)
- || ((*old_rep)->size != rep->size))
+ || ((rep->expanded_size == 0) && ((*old_rep)->size != rep->size)))
{
*old_rep = NULL;
}
Modified: subversion/branches/1.9.x/subversion/tests/libsvn_fs_fs/fs-fs-pack-test.c
URL: http://svn.apache.org/viewvc/subversion/branches/1.9.x/subversion/tests/libsvn_fs_fs/fs-fs-pack-test.c?rev=1673999&r1=1673998&r2=1673999&view=diff
==============================================================================
--- subversion/branches/1.9.x/subversion/tests/libsvn_fs_fs/fs-fs-pack-test.c (original)
+++ subversion/branches/1.9.x/subversion/tests/libsvn_fs_fs/fs-fs-pack-test.c Thu Apr 16 04:00:35 2015
@@ -1372,6 +1372,172 @@ plain_0_length(const svn_test_opts_t *op
#undef REPO_NAME
+/* ------------------------------------------------------------------------ */
+
+#define REPO_NAME "test-repo-rep_sharing_effectiveness"
+
+static int
+count_substring(svn_stringbuf_t *string,
+ const char *needle)
+{
+ int count = 0;
+ apr_size_t len = strlen(needle);
+ apr_size_t pos;
+
+ for (pos = 0; pos + len <= string->len; ++pos)
+ if (memcmp(string->data + pos, needle, len) == 0)
+ ++count;
+
+ return count;
+}
+
+static svn_error_t *
+count_representations(int *count,
+ svn_fs_t *fs,
+ svn_revnum_t revision,
+ apr_pool_t *pool)
+{
+ svn_stringbuf_t *rev_contents;
+ const char *rev_path = svn_fs_fs__path_rev_absolute(fs, revision, pool);
+ SVN_ERR(svn_stringbuf_from_file2(&rev_contents, rev_path, pool));
+
+ *count = count_substring(rev_contents, "PLAIN")
+ + count_substring(rev_contents, "DELTA");
+
+ return SVN_NO_ERROR;
+}
+
+/* Repeat string S many times to make it big enough for deltification etc.
+ to kick in. */
+static const char*
+multiply_string(const char *s,
+ apr_pool_t *pool)
+{
+ svn_stringbuf_t *temp = svn_stringbuf_create(s, pool);
+
+ int i;
+ for (i = 0; i < 7; ++i)
+ svn_stringbuf_insert(temp, temp->len, temp->data, temp->len);
+
+ return temp->data;
+}
+
+static svn_error_t *
+rep_sharing_effectiveness(const svn_test_opts_t *opts,
+ apr_pool_t *pool)
+{
+ svn_fs_t *fs;
+ fs_fs_data_t *ffd;
+ svn_fs_txn_t *txn;
+ svn_fs_root_t *root;
+ svn_revnum_t rev;
+ const char *hello_str = multiply_string("Hello, ", pool);
+ const char *world_str = multiply_string("World!", pool);
+ const char *goodbye_str = multiply_string("Goodbye!", pool);
+
+ if (strcmp(opts->fs_type, "fsfs") != 0)
+ return svn_error_create(SVN_ERR_TEST_SKIPPED, NULL, NULL);
+
+ /* Create a repo that and explicitly enable rep sharing. */
+ SVN_ERR(svn_test__create_fs(&fs, REPO_NAME, opts, pool));
+
+ ffd = fs->fsap_data;
+ if (ffd->format < SVN_FS_FS__MIN_REP_SHARING_FORMAT)
+ return svn_error_create(SVN_ERR_TEST_SKIPPED, NULL, NULL);
+
+ ffd->rep_sharing_allowed = TRUE;
+
+ /* Revision 1: create 2 files with different content. */
+ SVN_ERR(svn_fs_begin_txn(&txn, fs, 0, pool));
+ SVN_ERR(svn_fs_txn_root(&root, txn, pool));
+ SVN_ERR(svn_fs_make_file(root, "foo", pool));
+ SVN_ERR(svn_test__set_file_contents(root, "foo", hello_str, pool));
+ SVN_ERR(svn_fs_make_file(root, "bar", pool));
+ SVN_ERR(svn_test__set_file_contents(root, "bar", world_str, pool));
+ SVN_ERR(svn_fs_commit_txn(NULL, &rev, txn, pool));
+
+ /* Revision 2: modify a file to match another file's r1 content and
+ add another with the same content.
+ (classic rep-sharing). */
+ SVN_ERR(svn_fs_begin_txn(&txn, fs, rev, pool));
+ SVN_ERR(svn_fs_txn_root(&root, txn, pool));
+ SVN_ERR(svn_test__set_file_contents(root, "foo", world_str, pool));
+ SVN_ERR(svn_fs_make_file(root, "baz", pool));
+ SVN_ERR(svn_test__set_file_contents(root, "baz", hello_str, pool));
+ SVN_ERR(svn_fs_commit_txn(NULL, &rev, txn, pool));
+
+ /* Revision 3: modify all files to some new, identical content and add
+ another with the same content.
+ (in-revision rep-sharing). */
+ SVN_ERR(svn_fs_begin_txn(&txn, fs, rev, pool));
+ SVN_ERR(svn_fs_txn_root(&root, txn, pool));
+ SVN_ERR(svn_test__set_file_contents(root, "foo", goodbye_str, pool));
+ SVN_ERR(svn_test__set_file_contents(root, "bar", goodbye_str, pool));
+ SVN_ERR(svn_test__set_file_contents(root, "baz", goodbye_str, pool));
+ SVN_ERR(svn_fs_make_file(root, "qux", pool));
+ SVN_ERR(svn_test__set_file_contents(root, "qux", goodbye_str, pool));
+ SVN_ERR(svn_fs_commit_txn(NULL, &rev, txn, pool));
+
+ /* Verify revision contents. */
+ {
+ const struct {
+ svn_revnum_t revision;
+ const char *file;
+ const char *contents;
+ } expected[] = {
+ { 1, "foo", "Hello, " },
+ { 1, "bar", "World!" },
+ { 2, "foo", "World!" },
+ { 2, "bar", "World!" },
+ { 2, "baz", "Hello, " },
+ { 3, "foo", "Goodbye!" },
+ { 3, "bar", "Goodbye!" },
+ { 3, "baz", "Goodbye!" },
+ { 3, "qux", "Goodbye!" },
+ { SVN_INVALID_REVNUM, NULL, NULL }
+ };
+
+ int i;
+ apr_pool_t *iterpool = svn_pool_create(pool);
+ for (i = 0; SVN_IS_VALID_REVNUM(expected[i].revision); ++i)
+ {
+ svn_stringbuf_t *str;
+
+ SVN_ERR(svn_fs_revision_root(&root, fs, expected[i].revision,
+ iterpool));
+ SVN_ERR(svn_test__get_file_contents(root, expected[i].file, &str,
+ iterpool));
+
+ SVN_TEST_STRING_ASSERT(str->data,
+ multiply_string(expected[i].contents,
+ iterpool));
+ }
+
+ svn_pool_destroy(iterpool);
+ }
+
+ /* Verify that rep sharing eliminated most reps. */
+ {
+ /* Number of expected representations (including the root directory). */
+ const int expected[] = { 1, 3, 1, 2 } ;
+
+ svn_revnum_t i;
+ apr_pool_t *iterpool = svn_pool_create(pool);
+ for (i = 0; i <= rev; ++i)
+ {
+ int count;
+ SVN_ERR(count_representations(&count, fs, i, iterpool));
+ SVN_TEST_ASSERT(count == expected[i]);
+ }
+
+ svn_pool_destroy(iterpool);
+ }
+
+ return SVN_NO_ERROR;
+}
+
+#undef REPO_NAME
+
/* The test table. */
@@ -1416,6 +1582,8 @@ static struct svn_test_descriptor_t test
"id parser test"),
SVN_TEST_OPTS_PASS(plain_0_length,
"file with 0 expanded-length, issue #4554"),
+ SVN_TEST_OPTS_PASS(rep_sharing_effectiveness,
+ "rep-sharing effectiveness"),
SVN_TEST_NULL
};