You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by st...@apache.org on 2014/02/15 11:00:16 UTC

svn commit: r1568600 - in /subversion/trunk/subversion/libsvn_fs_x: fs.h fs_x.c low_level.c noderevs.c transaction.c

Author: stefan2
Date: Sat Feb 15 10:00:15 2014
New Revision: 1568600

URL: http://svn.apache.org/r1568600
Log:
In FSX, eliminate the representation's uniquifier.

This makes svn_fs_contents_changed and svn_fs_props_changed return FALSE
even if there have been intermediate changes that were later undone.
Because this is consistent with the API docstrings and our usage of these
functions, there is no need for the uniquifier storage overhead.

* subversion/libsvn_fs_x/fs.h
  (representation_t): Drop uniquifier member.

* subversion/libsvn_fs_x/fs_x.c
  (svn_fs_x__noderev_same_rep_key): Two references to the same physically
                                    representaion are now the "same".

* subversion/libsvn_fs_x/low_level.c
  (svn_fs_x__parse_representation,
   svn_fs_x__unparse_representation): Remove uniquifier (de-)serialization
                                      code.

* subversion/libsvn_fs_x/noderevs.c
  (shared_representation_t): This indirection struct is no longer needed.
  (binary_noderev_t): Directly reference the representation.
  (svn_fs_x__noderevs_add,
   svn_fs_x__noderevs_get,
   svn_fs_x__noderevs_get_func): Update container internal struct <->
                                 external struct conversion.
  (svn_fs_x__write_noderevs_container,
   svn_fs_x__read_noderevs_container): Update container (de-)serialization.

* subversion/libsvn_fs_x/transaction.c
  (set_uniquifier): Drop this now pointless utility function.
  (svn_fs_x__set_entry,
   get_shared_rep,
   rep_write_contents_close): Remove uniquifier setting code.

Modified:
    subversion/trunk/subversion/libsvn_fs_x/fs.h
    subversion/trunk/subversion/libsvn_fs_x/fs_x.c
    subversion/trunk/subversion/libsvn_fs_x/low_level.c
    subversion/trunk/subversion/libsvn_fs_x/noderevs.c
    subversion/trunk/subversion/libsvn_fs_x/transaction.c

Modified: subversion/trunk/subversion/libsvn_fs_x/fs.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_x/fs.h?rev=1568600&r1=1568599&r2=1568600&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_x/fs.h (original)
+++ subversion/trunk/subversion/libsvn_fs_x/fs.h Sat Feb 15 10:00:15 2014
@@ -464,15 +464,6 @@ typedef struct representation_t
   /* Is this representation a transaction? */
   svn_fs_x__txn_id_t txn_id;
 
-  /* For rep-sharing, we need a way of uniquifying node-revs which share the
-     same representation (see svn_fs_x__noderev_same_rep_key() ).  So, we
-     store the original txn of the node rev (not the rep!), along with some
-     intra-node uniqification content. */
-  struct
-  {
-    svn_fs_x__txn_id_t txn_id;
-    apr_uint64_t number;
-  } uniquifier;
 } representation_t;
 
 

Modified: subversion/trunk/subversion/libsvn_fs_x/fs_x.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_x/fs_x.c?rev=1568600&r1=1568599&r2=1568600&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_x/fs_x.c (original)
+++ subversion/trunk/subversion/libsvn_fs_x/fs_x.c Sat Feb 15 10:00:15 2014
@@ -650,10 +650,7 @@ svn_fs_x__noderev_same_rep_key(represent
   if (a->item_index != b->item_index)
     return FALSE;
 
-  if (a->revision != b->revision)
-    return FALSE;
-
-  return memcmp(&a->uniquifier, &b->uniquifier, sizeof(a->uniquifier)) == 0;
+  return a->revision == b->revision;
 }
 
 svn_error_t *

Modified: subversion/trunk/subversion/libsvn_fs_x/low_level.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_x/low_level.c?rev=1568600&r1=1568599&r2=1568600&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_x/low_level.c (original)
+++ subversion/trunk/subversion/libsvn_fs_x/low_level.c Sat Feb 15 10:00:15 2014
@@ -300,21 +300,6 @@ svn_fs_x__parse_representation(represent
   rep->has_sha1 = checksum != NULL;
   memcpy(rep->sha1_digest, checksum->digest, sizeof(rep->sha1_digest));
 
-  /* Read the uniquifier. */
-  str = svn_cstring_tokenize("/", &string);
-  if (str == NULL)
-    return svn_error_create(SVN_ERR_FS_CORRUPT, NULL,
-                            _("Malformed text representation offset line in node-rev"));
-
-  SVN_ERR(svn_fs_x__txn_by_name(&rep->uniquifier.txn_id, str));
-
-  str = svn_cstring_tokenize(" ", &string);
-  if (str == NULL)
-    return svn_error_create(SVN_ERR_FS_CORRUPT, NULL,
-                            _("Malformed text representation offset line in node-rev"));
-
-  rep->uniquifier.number = svn__base36toui64(NULL, str);
-
   return SVN_NO_ERROR;
 }
 
@@ -579,7 +564,6 @@ svn_fs_x__unparse_representation(represe
                                  svn_boolean_t mutable_rep_truncated,
                                  apr_pool_t *pool)
 {
-  char buffer[SVN_INT64_BUFFER_SIZE];
   if (svn_fs_x__id_txn_used(rep->txn_id) && mutable_rep_truncated)
     return svn_stringbuf_ncreate("-1", 2, pool);
 
@@ -591,17 +575,14 @@ svn_fs_x__unparse_representation(represe
              rep->expanded_size,
              format_digest(rep->md5_digest, svn_checksum_md5, FALSE, pool));
 
-  svn__ui64tobase36(buffer, rep->uniquifier.number);
   return svn_stringbuf_createf
           (pool, "%ld %" APR_OFF_T_FMT " %" SVN_FILESIZE_T_FMT
-           " %" SVN_FILESIZE_T_FMT " %s %s %s/%s",
+           " %" SVN_FILESIZE_T_FMT " %s %s",
            rep->revision, rep->item_index, rep->size,
            rep->expanded_size,
            format_digest(rep->md5_digest, svn_checksum_md5, FALSE, pool),
            format_digest(rep->sha1_digest, svn_checksum_sha1,
-                         !rep->has_sha1, pool),
-           svn_fs_x__txn_name(rep->uniquifier.txn_id, pool),
-           buffer);
+                         !rep->has_sha1, pool));
 
 #undef DISPLAY_MAYBE_NULL_CHECKSUM
 

Modified: subversion/trunk/subversion/libsvn_fs_x/noderevs.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_x/noderevs.c?rev=1568600&r1=1568599&r2=1568600&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_x/noderevs.c (original)
+++ subversion/trunk/subversion/libsvn_fs_x/noderevs.c Sat Feb 15 10:00:15 2014
@@ -86,27 +86,6 @@ typedef struct binary_representation_t
   svn_filesize_t expanded_size;
 } binary_representation_t;
 
-/* Add a uniquifier to binary_representation_t to distinguish between
- * multiple uses of the same shared representation.
- */
-typedef struct shared_representation_t
-{
-  /* For rep-sharing, we need a way of uniquifying node-revs which share the
-     same representation (see svn_fs_x__noderev_same_rep_key() ).  So, we
-     store the original txn of the node rev (not the rep!), along with some
-     intra-node uniqification content. */
-  struct
-  {
-    svn_fs_x__txn_id_t txn_id;
-    apr_uint64_t number;
-  } uniquifier;
-
-  /* Index+1 of the representation.
-   */
-  int representation;
-} shared_representation_t;
-
-
 /* Our internal representation of a node_revision_t.
  * 
  * We will store path strings in a string container and reference them
@@ -151,7 +130,7 @@ typedef struct binary_noderev_t
 
   /* Index+1 of the representation for this node's data.
      May be 0 if there is no data. */
-  shared_representation_t data_rep;
+  int data_rep;
 
   /* String index+1 of the path at which this node first came into
      existence.  */
@@ -329,16 +308,9 @@ svn_fs_x__noderevs_add(svn_fs_x__noderev
                                                  container->prop_reps_dict,
                                                  noderev->prop_rep);
   if (noderev->data_rep)
-    {
-      binary_noderev.data_rep.representation
-        = store_representation(container->data_reps,
-                               container->data_reps_dict,
-                               noderev->data_rep);
-      binary_noderev.data_rep.uniquifier.txn_id
-        = noderev->data_rep->uniquifier.txn_id;
-      binary_noderev.data_rep.uniquifier.number
-        = noderev->data_rep->uniquifier.number;
-    }
+    binary_noderev.data_rep = store_representation(container->data_reps,
+                                                   container->data_reps_dict,
+                                                   noderev->data_rep);
 
   if (noderev->created_path)
     binary_noderev.created_path
@@ -518,14 +490,7 @@ svn_fs_x__noderevs_get(node_revision_t *
   SVN_ERR(get_representation(&noderev->prop_rep, container->prop_reps,
                              binary_noderev->prop_rep, pool));
   SVN_ERR(get_representation(&noderev->data_rep, container->data_reps,
-                             binary_noderev->data_rep.representation, pool));
-  if (noderev->data_rep)
-    {
-      noderev->data_rep->uniquifier.txn_id
-        = binary_noderev->data_rep.uniquifier.txn_id;
-      noderev->data_rep->uniquifier.number
-        = binary_noderev->data_rep.uniquifier.number;
-    }
+                             binary_noderev->data_rep, pool));
 
   if (binary_noderev->flags & NODEREV_HAS_CPATH)
     noderev->created_path
@@ -629,7 +594,7 @@ svn_fs_x__write_noderevs_container(svn_s
     svn_packed__create_int_substream(ids_stream, TRUE, FALSE);
 
   svn_packed__create_int_substream(noderevs_stream, FALSE, FALSE);
-  for (i = 0; i < 14; ++i)
+  for (i = 0; i < 12; ++i)
     svn_packed__create_int_substream(noderevs_stream, TRUE, FALSE);
 
   /* serialize ids array */
@@ -667,12 +632,7 @@ svn_fs_x__write_noderevs_container(svn_s
       svn_packed__add_int(noderevs_stream, noderev->copyroot_rev);
 
       svn_packed__add_uint(noderevs_stream, noderev->prop_rep);
-      svn_packed__add_uint(noderevs_stream, noderev->data_rep.representation);
-
-      svn_packed__add_int(noderevs_stream,
-                          noderev->data_rep.uniquifier.txn_id);
-      svn_packed__add_uint(noderevs_stream,
-                           noderev->data_rep.uniquifier.number);
+      svn_packed__add_uint(noderevs_stream, noderev->data_rep);
 
       svn_packed__add_uint(noderevs_stream, noderev->created_path);
       svn_packed__add_uint(noderevs_stream, noderev->mergeinfo_count);
@@ -828,13 +788,7 @@ svn_fs_x__read_noderevs_container(svn_fs
       noderev.copyroot_rev = (svn_revnum_t)svn_packed__get_int(noderevs_stream);
 
       noderev.prop_rep = (int)svn_packed__get_uint(noderevs_stream);
-      noderev.data_rep.representation
-        = (int)svn_packed__get_uint(noderevs_stream);
-
-      noderev.data_rep.uniquifier.txn_id
-        = svn_packed__get_int(noderevs_stream);
-      noderev.data_rep.uniquifier.number
-        = svn_packed__get_uint(noderevs_stream);
+      noderev.data_rep = (int)svn_packed__get_uint(noderevs_stream);
 
       noderev.created_path = (int)svn_packed__get_uint(noderevs_stream);
       noderev.mergeinfo_count = svn_packed__get_uint(noderevs_stream);
@@ -994,14 +948,7 @@ svn_fs_x__noderevs_get_func(void **out,
   SVN_ERR(get_representation(&noderev->prop_rep, &prop_reps,
                              binary_noderev->prop_rep, pool));
   SVN_ERR(get_representation(&noderev->data_rep, &data_reps,
-                             binary_noderev->data_rep.representation, pool));
-  if (noderev->data_rep)
-    {
-      noderev->data_rep->uniquifier.txn_id
-        = binary_noderev->data_rep.uniquifier.txn_id;
-      noderev->data_rep->uniquifier.number
-        = binary_noderev->data_rep.uniquifier.number;
-    }
+                             binary_noderev->data_rep, pool));
 
   if (binary_noderev->flags & NODEREV_HAS_CPATH)
     noderev->created_path

Modified: subversion/trunk/subversion/libsvn_fs_x/transaction.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_x/transaction.c?rev=1568600&r1=1568599&r2=1568600&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_x/transaction.c (original)
+++ subversion/trunk/subversion/libsvn_fs_x/transaction.c Sat Feb 15 10:00:15 2014
@@ -1405,23 +1405,6 @@ svn_fs_x__abort_txn(svn_fs_txn_t *txn,
   return SVN_NO_ERROR;
 }
 
-/* Assign the UNIQUIFIER member of REP based on the current state of TXN_ID
- * in FS.  Allocate the uniquifier in POOL.
- */
-static svn_error_t *
-set_uniquifier(svn_fs_t *fs,
-               representation_t *rep,
-               apr_pool_t *pool)
-{
-  svn_fs_x__id_part_t temp;
-
-  SVN_ERR(get_new_txn_node_id(&temp, fs, rep->txn_id, pool));
-  rep->uniquifier.txn_id = rep->txn_id;
-  rep->uniquifier.number = temp.number;
-
-  return SVN_NO_ERROR;
-}
-
 svn_error_t *
 svn_fs_x__set_entry(svn_fs_t *fs,
                     svn_fs_x__txn_id_t txn_id,
@@ -1460,7 +1443,6 @@ svn_fs_x__set_entry(svn_fs_t *fs,
       rep = apr_pcalloc(pool, sizeof(*rep));
       rep->revision = SVN_INVALID_REVNUM;
       rep->txn_id = txn_id;
-      SVN_ERR(set_uniquifier(fs, rep, pool));
       parent_noderev->data_rep = rep;
       SVN_ERR(svn_fs_x__put_node_revision(fs, parent_noderev->id,
                                           parent_noderev, FALSE, pool));
@@ -2019,7 +2001,6 @@ get_shared_rep(representation_t **old_re
     {
       /* Use the old rep for this content. */
       memcpy((*old_rep)->md5_digest, rep->md5_digest, sizeof(rep->md5_digest));
-      (*old_rep)->uniquifier = rep->uniquifier;
     }
 
   return SVN_NO_ERROR;
@@ -2071,7 +2052,6 @@ rep_write_contents_close(void *baton)
   /* Fill in the rest of the representation field. */
   rep->expanded_size = b->rep_size;
   rep->txn_id = svn_fs_x__id_txn_id(b->noderev->id);
-  SVN_ERR(set_uniquifier(b->fs, rep, b->pool));
   rep->revision = SVN_INVALID_REVNUM;
 
   /* Finalize the checksum. */