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/10/30 01:04:03 UTC
svn commit: r1635346 - in /subversion/trunk/subversion/libsvn_fs_x: ./
cached_data.c fs_x.c hotcopy.c index.c index.h low_level.c low_level.h
pack.c rev_file.c rev_file.h transaction.c transaction.h util.c util.h
verify.c
Author: stefan2
Date: Thu Oct 30 00:04:02 2014
New Revision: 1635346
URL: http://svn.apache.org/r1635346
Log:
Sync FSX with FSFS:
Merge and adapt revisions r1604416, r1604417 and 1604421 from libsvn_fs_fs.
The usual conflicts caused by reordered code and renamed functions in FSX
had to be resolved.
This ports the "indexes as part of the rev / pack file" changes to FSX.
Modified:
subversion/trunk/subversion/libsvn_fs_x/ (props changed)
subversion/trunk/subversion/libsvn_fs_x/cached_data.c
subversion/trunk/subversion/libsvn_fs_x/fs_x.c
subversion/trunk/subversion/libsvn_fs_x/hotcopy.c
subversion/trunk/subversion/libsvn_fs_x/index.c
subversion/trunk/subversion/libsvn_fs_x/index.h
subversion/trunk/subversion/libsvn_fs_x/low_level.c
subversion/trunk/subversion/libsvn_fs_x/low_level.h
subversion/trunk/subversion/libsvn_fs_x/pack.c
subversion/trunk/subversion/libsvn_fs_x/rev_file.c
subversion/trunk/subversion/libsvn_fs_x/rev_file.h
subversion/trunk/subversion/libsvn_fs_x/transaction.c
subversion/trunk/subversion/libsvn_fs_x/transaction.h
subversion/trunk/subversion/libsvn_fs_x/util.c
subversion/trunk/subversion/libsvn_fs_x/util.h
subversion/trunk/subversion/libsvn_fs_x/verify.c
Propchange: subversion/trunk/subversion/libsvn_fs_x/
------------------------------------------------------------------------------
Merged /subversion/trunk/subversion/libsvn_fs_fs:r1604416-1604417,1604421
Modified: subversion/trunk/subversion/libsvn_fs_x/cached_data.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_x/cached_data.c?rev=1635346&r1=1635345&r2=1635346&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_x/cached_data.c (original)
+++ subversion/trunk/subversion/libsvn_fs_x/cached_data.c Thu Oct 30 00:04:02 2014
@@ -721,6 +721,8 @@ create_rep_state_body(rep_state_t **rep_
*rep_state = rs;
return SVN_NO_ERROR;
}
+
+ SVN_ERR(rs_aligned_seek(rs, NULL, offset, pool));
}
SVN_ERR(svn_fs_x__read_rep_header(&rh, rs->sfile->rfile->stream, pool));
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=1635346&r1=1635345&r2=1635346&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_x/fs_x.c (original)
+++ subversion/trunk/subversion/libsvn_fs_x/fs_x.c Thu Oct 30 00:04:02 2014
@@ -771,12 +771,10 @@ write_revision_zero(svn_fs_t *fs)
const char *path_revision_zero = svn_fs_x__path_rev(fs, 0, fs->pool);
apr_hash_t *proplist;
svn_string_t date;
- const char *path;
/* Write out a rev file for revision 0. */
SVN_ERR(svn_io_file_create_binary
(path_revision_zero,
-/* "DELTA\nSVN\4END\nENDREP\n"*/
"DELTA\nSVN\1" /* txdelta v1 */
"\0\0\4\2\5" /* sview offset, sview len,
tview len, instr len, newlen */
@@ -789,37 +787,30 @@ write_revision_zero(svn_fs_t *fs)
"text: 0 3 16 4 "
"2d2977d1c96f487abe4a1e202dd03b4e\n"
"cpath: /\n"
- "\n\n",
- 0x7b, fs->pool));
+ "\n\n"
- SVN_ERR(svn_io_set_file_read_only(path_revision_zero, FALSE, fs->pool));
-
- path = svn_fs_x__path_l2p_index(fs, 0, fs->pool);
- SVN_ERR(svn_io_file_create_binary
- (path,
- "\0\1\x80\x40\1\1" /* rev 0, single page */
- "\5\4" /* page size: bytes, count */
- "\0" /* 0 container offsets in list */
- "\0\x7b\x1e\1", /* phys offsets + 1 */
- 13,
- fs->pool));
- SVN_ERR(svn_io_set_file_read_only(path, FALSE, fs->pool));
-
- path = svn_fs_x__path_p2l_index(fs, 0, fs->pool);
- SVN_ERR(svn_io_file_create_binary
- (path,
- "\0\x7b" /* start rev, rev file size */
- "\x80\x80\4\1\x21" /* 64k pages, 1 page using 33 bytes */
- "\0" /* offset entry 0 page 1 */
+ /* L2P index */
+ "\0\1\x80\x40\1\1" /* rev 0, single page */
+ "\5\4" /* page size: bytes, count */
+ "\0" /* 0 container offsets in list */
+ "\0\x7b\x1e\1" /* phys offsets + 1 */
+
+ /* P2L index */
+ "\0\x7b" /* start rev, rev file size */
+ "\x80\x80\4\1\x21" /* 64k pages, 1 page using 33 bytes */
+ "\0" /* offset entry 0 page 1 */
/* len, type & count, checksum,
(rev, 2*item)* */
- "\x1d\x11\x8e\xef\xf2\xd6\x01\0\6"
- "\x5d\x15\xb6\xea\x97\xe0\x0f\0\4"
- "\1\x16\x9d\x9e\xa9\x94\x0f\0\2"
- "\x85\xff\3\0\0", /* last entry fills up 64k page */
- 40,
- fs->pool));
- SVN_ERR(svn_io_set_file_read_only(path, FALSE, fs->pool));
+ "\x1d\x11\x8e\xef\xf2\xd6\x01\0\6"
+ "\x5d\x15\xb6\xea\x97\xe0\x0f\0\4"
+ "\1\x16\x9d\x9e\xa9\x94\x0f\0\2"
+ "\x85\xff\3\0\0" /* last entry fills up 64k page */
+
+ /* Footer */
+ "123 136\7",
+ 0x7b + 13 + 40 + 7 + 1, fs->pool));
+
+ SVN_ERR(svn_io_set_file_read_only(path_revision_zero, FALSE, fs->pool));
/* Set a date on revision 0. */
date.data = svn_time_to_cstring(apr_time_now(), fs->pool);
Modified: subversion/trunk/subversion/libsvn_fs_x/hotcopy.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_x/hotcopy.c?rev=1635346&r1=1635345&r2=1635346&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_x/hotcopy.c (original)
+++ subversion/trunk/subversion/libsvn_fs_x/hotcopy.c Thu Oct 30 00:04:02 2014
@@ -229,14 +229,12 @@ hotcopy_io_copy_dir_recursively(const ch
/* Copy an un-packed revision or revprop file for revision REV from SRC_SUBDIR
* to DST_SUBDIR. Assume a sharding layout based on MAX_FILES_PER_DIR.
- * If INCLUDE_INDEXES is set, copy rev index files as well.
* Use SCRATCH_POOL for temporary allocations. */
static svn_error_t *
hotcopy_copy_shard_file(const char *src_subdir,
const char *dst_subdir,
svn_revnum_t rev,
int max_files_per_dir,
- svn_boolean_t include_indexes,
apr_pool_t *scratch_pool)
{
const char *src_subdir_shard = src_subdir,
@@ -257,18 +255,6 @@ hotcopy_copy_shard_file(const char *src_
SVN_ERR(hotcopy_io_dir_file_copy(src_subdir_shard, dst_subdir_shard,
apr_psprintf(scratch_pool, "%ld", rev),
scratch_pool));
- if (include_indexes)
- {
- SVN_ERR(hotcopy_io_dir_file_copy(src_subdir_shard, dst_subdir_shard,
- apr_psprintf(scratch_pool, "%ld.l2p",
- rev),
- scratch_pool));
- SVN_ERR(hotcopy_io_dir_file_copy(src_subdir_shard, dst_subdir_shard,
- apr_psprintf(scratch_pool, "%ld.p2l",
- rev),
- scratch_pool));
- }
-
return SVN_NO_ERROR;
}
@@ -323,7 +309,7 @@ hotcopy_copy_packed_shard(svn_revnum_t *
SVN_ERR(hotcopy_copy_shard_file(src_subdir, dst_subdir,
revprop_rev, max_files_per_dir,
- FALSE, iterpool));
+ iterpool));
}
svn_pool_destroy(iterpool);
}
@@ -332,7 +318,7 @@ hotcopy_copy_packed_shard(svn_revnum_t *
/* revprop for revision 0 will never be packed */
if (rev == 0)
SVN_ERR(hotcopy_copy_shard_file(src_subdir, dst_subdir,
- 0, max_files_per_dir, FALSE,
+ 0, max_files_per_dir,
scratch_pool));
/* packed revprops folder */
@@ -669,7 +655,7 @@ hotcopy_revisions(svn_revnum_t *dst_youn
/* Copy the rev file. */
err = hotcopy_copy_shard_file(src_revs_dir, dst_revs_dir,
- rev, max_files_per_dir, TRUE,
+ rev, max_files_per_dir,
iterpool);
if (err)
{
@@ -719,7 +705,7 @@ hotcopy_revisions(svn_revnum_t *dst_youn
/* Copy the revprop file. */
SVN_ERR(hotcopy_copy_shard_file(src_revprops_dir,
dst_revprops_dir,
- rev, max_files_per_dir, FALSE,
+ rev, max_files_per_dir,
iterpool));
/* After completing a full shard, update 'current'. */
Modified: subversion/trunk/subversion/libsvn_fs_x/index.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_x/index.c?rev=1635346&r1=1635345&r2=1635346&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_x/index.c (original)
+++ subversion/trunk/subversion/libsvn_fs_x/index.c Thu Oct 30 00:04:02 2014
@@ -165,6 +165,15 @@ struct svn_fs_x__packed_number_stream_t
/* underlying data file containing the packed values */
apr_file_t *file;
+ /* Offset within FILE at which the stream data starts
+ * (i.e. which offset will reported as offset 0 by packed_stream_offset). */
+ apr_off_t stream_start;
+
+ /* First offset within FILE after the stream data.
+ * Attempts to read beyond this will cause an "Unexpected End Of Stream"
+ * error. */
+ apr_off_t stream_end;
+
/* number of used entries in BUFFER (starting at index 0) */
apr_size_t used;
@@ -246,6 +255,10 @@ packed_stream_read(svn_fs_x__packed_numb
if (block_left >= 10 && block_left < read)
read = block_left;
+ /* Don't read beyond the end of the file section that belongs to this
+ * index / stream. */
+ read = MIN(read, stream->stream_end - stream->next_offset);
+
err = apr_file_read(stream->file, buffer, &read);
if (err && !APR_STATUS_IS_EOF(err))
return stream_error_create(stream, err,
@@ -306,45 +319,33 @@ packed_stream_read(svn_fs_x__packed_numb
return SVN_NO_ERROR;
}
-/* Create and open a packed number stream reading from FILE_NAME and
- * return it in *STREAM. Access the file in chunks of BLOCK_SIZE bytes.
- * Use POOL for allocations.
+/* Create and open a packed number stream reading from offsets START to
+ * END in FILE and return it in *STREAM. Access the file in chunks of
+ * BLOCK_SIZE bytes. Use POOL for allocations.
*/
static svn_error_t *
packed_stream_open(svn_fs_x__packed_number_stream_t **stream,
- const char *file_name,
+ apr_file_t *file,
+ apr_off_t start,
+ apr_off_t end,
apr_size_t block_size,
apr_pool_t *pool)
{
svn_fs_x__packed_number_stream_t *result
= apr_palloc(pool, sizeof(*result));
- result->pool = svn_pool_create(pool);
- SVN_ERR(svn_io_file_open(&result->file, file_name,
- APR_READ | APR_BUFFERED, APR_OS_DEFAULT,
- result->pool));
+ result->pool = pool;
+ result->file = file;
+ result->stream_start = start;
+ result->stream_end = end;
result->used = 0;
result->current = 0;
- result->start_offset = 0;
- result->next_offset = 0;
+ result->start_offset = result->stream_start;
+ result->next_offset = result->stream_start;
result->block_size = block_size;
*stream = result;
-
- return SVN_NO_ERROR;
-}
-
-/* Close STREAM which may be NULL.
- */
-svn_error_t *
-svn_fs_x__packed_stream_close(svn_fs_x__packed_number_stream_t *stream)
-{
- if (stream)
- {
- SVN_ERR(svn_io_file_close(stream->file, stream->pool));
- svn_pool_destroy(stream->pool);
- }
return SVN_NO_ERROR;
}
@@ -369,20 +370,22 @@ packed_stream_get(apr_uint64_t *value,
return SVN_NO_ERROR;
}
-/* Navigate STREAM to packed file offset OFFSET. There will be no checks
+/* Navigate STREAM to packed stream offset OFFSET. There will be no checks
* whether the given OFFSET is valid.
*/
static void
packed_stream_seek(svn_fs_x__packed_number_stream_t *stream,
apr_off_t offset)
{
+ apr_off_t file_offset = offset + stream->stream_start;
+
if ( stream->used == 0
|| offset < stream->start_offset
|| offset >= stream->next_offset)
{
/* outside buffered data. Next get() will read() from OFFSET. */
- stream->start_offset = offset;
- stream->next_offset = offset;
+ stream->start_offset = file_offset;
+ stream->next_offset = file_offset;
stream->current = 0;
stream->used = 0;
}
@@ -393,22 +396,25 @@ packed_stream_seek(svn_fs_x__packed_numb
* it for the desired position. */
apr_size_t i;
for (i = 0; i < stream->used; ++i)
- if (stream->buffer[i].total_len > offset - stream->start_offset)
+ if (stream->buffer[i].total_len > file_offset - stream->start_offset)
break;
stream->current = i;
}
}
-/* Return the packed file offset of at which the next number in the stream
+/* Return the packed stream offset of at which the next number in the stream
* can be found.
*/
static apr_off_t
packed_stream_offset(svn_fs_x__packed_number_stream_t *stream)
{
- return stream->current == 0
+ apr_off_t file_offset
+ = stream->current == 0
? stream->start_offset
: stream->buffer[stream->current-1].total_len + stream->start_offset;
+
+ return file_offset - stream->stream_start;
}
/*
@@ -662,25 +668,9 @@ encode_l2p_page(apr_array_header_t *entr
return SVN_NO_ERROR;
}
-static svn_error_t *
-index_create(apr_file_t **index_file, const char *file_name, apr_pool_t *pool)
-{
- /* remove any old index file
- * (it would probably be r/o and simply re-writing it would fail) */
- SVN_ERR(svn_io_remove_file2(file_name, TRUE, pool));
-
- /* We most likely own the write lock to the repo, so this should
- * either just work or fail indicating a serious problem. */
- SVN_ERR(svn_io_file_open(index_file, file_name,
- APR_WRITE | APR_CREATE | APR_BUFFERED,
- APR_OS_DEFAULT, pool));
-
- return SVN_NO_ERROR;
-}
-
svn_error_t *
-svn_fs_x__l2p_index_create(svn_fs_t *fs,
- const char *file_name,
+svn_fs_x__l2p_index_append(svn_fs_t *fs,
+ apr_file_t *index_file,
const char *proto_file_name,
svn_revnum_t revision,
apr_pool_t *pool)
@@ -691,7 +681,6 @@ svn_fs_x__l2p_index_create(svn_fs_t *fs,
int end;
apr_uint64_t entry;
svn_boolean_t eof = FALSE;
- apr_file_t *index_file;
unsigned char encoded[ENCODED_INT_LENGTH];
int last_page_count = 0; /* total page count at the start of
@@ -803,9 +792,6 @@ svn_fs_x__l2p_index_create(svn_fs_t *fs,
/* we are now done with the source file */
SVN_ERR(svn_io_file_close(proto_index, local_pool));
- /* create the target file */
- SVN_ERR(index_create(&index_file, file_name, local_pool));
-
/* Paranoia check that makes later casting to int32 safe.
* The current implementation is limited to 2G pages per index. */
if (page_counts->nelts > APR_INT32_MAX)
@@ -857,10 +843,6 @@ svn_fs_x__l2p_index_create(svn_fs_t *fs,
local_pool),
NULL, NULL, local_pool));
- /* finalize the index file */
- SVN_ERR(svn_io_file_close(index_file, local_pool));
- SVN_ERR(svn_io_set_file_read_only(file_name, FALSE, local_pool));
-
svn_pool_destroy(local_pool);
return SVN_NO_ERROR;
@@ -1038,9 +1020,12 @@ auto_open_l2p_index(svn_fs_x__revision_f
if (rev_file->l2p_stream == NULL)
{
fs_x_data_t *ffd = fs->fsap_data;
+
+ SVN_ERR(svn_fs_x__auto_read_footer(rev_file));
SVN_ERR(packed_stream_open(&rev_file->l2p_stream,
- svn_fs_x__path_l2p_index(fs, revision,
- rev_file->pool),
+ rev_file->file,
+ rev_file->l2p_offset,
+ rev_file->p2l_offset,
ffd->block_size,
rev_file->pool));
}
@@ -1823,8 +1808,8 @@ svn_fs_x__p2l_proto_index_next_offset(ap
}
svn_error_t *
-svn_fs_x__p2l_index_create(svn_fs_t *fs,
- const char *file_name,
+svn_fs_x__p2l_index_append(svn_fs_t *fs,
+ apr_file_t *index_file,
const char *proto_file_name,
svn_revnum_t revision,
apr_pool_t *pool)
@@ -1835,7 +1820,6 @@ svn_fs_x__p2l_index_create(svn_fs_t *fs,
int i;
apr_uint32_t sub_item;
svn_boolean_t eof = FALSE;
- apr_file_t *index_file;
unsigned char encoded[ENCODED_INT_LENGTH];
apr_uint64_t last_entry_end = 0;
@@ -1983,9 +1967,6 @@ svn_fs_x__p2l_index_create(svn_fs_t *fs,
APR_ARRAY_PUSH(table_sizes, apr_uint64_t)
= svn_spillbuf__get_size(buffer) - last_buffer_size;
- /* create the target file */
- SVN_ERR(index_create(&index_file, file_name, local_pool));
-
/* write the start revision, file size and page size */
SVN_ERR(svn_io_file_write_full(index_file, encoded,
encode_uint(encoded, revision),
@@ -2015,16 +1996,35 @@ svn_fs_x__p2l_index_create(svn_fs_t *fs,
local_pool),
NULL, NULL, local_pool));
- /* finalize the index file */
- SVN_ERR(svn_io_file_close(index_file, local_pool));
- SVN_ERR(svn_io_set_file_read_only(file_name, FALSE, local_pool));
-
svn_pool_destroy(iterpool);
svn_pool_destroy(local_pool);
return SVN_NO_ERROR;
}
+/* If REV_FILE->P2L_STREAM is NULL, create a new stream for the phys-to-log
+ * index for REVISION in FS using the rev / pack file provided by REV_FILE.
+ */
+static svn_error_t *
+auto_open_p2l_index(svn_fs_x__revision_file_t *rev_file,
+ svn_fs_t *fs,
+ svn_revnum_t revision)
+{
+ if (rev_file->p2l_stream == NULL)
+ {
+ fs_x_data_t *ffd = fs->fsap_data;
+
+ SVN_ERR(svn_fs_x__auto_read_footer(rev_file));
+ SVN_ERR(packed_stream_open(&rev_file->p2l_stream,
+ rev_file->file,
+ rev_file->p2l_offset,
+ rev_file->footer_offset,
+ ffd->block_size, rev_file->pool));
+ }
+
+ return SVN_NO_ERROR;
+}
+
/* Data structure that describes which p2l page info shall be extracted
* from the cache and contains the fields that receive the result.
*/
@@ -2112,30 +2112,9 @@ p2l_page_info_func(void **out,
return SVN_NO_ERROR;
}
-/* If REV_FILE->L2P_STREAM is NULL, create a new stream for the log-to-phys
- * index for REVISION in FS and return it in REV_FILE.
- */
-static svn_error_t *
-auto_open_p2l_index(svn_fs_x__revision_file_t *rev_file,
- svn_fs_t *fs,
- svn_revnum_t revision)
-{
- if (rev_file->p2l_stream == NULL)
- {
- fs_x_data_t *ffd = fs->fsap_data;
- SVN_ERR(packed_stream_open(&rev_file->p2l_stream,
- svn_fs_x__path_p2l_index(fs, revision,
- rev_file->pool),
- ffd->block_size,
- rev_file->pool));
- }
-
- return SVN_NO_ERROR;
-}
-
/* Read the header data structure of the phys-to-log index for REVISION in
- * FS and return it in *HEADER, allocated in POOL. Use REV_FILE to access
- * on-disk data.
+ * FS and return it in *HEADER. Use REV_FILE to access on-disk data.
+ * Use POOL for allocations.
*/
static svn_error_t *
get_p2l_header(p2l_header_t **header,
@@ -2153,8 +2132,8 @@ get_p2l_header(p2l_header_t **header,
/* look for the header data in our cache */
pair_cache_key_t key;
- key.revision = base_revision(fs, revision);
- key.second = svn_fs_x__is_packed_rev(fs, revision);
+ key.revision = rev_file->start_revision;
+ key.second = rev_file->is_packed;
SVN_ERR(svn_cache__get((void**)header, &is_cached, ffd->p2l_header_cache,
&key, pool));
@@ -2864,14 +2843,9 @@ svn_fs_x__p2l_entry_lookup(svn_fs_x__p2l
apr_off_t offset,
apr_pool_t *pool)
{
- svn_fs_x__packed_number_stream_t *stream = NULL;
-
/* look for this info in our cache */
SVN_ERR(p2l_entry_lookup(entry_p, rev_file, fs, revision, offset, pool));
- /* make sure we close files after usage */
- SVN_ERR(svn_fs_x__packed_stream_close(stream));
-
return SVN_NO_ERROR;
}
Modified: subversion/trunk/subversion/libsvn_fs_x/index.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_x/index.h?rev=1635346&r1=1635345&r2=1635346&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_x/index.h (original)
+++ subversion/trunk/subversion/libsvn_fs_x/index.h Thu Oct 30 00:04:02 2014
@@ -86,10 +86,6 @@ svn_fs_x__p2l_entry_t *
svn_fs_x__p2l_entry_dup(const svn_fs_x__p2l_entry_t *entry,
apr_pool_t *pool);
-/* Close the index file STREAM and underlying file handle. */
-svn_error_t *
-svn_fs_x__packed_stream_close(svn_fs_x__packed_number_stream_t *stream);
-
/* Open / create a log-to-phys index file with the full file path name
* FILE_NAME. Return the open file in *PROTO_INDEX and use POOL for
* allocations.
@@ -123,14 +119,14 @@ svn_fs_x__l2p_proto_index_add_entry(apr_
apr_uint64_t item_index,
apr_pool_t *pool);
-/* Use the proto index file stored at PROTO_FILE_NAME and construct the
- * final log-to-phys index file at FILE_NAME. The first revision will
+/* Use the proto index file stored at PROTO_FILE_NAME, construct the final
+ * log-to-phys index and append it to INDEX_FILE. The first revision will
* be REVISION, entries to the next revision will be assigned to REVISION+1
* and so forth. Use POOL for allocations.
*/
svn_error_t *
-svn_fs_x__l2p_index_create(svn_fs_t *fs,
- const char *file_name,
+svn_fs_x__l2p_index_append(svn_fs_t *fs,
+ apr_file_t *index_file,
const char *proto_file_name,
svn_revnum_t revision,
apr_pool_t *pool);
@@ -163,14 +159,14 @@ svn_fs_x__p2l_proto_index_next_offset(ap
apr_file_t *proto_index,
apr_pool_t *pool);
-/* Use the proto index file stored at PROTO_FILE_NAME and construct the
- * final phys-to-log index file at FILE_NAME. Entries without a valid
+/* Use the proto index file stored at PROTO_FILE_NAME, construct the final
+ * phys-to-log index and append it to INDEX_FILE. Entries without a valid
* revision will be assigned to the REVISION given here.
* Use POOL for allocations.
*/
svn_error_t *
-svn_fs_x__p2l_index_create(svn_fs_t *fs,
- const char *file_name,
+svn_fs_x__p2l_index_append(svn_fs_t *fs,
+ apr_file_t *index_file,
const char *proto_file_name,
svn_revnum_t revision,
apr_pool_t *pool);
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=1635346&r1=1635345&r2=1635346&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_x/low_level.c (original)
+++ subversion/trunk/subversion/libsvn_fs_x/low_level.c Thu Oct 30 00:04:02 2014
@@ -160,6 +160,42 @@ svn_fs_x__unparse_revision_trailer(apr_o
changes_offset);
}
+svn_error_t *
+svn_fs_x__parse_footer(apr_off_t *l2p_offset,
+ apr_off_t *p2l_offset,
+ svn_stringbuf_t *footer,
+ svn_revnum_t rev)
+{
+ apr_int64_t val;
+
+ /* Split the footer into the 2 number strings. */
+ char *seperator = strchr(footer->data, ' ');
+ if (!seperator)
+ return svn_error_createf(SVN_ERR_FS_CORRUPT, NULL,
+ _("Revision file (r%ld) has corrupt footer"),
+ rev);
+ *seperator = '\0';
+
+ /* Convert offset values. */
+ SVN_ERR(svn_cstring_atoi64(&val, footer->data));
+ *l2p_offset = (apr_off_t)val;
+ SVN_ERR(svn_cstring_atoi64(&val, seperator + 1));
+ *p2l_offset = (apr_off_t)val;
+
+ return SVN_NO_ERROR;
+}
+
+svn_stringbuf_t *
+svn_fs_x__unparse_footer(apr_off_t l2p_offset,
+ apr_off_t p2l_offset,
+ apr_pool_t *pool)
+{
+ return svn_stringbuf_createf(pool,
+ "%" APR_OFF_T_FMT " %" APR_OFF_T_FMT,
+ l2p_offset,
+ p2l_offset);
+}
+
/* Given a revision file FILE that has been pre-positioned at the
beginning of a Node-Rev header block, read in that header block and
store it in the apr_hash_t HEADERS. All allocations will be from
Modified: subversion/trunk/subversion/libsvn_fs_x/low_level.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_x/low_level.h?rev=1635346&r1=1635345&r2=1635346&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_x/low_level.h (original)
+++ subversion/trunk/subversion/libsvn_fs_x/low_level.h Thu Oct 30 00:04:02 2014
@@ -59,6 +59,28 @@ svn_fs_x__unparse_revision_trailer(apr_o
apr_off_t changes_offset,
apr_pool_t *pool);
+/* Given the FSX revision / pack FOOTER, parse it destructively
+ * and return the start offsets of the index data in *L2P_OFFSET and
+ * *P2L_OFFSET, respectively.
+ *
+ * Note that REV is only used to construct nicer error objects that
+ * mention this revision.
+ */
+svn_error_t *
+svn_fs_x__parse_footer(apr_off_t *l2p_offset,
+ apr_off_t *p2l_offset,
+ svn_stringbuf_t *footer,
+ svn_revnum_t rev);
+
+/* Given the offset of the L2P index data in L2P_OFFSET and the offset of
+ * the P2L index data in P2L_OFFSET, return the corresponding format 7+
+ * revision / pack file footer. Allocate it in POOL.
+ */
+svn_stringbuf_t *
+svn_fs_x__unparse_footer(apr_off_t l2p_offset,
+ apr_off_t p2l_offset,
+ apr_pool_t *pool);
+
/* Parse the description of a representation from TEXT and store it
into *REP_P. Allocate *REP_P in POOL. */
svn_error_t *
Modified: subversion/trunk/subversion/libsvn_fs_x/pack.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_x/pack.c?rev=1635346&r1=1635345&r2=1635346&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_x/pack.c (original)
+++ subversion/trunk/subversion/libsvn_fs_x/pack.c Thu Oct 30 00:04:02 2014
@@ -357,12 +357,6 @@ static svn_error_t *
close_pack_context(pack_context_t *context,
apr_pool_t *pool)
{
- const char *l2p_index_path
- = apr_pstrcat(pool, context->pack_file_path, PATH_EXT_L2P_INDEX,
- SVN_VA_NULL);
- const char *p2l_index_path
- = apr_pstrcat(pool, context->pack_file_path, PATH_EXT_P2L_INDEX,
- SVN_VA_NULL);
const char *proto_l2p_index_path;
const char *proto_p2l_index_path;
@@ -371,18 +365,17 @@ close_pack_context(pack_context_t *conte
context->proto_l2p_index, pool));
SVN_ERR(svn_io_file_name_get(&proto_p2l_index_path,
context->proto_p2l_index, pool));
-
+
/* finalize proto index files */
SVN_ERR(svn_io_file_close(context->proto_l2p_index, pool));
SVN_ERR(svn_io_file_close(context->proto_p2l_index, pool));
- /* Create the actual index files*/
- SVN_ERR(svn_fs_x__l2p_index_create(context->fs, l2p_index_path,
- proto_l2p_index_path,
- context->shard_rev, pool));
- SVN_ERR(svn_fs_x__p2l_index_create(context->fs, p2l_index_path,
- proto_p2l_index_path,
- context->shard_rev, pool));
+ /* Append the actual index data to the pack file. */
+ SVN_ERR(svn_fs_x__add_index_data(context->fs, context->pack_file,
+ proto_l2p_index_path,
+ proto_p2l_index_path,
+ context->shard_rev,
+ pool));
/* remove proto index files */
SVN_ERR(svn_io_remove_file2(proto_l2p_index_path, FALSE, pool));
@@ -1832,24 +1825,19 @@ pack_range(pack_context_t *context,
for (revision = context->start_rev; revision < context->end_rev; ++revision)
{
apr_off_t offset = 0;
- apr_finfo_t finfo;
svn_fs_x__revision_file_t *rev_file;
- /* Get the size of the file. */
- const char *path = svn_dirent_join(context->shard_dir,
- apr_psprintf(revpool, "%ld",
- revision),
- revpool);
- SVN_ERR(svn_io_stat(&finfo, path, APR_FINFO_SIZE, revpool));
+ /* Get the rev file dimensions (mainly index locations). */
SVN_ERR(svn_fs_x__open_pack_or_rev_file(&rev_file, context->fs,
revision, revpool));
+ SVN_ERR(svn_fs_x__auto_read_footer(rev_file));
/* store the indirect array index */
APR_ARRAY_PUSH(context->rev_offsets, int) = context->reps->nelts;
/* read the phys-to-log index file until we covered the whole rev file.
* That index contains enough info to build both target indexes from it. */
- while (offset < finfo.size)
+ while (offset < rev_file->l2p_offset)
{
/* read one cluster */
int i;
@@ -1872,7 +1860,7 @@ pack_range(pack_context_t *context,
/* process entry while inside the rev file */
offset = entry->offset;
- if (offset < finfo.size)
+ if (offset < rev_file->l2p_offset)
{
SVN_ERR(svn_io_file_seek(rev_file->file, APR_SET, &offset,
iterpool));
Modified: subversion/trunk/subversion/libsvn_fs_x/rev_file.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_x/rev_file.c?rev=1635346&r1=1635345&r2=1635346&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_x/rev_file.c (original)
+++ subversion/trunk/subversion/libsvn_fs_x/rev_file.c Thu Oct 30 00:04:02 2014
@@ -23,30 +23,50 @@
#include "rev_file.h"
#include "fs_x.h"
#include "index.h"
+#include "low_level.h"
#include "util.h"
#include "../libsvn_fs/fs-loader.h"
#include "svn_private_config.h"
-static void
-svn_fs_x__init_revision_file(svn_fs_x__revision_file_t *file,
- svn_fs_t *fs,
- svn_revnum_t revision,
- apr_pool_t *pool)
+static svn_fs_x__revision_file_t *
+create_revision_file(svn_fs_t *fs,
+ apr_pool_t *pool)
{
fs_x_data_t *ffd = fs->fsap_data;
+ svn_fs_x__revision_file_t *file = apr_palloc(pool, sizeof(*file));
- file->is_packed = svn_fs_x__is_packed_rev(fs, revision);
- file->start_revision = revision < ffd->min_unpacked_rev
- ? revision - (revision % ffd->max_files_per_dir)
- : revision;
+ file->is_packed = FALSE;
+ file->start_revision = SVN_INVALID_REVNUM;
file->file = NULL;
file->stream = NULL;
file->p2l_stream = NULL;
file->l2p_stream = NULL;
+ file->block_size = ffd->block_size;
+ file->l2p_offset = -1;
+ file->p2l_offset = -1;
+ file->footer_offset = -1;
file->pool = pool;
+
+ return file;
+}
+
+static svn_fs_x__revision_file_t *
+init_revision_file(svn_fs_t *fs,
+ svn_revnum_t revision,
+ apr_pool_t *pool)
+{
+ fs_x_data_t *ffd = fs->fsap_data;
+ svn_fs_x__revision_file_t *file = create_revision_file(fs, pool);
+
+ file->is_packed = svn_fs_x__is_packed_rev(fs, revision);
+ file->start_revision = revision < ffd->min_unpacked_rev
+ ? revision - (revision % ffd->max_files_per_dir)
+ : revision;
+
+ return file;
}
/* Core implementation of svn_fs_x__open_pack_or_rev_file working on an
@@ -109,21 +129,45 @@ svn_fs_x__open_pack_or_rev_file(svn_fs_x
svn_revnum_t rev,
apr_pool_t *pool)
{
- *file = apr_palloc(pool, sizeof(**file));
- svn_fs_x__init_revision_file(*file, fs, rev, pool);
-
+ *file = init_revision_file(fs, rev, pool);
return svn_error_trace(open_pack_or_rev_file(*file, fs, rev, pool));
}
svn_error_t *
-svn_fs_x__reopen_revision_file(svn_fs_x__revision_file_t *file,
- svn_fs_t *fs,
- svn_revnum_t rev)
+svn_fs_x__auto_read_footer(svn_fs_x__revision_file_t *file)
{
- if (file->file)
- svn_fs_x__close_revision_file(file);
+ if (file->l2p_offset == -1)
+ {
+ apr_off_t filesize = 0;
+ unsigned char footer_length;
+ svn_stringbuf_t *footer;
+
+ /* Determine file size. */
+ SVN_ERR(svn_io_file_seek(file->file, APR_END, &filesize, file->pool));
+
+ /* Read last byte (containing the length of the footer). */
+ SVN_ERR(svn_io_file_aligned_seek(file->file, file->block_size, NULL,
+ filesize - 1, file->pool));
+ SVN_ERR(svn_io_file_read_full2(file->file, &footer_length,
+ sizeof(footer_length), NULL, NULL,
+ file->pool));
+
+ /* Read footer. */
+ footer = svn_stringbuf_create_ensure(footer_length, file->pool);
+ SVN_ERR(svn_io_file_aligned_seek(file->file, file->block_size, NULL,
+ filesize - 1 - footer_length,
+ file->pool));
+ SVN_ERR(svn_io_file_read_full2(file->file, footer->data, footer_length,
+ &footer->len, NULL, file->pool));
+ footer->data[footer->len] = '\0';
+
+ /* Extract index locations. */
+ SVN_ERR(svn_fs_x__parse_footer(&file->l2p_offset, &file->p2l_offset,
+ footer, file->start_revision));
+ file->footer_offset = filesize - footer_length - 1;
+ }
- return svn_error_trace(open_pack_or_rev_file(file, fs, rev, file->pool));
+ return SVN_NO_ERROR;
}
svn_error_t *
@@ -137,13 +181,8 @@ svn_fs_x__open_proto_rev_file(svn_fs_x__
svn_fs_x__path_txn_proto_rev(fs, txn_id, pool),
APR_READ | APR_BUFFERED, APR_OS_DEFAULT, pool));
- *file = apr_pcalloc(pool, sizeof(**file));
- (*file)->file = apr_file;
- (*file)->is_packed = FALSE;
- (*file)->start_revision = SVN_INVALID_REVNUM;
- (*file)->stream = svn_stream_from_aprfile2(apr_file, TRUE, pool);
-
- return SVN_NO_ERROR;
+ return svn_error_trace(svn_fs_x__wrap_temp_rev_file(file, fs, apr_file,
+ pool));
}
svn_error_t *
@@ -152,10 +191,8 @@ svn_fs_x__wrap_temp_rev_file(svn_fs_x__r
apr_file_t *temp_file,
apr_pool_t *pool)
{
- *file = apr_pcalloc(pool, sizeof(**file));
+ *file = create_revision_file(fs, pool);
(*file)->file = temp_file;
- (*file)->is_packed = FALSE;
- (*file)->start_revision = SVN_INVALID_REVNUM;
(*file)->stream = svn_stream_from_aprfile2(temp_file, TRUE, pool);
return SVN_NO_ERROR;
@@ -169,9 +206,6 @@ svn_fs_x__close_revision_file(svn_fs_x__
if (file->file)
SVN_ERR(svn_io_file_close(file->file, file->pool));
- SVN_ERR(svn_fs_x__packed_stream_close(file->l2p_stream));
- SVN_ERR(svn_fs_x__packed_stream_close(file->p2l_stream));
-
file->file = NULL;
file->stream = NULL;
file->l2p_stream = NULL;
Modified: subversion/trunk/subversion/libsvn_fs_x/rev_file.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_x/rev_file.h?rev=1635346&r1=1635345&r2=1635346&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_x/rev_file.h (original)
+++ subversion/trunk/subversion/libsvn_fs_x/rev_file.h Thu Oct 30 00:04:02 2014
@@ -38,7 +38,9 @@
typedef struct svn_fs_x__packed_number_stream_t
svn_fs_x__packed_number_stream_t;
-/* All files and associated properties for START_REVISION.
+/* Data file, including indexes data, and associated properties for
+ * START_REVISION. As the FILE is kept open, background pack operations
+ * will not cause access to this file to fail.
*/
typedef struct svn_fs_x__revision_file_t
{
@@ -49,18 +51,37 @@ typedef struct svn_fs_x__revision_file_t
/* the revision was packed when the first file / stream got opened */
svn_boolean_t is_packed;
- /* rev / pack file or NULL if not opened, yet */
+ /* rev / pack file */
apr_file_t *file;
/* stream based on FILE and not NULL exactly when FILE is not NULL */
svn_stream_t *stream;
- /* the opened P2L index or NULL. Always NULL for txns. */
+ /* the opened P2L index stream or NULL. Always NULL for txns. */
svn_fs_x__packed_number_stream_t *p2l_stream;
- /* the opened L2P index or NULL. Always NULL for txns. */
+ /* the opened L2P index stream or NULL. Always NULL for txns. */
svn_fs_x__packed_number_stream_t *l2p_stream;
+ /* Copied from FS->FFD->BLOCK_SIZE upon creation. It allows us to
+ * use aligned seek() without having the FS handy. */
+ apr_off_t block_size;
+
+ /* Offset within FILE at which the rev data ends and the L2P index
+ * data starts. Less than P2L_OFFSET. -1 if svn_fs_fs__auto_read_footer
+ * has not been called, yet. */
+ apr_off_t l2p_offset;
+
+ /* Offset within FILE at which the L2P index ends and the P2L index
+ * data starts. Greater than L2P_OFFSET. -1 if svn_fs_fs__auto_read_footer
+ * has not been called, yet. */
+ apr_off_t p2l_offset;
+
+ /* Offset within FILE at which the P2L index ends and the footer starts.
+ * Greater than P2L_OFFSET. -1 if svn_fs_fs__auto_read_footer has not
+ * been called, yet. */
+ apr_off_t footer_offset;
+
/* pool containing this object */
apr_pool_t *pool;
} svn_fs_x__revision_file_t;
@@ -75,15 +96,13 @@ svn_fs_x__open_pack_or_rev_file(svn_fs_x
svn_revnum_t rev,
apr_pool_t *pool);
-/* Close previous files as well as streams in FILE (if open) and open the
- * rev / pack file for REVISION in FS. This is useful when a pack operation
- * made the current files outdated or no longer available and the caller
- * wants to keep the same revision file data structure.
+/* If the footer data in FILE has not been read, yet, do so now.
+ * Index locations will only be read upon request as we assume they get
+ * cached and the FILE is usually used for REP data access only.
+ * Hence, the separate step.
*/
svn_error_t *
-svn_fs_x__reopen_revision_file(svn_fs_x__revision_file_t *file,
- svn_fs_t *fs,
- svn_revnum_t revision);
+svn_fs_x__auto_read_footer(svn_fs_x__revision_file_t *file);
/* Open the proto-rev file of transaction TXN_ID in FS and return it in *FILE.
* Use POOL for allocations. */
Modified: subversion/trunk/subversion/libsvn_fs_x/transaction.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_x/transaction.c?rev=1635346&r1=1635345&r2=1635346&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_x/transaction.c (original)
+++ subversion/trunk/subversion/libsvn_fs_x/transaction.c Thu Oct 30 00:04:02 2014
@@ -3195,6 +3195,42 @@ write_final_revprop(const char **path,
return SVN_NO_ERROR;
}
+svn_error_t *
+svn_fs_x__add_index_data(svn_fs_t *fs,
+ apr_file_t *file,
+ const char *l2p_proto_index,
+ const char *p2l_proto_index,
+ svn_revnum_t revision,
+ apr_pool_t *pool)
+{
+ apr_off_t l2p_offset;
+ apr_off_t p2l_offset;
+ svn_stringbuf_t *footer;
+ unsigned char footer_length;
+
+ /* Append the actual index data to the pack file. */
+ l2p_offset = 0;
+ SVN_ERR(svn_io_file_seek(file, APR_CUR, &l2p_offset, pool));
+ SVN_ERR(svn_fs_x__l2p_index_append(fs, file, l2p_proto_index, revision,
+ pool));
+
+ p2l_offset = 0;
+ SVN_ERR(svn_io_file_seek(file, APR_CUR, &p2l_offset, pool));
+ SVN_ERR(svn_fs_x__p2l_index_append(fs, file, p2l_proto_index, revision,
+ pool));
+
+ /* Append footer. */
+ footer = svn_fs_x__unparse_footer(l2p_offset, p2l_offset, pool);
+ SVN_ERR(svn_io_file_write_full(file, footer->data, footer->len, NULL,
+ pool));
+
+ footer_length = footer->len;
+ SVN_ERR_ASSERT(footer_length == footer->len);
+ SVN_ERR(svn_io_file_write_full(file, &footer_length, 1, NULL, pool));
+
+ return SVN_NO_ERROR;
+}
+
/* Baton used for commit_body below. */
struct commit_baton {
svn_revnum_t *new_rev_p;
@@ -3262,6 +3298,12 @@ commit_body(void *baton, apr_pool_t *poo
cb->fs, txn_id, changed_paths,
new_rev, pool));
+ /* Append the index data to the rev file. */
+ SVN_ERR(svn_fs_x__add_index_data(cb->fs, proto_file,
+ svn_fs_x__path_l2p_proto_index(cb->fs, txn_id, pool),
+ svn_fs_x__path_p2l_proto_index(cb->fs, txn_id, pool),
+ new_rev, pool));
+
SVN_ERR(svn_io_file_flush_to_disk(proto_file, pool));
SVN_ERR(svn_io_file_close(proto_file, pool));
@@ -3304,17 +3346,6 @@ commit_body(void *baton, apr_pool_t *poo
}
}
- /* Convert the index files from the proto format into their form
- in their final location */
- SVN_ERR(svn_fs_x__l2p_index_create(cb->fs,
- svn_fs_x__path_l2p_index(cb->fs, new_rev, pool),
- svn_fs_x__path_l2p_proto_index(cb->fs, txn_id, pool),
- new_rev, pool));
- SVN_ERR(svn_fs_x__p2l_index_create(cb->fs,
- svn_fs_x__path_p2l_index(cb->fs, new_rev, pool),
- svn_fs_x__path_p2l_proto_index(cb->fs, txn_id, pool),
- new_rev, pool));
-
/* Move the finished rev file into place.
### This "breaks" the transaction by removing the protorev file
Modified: subversion/trunk/subversion/libsvn_fs_x/transaction.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_x/transaction.h?rev=1635346&r1=1635345&r2=1635346&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_x/transaction.h (original)
+++ subversion/trunk/subversion/libsvn_fs_x/transaction.h Thu Oct 30 00:04:02 2014
@@ -240,6 +240,18 @@ svn_fs_x__set_proplist(svn_fs_t *fs,
apr_hash_t *proplist,
apr_pool_t *pool);
+/* Append the L2P and P2L indexes given by their proto index file names
+ * L2P_PROTO_INDEX and P2L_PROTO_INDEX to the revision / pack FILE.
+ * The latter contains revision(s) starting at REVISION in FS.
+ * Use POOL for temporary allocations. */
+svn_error_t *
+svn_fs_x__add_index_data(svn_fs_t *fs,
+ apr_file_t *file,
+ const char *l2p_proto_index,
+ const char *p2l_proto_index,
+ svn_revnum_t revision,
+ apr_pool_t *pool);
+
/* Commit the transaction TXN in filesystem FS and return its new
revision number in *REV. If the transaction is out of date, return
the error SVN_ERR_FS_TXN_OUT_OF_DATE. Use POOL for temporary
Modified: subversion/trunk/subversion/libsvn_fs_x/util.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_x/util.c?rev=1635346&r1=1635345&r2=1635346&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_x/util.c (original)
+++ subversion/trunk/subversion/libsvn_fs_x/util.c Thu Oct 30 00:04:02 2014
@@ -172,24 +172,6 @@ svn_fs_x__path_rev(svn_fs_t *fs, svn_rev
}
const char *
-svn_fs_x__path_l2p_index(svn_fs_t *fs,
- svn_revnum_t rev,
- apr_pool_t *pool)
-{
- return apr_psprintf(pool, "%s" PATH_EXT_L2P_INDEX,
- svn_fs_x__path_rev_absolute(fs, rev, pool));
-}
-
-const char *
-svn_fs_x__path_p2l_index(svn_fs_t *fs,
- svn_revnum_t rev,
- apr_pool_t *pool)
-{
- return apr_psprintf(pool, "%s" PATH_EXT_P2L_INDEX,
- svn_fs_x__path_rev_absolute(fs, rev, pool));
-}
-
-const char *
svn_fs_x__path_rev_absolute(svn_fs_t *fs,
svn_revnum_t rev,
apr_pool_t *pool)
Modified: subversion/trunk/subversion/libsvn_fs_x/util.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_x/util.h?rev=1635346&r1=1635345&r2=1635346&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_x/util.h (original)
+++ subversion/trunk/subversion/libsvn_fs_x/util.h Thu Oct 30 00:04:02 2014
@@ -135,16 +135,6 @@ svn_fs_x__path_rev(svn_fs_t *fs,
apr_pool_t *pool);
const char *
-svn_fs_x__path_l2p_index(svn_fs_t *fs,
- svn_revnum_t rev,
- apr_pool_t *pool);
-
-const char *
-svn_fs_x__path_p2l_index(svn_fs_t *fs,
- svn_revnum_t rev,
- apr_pool_t *pool);
-
-const char *
svn_fs_x__path_revprops_shard(svn_fs_t *fs,
svn_revnum_t rev,
apr_pool_t *pool);
Modified: subversion/trunk/subversion/libsvn_fs_x/verify.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_x/verify.c?rev=1635346&r1=1635345&r2=1635346&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_x/verify.c (original)
+++ subversion/trunk/subversion/libsvn_fs_x/verify.c Thu Oct 30 00:04:02 2014
@@ -150,6 +150,7 @@ compare_l2p_to_p2l_index(svn_fs_t *fs,
apr_pool_t *iterpool = svn_pool_create(pool);
apr_array_header_t *max_ids;
+ /* common file access structure */
svn_fs_x__revision_file_t *rev_file;
SVN_ERR(svn_fs_x__open_pack_or_rev_file(&rev_file, fs, start, pool));
@@ -180,8 +181,9 @@ compare_l2p_to_p2l_index(svn_fs_t *fs,
continue;
/* find the corresponding P2L entry */
- SVN_ERR(svn_fs_x__p2l_item_lookup(&p2l_item, fs, rev_file, start,
- offset, sub_item, iterpool));
+ SVN_ERR(svn_fs_x__p2l_item_lookup(&p2l_item, fs, rev_file,
+ revision, offset, sub_item,
+ iterpool));
if (p2l_item == NULL)
return svn_error_createf(SVN_ERR_FS_INDEX_INCONSISTENT,
@@ -211,6 +213,8 @@ compare_l2p_to_p2l_index(svn_fs_t *fs,
svn_pool_destroy(iterpool);
+ SVN_ERR(svn_fs_x__close_revision_file(rev_file));
+
return SVN_NO_ERROR;
}
@@ -306,6 +310,8 @@ compare_p2l_to_l2p_index(svn_fs_t *fs,
svn_pool_destroy(iterpool);
+ SVN_ERR(svn_fs_x__close_revision_file(rev_file));
+
return SVN_NO_ERROR;
}
@@ -483,15 +489,15 @@ compare_p2l_to_rev(svn_fs_t *fs,
SVN_ERR(svn_fs_x__open_pack_or_rev_file(&rev_file, fs, start, pool));
/* check file size vs. range covered by index */
- SVN_ERR(svn_io_file_seek(rev_file->file, APR_END, &offset, pool));
+ SVN_ERR(svn_fs_x__auto_read_footer(rev_file));
SVN_ERR(svn_fs_x__p2l_get_max_offset(&max_offset, fs, rev_file, start,
pool));
- if (offset != max_offset)
+ if (rev_file->l2p_offset != max_offset)
return svn_error_createf(SVN_ERR_FS_INDEX_INCONSISTENT, NULL,
_("File size of %s for revision r%ld does "
"not match p2l index size of %s"),
- apr_off_t_toa(pool, offset), start,
+ apr_off_t_toa(pool, rev_file->l2p_offset), start,
apr_off_t_toa(pool, max_offset));
SVN_ERR(svn_io_file_aligned_seek(rev_file->file, ffd->block_size, NULL, 0,