subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From stef...@apache.org
Subject svn commit: r1633617 - in /subversion/trunk/subversion/libsvn_fs_fs: index.c structure-indexes
Date Wed, 22 Oct 2014 13:53:12 GMT
Author: stefan2
Date: Wed Oct 22 13:53:12 2014
New Revision: 1633617

URL: http://svn.apache.org/r1633617
Log:
In the FSFS index code and structure docs, make it explicit
that empty P2L index pages are a thing.

* subversion/libsvn_fs_fs/index.c
  (get_p2l_page): Make empty pages an explicitly handled
                  special case.

* subversion/libsvn_fs_fs/structure-indexes
  (P2L / Index on-disk format): Explicitly state that large
                                items cause zero entry pages.

Modified:
    subversion/trunk/subversion/libsvn_fs_fs/index.c
    subversion/trunk/subversion/libsvn_fs_fs/structure-indexes

Modified: subversion/trunk/subversion/libsvn_fs_fs/index.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_fs/index.c?rev=1633617&r1=1633616&r2=1633617&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_fs/index.c (original)
+++ subversion/trunk/subversion/libsvn_fs_fs/index.c Wed Oct 22 13:53:12 2014
@@ -2463,35 +2463,42 @@ get_p2l_page(apr_array_header_t **entrie
   last_revision = start_revision;
   last_compound = 0;
 
-  /* If the rev / pack file page contains a single item spreading over
-   * multiple pages, the current page description may be empty (the item
-   * description will be read from the first entry in next page). */
-  offset = start_offset;
-
-  /* Read page. */
-  while (offset < next_offset)
-    {
-      SVN_ERR(read_entry(rev_file->p2l_stream, &item_offset, &last_revision,
-                         &last_compound, result));
-      offset = packed_stream_offset(rev_file->p2l_stream);
-    }
-
-  /* We should now be exactly at the next offset, i.e. the numbers in the
-   * stream cannot overlap into the next page description. */
-  if (offset != next_offset)
-    return svn_error_create(SVN_ERR_FS_INDEX_CORRUPTION, NULL,
+  /* Special case: empty pages. */
+  if (start_offset == next_offset)
+    {
+      /* Empty page. This only happens if the first entry of the next page
+       * also covers this page (and possibly more) completely. */
+      SVN_ERR(read_entry(rev_file->p2l_stream, &item_offset,
+                         &last_revision, &last_compound, result));
+    }
+  else
+    {
+      /* Read non-empty page. */
+      do
+        {
+          SVN_ERR(read_entry(rev_file->p2l_stream, &item_offset,
+                             &last_revision, &last_compound, result));
+          offset = packed_stream_offset(rev_file->p2l_stream);
+        }
+      while (offset < next_offset);
+
+      /* We should now be exactly at the next offset, i.e. the numbers in
+       * the stream cannot overlap into the next page description. */
+      if (offset != next_offset)
+        return svn_error_create(SVN_ERR_FS_INDEX_CORRUPTION, NULL,
              _("P2L page description overlaps with next page description"));
 
-  /* if we haven't covered the cluster end yet, we must read the first
-   * entry of the next page */
-  if (item_offset < page_start + page_size)
-    {
-      SVN_ERR(packed_stream_get(&value, rev_file->p2l_stream));
-      item_offset = (apr_off_t)value;
-      last_revision = start_revision;
-      last_compound = 0;
-      SVN_ERR(read_entry(rev_file->p2l_stream, &item_offset, &last_revision,
-                         &last_compound, result));
+      /* if we haven't covered the cluster end yet, we must read the first
+       * entry of the next page */
+      if (item_offset < page_start + page_size)
+        {
+          SVN_ERR(packed_stream_get(&value, rev_file->p2l_stream));
+          item_offset = (apr_off_t)value;
+          last_revision = start_revision;
+          last_compound = 0;
+          SVN_ERR(read_entry(rev_file->p2l_stream, &item_offset,
+                             &last_revision, &last_compound, result));
+        }
     }
 
   *entries = result;

Modified: subversion/trunk/subversion/libsvn_fs_fs/structure-indexes
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_fs/structure-indexes?rev=1633617&r1=1633616&r2=1633617&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_fs/structure-indexes (original)
+++ subversion/trunk/subversion/libsvn_fs_fs/structure-indexes Wed Oct 22 13:53:12 2014
@@ -296,7 +296,7 @@ Index on-disk format
   started after the begin of a given page and overlap with the next page
   will not be stored in the start page.  The runtime representation will
   duplicate items overlapping page boundaries; the on-disk representation
-  will not.
+  will not.  Thus, pages inside large items will have zero entries on disk.
 
 
 Proto index file format



Mime
View raw message