You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by hw...@apache.org on 2012/11/23 02:12:45 UTC

svn commit: r1412731 [10/10] - in /subversion/branches/ev2-export: ./ build/ build/ac-macros/ contrib/client-side/svnmerge/ contrib/server-side/svncutter/ notes/ subversion/ subversion/bindings/javahl/native/ subversion/bindings/swig/perl/native/ subve...

Modified: subversion/branches/ev2-export/subversion/tests/svn_test_fs.c
URL: http://svn.apache.org/viewvc/subversion/branches/ev2-export/subversion/tests/svn_test_fs.c?rev=1412731&r1=1412730&r2=1412731&view=diff
==============================================================================
--- subversion/branches/ev2-export/subversion/tests/svn_test_fs.c (original)
+++ subversion/branches/ev2-export/subversion/tests/svn_test_fs.c Fri Nov 23 01:12:18 2012
@@ -115,10 +115,14 @@ create_fs(svn_fs_t **fs_p,
   if (apr_stat(&finfo, name, APR_FINFO_TYPE, pool) == APR_SUCCESS)
     {
       if (finfo.filetype == APR_DIR)
-        SVN_ERR(svn_fs_delete_fs(name, pool));
+        SVN_ERR_W(svn_fs_delete_fs(name, pool),
+                  apr_psprintf(pool,
+                               "cannot create fs '%s' there is already "
+                               "a directory of that name", name));
       else
         return svn_error_createf(SVN_ERR_TEST_FAILED, NULL,
-                                 "there is already a file named '%s'", name);
+                                 "cannot create fs '%s' there is already "
+                                 "a file of that name", name);
     }
 
   SVN_ERR(svn_fs_create(fs_p, name, fs_config, pool));

Modified: subversion/branches/ev2-export/tools/server-side/fsfs-reorg.c
URL: http://svn.apache.org/viewvc/subversion/branches/ev2-export/tools/server-side/fsfs-reorg.c?rev=1412731&r1=1412730&r2=1412731&view=diff
==============================================================================
--- subversion/branches/ev2-export/tools/server-side/fsfs-reorg.c (original)
+++ subversion/branches/ev2-export/tools/server-side/fsfs-reorg.c Fri Nov 23 01:12:18 2012
@@ -47,165 +47,376 @@
 
 #define ERROR_TAG "diff: "
 
+/* forward declarations */
 typedef struct noderev_t noderev_t;
 typedef struct revision_info_t revision_info_t;
 
+/* A FSFS rev file is sequence of fragments and unused space (the latter
+ * only being inserted by this tool and not during ordinary SVN operation).
+ * 
+ * This type defines the type of any fragment.
+ *
+ * Please note that the classification as "property", "dir" or "file"
+ * fragments is only to be used while determining the future placement
+ * of a representation.  If the rep is shared, the same rep may be used
+ * as *any* of the 3 kinds.
+ */
 enum fragment_kind_t
 {
+  /* the 2 number line containing changes and root node offsets */
   header_fragment,
+
+  /* list of all changes in a revision */
   changes_fragment,
-  noderep_fragment,
+
+  /* (the textual representation of) a noderev */
+  noderev_fragment,
+
+  /* a property rep (including PLAIN / DELTA header) */
   property_fragment,
+
+  /* a directory rep (including PLAIN / DELTA header) */
   dir_fragment,
+
+  /* a file rep (including PLAIN / DELTA header) */
   file_fragment
 };
 
+/* A fragment.  This is used to represent the final ordering, i.e. there
+ * will be an array containing elements of this type that basically put
+ * a fragment at some location in the target file.
+ */
 typedef struct fragment_t
 {
+  /* position in the target file */
   apr_size_t position;
-  void *data;
+
+  /* kind of fragment */
   enum fragment_kind_t kind;
+
+  /* pointer to the  fragment struct; type depends on KIND */
+  void *data;
 } fragment_t;
 
+/* Location info for a single revision.
+ */
 typedef struct revision_location_t
 {
+  /* pack file offset (manifest value), 0 for non-packed files */
   apr_size_t offset;
+  
+  /* offset of the changes list relative to OFFSET */
   apr_size_t changes;
+
+  /* length of the changes list on bytes */
   apr_size_t changes_len;
+
+  /* first offset behind the revision data in the pack file (file length
+   * for non-packed revs) */
   apr_size_t end;  
 } revision_location_t;
 
+/* Absolute position and size of some item.
+ */
 typedef struct location_t
 {
+  /* absolute offset in the file */
   apr_size_t offset;
+
+  /* item length in bytes */
   apr_size_t size;
 } location_t;
 
+/* A parsed directory entry. Note that instances of this struct may be
+ * shared between different DIRECTORY_T containers.
+ */
 typedef struct direntry_t
 {
+  /* (local) entry / path name */
   const char *name;
+
+  /* strlen (name) */
   apr_size_t name_len;
+
+  /* node rev providing ID and representation(s) */
   noderev_t *node;
 } direntry_t;
 
+/* Representation of a parsed directory content.
+ */
 typedef struct directory_t
 {
+  /* array of pointers to DIRENTRY_T */
   apr_array_header_t *entries;
+
+  /* MD5 of the textual representation. Will be set lazily as a side-effect
+   * of determining the length of this dir's textual representation. */
   unsigned char target_md5[16];
+
+  /* (expanded) length of the textual representation.
+   * Determined lazily during the write process. */
   apr_size_t size;
 } directory_t;
 
+/* A representation fragment.
+ */
 typedef struct representation_t
 {
+  /* location in the source file */
   location_t original;
+
+  /* location in the reordered target file */
   location_t target;
+
+  /* length of the PLAIN / DELTA line in the source file in bytes */
   apr_size_t header_size;
+
+  /* deltification base, or NULL if there is none */
   struct representation_t *delta_base;
+
+  /* revision that contains this representation
+   * (may be referenced by other revisions, though) */
   revision_info_t *revision;
+
+  /* representation content parsed as a directory. This will be NULL, if
+   * *no* directory noderev uses this representation. */
   directory_t *dir;
+
+  /* the source content has a PLAIN header, so we may simply copy the
+   * source content into the target */
   svn_boolean_t is_plain;
+
+  /* coloring flag used in the reordering algorithm to keep track of
+   * representations that still need to be placed. */
   svn_boolean_t covered;
 } representation_t;
 
+/* A node rev.
+ */
 struct noderev_t
 {
+  /* location within the source file */
   location_t original;
+
+  /* location within the reorganized target file. */
   location_t target;
+
+  /* predecessor node, or NULL if there is none */
   noderev_t *predecessor;
+
+  /* content representation; may be NULL if there is none */
   representation_t *text;
+
+  /* properties representation; may be NULL if there is none */
   representation_t *props;
+
+  /* revision that this noderev belongs to */
   revision_info_t *revision;
+
+  /* coloring flag used in the reordering algorithm to keep track of
+   * representations that still need to be placed. */
   svn_boolean_t covered;
 };
 
+/* Represents a single revision.
+ * There will be only one instance per revision. */
 struct revision_info_t
 {
+  /* number of this revision */
   svn_revnum_t revision;
+
+  /* position in the source file */
   revision_location_t original;
+
+  /* position in the reorganized target file */
   revision_location_t target;
+
+  /* noderev of the root directory */
   noderev_t *root_noderev;
+
+  /* all noderevs_t of this revision (in no particular order),
+   * i.e. those that point back to this struct */
   apr_array_header_t *node_revs;
+  
+  /* all representation_t of this revision (in no particular order),
+   * i.e. those that point back to this struct */
   apr_array_header_t *representations;
 };
 
+/* Represents a packed revision file.
+ */
 typedef struct revision_pack_t
 {
+  /* first revision in the pack file */
   svn_revnum_t base;
+
+  /* revision_info_t* of all revisions in the pack file; in revision order. */
   apr_array_header_t *info;
+
+  /* list of fragments to place in the target pack file; in target order. */
   apr_array_header_t *fragments;
+
+  /* source pack file length */
   apr_size_t filesize;
+
+  /* temporary value. Equal to the number of bytes in the target pack file
+   * already allocated to fragments. */
   apr_size_t target_offset;
 } revision_pack_t;
 
+/* Cache for revision source content.  All content is stored in DATA and
+ * the HASH maps revision number to an svn_string_t instance whose data
+ * member points into DATA.
+ * 
+ * Once TOTAL_SIZE exceeds LIMIT, all content will be discarded.  Similarly,
+ * the hash gets cleared every 10000 insertions to keep the HASH_POOL
+ * memory usage in check.
+ */
 typedef struct content_cache_t
 {
-  apr_pool_t *pool;
+  /* pool used for HASH */
   apr_pool_t *hash_pool;
 
+  /* svn_revnum_t -> svn_string_t.
+   * The strings become (potentially) invalid when adding new cache entries. */
   apr_hash_t *hash;
 
+  /* data buffer. the first TOTAL_SIZE bytes are actually being used. */
   char *data;
+
+  /* DATA capacity */
   apr_size_t limit;
 
+  /* number of bytes used in DATA */
   apr_size_t total_size;
+
+  /* number of insertions since the last hash cleanup */
   apr_size_t insert_count;
 } content_cache_t;
 
+/* A cached directory. In contrast to directory_t, this stored the data as
+ * the plain hash that the normal FSFS will use to serialize & diff dirs.
+ */
 typedef struct dir_cache_entry_t
 {
+  /* revision containing the representation */
   svn_revnum_t revision;
+
+  /* offset of the representation within that revision */
   apr_size_t offset;
-  
+
+  /* key-value representation of the directory entries */
   apr_hash_t *hash;
 } dir_cache_entry_t;
 
+/* Directory cache. (revision, offset) will be mapped directly into the
+ * ENTRIES array of ENTRY_COUNT buckets (many entries will be NULL).
+ * Two alternating pools will be used to allocate dir content.
+ * 
+ * If the INSERT_COUNT exceeds a given limit, the pools get exchanged and
+ * the older of the two will be cleared. This is to keep dir objects valid
+ * for at least one insertion.
+ */
 typedef struct dir_cache_t
 {
+  /* fixed-size array of ENTRY_COUNT elements */
   dir_cache_entry_t *entries;
 
+  /* currently used for entry allocations */
   apr_pool_t *pool1;
+  
+  /* previously used for entry allocations */
   apr_pool_t *pool2;
+
+  /* size of ENTRIES in elements */
   apr_size_t entry_count;
+
+  /* number of directory elements added. I.e. usually >> #cached dirs */
   apr_size_t insert_count;
 } dir_cache_t;
 
+/* A cached, undeltified txdelta window.
+ */
 typedef struct window_cache_entry_t
 {
+  /* revision containing the window */
   svn_revnum_t revision;
+
+  /* offset of the deltified window within that revision */
   apr_size_t offset;
 
+  /* window content */
   svn_stringbuf_t *window;
 } window_cache_entry_t;
 
+/* Cache for undeltified txdelta windows. (revision, offset) will be mapped
+ * directly into the ENTRIES array of INSERT_COUNT buckets (most entries
+ * will be NULL).
+ *
+ * The cache will be cleared when USED exceeds CAPACITY.
+ */
 typedef struct window_cache_t
 {
+  /* fixed-size array of ENTRY_COUNT elements */
   window_cache_entry_t *entries;
 
+  /* used to allocate windows */
   apr_pool_t *pool;
+
+  /* size of ENTRIES in elements */
   apr_size_t entry_count;
+
+  /* maximum combined size of all cached windows */
   apr_size_t capacity;
+
+  /* current combined size of all cached windows */
   apr_size_t used;
 } window_cache_t;
 
+/* Root data structure containing all information about a given repository.
+ */
 typedef struct fs_fs_t
 {
+  /* repository to reorg */
   const char *path;
+
+  /* revision to start at (must be 0, ATM) */
   svn_revnum_t start_revision;
+
+  /* FSFS format number */
   int format;
 
+  /* highest revision number in the repo */
   svn_revnum_t max_revision;
+
+  /* first non-packed revision */
   svn_revnum_t min_unpacked_rev;
+
+  /* sharing size*/
   int max_files_per_dir;
 
+  /* all revisions */
   apr_array_header_t *revisions;
+
+  /* all packed files */
   apr_array_header_t *packs;
 
+  /* empty representation.
+   * Used as a dummy base for DELTA reps without base. */
   representation_t *null_base;
+
+  /* revision content cache */
   content_cache_t *cache;
+
+  /* directory hash cache */
   dir_cache_t *dir_cache;
+
+  /* undeltified txdelta window cache */
   window_cache_t *window_cache;
 } fs_fs_t;
 
+/* Return the rev pack folder for revision REV in FS.
+ */
 static const char *
 get_pack_folder(fs_fs_t *fs,
                 svn_revnum_t rev,
@@ -215,6 +426,8 @@ get_pack_folder(fs_fs_t *fs,
                       fs->path, rev / fs->max_files_per_dir);
 }
 
+/* Return the path of the file containing revision REV in FS.
+ */
 static const char *
 rev_or_pack_file_name(fs_fs_t *fs,
                       svn_revnum_t rev,
@@ -226,6 +439,8 @@ rev_or_pack_file_name(fs_fs_t *fs,
                           rev / fs->max_files_per_dir, rev);
 }
 
+/* Open the file containing revision REV in FS and return it in *FILE.
+ */
 static svn_error_t *
 open_rev_or_pack_file(apr_file_t **file,
                       fs_fs_t *fs,
@@ -239,6 +454,9 @@ open_rev_or_pack_file(apr_file_t **file,
                           pool);
 }
 
+/* Read the whole content of the file containing REV in FS and return that
+ * in *CONTENT.
+ */
 static svn_error_t *
 read_rev_or_pack_file(svn_stringbuf_t **content,
                       fs_fs_t *fs,
@@ -250,13 +468,15 @@ read_rev_or_pack_file(svn_stringbuf_t **
                                   pool);
 }
 
+/* Return a new content cache with the given size LIMIT.  Use POOL for
+ * all cache-related allocations.
+ */
 static content_cache_t *
 create_content_cache(apr_pool_t *pool,
                      apr_size_t limit)
 {
   content_cache_t *result = apr_pcalloc(pool, sizeof(*result));
 
-  result->pool = pool;
   result->hash_pool = svn_pool_create(pool);
   result->hash = svn_hash__make(result->hash_pool);
   result->limit = limit;
@@ -267,6 +487,9 @@ create_content_cache(apr_pool_t *pool,
   return result;
 }
 
+/* Return the content of revision REVISION from CACHE. Return NULL upon a
+ * cache miss. This is a cache-internal function.
+ */
 static svn_string_t *
 get_cached_content(content_cache_t *cache,
                    svn_revnum_t revision)
@@ -274,6 +497,9 @@ get_cached_content(content_cache_t *cach
   return apr_hash_get(cache->hash, &revision, sizeof(revision));
 }
 
+/* Take the content in DATA and store it under REVISION in CACHE.
+ * This is a cache-internal function.
+ */
 static void
 set_cached_content(content_cache_t *cache,
                    svn_revnum_t revision,
@@ -281,11 +507,14 @@ set_cached_content(content_cache_t *cach
 {
   svn_string_t *content;
   svn_revnum_t *key;
-  
+
+  /* double insertion? -> broken cache logic */
   assert(get_cached_content(cache, revision) == NULL);
 
+  /* purge the cache upon overflow */
   if (cache->total_size + data->len > cache->limit)
     {
+      /* the hash pool grows slowly over time; clear it once in a while */
       if (cache->insert_count > 10000)
         {
           svn_pool_clear(cache->hash_pool);
@@ -296,8 +525,13 @@ set_cached_content(content_cache_t *cach
         cache->hash = svn_hash__make(cache->hash_pool);
 
       cache->total_size = 0;
+
+      /* buffer overflow / revision too large */
+      if (data->len > cache->limit)
+        SVN_ERR_MALFUNCTION_NO_RETURN();
     }
 
+  /* copy data to cache and update he index (hash) */
   content = apr_palloc(cache->hash_pool, sizeof(*content));
   content->data = cache->data + cache->total_size;
   content->len = data->len;
@@ -312,6 +546,9 @@ set_cached_content(content_cache_t *cach
   ++cache->insert_count;
 }
 
+/* Get the file content of revision REVISION in FS and return it in *DATA.
+ * Use SCRATCH_POOL for temporary allocations.
+ */
 static svn_error_t *
 get_content(svn_string_t **data,
             fs_fs_t *fs,
@@ -322,7 +559,8 @@ get_content(svn_string_t **data,
   revision_info_t *revision_info;
   svn_stringbuf_t *temp;
   apr_off_t temp_offset;
-  
+
+  /* try getting the data from our cache */
   svn_string_t *result = get_cached_content(fs->cache, revision);
   if (result)
     {
@@ -330,6 +568,7 @@ get_content(svn_string_t **data,
       return SVN_NO_ERROR;
     }
 
+  /* not in cache. Is the revision valid at all? */
   if (revision - fs->start_revision > fs->revisions->nelts)
     return svn_error_createf(SVN_ERR_BAD_VERSION_FILE_FORMAT, NULL,
                              _("Unknown revision %ld"), revision);
@@ -337,6 +576,8 @@ get_content(svn_string_t **data,
                                 revision - fs->start_revision,
                                 revision_info_t*);
 
+  /* read the revision content. Assume that the file has *not* been
+   * reorg'ed, yet, i.e. all data is in one place. */
   temp = svn_stringbuf_create_ensure(  revision_info->original.end
                                      - revision_info->original.offset,
                                      scratch_pool);
@@ -350,6 +591,7 @@ get_content(svn_string_t **data,
   revision_info->original.offset = (apr_size_t)temp_offset;
   SVN_ERR(svn_io_file_read(file, temp->data, &temp->len, scratch_pool));
 
+  /* cache the result and return it */
   set_cached_content(fs->cache, revision,
                      svn_stringbuf__morph_into_string(temp));
   *data = get_cached_content(fs->cache, revision);
@@ -357,6 +599,9 @@ get_content(svn_string_t **data,
   return SVN_NO_ERROR;
 }
 
+/* Return a new directory cache with ENTRY_COUNT buckets in its index.
+ * Use POOL for all cache-related allocations.
+ */
 static dir_cache_t *
 create_dir_cache(apr_pool_t *pool,
                  apr_size_t entry_count)
@@ -372,6 +617,9 @@ create_dir_cache(apr_pool_t *pool,
   return result;
 }
 
+/* Return the position within FS' dir cache ENTRIES index for the given
+ * (REVISION, OFFSET) pair. This is a cache-internal function.
+ */
 static apr_size_t
 get_dir_cache_index(fs_fs_t *fs,
                     svn_revnum_t revision,
@@ -380,12 +628,18 @@ get_dir_cache_index(fs_fs_t *fs,
   return (revision + offset * 0xd1f3da69) % fs->dir_cache->entry_count;
 }
 
+/* Return the currently active pool of FS' dir cache. Note that it may be
+ * cleared after *2* insertions.
+ */
 static apr_pool_t *
 get_cached_dir_pool(fs_fs_t *fs)
 {
   return fs->dir_cache->pool1;
 }
 
+/* Return the cached directory content stored in REPRESENTAION within FS.
+ * If that has not been found in cache, return NULL.
+ */
 static apr_hash_t *
 get_cached_dir(fs_fs_t *fs,
                representation_t *representation)
@@ -401,17 +655,21 @@ get_cached_dir(fs_fs_t *fs,
     : NULL;
 }
 
+/* Cache the directory HASH for  REPRESENTAION within FS.
+ */
 static void
 set_cached_dir(fs_fs_t *fs,
                representation_t *representation,
                apr_hash_t *hash)
 {
+  /* select the entry to use */
   svn_revnum_t revision = representation->revision->revision;
   apr_size_t offset = representation->original.offset;
 
   apr_size_t i = get_dir_cache_index(fs, revision, offset);
   dir_cache_entry_t *entry = &fs->dir_cache->entries[i];
 
+  /* clean the cache and rotate pools at regular intervals */
   fs->dir_cache->insert_count += apr_hash_count(hash);
   if (fs->dir_cache->insert_count >= fs->dir_cache->entry_count * 100)
     {
@@ -428,11 +686,16 @@ set_cached_dir(fs_fs_t *fs,
       fs->dir_cache->pool1 = pool;
     }
 
+  /* write data to cache */
   entry->hash = hash;
   entry->offset = offset;
   entry->revision = revision;
 }
 
+/* Return a new txdelta window cache with ENTRY_COUNT buckets in its index
+ * and a the total CAPACITY given in bytes.
+ * Use POOL for all cache-related allocations.
+ */
 static window_cache_t *
 create_window_cache(apr_pool_t *pool,
                     apr_size_t entry_count,
@@ -449,6 +712,9 @@ create_window_cache(apr_pool_t *pool,
   return result;
 }
 
+/* Return the position within FS' window cache ENTRIES index for the given
+ * (REVISION, OFFSET) pair. This is a cache-internal function.
+ */
 static apr_size_t
 get_window_cache_index(fs_fs_t *fs,
                        svn_revnum_t revision,
@@ -457,6 +723,9 @@ get_window_cache_index(fs_fs_t *fs,
   return (revision + offset * 0xd1f3da69) % fs->window_cache->entry_count;
 }
 
+/* Return the cached txdelta window stored in REPRESENTAION within FS.
+ * If that has not been found in cache, return NULL.
+ */
 static svn_stringbuf_t *
 get_cached_window(fs_fs_t *fs,
                   representation_t *representation,
@@ -473,17 +742,21 @@ get_cached_window(fs_fs_t *fs,
     : NULL;
 }
 
+/* Cache the undeltified txdelta WINDOW for REPRESENTAION within FS.
+ */
 static void
 set_cached_window(fs_fs_t *fs,
                   representation_t *representation,
                   svn_stringbuf_t *window)
 {
+  /* select entry */
   svn_revnum_t revision = representation->revision->revision;
   apr_size_t offset = representation->original.offset;
 
   apr_size_t i = get_window_cache_index(fs, revision, offset);
   window_cache_entry_t *entry = &fs->window_cache->entries[i];
 
+  /* if the capacity is exceeded, clear the cache */
   fs->window_cache->used += window->len;
   if (fs->window_cache->used >= fs->window_cache->capacity)
     {
@@ -494,6 +767,7 @@ set_cached_window(fs_fs_t *fs,
       fs->window_cache->used = window->len;
     }
 
+  /* set the entry to a copy of the window data */
   entry->window = svn_stringbuf_dup(window, fs->window_cache->pool);
   entry->offset = offset;
   entry->revision = revision;
@@ -554,7 +828,7 @@ read_revision_header(apr_size_t *changes
 {
   char buf[64];
   const char *line;
-  const char *space;
+  char *space;
   apr_uint64_t val;
   apr_size_t len;
   
@@ -583,7 +857,7 @@ read_revision_header(apr_size_t *changes
     return svn_error_create(SVN_ERR_FS_CORRUPT, NULL,
                             _("Final line in revision file missing space"));
 
-  *(char *)space = 0;
+  *space = 0;
   
   SVN_ERR(svn_cstring_strtoui64(&val, line+1, 0, APR_SIZE_MAX, 10));
   *root_noderev = (apr_size_t)val;
@@ -724,8 +998,13 @@ key_matches(svn_string_t *string, const 
 static int
 compare_noderev_offsets(const void *data, const void *key)
 {
-  return (*(const noderev_t **)data)->original.offset
-       - *(const apr_size_t *)key;
+  apr_ssize_t diff = (*(const noderev_t *const *)data)->original.offset
+                     - *(const apr_size_t *)key;
+
+  /* sizeof(int) may be < sizeof(ssize_t) */
+  if (diff < 0)
+    return -1;
+  return diff > 0 ? 1 : 0;
 }
 
 static svn_error_t *
@@ -771,14 +1050,14 @@ find_noderev(noderev_t **result,
                                           compare_noderev_offsets);
   if ((idx < 0) || (idx >= revision_info->node_revs->nelts))
     return svn_error_createf(SVN_ERR_BAD_VERSION_FILE_FORMAT, NULL,
-                             _("No noderev found at offset %" APR_OFF_T_FMT),
-                             offset);
+                             _("No noderev found at offset %ld"),
+                             (long)offset);
 
   *result = APR_ARRAY_IDX(revision_info->node_revs, idx, noderev_t *);
   if ((*result)->original.offset != offset)
     return svn_error_createf(SVN_ERR_BAD_VERSION_FILE_FORMAT, NULL,
-                             _("No noderev found at offset %" APR_OFF_T_FMT),
-                             offset);
+                             _("No noderev found at offset %ld"),
+                             (long)offset);
 
   return SVN_NO_ERROR;
 }
@@ -800,8 +1079,13 @@ parse_pred(noderev_t **result,
 static int
 compare_representation_offsets(const void *data, const void *key)
 {
-  return (*(const representation_t **)data)->original.offset
-       - *(const apr_size_t *)key;
+  apr_ssize_t diff = (*(const representation_t *const *)data)->original.offset
+                     - *(const apr_size_t *)key;
+
+  /* sizeof(int) may be < sizeof(ssize_t) */
+  if (diff < 0)
+    return -1;
+  return diff > 0 ? 1 : 0;
 }
 
 static representation_t *
@@ -1662,7 +1946,7 @@ add_noderev_recursively(fs_fs_t *fs,
   node->target.offset = *current_pos;
 
   fragment.data = node;
-  fragment.kind = noderep_fragment;
+  fragment.kind = noderev_fragment;
   fragment.position = *current_pos;
   APR_ARRAY_PUSH(fragments, fragment_t) = fragment;
 
@@ -1794,7 +2078,7 @@ get_content_length(apr_size_t *length,
         case dir_fragment:
           *length = content->len + 16;
           break;
-        case noderep_fragment:
+        case noderev_fragment:
           *length = content->len + 3;
           break;
         default:
@@ -1836,7 +2120,7 @@ move_fragment(fragment_t *fragment,
         representation->target.offset = new_position;
         break;
 
-      case noderep_fragment:
+      case noderev_fragment:
         node = fragment->data;
         node->target.offset = new_position;
         break;
@@ -2006,7 +2290,7 @@ write_revisions(fs_fs_t *fs,
           revision_info_t *info = APR_ARRAY_IDX(pack->info, i,
                                                 revision_info_t *);
           SVN_ERR(svn_stream_printf(stream, itempool,
-                                    "%" APR_UINT64_T_FMT "\n",
+                                    "%" APR_SIZE_T_FMT "\n",
                                     info->target.offset));
           svn_pool_clear(itempool);
         }
@@ -2187,8 +2471,8 @@ update_text(svn_stringbuf_t *node_rev,
       char *newline_pos = strchr(val_pos, '\n');
       svn_checksum_t checksum = {representation->dir->target_md5,
                                  svn_checksum_md5};
-      const char* temp = apr_psprintf(scratch_pool, "%ld %" APR_UINT64_T_FMT " %" 
-                                      APR_UINT64_T_FMT" %" APR_SIZE_T_FMT " %s",
+      const char* temp = apr_psprintf(scratch_pool, "%ld %" APR_SIZE_T_FMT " %" 
+                                      APR_SIZE_T_FMT" %" APR_SIZE_T_FMT " %s",
                                       representation->revision->revision,
                                       representation->target.offset - representation->revision->target.offset,
                                       representation->target.size,
@@ -2207,7 +2491,7 @@ update_text(svn_stringbuf_t *node_rev,
       
       val_pos = end_pos + 1;
       end_pos = strchr(strchr(val_pos, ' ') + 1, ' ');
-      temp = apr_psprintf(scratch_pool, "%" APR_UINT64_T_FMT " %" APR_UINT64_T_FMT,
+      temp = apr_psprintf(scratch_pool, "%" APR_SIZE_T_FMT " %" APR_SIZE_T_FMT,
                           representation->target.offset - representation->revision->target.offset,
                           representation->target.size);
 
@@ -2236,7 +2520,7 @@ get_fragment_content(svn_string_t **cont
       case header_fragment:
         info = fragment->data;
         *content = svn_string_createf(pool,
-                                      "\n%" APR_UINT64_T_FMT " %" APR_UINT64_T_FMT "\n",
+                                      "\n%" APR_SIZE_T_FMT " %" APR_SIZE_T_FMT "\n",
                                       info->root_noderev->target.offset - info->target.offset,
                                       info->target.changes);
         return SVN_NO_ERROR;
@@ -2273,7 +2557,7 @@ get_fragment_content(svn_string_t **cont
               header = svn_stringbuf_create("DELTA\n", pool);
             else
               header = svn_stringbuf_createf(pool,
-                                             "DELTA %ld %" APR_UINT64_T_FMT " %" APR_UINT64_T_FMT "\n",
+                                             "DELTA %ld %" APR_SIZE_T_FMT " %" APR_SIZE_T_FMT "\n",
                                              representation->delta_base->revision->revision,
                                              representation->delta_base->target.offset
                                              - representation->delta_base->revision->target.offset,
@@ -2316,7 +2600,7 @@ get_fragment_content(svn_string_t **cont
               {
                 representation_t *base_rep = representation->delta_base;
                 header = svn_stringbuf_createf(pool,
-                                               "DELTA %ld %" APR_UINT64_T_FMT " %" APR_UINT64_T_FMT "\n",
+                                               "DELTA %ld %" APR_SIZE_T_FMT " %" APR_SIZE_T_FMT "\n",
                                                base_rep->revision->revision,
                                                base_rep->target.offset - base_rep->revision->target.offset,
                                                base_rep->target.size);
@@ -2342,7 +2626,7 @@ get_fragment_content(svn_string_t **cont
 
         return SVN_NO_ERROR;
 
-      case noderep_fragment:
+      case noderev_fragment:
         node = fragment->data;
         SVN_ERR(get_content(&revision_content, fs,
                             node->revision->revision, pool));

Modified: subversion/branches/ev2-export/tools/server-side/svn-backup-dumps.py
URL: http://svn.apache.org/viewvc/subversion/branches/ev2-export/tools/server-side/svn-backup-dumps.py?rev=1412731&r1=1412730&r2=1412731&view=diff
==============================================================================
--- subversion/branches/ev2-export/tools/server-side/svn-backup-dumps.py (original)
+++ subversion/branches/ev2-export/tools/server-side/svn-backup-dumps.py Fri Nov 23 01:12:18 2012
@@ -686,7 +686,7 @@ if __name__ == "__main__":
         print("Everything OK.")
         sys.exit(0)
     else:
-        print("An error occured!")
+        print("An error occurred!")
         sys.exit(1)
 
 # vim:et:ts=4:sw=4