You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by ph...@apache.org on 2014/03/12 18:18:26 UTC
svn commit: r1576824 [3/7] - in /subversion/branches/fsfs-lock-many: ./
build/generator/ build/generator/templates/
subversion/bindings/ctypes-python/test/ subversion/bindings/javahl/native/
subversion/bindings/javahl/src/org/apache/subversion/javahl/t...
Modified: subversion/branches/fsfs-lock-many/subversion/libsvn_fs_fs/fs_fs.h
URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-lock-many/subversion/libsvn_fs_fs/fs_fs.h?rev=1576824&r1=1576823&r2=1576824&view=diff
==============================================================================
--- subversion/branches/fsfs-lock-many/subversion/libsvn_fs_fs/fs_fs.h (original)
+++ subversion/branches/fsfs-lock-many/subversion/libsvn_fs_fs/fs_fs.h Wed Mar 12 17:18:20 2014
@@ -136,6 +136,12 @@ svn_fs_fs__write_format(svn_fs_t *fs,
svn_boolean_t overwrite,
apr_pool_t *pool);
+/* Get a lock on empty file LOCK_FILENAME, creating it in POOL;
+ releasing the lock upon POOL cleanup. */
+svn_error_t *
+svn_fs_fs__get_lock_on_filesystem(const char *lock_filename,
+ apr_pool_t *pool);
+
/* Obtain a write lock on the filesystem FS in a subpool of POOL, call
BODY with BATON and that subpool, destroy the subpool (releasing the write
lock) and return what BODY returned. */
Modified: subversion/branches/fsfs-lock-many/subversion/libsvn_fs_fs/hotcopy.c
URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-lock-many/subversion/libsvn_fs_fs/hotcopy.c?rev=1576824&r1=1576823&r2=1576824&view=diff
==============================================================================
--- subversion/branches/fsfs-lock-many/subversion/libsvn_fs_fs/hotcopy.c (original)
+++ subversion/branches/fsfs-lock-many/subversion/libsvn_fs_fs/hotcopy.c Wed Mar 12 17:18:20 2014
@@ -382,12 +382,6 @@ hotcopy_update_current(svn_revnum_t *dst
/* If necessary, get new current next_node and next_copy IDs. */
if (dst_ffd->format < SVN_FS_FS__MIN_NO_GLOBAL_IDS_FORMAT)
{
- /* Make sure NEW_YOUNGEST is a valid revision in DST_FS.
- Because a crash in hotcopy requires at least a full recovery run,
- it is safe to temporarily reset the max IDs to 0. */
- SVN_ERR(svn_fs_fs__write_current(dst_fs, new_youngest, next_node_id,
- next_copy_id, scratch_pool));
-
SVN_ERR(svn_fs_fs__find_max_ids(dst_fs, new_youngest,
&next_node_id, &next_copy_id,
scratch_pool));
Modified: subversion/branches/fsfs-lock-many/subversion/libsvn_fs_fs/id.c
URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-lock-many/subversion/libsvn_fs_fs/id.c?rev=1576824&r1=1576823&r2=1576824&view=diff
==============================================================================
--- subversion/branches/fsfs-lock-many/subversion/libsvn_fs_fs/id.c (original)
+++ subversion/branches/fsfs-lock-many/subversion/libsvn_fs_fs/id.c Wed Mar 12 17:18:20 2014
@@ -190,7 +190,7 @@ svn_fs_fs__id_txn_unparse(const svn_fs_f
const svn_fs_fs__id_part_t *
svn_fs_fs__id_node_id(const svn_fs_id_t *fs_id)
{
- fs_fs__id_t *id = (fs_fs__id_t *)fs_id;
+ const fs_fs__id_t *id = (const fs_fs__id_t *)fs_id;
return &id->private_id.node_id;
}
@@ -199,7 +199,7 @@ svn_fs_fs__id_node_id(const svn_fs_id_t
const svn_fs_fs__id_part_t *
svn_fs_fs__id_copy_id(const svn_fs_id_t *fs_id)
{
- fs_fs__id_t *id = (fs_fs__id_t *)fs_id;
+ const fs_fs__id_t *id = (const fs_fs__id_t *)fs_id;
return &id->private_id.copy_id;
}
@@ -208,7 +208,7 @@ svn_fs_fs__id_copy_id(const svn_fs_id_t
const svn_fs_fs__id_part_t *
svn_fs_fs__id_txn_id(const svn_fs_id_t *fs_id)
{
- fs_fs__id_t *id = (fs_fs__id_t *)fs_id;
+ const fs_fs__id_t *id = (const fs_fs__id_t *)fs_id;
return &id->private_id.txn_id;
}
@@ -217,7 +217,7 @@ svn_fs_fs__id_txn_id(const svn_fs_id_t *
const svn_fs_fs__id_part_t *
svn_fs_fs__id_rev_item(const svn_fs_id_t *fs_id)
{
- fs_fs__id_t *id = (fs_fs__id_t *)fs_id;
+ const fs_fs__id_t *id = (const fs_fs__id_t *)fs_id;
return &id->private_id.rev_item;
}
@@ -225,7 +225,7 @@ svn_fs_fs__id_rev_item(const svn_fs_id_t
svn_revnum_t
svn_fs_fs__id_rev(const svn_fs_id_t *fs_id)
{
- fs_fs__id_t *id = (fs_fs__id_t *)fs_id;
+ const fs_fs__id_t *id = (const fs_fs__id_t *)fs_id;
return id->private_id.rev_item.revision;
}
@@ -233,7 +233,7 @@ svn_fs_fs__id_rev(const svn_fs_id_t *fs_
apr_uint64_t
svn_fs_fs__id_item(const svn_fs_id_t *fs_id)
{
- fs_fs__id_t *id = (fs_fs__id_t *)fs_id;
+ const fs_fs__id_t *id = (const fs_fs__id_t *)fs_id;
return id->private_id.rev_item.number;
}
@@ -241,7 +241,7 @@ svn_fs_fs__id_item(const svn_fs_id_t *fs
svn_boolean_t
svn_fs_fs__id_is_txn(const svn_fs_id_t *fs_id)
{
- fs_fs__id_t *id = (fs_fs__id_t *)fs_id;
+ const fs_fs__id_t *id = (const fs_fs__id_t *)fs_id;
return svn_fs_fs__id_txn_used(&id->private_id.txn_id);
}
@@ -251,7 +251,7 @@ svn_fs_fs__id_unparse(const svn_fs_id_t
apr_pool_t *pool)
{
char string[6 * SVN_INT64_BUFFER_SIZE + 10];
- fs_fs__id_t *id = (fs_fs__id_t *)fs_id;
+ const fs_fs__id_t *id = (const fs_fs__id_t *)fs_id;
char *p = unparse_id_part(string, &id->private_id.node_id);
p = unparse_id_part(p, &id->private_id.copy_id);
@@ -281,8 +281,8 @@ svn_boolean_t
svn_fs_fs__id_eq(const svn_fs_id_t *a,
const svn_fs_id_t *b)
{
- fs_fs__id_t *id_a = (fs_fs__id_t *)a;
- fs_fs__id_t *id_b = (fs_fs__id_t *)b;
+ const fs_fs__id_t *id_a = (const fs_fs__id_t *)a;
+ const fs_fs__id_t *id_b = (const fs_fs__id_t *)b;
if (a == b)
return TRUE;
@@ -296,8 +296,8 @@ svn_boolean_t
svn_fs_fs__id_check_related(const svn_fs_id_t *a,
const svn_fs_id_t *b)
{
- fs_fs__id_t *id_a = (fs_fs__id_t *)a;
- fs_fs__id_t *id_b = (fs_fs__id_t *)b;
+ const fs_fs__id_t *id_a = (const fs_fs__id_t *)a;
+ const fs_fs__id_t *id_b = (const fs_fs__id_t *)b;
if (a == b)
return TRUE;
@@ -317,13 +317,14 @@ svn_fs_fs__id_check_related(const svn_fs
}
-int
+svn_fs_node_relation_t
svn_fs_fs__id_compare(const svn_fs_id_t *a,
const svn_fs_id_t *b)
{
if (svn_fs_fs__id_eq(a, b))
- return 0;
- return (svn_fs_fs__id_check_related(a, b) ? 1 : -1);
+ return svn_fs_node_same;
+ return (svn_fs_fs__id_check_related(a, b) ? svn_fs_node_common_ancestor
+ : svn_fs_node_unrelated);
}
int
@@ -422,7 +423,7 @@ svn_fs_fs__id_rev_create(const svn_fs_fs
svn_fs_id_t *
svn_fs_fs__id_copy(const svn_fs_id_t *source, apr_pool_t *pool)
{
- fs_fs__id_t *id = (fs_fs__id_t *)source;
+ const fs_fs__id_t *id = (const fs_fs__id_t *)source;
fs_fs__id_t *new_id = apr_palloc(pool, sizeof(*new_id));
*new_id = *id;
Modified: subversion/branches/fsfs-lock-many/subversion/libsvn_fs_fs/id.h
URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-lock-many/subversion/libsvn_fs_fs/id.h?rev=1576824&r1=1576823&r2=1576824&view=diff
==============================================================================
--- subversion/branches/fsfs-lock-many/subversion/libsvn_fs_fs/id.h (original)
+++ subversion/branches/fsfs-lock-many/subversion/libsvn_fs_fs/id.h Wed Mar 12 17:18:20 2014
@@ -114,9 +114,9 @@ svn_boolean_t svn_fs_fs__id_eq(const svn
svn_boolean_t svn_fs_fs__id_check_related(const svn_fs_id_t *a,
const svn_fs_id_t *b);
-/* Return 0 if A and B are equal, 1 if they are related, -1 otherwise. */
-int svn_fs_fs__id_compare(const svn_fs_id_t *a,
- const svn_fs_id_t *b);
+/* Return the noderev relationship between A and B. */
+svn_fs_node_relation_t svn_fs_fs__id_compare(const svn_fs_id_t *a,
+ const svn_fs_id_t *b);
/* Return 0 if A and B are equal, 1 if A is "greater than" B, -1 otherwise. */
int svn_fs_fs__id_part_compare(const svn_fs_fs__id_part_t *a,
Modified: subversion/branches/fsfs-lock-many/subversion/libsvn_fs_fs/index.c
URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-lock-many/subversion/libsvn_fs_fs/index.c?rev=1576824&r1=1576823&r2=1576824&view=diff
==============================================================================
--- subversion/branches/fsfs-lock-many/subversion/libsvn_fs_fs/index.c (original)
+++ subversion/branches/fsfs-lock-many/subversion/libsvn_fs_fs/index.c Wed Mar 12 17:18:20 2014
@@ -71,7 +71,7 @@ typedef struct l2p_header_t
apr_size_t revision_count;
/* (max) number of entries per page */
- apr_size_t page_size;
+ apr_uint32_t page_size;
/* indexes into PAGE_TABLE that mark the first page of the respective
* revision. PAGE_TABLE_INDEX[REVISION_COUNT] points to the end of
@@ -587,6 +587,14 @@ svn_fs_fs__l2p_index_create(svn_fs_t *fs
svn_spillbuf_t *buffer
= svn_spillbuf__create(0x10000, 0x1000000, local_pool);
+ /* Paranoia check that makes later casting to int32 safe.
+ * The current implementation is limited to 2G entries per page. */
+ if (ffd->l2p_page_size > APR_INT32_MAX)
+ return svn_error_createf(SVN_ERR_FS_ITEM_INDEX_OVERFLOW , NULL,
+ _("L2P index page size %" APR_UINT64_T_FMT
+ " exceeds current limit of 2G entries"),
+ ffd->l2p_page_size);
+
/* start at the beginning of the source file */
SVN_ERR(svn_io_file_open(&proto_index, proto_file_name,
APR_READ | APR_CREATE | APR_BUFFERED,
@@ -617,7 +625,9 @@ svn_fs_fs__l2p_index_create(svn_fs_t *fs
svn_pool_clear(iterpool);
- entry_count = MIN(entries->nelts - i, ffd->l2p_page_size);
+ entry_count = ffd->l2p_page_size < entries->nelts - i
+ ? (int)ffd->l2p_page_size
+ : entries->nelts - i;
SVN_ERR(encode_l2p_page(entries, i, i + entry_count,
buffer, iterpool));
@@ -636,8 +646,18 @@ svn_fs_fs__l2p_index_create(svn_fs_t *fs
}
else
{
+ int idx;
+
/* store the mapping in our array */
- int idx = (apr_size_t)proto_entry.item_index;
+ if (proto_entry.item_index > APR_INT32_MAX)
+ return svn_error_createf(SVN_ERR_FS_ITEM_INDEX_OVERFLOW , NULL,
+ _("Item index %" APR_UINT64_T_FMT
+ " too large in l2p proto index for"
+ " revision %ld"),
+ proto_entry.item_index,
+ revision + page_counts->nelts);
+
+ idx = (int)proto_entry.item_index;
while (idx >= entries->nelts)
APR_ARRAY_PUSH(entries, apr_uint64_t) = 0;
@@ -651,6 +671,14 @@ svn_fs_fs__l2p_index_create(svn_fs_t *fs
/* 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)
+ return svn_error_createf(SVN_ERR_FS_ITEM_INDEX_OVERFLOW , NULL,
+ _("L2P index page count %d"
+ " exceeds current limit of 2G pages"),
+ page_counts->nelts);
+
/* write header info */
SVN_ERR(svn_io_file_write_full(index_file, encoded,
encode_uint(encoded, revision),
@@ -782,7 +810,7 @@ get_l2p_header_body(l2p_header_t **heade
SVN_ERR(packed_stream_get(&value, rev_file->l2p_stream));
result->first_revision = (svn_revnum_t)value;
SVN_ERR(packed_stream_get(&value, rev_file->l2p_stream));
- result->page_size = (apr_size_t)value;
+ result->page_size = (apr_uint32_t)value;
SVN_ERR(packed_stream_get(&value, rev_file->l2p_stream));
result->revision_count = (int)value;
SVN_ERR(packed_stream_get(&value, rev_file->l2p_stream));
@@ -851,7 +879,7 @@ typedef struct l2p_page_info_baton_t
l2p_page_table_entry_t entry;
/* page number within the pages for REVISION (not l2p index global!) */
- apr_size_t page_no;
+ apr_uint32_t page_no;
/* offset of ITEM_INDEX within that page */
apr_uint32_t page_offset;
@@ -882,7 +910,7 @@ l2p_page_info_copy(l2p_page_info_baton_t
if (baton->item_index < header->page_size)
{
/* most revs fit well into a single page */
- baton->page_offset = (apr_size_t)baton->item_index;
+ baton->page_offset = (apr_uint32_t)baton->item_index;
baton->page_no = 0;
baton->entry = page_table[page_table_index[rel_revision]];
}
@@ -890,29 +918,29 @@ l2p_page_info_copy(l2p_page_info_baton_t
{
const l2p_page_table_entry_t *first_entry;
const l2p_page_table_entry_t *last_entry;
-
- /* all pages are of the same size and full, except for the last one */
- baton->page_offset = (apr_size_t)(baton->item_index % header->page_size);
- baton->page_no = (apr_uint32_t)(baton->item_index / header->page_size);
+ apr_uint64_t max_item_index;
/* range of pages for this rev */
first_entry = page_table + page_table_index[rel_revision];
last_entry = page_table + page_table_index[rel_revision + 1];
- if (last_entry - first_entry > baton->page_no)
- {
- baton->entry = first_entry[baton->page_no];
- }
- else
- {
- /* limit page index to the valid range */
- baton->entry = last_entry[-1];
+ /* do we hit a valid index page? */
+ max_item_index = (apr_uint64_t)header->page_size
+ * (last_entry - first_entry);
+ if (baton->item_index >= max_item_index)
+ return svn_error_createf(SVN_ERR_FS_ITEM_INDEX_OVERFLOW , NULL,
+ _("Item index %" APR_UINT64_T_FMT
+ " exceeds l2p limit of %" APR_UINT64_T_FMT
+ " for revision %ld"),
+ baton->item_index, max_item_index,
+ baton->revision);
- /* cause index overflow further down the road */
- baton->page_offset = header->page_size + 1;
- }
+ /* all pages are of the same size and full, except for the last one */
+ baton->page_offset = (apr_uint32_t)(baton->item_index % header->page_size);
+ baton->page_no = (apr_uint32_t)(baton->item_index / header->page_size);
+ baton->entry = first_entry[baton->page_no];
}
-
+
baton->first_revision = header->first_revision;
return SVN_NO_ERROR;
Modified: subversion/branches/fsfs-lock-many/subversion/libsvn_fs_fs/lock.c
URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-lock-many/subversion/libsvn_fs_fs/lock.c?rev=1576824&r1=1576823&r2=1576824&view=diff
==============================================================================
--- subversion/branches/fsfs-lock-many/subversion/libsvn_fs_fs/lock.c (original)
+++ subversion/branches/fsfs-lock-many/subversion/libsvn_fs_fs/lock.c Wed Mar 12 17:18:20 2014
@@ -20,7 +20,6 @@
* ====================================================================
*/
-#include "svn_private_config.h"
#include "svn_pools.h"
#include "svn_error.h"
#include "svn_dirent_uri.h"
@@ -43,6 +42,7 @@
#include "private/svn_fs_util.h"
#include "private/svn_fspath.h"
#include "private/svn_sorts_private.h"
+#include "svn_private_config.h"
/* Names of hash keys used to store a lock for writing to disk. */
#define PATH_KEY "path"
Modified: subversion/branches/fsfs-lock-many/subversion/libsvn_fs_fs/pack.c
URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-lock-many/subversion/libsvn_fs_fs/pack.c?rev=1576824&r1=1576823&r2=1576824&view=diff
==============================================================================
--- subversion/branches/fsfs-lock-many/subversion/libsvn_fs_fs/pack.c (original)
+++ subversion/branches/fsfs-lock-many/subversion/libsvn_fs_fs/pack.c Wed Mar 12 17:18:20 2014
@@ -247,14 +247,14 @@ initialize_pack_context(pack_context_t *
const char *pack_file_dir,
const char *shard_dir,
svn_revnum_t shard_rev,
- apr_size_t max_items,
+ int max_items,
svn_cancel_func_t cancel_func,
void *cancel_baton,
apr_pool_t *pool)
{
fs_fs_data_t *ffd = fs->fsap_data;
const char *temp_dir;
- apr_size_t max_revs = MIN(ffd->max_files_per_dir, (int)max_items);
+ int max_revs = MIN(ffd->max_files_per_dir, max_items);
SVN_ERR_ASSERT(ffd->format >= SVN_FS_FS__MIN_LOG_ADDRESSING_FORMAT);
SVN_ERR_ASSERT(shard_rev % ffd->max_files_per_dir == 0);
@@ -617,7 +617,7 @@ compare_dir_entries_format7(const svn_so
if (lhs->kind != rhs->kind)
return lhs->kind == svn_node_dir ? -1 : 1;
- return 0 - strcmp(lhs->name, rhs->name);
+ return strcmp(lhs->name, rhs->name);
}
/* Directories entries sorted by revision (decreasing - to max cache hits)
@@ -1516,13 +1516,21 @@ pack_log_addressed(svn_fs_t *fs,
+ 6 * sizeof(void*)
};
- apr_size_t max_items = max_mem / PER_ITEM_MEM;
+ int max_items;
apr_array_header_t *max_ids;
pack_context_t context = { 0 };
int i;
apr_size_t item_count = 0;
apr_pool_t *iterpool = svn_pool_create(pool);
+ /* Prevent integer overflow. We use apr arrays to process the items so
+ * the maximum number of items is INT_MAX. */
+ {
+ apr_size_t temp = max_mem / PER_ITEM_MEM;
+ SVN_ERR_ASSERT(temp <= INT_MAX);
+ max_items = (int)temp;
+ }
+
/* set up a pack context */
SVN_ERR(initialize_pack_context(&context, fs, pack_file_dir, shard_dir,
shard_rev, max_items, cancel_func,
@@ -1769,105 +1777,96 @@ pack_rev_shard(svn_fs_t *fs,
return SVN_NO_ERROR;
}
-/* In the file system at FS_PATH, pack the SHARD in REVS_DIR and
- * REVPROPS_DIR containing exactly MAX_FILES_PER_DIR revisions, using POOL
- * for allocations. REVPROPS_DIR will be NULL if revprop packing is not
- * supported. COMPRESSION_LEVEL and MAX_PACK_SIZE will be ignored in that
- * case.
- *
- * CANCEL_FUNC and CANCEL_BATON are what you think they are; similarly
- * NOTIFY_FUNC and NOTIFY_BATON.
- *
- * If for some reason we detect a partial packing already performed, we
- * remove the pack file and start again.
- */
-static svn_error_t *
-pack_shard(const char *revs_dir,
- const char *revsprops_dir,
- svn_fs_t *fs,
- apr_int64_t shard,
- int max_files_per_dir,
- apr_off_t max_pack_size,
- int compression_level,
- svn_fs_pack_notify_t notify_func,
- void *notify_baton,
- svn_cancel_func_t cancel_func,
- void *cancel_baton,
- apr_pool_t *pool)
+/* Baton struct used by pack_body(), pack_shard() and synced_pack_shard().
+ These calls are nested and for every level additional fields will be
+ available. */
+struct pack_baton
{
- fs_fs_data_t *ffd = fs->fsap_data;
- const char *rev_shard_path, *rev_pack_file_dir;
- const char *revprops_shard_path, *revprops_pack_file_dir;
+ /* Valid when entering pack_body(). */
+ svn_fs_t *fs;
+ svn_fs_pack_notify_t notify_func;
+ void *notify_baton;
+ svn_cancel_func_t cancel_func;
+ void *cancel_baton;
- /* Notify caller we're starting to pack this shard. */
- if (notify_func)
- SVN_ERR(notify_func(notify_baton, shard, svn_fs_pack_notify_start,
- pool));
+ /* Additional entries valid when entering pack_shard(). */
+ const char *revs_dir;
+ const char *revsprops_dir;
+ apr_int64_t shard;
- /* Some useful paths. */
- rev_pack_file_dir = svn_dirent_join(revs_dir,
- apr_psprintf(pool,
- "%" APR_INT64_T_FMT PATH_EXT_PACKED_SHARD,
- shard),
- pool);
- rev_shard_path = svn_dirent_join(revs_dir,
- apr_psprintf(pool, "%" APR_INT64_T_FMT, shard),
- pool);
+ /* Additional entries valid when entering synced_pack_shard(). */
+ const char *rev_shard_path;
+};
- /* pack the revision content */
- SVN_ERR(pack_rev_shard(fs, rev_pack_file_dir, rev_shard_path,
- shard, max_files_per_dir, DEFAULT_MAX_MEM,
- cancel_func, cancel_baton, pool));
+
+/* Part of the pack process that requires global (write) synchronization.
+ * We pack the revision properties of the shard described by BATON and
+ * In the file system at FS_PATH, pack the SHARD in REVS_DIR and replace
+ * the non-packed revprop & rev shard folder(s) with the packed ones.
+ * The packed rev folder has been created prior to calling this function.
+ */
+static svn_error_t *
+synced_pack_shard(void *baton,
+ apr_pool_t *pool)
+{
+ struct pack_baton *pb = baton;
+ fs_fs_data_t *ffd = pb->fs->fsap_data;
+ const char *revprops_shard_path, *revprops_pack_file_dir;
/* if enabled, pack the revprops in an equivalent way */
- if (revsprops_dir)
+ if (pb->revsprops_dir)
{
- revprops_pack_file_dir = svn_dirent_join(revsprops_dir,
+ revprops_pack_file_dir = svn_dirent_join(pb->revsprops_dir,
apr_psprintf(pool,
"%" APR_INT64_T_FMT PATH_EXT_PACKED_SHARD,
- shard),
+ pb->shard),
pool);
- revprops_shard_path = svn_dirent_join(revsprops_dir,
- apr_psprintf(pool, "%" APR_INT64_T_FMT, shard),
- pool);
+ revprops_shard_path = svn_dirent_join(pb->revsprops_dir,
+ apr_psprintf(pool, "%" APR_INT64_T_FMT, pb->shard),
+ pool);
SVN_ERR(svn_fs_fs__pack_revprops_shard(revprops_pack_file_dir,
revprops_shard_path,
- shard, max_files_per_dir,
- (int)(0.9 * max_pack_size),
- compression_level,
- cancel_func, cancel_baton,
+ pb->shard,
+ ffd->max_files_per_dir,
+ (int)(0.9*ffd->revprop_pack_size),
+ ffd->compress_packed_revprops
+ ? SVN__COMPRESSION_ZLIB_DEFAULT
+ : SVN__COMPRESSION_NONE,
+ pb->cancel_func,
+ pb->cancel_baton,
pool));
}
/* Update the min-unpacked-rev file to reflect our newly packed shard. */
- SVN_ERR(svn_fs_fs__write_min_unpacked_rev(fs,
- (svn_revnum_t)((shard + 1) * max_files_per_dir),
- pool));
- ffd->min_unpacked_rev = (svn_revnum_t)((shard + 1) * max_files_per_dir);
+ SVN_ERR(svn_fs_fs__write_min_unpacked_rev(pb->fs,
+ (svn_revnum_t)((pb->shard + 1) * ffd->max_files_per_dir),
+ pool));
+ ffd->min_unpacked_rev
+ = (svn_revnum_t)((pb->shard + 1) * ffd->max_files_per_dir);
/* Finally, remove the existing shard directories.
* For revprops, clean up older obsolete shards as well as they might
* have been left over from an interrupted FS upgrade. */
- SVN_ERR(svn_io_remove_dir2(rev_shard_path, TRUE,
- cancel_func, cancel_baton, pool));
- if (revsprops_dir)
+ SVN_ERR(svn_io_remove_dir2(pb->rev_shard_path, TRUE,
+ pb->cancel_func, pb->cancel_baton, pool));
+ if (pb->revsprops_dir)
{
svn_node_kind_t kind = svn_node_dir;
- apr_int64_t to_cleanup = shard;
+ apr_int64_t to_cleanup = pb->shard;
do
{
SVN_ERR(svn_fs_fs__delete_revprops_shard(revprops_shard_path,
to_cleanup,
- max_files_per_dir,
- cancel_func,
- cancel_baton,
+ ffd->max_files_per_dir,
+ pb->cancel_func,
+ pb->cancel_baton,
pool));
/* If the previous shard exists, clean it up as well.
Don't try to clean up shard 0 as it we can't tell quickly
whether it actually needs cleaning up. */
- revprops_shard_path = svn_dirent_join(revsprops_dir,
+ revprops_shard_path = svn_dirent_join(pb->revsprops_dir,
apr_psprintf(pool, "%" APR_INT64_T_FMT, --to_cleanup),
pool);
SVN_ERR(svn_io_check_path(revprops_shard_path, &kind, pool));
@@ -1875,23 +1874,60 @@ pack_shard(const char *revs_dir,
while (kind == svn_node_dir && to_cleanup > 0);
}
- /* Notify caller we're starting to pack this shard. */
- if (notify_func)
- SVN_ERR(notify_func(notify_baton, shard, svn_fs_pack_notify_end,
- pool));
-
return SVN_NO_ERROR;
}
-struct pack_baton
+/* Pack the shard described by BATON.
+ *
+ * If for some reason we detect a partial packing already performed,
+ * we remove the pack file and start again.
+ */
+static svn_error_t *
+pack_shard(struct pack_baton *baton,
+ apr_pool_t *pool)
{
- svn_fs_t *fs;
- svn_fs_pack_notify_t notify_func;
- void *notify_baton;
- svn_cancel_func_t cancel_func;
- void *cancel_baton;
-};
+ fs_fs_data_t *ffd = baton->fs->fsap_data;
+ const char *rev_pack_file_dir;
+ /* Notify caller we're starting to pack this shard. */
+ if (baton->notify_func)
+ SVN_ERR(baton->notify_func(baton->notify_baton, baton->shard,
+ svn_fs_pack_notify_start, pool));
+
+ /* Some useful paths. */
+ rev_pack_file_dir = svn_dirent_join(baton->revs_dir,
+ apr_psprintf(pool,
+ "%" APR_INT64_T_FMT PATH_EXT_PACKED_SHARD,
+ baton->shard),
+ pool);
+ baton->rev_shard_path = svn_dirent_join(baton->revs_dir,
+ apr_psprintf(pool,
+ "%" APR_INT64_T_FMT,
+ baton->shard),
+ pool);
+
+ /* pack the revision content */
+ SVN_ERR(pack_rev_shard(baton->fs, rev_pack_file_dir, baton->rev_shard_path,
+ baton->shard, ffd->max_files_per_dir,
+ DEFAULT_MAX_MEM, baton->cancel_func,
+ baton->cancel_baton, pool));
+
+ /* For newer repo formats, we only acquired the pack lock so far.
+ Before modifying the repo state by switching over to the packed
+ data, we need to acquire the global (write) lock. */
+ if (ffd->format >= SVN_FS_FS__MIN_PACK_LOCK_FORMAT)
+ SVN_ERR(svn_fs_fs__with_write_lock(baton->fs, synced_pack_shard, baton,
+ pool));
+ else
+ SVN_ERR(synced_pack_shard(baton, pool));
+
+ /* Notify caller we're starting to pack this shard. */
+ if (baton->notify_func)
+ SVN_ERR(baton->notify_func(baton->notify_baton, baton->shard,
+ svn_fs_pack_notify_end, pool));
+
+ return SVN_NO_ERROR;
+}
/* The work-horse for svn_fs_fs__pack, called with the FS write lock.
This implements the svn_fs_fs__with_write_lock() 'body' callback
@@ -1914,11 +1950,8 @@ pack_body(void *baton,
struct pack_baton *pb = baton;
fs_fs_data_t *ffd = pb->fs->fsap_data;
apr_int64_t completed_shards;
- apr_int64_t i;
svn_revnum_t youngest;
apr_pool_t *iterpool;
- const char *rev_data_path;
- const char *revprops_data_path = NULL;
/* If the repository isn't a new enough format, we don't support packing.
Return a friendly error to that effect. */
@@ -1941,29 +1974,22 @@ pack_body(void *baton,
if (ffd->min_unpacked_rev == (completed_shards * ffd->max_files_per_dir))
return SVN_NO_ERROR;
- rev_data_path = svn_dirent_join(pb->fs->path, PATH_REVS_DIR, pool);
+ pb->revs_dir = svn_dirent_join(pb->fs->path, PATH_REVS_DIR, pool);
if (ffd->format >= SVN_FS_FS__MIN_PACKED_REVPROP_FORMAT)
- revprops_data_path = svn_dirent_join(pb->fs->path, PATH_REVPROPS_DIR,
- pool);
+ pb->revsprops_dir = svn_dirent_join(pb->fs->path, PATH_REVPROPS_DIR,
+ pool);
iterpool = svn_pool_create(pool);
- for (i = ffd->min_unpacked_rev / ffd->max_files_per_dir;
- i < completed_shards;
- i++)
+ for (pb->shard = ffd->min_unpacked_rev / ffd->max_files_per_dir;
+ pb->shard < completed_shards;
+ pb->shard++)
{
svn_pool_clear(iterpool);
if (pb->cancel_func)
SVN_ERR(pb->cancel_func(pb->cancel_baton));
- SVN_ERR(pack_shard(rev_data_path, revprops_data_path,
- pb->fs, i, ffd->max_files_per_dir,
- ffd->revprop_pack_size,
- ffd->compress_packed_revprops
- ? SVN__COMPRESSION_ZLIB_DEFAULT
- : SVN__COMPRESSION_NONE,
- pb->notify_func, pb->notify_baton,
- pb->cancel_func, pb->cancel_baton, iterpool));
+ SVN_ERR(pack_shard(pb, iterpool));
}
svn_pool_destroy(iterpool);
@@ -1979,10 +2005,38 @@ svn_fs_fs__pack(svn_fs_t *fs,
apr_pool_t *pool)
{
struct pack_baton pb = { 0 };
+ fs_fs_data_t *ffd = fs->fsap_data;
+ svn_error_t *err;
+
pb.fs = fs;
pb.notify_func = notify_func;
pb.notify_baton = notify_baton;
pb.cancel_func = cancel_func;
pb.cancel_baton = cancel_baton;
- return svn_fs_fs__with_write_lock(fs, pack_body, &pb, pool);
+
+ if (ffd->format >= SVN_FS_FS__MIN_PACK_LOCK_FORMAT)
+ {
+ /* Newer repositories provide a pack operation specific lock.
+ Acquire it to prevent concurrent packs.
+
+ Since the file lock's lifetime is bound to a pool, we create a
+ separate subpool here to release the lock immediately after the
+ operation finished.
+ */
+ apr_pool_t *subpool = svn_pool_create(pool);
+ const char *lock_path = svn_dirent_join(fs->path, PATH_PACK_LOCK_FILE,
+ subpool);
+ err = svn_fs_fs__get_lock_on_filesystem(lock_path, subpool);
+ if (!err)
+ err = pack_body(&pb, subpool);
+
+ svn_pool_destroy(subpool);
+ }
+ else
+ {
+ /* Use the global write lock for older repos. */
+ err = svn_fs_fs__with_write_lock(fs, pack_body, &pb, pool);
+ }
+
+ return svn_error_trace(err);
}
Modified: subversion/branches/fsfs-lock-many/subversion/libsvn_fs_fs/recovery.c
URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-lock-many/subversion/libsvn_fs_fs/recovery.c?rev=1576824&r1=1576823&r2=1576824&view=diff
==============================================================================
--- subversion/branches/fsfs-lock-many/subversion/libsvn_fs_fs/recovery.c (original)
+++ subversion/branches/fsfs-lock-many/subversion/libsvn_fs_fs/recovery.c Wed Mar 12 17:18:20 2014
@@ -276,6 +276,51 @@ recover_find_max_ids(svn_fs_t *fs,
return SVN_NO_ERROR;
}
+/* Part of the recovery procedure. Given an open non-packed revision file
+ REV_FILE for REV, locate the trailer that specifies the offset to the root
+ node-id and store this offset in *ROOT_OFFSET. Do temporary allocations in
+ POOL. */
+static svn_error_t *
+recover_get_root_offset(apr_off_t *root_offset,
+ svn_revnum_t rev,
+ svn_fs_fs__revision_file_t *rev_file,
+ apr_pool_t *pool)
+{
+ char buffer[64];
+ svn_stringbuf_t *trailer;
+ apr_off_t start;
+ apr_off_t end;
+ apr_size_t len;
+
+ SVN_ERR_ASSERT(!rev_file->is_packed);
+
+ /* We will assume that the last line containing the two offsets (to the root
+ node-id and to the changed path information) will never be longer than 64
+ characters. */
+ end = 0;
+ SVN_ERR(svn_io_file_seek(rev_file->file, APR_END, &end, pool));
+
+ if (end < sizeof(buffer))
+ {
+ len = (apr_size_t)end;
+ start = 0;
+ }
+ else
+ {
+ len = sizeof(buffer);
+ start = end - sizeof(buffer);
+ }
+
+ SVN_ERR(svn_io_file_seek(rev_file->file, APR_SET, &start, pool));
+ SVN_ERR(svn_io_file_read_full2(rev_file->file, buffer, len,
+ NULL, NULL, pool));
+
+ trailer = svn_stringbuf_ncreate(buffer, len, pool);
+ SVN_ERR(svn_fs_fs__parse_revision_trailer(root_offset, NULL, trailer, rev));
+
+ return SVN_NO_ERROR;
+}
+
svn_error_t *
svn_fs_fs__find_max_ids(svn_fs_t *fs,
svn_revnum_t youngest,
@@ -286,16 +331,12 @@ svn_fs_fs__find_max_ids(svn_fs_t *fs,
fs_fs_data_t *ffd = fs->fsap_data;
apr_off_t root_offset;
svn_fs_fs__revision_file_t *rev_file;
- svn_fs_id_t *root_id;
/* call this function for old repo formats only */
SVN_ERR_ASSERT(ffd->format < SVN_FS_FS__MIN_NO_GLOBAL_IDS_FORMAT);
- SVN_ERR(svn_fs_fs__rev_get_root(&root_id, fs, youngest, pool));
SVN_ERR(svn_fs_fs__open_pack_or_rev_file(&rev_file, fs, youngest, pool));
- SVN_ERR(svn_fs_fs__item_offset(&root_offset, fs, rev_file, youngest, NULL,
- svn_fs_fs__id_item(root_id), pool));
-
+ SVN_ERR(recover_get_root_offset(&root_offset, youngest, rev_file, pool));
SVN_ERR(recover_find_max_ids(fs, youngest, rev_file, root_offset,
max_node_id, max_copy_id, pool));
SVN_ERR(svn_fs_fs__close_revision_file(rev_file));
Modified: subversion/branches/fsfs-lock-many/subversion/libsvn_fs_fs/structure
URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-lock-many/subversion/libsvn_fs_fs/structure?rev=1576824&r1=1576823&r2=1576824&view=diff
==============================================================================
--- subversion/branches/fsfs-lock-many/subversion/libsvn_fs_fs/structure (original)
+++ subversion/branches/fsfs-lock-many/subversion/libsvn_fs_fs/structure Wed Mar 12 17:18:20 2014
@@ -60,6 +60,7 @@ repository) is:
current File specifying current revision and next node/copy id
fs-type File identifying this filesystem as an FSFS filesystem
write-lock Empty file, locked to serialise writers
+ pack-lock Empty file, locked to serialise 'svnadmin pack' (f. 7+)
txn-current-lock Empty file, locked to serialise 'txn-current'
uuid File containing the UUID of the repository
format File containing the format number of this filesystem
@@ -86,9 +87,19 @@ The "write-lock" file is an empty file w
final stage of a commit and unlocked after the new "current" file has
been moved into place to indicate that a new revision is present. It
is also locked during a revprop propchange while the revprop file is
-read in, mutated, and written out again. Note that readers are never
-blocked by any operation - writers must ensure that the filesystem is
-always in a consistent state.
+read in, mutated, and written out again. Furthermore, it will be used
+to serialize the repository structure changes during 'svnadmin pack'
+(see also next section). Note that readers are never blocked by any
+operation - writers must ensure that the filesystem is always in a
+consistent state.
+
+The "pack-lock" file is an empty file which is locked before an 'svnadmin
+pack' operation commences. Thus, only one process may attempt to modify
+the repository structure at a time while other processes may still read
+and write (commit) to the repository during most of the pack procedure.
+It is only available with format 7 and newer repositories. Older formats
+use the global write-lock instead which disables commits completely
+for the duration of the pack process.
The "txn-current" file is a file with a single line of text that
contains only a base-36 number. The current value will be used in the
Modified: subversion/branches/fsfs-lock-many/subversion/libsvn_fs_fs/temp_serializer.c
URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-lock-many/subversion/libsvn_fs_fs/temp_serializer.c?rev=1576824&r1=1576823&r2=1576824&view=diff
==============================================================================
--- subversion/branches/fsfs-lock-many/subversion/libsvn_fs_fs/temp_serializer.c (original)
+++ subversion/branches/fsfs-lock-many/subversion/libsvn_fs_fs/temp_serializer.c Wed Mar 12 17:18:20 2014
@@ -22,7 +22,6 @@
#include <apr_pools.h>
-#include "svn_private_config.h"
#include "svn_pools.h"
#include "svn_hash.h"
#include "svn_sorts.h"
@@ -150,8 +149,9 @@ serialize_representation(svn_temp_serial
/* auxiliary structure representing the content of a directory array */
typedef struct dir_data_t
{
- /* number of entries in the directory */
- apr_size_t count;
+ /* number of entries in the directory
+ * (it's int because the directory is an APR array) */
+ int count;
/* number of unused dir entry buckets in the index */
apr_size_t over_provision;
@@ -209,7 +209,7 @@ serialize_dir(apr_array_header_t *entrie
svn_temp_serializer__context_t *context;
/* calculate sizes */
- apr_size_t count = entries->nelts;
+ int count = entries->nelts;
apr_size_t over_provision = 2 + count / 4;
apr_size_t entries_len = (count + over_provision) * sizeof(svn_fs_dirent_t*);
apr_size_t lengths_len = (count + over_provision) * sizeof(apr_uint32_t);
@@ -589,10 +589,10 @@ svn_fs_fs__deserialize_properties(void *
for (i = 0; i < properties->count; ++i)
{
apr_size_t len = properties->keys[i+1] - properties->keys[i] - 1;
- svn_temp_deserializer__resolve((void*)properties->keys,
+ svn_temp_deserializer__resolve(properties->keys,
(void**)&properties->keys[i]);
- deserialize_svn_string((void*)properties->values,
+ deserialize_svn_string(properties->values,
(svn_string_t **)&properties->values[i]);
apr_hash_set(hash,
@@ -916,12 +916,12 @@ svn_fs_fs__replace_dir_entry(void **data
/* resolve the reference to the entries array */
entries = (svn_fs_dirent_t **)
- svn_temp_deserializer__ptr((const char *)dir_data,
+ svn_temp_deserializer__ptr(dir_data,
(const void *const *)&dir_data->entries);
/* resolve the reference to the lengths array */
lengths = (apr_uint32_t *)
- svn_temp_deserializer__ptr((const char *)dir_data,
+ svn_temp_deserializer__ptr(dir_data,
(const void *const *)&dir_data->lengths);
/* binary search for the desired entry by name */
@@ -990,7 +990,7 @@ svn_fs_fs__replace_dir_entry(void **data
dir_data = (dir_data_t *)*data;
lengths = (apr_uint32_t *)
- svn_temp_deserializer__ptr((const char *)dir_data,
+ svn_temp_deserializer__ptr(dir_data,
(const void *const *)&dir_data->lengths);
lengths[pos] = length;
@@ -1148,7 +1148,7 @@ svn_fs_fs__deserialize_changes(void **ou
/* de-serialize each entry and add it to the array */
for (i = 0; i < changes->count; ++i)
{
- deserialize_change((void*)changes->changes,
+ deserialize_change(changes->changes,
(change_t **)&changes->changes[i]);
APR_ARRAY_PUSH(array, change_t *) = changes->changes[i];
}
@@ -1293,7 +1293,7 @@ svn_fs_fs__deserialize_mergeinfo(void **
for (k = 0; k < merges->range_counts[i]; ++k, ++n)
APR_ARRAY_PUSH(ranges, svn_merge_range_t*) = &merges->ranges[n];
- svn_temp_deserializer__resolve((void*)merges->keys,
+ svn_temp_deserializer__resolve(merges->keys,
(void**)&merges->keys[i]);
apr_hash_set(mergeinfo, merges->keys[i], merges->key_lengths[i], ranges);
}
Modified: subversion/branches/fsfs-lock-many/subversion/libsvn_fs_fs/transaction.c
URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-lock-many/subversion/libsvn_fs_fs/transaction.c?rev=1576824&r1=1576823&r2=1576824&view=diff
==============================================================================
--- subversion/branches/fsfs-lock-many/subversion/libsvn_fs_fs/transaction.c (original)
+++ subversion/branches/fsfs-lock-many/subversion/libsvn_fs_fs/transaction.c Wed Mar 12 17:18:20 2014
@@ -1765,7 +1765,7 @@ fnv1a_checksum_finalize(apr_uint32_t *di
SVN_ERR(svn_checksum_final(&checksum, context, scratch_pool));
SVN_ERR_ASSERT(checksum->kind == svn_checksum_fnv1a_32x4);
- *digest = ntohl(*(apr_uint32_t *)(checksum->digest));
+ *digest = ntohl(*(const apr_uint32_t *)(checksum->digest));
return SVN_NO_ERROR;
}
@@ -1849,7 +1849,7 @@ shards_spanned(int *spanned,
int shard_size = ffd->max_files_per_dir ? ffd->max_files_per_dir : 1;
int count = 0;
- int shard, last_shard = ffd->youngest_rev_cache / shard_size;
+ svn_revnum_t shard, last_shard = ffd->youngest_rev_cache / shard_size;
while (walk-- && noderev->predecessor_count)
{
SVN_ERR(svn_fs_fs__get_node_revision(&noderev, fs,
Modified: subversion/branches/fsfs-lock-many/subversion/libsvn_fs_fs/tree.c
URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-lock-many/subversion/libsvn_fs_fs/tree.c?rev=1576824&r1=1576823&r2=1576824&view=diff
==============================================================================
--- subversion/branches/fsfs-lock-many/subversion/libsvn_fs_fs/tree.c (original)
+++ subversion/branches/fsfs-lock-many/subversion/libsvn_fs_fs/tree.c Wed Mar 12 17:18:20 2014
@@ -41,8 +41,8 @@
#include <apr_pools.h>
#include <apr_hash.h>
-#include "svn_private_config.h"
#include "svn_hash.h"
+#include "svn_private_config.h"
#include "svn_pools.h"
#include "svn_error.h"
#include "svn_path.h"
@@ -860,7 +860,7 @@ get_copy_inheritance(copy_id_inherit_t *
SVN_ERR(get_dag(©root_node, copyroot_root, copyroot_path, FALSE, pool));
copyroot_id = svn_fs_fs__dag_get_id(copyroot_node);
- if (svn_fs_fs__id_compare(copyroot_id, child_id) == -1)
+ if (svn_fs_fs__id_compare(copyroot_id, child_id) == svn_fs_node_unrelated)
return SVN_NO_ERROR;
/* Determine if we are looking at the child via its original path or
@@ -1350,9 +1350,8 @@ fs_node_relation(svn_fs_node_relation_t
svn_boolean_t b_is_root_dir
= (path_b[0] == '\0') || ((path_b[0] == '/') && (path_b[1] == '\0'));
- /* Root paths are never related to non-root paths and path from different
- * repository are always unrelated. */
- if (a_is_root_dir ^ b_is_root_dir || root_a->fs != root_b->fs)
+ /* Path from different repository are always unrelated. */
+ if (root_a->fs != root_b->fs)
{
*relation = svn_fs_node_unrelated;
return SVN_NO_ERROR;
@@ -1368,11 +1367,11 @@ fs_node_relation(svn_fs_node_relation_t
/* Are both (!) root paths? Then, they are related and we only test how
* direct the relation is. */
- if (a_is_root_dir)
+ if (a_is_root_dir && b_is_root_dir)
{
*relation = root_a->rev == root_b->rev
? svn_fs_node_same
- : svn_fs_node_common_anchestor;
+ : svn_fs_node_common_ancestor;
return SVN_NO_ERROR;
}
@@ -1391,7 +1390,7 @@ fs_node_relation(svn_fs_node_relation_t
if (svn_fs_fs__id_part_eq(&rev_item_a, &rev_item_b))
*relation = svn_fs_node_same;
else if (svn_fs_fs__id_part_eq(&node_id_a, &node_id_b))
- *relation = svn_fs_node_common_anchestor;
+ *relation = svn_fs_node_common_ancestor;
else
*relation = svn_fs_node_unrelated;
Modified: subversion/branches/fsfs-lock-many/subversion/libsvn_fs_fs/verify.c
URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-lock-many/subversion/libsvn_fs_fs/verify.c?rev=1576824&r1=1576823&r2=1576824&view=diff
==============================================================================
--- subversion/branches/fsfs-lock-many/subversion/libsvn_fs_fs/verify.c (original)
+++ subversion/branches/fsfs-lock-many/subversion/libsvn_fs_fs/verify.c Wed Mar 12 17:18:20 2014
@@ -469,7 +469,7 @@ expected_streamed_checksum(apr_file_t *f
SVN_ERR(svn_checksum_final(&checksum, context, pool));
SVN_ERR(expected_checksum(file, entry,
- ntohl(*(apr_uint32_t *)checksum->digest),
+ ntohl(*(const apr_uint32_t *)checksum->digest),
pool));
return SVN_NO_ERROR;
Propchange: subversion/branches/fsfs-lock-many/subversion/libsvn_fs_util/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Wed Mar 12 17:18:20 2014
@@ -7,5 +7,5 @@ Debug
*.o
*~
.*~
-
-
+libsvn_fs_util.pc.in
+libsvn_fs_util.pc
Propchange: subversion/branches/fsfs-lock-many/subversion/libsvn_fs_x/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Wed Mar 12 17:18:20 2014
@@ -9,3 +9,5 @@ Release
.*~
rep-cache-db.h
revprops-db.h
+libsvn_fs_x.pc.in
+libsvn_fs_x.pc
Propchange: subversion/branches/fsfs-lock-many/subversion/libsvn_fs_x/
------------------------------------------------------------------------------
Merged /subversion/trunk/subversion/libsvn_fs_x:r1573586-1576815
Modified: subversion/branches/fsfs-lock-many/subversion/libsvn_fs_x/changes.c
URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-lock-many/subversion/libsvn_fs_x/changes.c?rev=1576824&r1=1576823&r2=1576824&view=diff
==============================================================================
--- subversion/branches/fsfs-lock-many/subversion/libsvn_fs_x/changes.c (original)
+++ subversion/branches/fsfs-lock-many/subversion/libsvn_fs_x/changes.c Wed Mar 12 17:18:20 2014
@@ -392,7 +392,7 @@ svn_fs_x__read_changes_container(svn_fs_
/* read offsets array */
count = svn_packed__int_count(offsets_stream);
- changes->offsets = apr_array_make(result_pool, count, sizeof(int));
+ changes->offsets = apr_array_make(result_pool, (int)count, sizeof(int));
for (i = 0; i < count; ++i)
APR_ARRAY_PUSH(changes->offsets, int)
= (int)svn_packed__get_uint(offsets_stream);
@@ -401,7 +401,7 @@ svn_fs_x__read_changes_container(svn_fs_
count
= svn_packed__int_count(svn_packed__first_int_substream(changes_stream));
changes->changes
- = apr_array_make(result_pool, count, sizeof(binary_change_t));
+ = apr_array_make(result_pool, (int)count, sizeof(binary_change_t));
for (i = 0; i < count; ++i)
{
binary_change_t change;
Modified: subversion/branches/fsfs-lock-many/subversion/libsvn_fs_x/fs.c
URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-lock-many/subversion/libsvn_fs_x/fs.c?rev=1576824&r1=1576823&r2=1576824&view=diff
==============================================================================
--- subversion/branches/fsfs-lock-many/subversion/libsvn_fs_x/fs.c (original)
+++ subversion/branches/fsfs-lock-many/subversion/libsvn_fs_x/fs.c Wed Mar 12 17:18:20 2014
@@ -103,8 +103,11 @@ x_serialized_init(svn_fs_t *fs, apr_pool
SVN_ERR(svn_mutex__init(&ffsd->txn_current_lock,
SVN_FS_X__USE_LOCK_MUTEX, common_pool));
+ /* We also need a mutex for synchronizing access to the active
+ transaction list and free transaction pointer. This one is
+ enabled unconditionally. */
SVN_ERR(svn_mutex__init(&ffsd->txn_list_lock,
- SVN_FS_X__USE_LOCK_MUTEX, common_pool));
+ TRUE, common_pool));
key = apr_pstrdup(common_pool, key);
status = apr_pool_userdata_set(ffsd, key, NULL, common_pool);
Modified: subversion/branches/fsfs-lock-many/subversion/libsvn_fs_x/fs.h
URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-lock-many/subversion/libsvn_fs_x/fs.h?rev=1576824&r1=1576823&r2=1576824&view=diff
==============================================================================
--- subversion/branches/fsfs-lock-many/subversion/libsvn_fs_x/fs.h (original)
+++ subversion/branches/fsfs-lock-many/subversion/libsvn_fs_x/fs.h Wed Mar 12 17:18:20 2014
@@ -208,7 +208,7 @@ typedef struct pair_cache_key_t
typedef struct representation_cache_key_t
{
/* Revision that contains the representation */
- apr_uint32_t revision;
+ svn_revnum_t revision;
/* Packed or non-packed representation? */
svn_boolean_t is_packed;
Modified: subversion/branches/fsfs-lock-many/subversion/libsvn_fs_x/id.c
URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-lock-many/subversion/libsvn_fs_x/id.c?rev=1576824&r1=1576823&r2=1576824&view=diff
==============================================================================
--- subversion/branches/fsfs-lock-many/subversion/libsvn_fs_x/id.c (original)
+++ subversion/branches/fsfs-lock-many/subversion/libsvn_fs_x/id.c Wed Mar 12 17:18:20 2014
@@ -160,7 +160,7 @@ svn_fs_x__id_part_eq(const svn_fs_x__id_
const svn_fs_x__id_part_t *
svn_fs_x__id_node_id(const svn_fs_id_t *fs_id)
{
- fs_x__id_t *id = (fs_x__id_t *)fs_id;
+ const fs_x__id_t *id = (const fs_x__id_t *)fs_id;
return &id->node_id;
}
@@ -169,7 +169,7 @@ svn_fs_x__id_node_id(const svn_fs_id_t *
const svn_fs_x__id_part_t *
svn_fs_x__id_copy_id(const svn_fs_id_t *fs_id)
{
- fs_x__id_t *id = (fs_x__id_t *)fs_id;
+ const fs_x__id_t *id = (const fs_x__id_t *)fs_id;
return &id->copy_id;
}
@@ -178,7 +178,7 @@ svn_fs_x__id_copy_id(const svn_fs_id_t *
svn_fs_x__txn_id_t
svn_fs_x__id_txn_id(const svn_fs_id_t *fs_id)
{
- fs_x__id_t *id = (fs_x__id_t *)fs_id;
+ const fs_x__id_t *id = (const fs_x__id_t *)fs_id;
return svn_fs_x__get_txn_id(id->noderev_id.change_set);
}
@@ -187,7 +187,7 @@ svn_fs_x__id_txn_id(const svn_fs_id_t *f
const svn_fs_x__id_part_t *
svn_fs_x__id_noderev_id(const svn_fs_id_t *fs_id)
{
- fs_x__id_t *id = (fs_x__id_t *)fs_id;
+ const fs_x__id_t *id = (const fs_x__id_t *)fs_id;
return &id->noderev_id;
}
@@ -195,7 +195,7 @@ svn_fs_x__id_noderev_id(const svn_fs_id_
svn_revnum_t
svn_fs_x__id_rev(const svn_fs_id_t *fs_id)
{
- fs_x__id_t *id = (fs_x__id_t *)fs_id;
+ const fs_x__id_t *id = (const fs_x__id_t *)fs_id;
return svn_fs_x__get_revnum(id->noderev_id.change_set);
}
@@ -204,7 +204,7 @@ svn_fs_x__id_rev(const svn_fs_id_t *fs_i
apr_uint64_t
svn_fs_x__id_item(const svn_fs_id_t *fs_id)
{
- fs_x__id_t *id = (fs_x__id_t *)fs_id;
+ const fs_x__id_t *id = (const fs_x__id_t *)fs_id;
return id->noderev_id.number;
}
@@ -212,7 +212,7 @@ svn_fs_x__id_item(const svn_fs_id_t *fs_
svn_boolean_t
svn_fs_x__id_is_txn(const svn_fs_id_t *fs_id)
{
- fs_x__id_t *id = (fs_x__id_t *)fs_id;
+ const fs_x__id_t *id = (const fs_x__id_t *)fs_id;
return svn_fs_x__is_txn(id->noderev_id.change_set);
}
@@ -222,7 +222,7 @@ svn_fs_x__id_unparse(const svn_fs_id_t *
apr_pool_t *pool)
{
char string[6 * SVN_INT64_BUFFER_SIZE + 10];
- fs_x__id_t *id = (fs_x__id_t *)fs_id;
+ const fs_x__id_t *id = (const fs_x__id_t *)fs_id;
char *p = part_unparse(string, &id->node_id);
*(p++) = '.';
@@ -240,8 +240,8 @@ svn_boolean_t
svn_fs_x__id_eq(const svn_fs_id_t *a,
const svn_fs_id_t *b)
{
- fs_x__id_t *id_a = (fs_x__id_t *)a;
- fs_x__id_t *id_b = (fs_x__id_t *)b;
+ const fs_x__id_t *id_a = (const fs_x__id_t *)a;
+ const fs_x__id_t *id_b = (const fs_x__id_t *)b;
if (a == b)
return TRUE;
@@ -255,8 +255,8 @@ svn_boolean_t
svn_fs_x__id_check_related(const svn_fs_id_t *a,
const svn_fs_id_t *b)
{
- fs_x__id_t *id_a = (fs_x__id_t *)a;
- fs_x__id_t *id_b = (fs_x__id_t *)b;
+ const fs_x__id_t *id_a = (const fs_x__id_t *)a;
+ const fs_x__id_t *id_b = (const fs_x__id_t *)b;
if (a == b)
return TRUE;
@@ -272,13 +272,14 @@ svn_fs_x__id_check_related(const svn_fs_
}
-int
+svn_fs_node_relation_t
svn_fs_x__id_compare(const svn_fs_id_t *a,
const svn_fs_id_t *b)
{
if (svn_fs_x__id_eq(a, b))
- return 0;
- return (svn_fs_x__id_check_related(a, b) ? 1 : -1);
+ return svn_fs_node_same;
+ return (svn_fs_x__id_check_related(a, b) ? svn_fs_node_common_ancestor
+ : svn_fs_node_unrelated);
}
int
@@ -383,7 +384,7 @@ svn_fs_x__id_create(const svn_fs_x__id_p
svn_fs_id_t *
svn_fs_x__id_copy(const svn_fs_id_t *source, apr_pool_t *pool)
{
- fs_x__id_t *id = (fs_x__id_t *)source;
+ const fs_x__id_t *id = (const fs_x__id_t *)source;
fs_x__id_t *new_id = apr_pmemdup(pool, id, sizeof(*id));
new_id->generic_id.fsap_data = new_id;
Modified: subversion/branches/fsfs-lock-many/subversion/libsvn_fs_x/id.h
URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-lock-many/subversion/libsvn_fs_x/id.h?rev=1576824&r1=1576823&r2=1576824&view=diff
==============================================================================
--- subversion/branches/fsfs-lock-many/subversion/libsvn_fs_x/id.h (original)
+++ subversion/branches/fsfs-lock-many/subversion/libsvn_fs_x/id.h Wed Mar 12 17:18:20 2014
@@ -126,9 +126,9 @@ svn_boolean_t svn_fs_x__id_eq(const svn_
svn_boolean_t svn_fs_x__id_check_related(const svn_fs_id_t *a,
const svn_fs_id_t *b);
-/* Return 0 if A and B are equal, 1 if they are related, -1 otherwise. */
-int svn_fs_x__id_compare(const svn_fs_id_t *a,
- const svn_fs_id_t *b);
+/* Return the noderev relationship between A and B. */
+svn_fs_node_relation_t svn_fs_x__id_compare(const svn_fs_id_t *a,
+ const svn_fs_id_t *b);
/* Return 0 if A and B are equal, 1 if A is "greater than" B, -1 otherwise. */
int svn_fs_x__id_part_compare(const svn_fs_x__id_part_t *a,
Modified: subversion/branches/fsfs-lock-many/subversion/libsvn_fs_x/lock.c
URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-lock-many/subversion/libsvn_fs_x/lock.c?rev=1576824&r1=1576823&r2=1576824&view=diff
==============================================================================
--- subversion/branches/fsfs-lock-many/subversion/libsvn_fs_x/lock.c (original)
+++ subversion/branches/fsfs-lock-many/subversion/libsvn_fs_x/lock.c Wed Mar 12 17:18:20 2014
@@ -20,7 +20,6 @@
* ====================================================================
*/
-#include "svn_private_config.h"
#include "svn_pools.h"
#include "svn_error.h"
#include "svn_dirent_uri.h"
@@ -43,6 +42,7 @@
#include "private/svn_fs_util.h"
#include "private/svn_fspath.h"
#include "private/svn_sorts_private.h"
+#include "svn_private_config.h"
/* Names of hash keys used to store a lock for writing to disk. */
#define PATH_KEY "path"
Modified: subversion/branches/fsfs-lock-many/subversion/libsvn_fs_x/noderevs.c
URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-lock-many/subversion/libsvn_fs_x/noderevs.c?rev=1576824&r1=1576823&r2=1576824&view=diff
==============================================================================
--- subversion/branches/fsfs-lock-many/subversion/libsvn_fs_x/noderevs.c (original)
+++ subversion/branches/fsfs-lock-many/subversion/libsvn_fs_x/noderevs.c Wed Mar 12 17:18:20 2014
@@ -115,11 +115,11 @@ typedef struct binary_noderev_t
/* If this node-rev is a copy, this is the string index+1 of the path
from which that copy way made. 0, otherwise. */
- int copyfrom_path;
+ apr_size_t copyfrom_path;
/* String index+1 of the root of the parent tree from whence this node-
* rev was copied. */
- int copyroot_path;
+ apr_size_t copyroot_path;
/* Index+1 of the representation key for this node's properties.
May be 0 if there are no properties. */
@@ -131,7 +131,7 @@ typedef struct binary_noderev_t
/* String index+1 of the path at which this node first came into
existence. */
- int created_path;
+ apr_size_t created_path;
/* Number of nodes with svn:mergeinfo properties that are
descendants of this node (including it itself) */
@@ -177,7 +177,7 @@ struct svn_fs_x__noderevs_t
};
svn_fs_x__noderevs_t *
-svn_fs_x__noderevs_create(apr_size_t initial_count,
+svn_fs_x__noderevs_create(int initial_count,
apr_pool_t* pool)
{
svn_fs_x__noderevs_t *noderevs = apr_palloc(pool, sizeof(*noderevs));
@@ -588,7 +588,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 < 12; ++i)
+ for (i = 0; i < 11; ++i)
svn_packed__create_int_substream(noderevs_stream, TRUE, FALSE);
/* serialize ids array */
@@ -656,7 +656,7 @@ read_reps(apr_array_header_t **reps_p,
apr_size_t count
= svn_packed__int_count(svn_packed__first_int_substream(rep_stream));
apr_array_header_t *reps
- = apr_array_make(pool, count, sizeof(binary_representation_t));
+ = apr_array_make(pool, (int)count, sizeof(binary_representation_t));
for (i = 0; i < count; ++i)
{
@@ -776,15 +776,15 @@ svn_fs_x__read_noderevs_container(svn_fs
noderev.predecessor_id = (int)svn_packed__get_uint(noderevs_stream);
noderev.predecessor_count = (int)svn_packed__get_uint(noderevs_stream);
- noderev.copyfrom_path = (int)svn_packed__get_uint(noderevs_stream);
+ noderev.copyfrom_path = (apr_size_t)svn_packed__get_uint(noderevs_stream);
noderev.copyfrom_rev = (svn_revnum_t)svn_packed__get_int(noderevs_stream);
- noderev.copyroot_path = (int)svn_packed__get_uint(noderevs_stream);
+ noderev.copyroot_path = (apr_size_t)svn_packed__get_uint(noderevs_stream);
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 = (int)svn_packed__get_uint(noderevs_stream);
- noderev.created_path = (int)svn_packed__get_uint(noderevs_stream);
+ noderev.created_path = (apr_size_t)svn_packed__get_uint(noderevs_stream);
noderev.mergeinfo_count = svn_packed__get_uint(noderevs_stream);
APR_ARRAY_PUSH(noderevs->noderevs, binary_noderev_t) = noderev;
Modified: subversion/branches/fsfs-lock-many/subversion/libsvn_fs_x/noderevs.h
URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-lock-many/subversion/libsvn_fs_x/noderevs.h?rev=1576824&r1=1576823&r2=1576824&view=diff
==============================================================================
--- subversion/branches/fsfs-lock-many/subversion/libsvn_fs_x/noderevs.h (original)
+++ subversion/branches/fsfs-lock-many/subversion/libsvn_fs_x/noderevs.h Wed Mar 12 17:18:20 2014
@@ -50,7 +50,7 @@ typedef struct svn_fs_x__noderevs_t svn_
* INITIAL_COUNT node_revision_t objects. Allocate the result in POOL.
*/
svn_fs_x__noderevs_t *
-svn_fs_x__noderevs_create(apr_size_t initial_count,
+svn_fs_x__noderevs_create(int initial_count,
apr_pool_t *pool);
/* Add NODEREV to the CONTAINER. Return the index that identifies the new
Modified: subversion/branches/fsfs-lock-many/subversion/libsvn_fs_x/pack.c
URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-lock-many/subversion/libsvn_fs_x/pack.c?rev=1576824&r1=1576823&r2=1576824&view=diff
==============================================================================
--- subversion/branches/fsfs-lock-many/subversion/libsvn_fs_x/pack.c (original)
+++ subversion/branches/fsfs-lock-many/subversion/libsvn_fs_x/pack.c Wed Mar 12 17:18:20 2014
@@ -229,17 +229,17 @@ initialize_pack_context(pack_context_t *
const char *pack_file_dir,
const char *shard_dir,
svn_revnum_t shard_rev,
- apr_size_t max_items,
+ int max_items,
svn_cancel_func_t cancel_func,
void *cancel_baton,
apr_pool_t *pool)
{
fs_x_data_t *ffd = fs->fsap_data;
const char *temp_dir;
- apr_size_t max_revs = MIN(ffd->max_files_per_dir, (int)max_items);
-
+ apr_size_t max_revs = MIN(ffd->max_files_per_dir, max_items);
+
SVN_ERR_ASSERT(shard_rev % ffd->max_files_per_dir == 0);
-
+
/* where we will place our various temp files */
SVN_ERR(svn_io_temp_dir(&temp_dir, pool));
@@ -1985,7 +1985,9 @@ pack_log_addressed(svn_fs_t *fs,
+ 6 * sizeof(void*)
};
- apr_size_t max_items = max_mem / PER_ITEM_MEM;
+ int max_items = max_mem / PER_ITEM_MEM > INT_MAX
+ ? INT_MAX
+ : (int)(max_mem / PER_ITEM_MEM);
apr_array_header_t *max_ids;
pack_context_t context = { 0 };
int i;
Modified: subversion/branches/fsfs-lock-many/subversion/libsvn_fs_x/string_table.c
URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-lock-many/subversion/libsvn_fs_x/string_table.c?rev=1576824&r1=1576823&r2=1576824&view=diff
==============================================================================
--- subversion/branches/fsfs-lock-many/subversion/libsvn_fs_x/string_table.c (original)
+++ subversion/branches/fsfs-lock-many/subversion/libsvn_fs_x/string_table.c Wed Mar 12 17:18:20 2014
@@ -137,36 +137,36 @@ balance(builder_table_t *table,
builder_string_t **parent,
builder_string_t *node)
{
- unsigned left_hight = node->left ? node->left->depth + 1 : 0;
- unsigned right_hight = node->right ? node->right->depth + 1 : 0;
+ apr_size_t left_height = node->left ? node->left->depth + 1 : 0;
+ apr_size_t right_height = node->right ? node->right->depth + 1 : 0;
- if (left_hight > right_hight + 1)
+ if (left_height > right_height + 1)
{
builder_string_t *temp = node->left->right;
node->left->right = node;
*parent = node->left;
node->left = temp;
- --left_hight;
+ --left_height;
}
- else if (left_hight + 1 < right_hight)
+ else if (left_height + 1 < right_height)
{
builder_string_t *temp = node->right->left;
*parent = node->right;
node->right->left = node;
node->right = temp;
- --right_hight;
+ --right_height;
}
- node->depth = MAX(left_hight, right_hight);
+ node->depth = MAX(left_height, right_height);
}
static apr_uint16_t
match_length(const svn_string_t *lhs,
const svn_string_t *rhs)
{
- apr_size_t len = MIN(rhs->len, rhs->len);
+ apr_size_t len = MIN(lhs->len, rhs->len);
return (apr_uint16_t)svn_cstring__match_length(lhs->data, rhs->data, len);
}
@@ -274,7 +274,7 @@ svn_fs_x__string_table_builder_add(strin
const char *string,
apr_size_t len)
{
- apr_size_t result = -1;
+ apr_size_t result;
builder_table_t *table = APR_ARRAY_IDX(builder->tables,
builder->tables->nelts - 1,
builder_table_t *);
@@ -319,7 +319,7 @@ svn_fs_x__string_table_builder_add(strin
|| table->max_data_size < len)
table = add_table(builder);
- item->position = (apr_size_t)table->short_strings->nelts;
+ item->position = table->short_strings->nelts;
APR_ARRAY_PUSH(table->short_strings, builder_string_t *) = item;
if (table->top == NULL)
Modified: subversion/branches/fsfs-lock-many/subversion/libsvn_fs_x/temp_serializer.c
URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-lock-many/subversion/libsvn_fs_x/temp_serializer.c?rev=1576824&r1=1576823&r2=1576824&view=diff
==============================================================================
--- subversion/branches/fsfs-lock-many/subversion/libsvn_fs_x/temp_serializer.c (original)
+++ subversion/branches/fsfs-lock-many/subversion/libsvn_fs_x/temp_serializer.c Wed Mar 12 17:18:20 2014
@@ -639,10 +639,10 @@ svn_fs_x__deserialize_properties(void **
for (i = 0; i < properties->count; ++i)
{
apr_size_t len = properties->keys[i+1] - properties->keys[i] - 1;
- svn_temp_deserializer__resolve((void*)properties->keys,
+ svn_temp_deserializer__resolve(properties->keys,
(void**)&properties->keys[i]);
- deserialize_svn_string((void*)properties->values,
+ deserialize_svn_string(properties->values,
(svn_string_t **)&properties->values[i]);
apr_hash_set(hash,
@@ -948,12 +948,12 @@ svn_fs_x__replace_dir_entry(void **data,
/* resolve the reference to the entries array */
entries = (svn_fs_dirent_t **)
- svn_temp_deserializer__ptr((const char *)hash_data,
+ svn_temp_deserializer__ptr(hash_data,
(const void *const *)&hash_data->entries);
/* resolve the reference to the lengths array */
lengths = (apr_uint32_t *)
- svn_temp_deserializer__ptr((const char *)hash_data,
+ svn_temp_deserializer__ptr(hash_data,
(const void *const *)&hash_data->lengths);
/* binary search for the desired entry by name */
@@ -1022,7 +1022,7 @@ svn_fs_x__replace_dir_entry(void **data,
hash_data = (hash_data_t *)*data;
lengths = (apr_uint32_t *)
- svn_temp_deserializer__ptr((const char *)hash_data,
+ svn_temp_deserializer__ptr(hash_data,
(const void *const *)&hash_data->lengths);
lengths[pos] = length;
@@ -1184,7 +1184,7 @@ svn_fs_x__deserialize_changes(void **out
/* de-serialize each entry and add it to the array */
for (i = 0; i < changes->count; ++i)
{
- deserialize_change((void*)changes->changes,
+ deserialize_change(changes->changes,
(change_t **)&changes->changes[i],
pool);
APR_ARRAY_PUSH(array, change_t *) = changes->changes[i];
@@ -1330,7 +1330,7 @@ svn_fs_x__deserialize_mergeinfo(void **o
for (k = 0; k < merges->range_counts[i]; ++k, ++n)
APR_ARRAY_PUSH(ranges, svn_merge_range_t*) = &merges->ranges[n];
- svn_temp_deserializer__resolve((void*)merges->keys,
+ svn_temp_deserializer__resolve(merges->keys,
(void**)&merges->keys[i]);
apr_hash_set(mergeinfo, merges->keys[i], merges->key_lengths[i], ranges);
}
Modified: subversion/branches/fsfs-lock-many/subversion/libsvn_fs_x/transaction.c
URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-lock-many/subversion/libsvn_fs_x/transaction.c?rev=1576824&r1=1576823&r2=1576824&view=diff
==============================================================================
--- subversion/branches/fsfs-lock-many/subversion/libsvn_fs_x/transaction.c (original)
+++ subversion/branches/fsfs-lock-many/subversion/libsvn_fs_x/transaction.c Wed Mar 12 17:18:20 2014
@@ -941,7 +941,8 @@ create_new_txn_noderev_from_rev(svn_fs_t
SVN_ERR(svn_fs_x__get_node_revision(&noderev, fs, src, pool));
/* This must be a root node. */
- SVN_ERR_ASSERT(svn_fs_x__id_node_id(noderev->id)->number == 0);
+ SVN_ERR_ASSERT( svn_fs_x__id_node_id(noderev->id)->number == 0
+ && svn_fs_x__id_copy_id(noderev->id)->number == 0);
if (svn_fs_x__id_is_txn(noderev->id))
return svn_error_create(SVN_ERR_FS_CORRUPT, NULL,
Modified: subversion/branches/fsfs-lock-many/subversion/libsvn_fs_x/tree.c
URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-lock-many/subversion/libsvn_fs_x/tree.c?rev=1576824&r1=1576823&r2=1576824&view=diff
==============================================================================
--- subversion/branches/fsfs-lock-many/subversion/libsvn_fs_x/tree.c (original)
+++ subversion/branches/fsfs-lock-many/subversion/libsvn_fs_x/tree.c Wed Mar 12 17:18:20 2014
@@ -838,7 +838,7 @@ get_copy_inheritance(copy_id_inherit_t *
SVN_ERR(get_dag(©root_node, copyroot_root, copyroot_path, FALSE, pool));
copyroot_id = svn_fs_x__dag_get_id(copyroot_node);
- if (svn_fs_x__id_compare(copyroot_id, child_id) == -1)
+ if (svn_fs_x__id_compare(copyroot_id, child_id) == svn_fs_node_unrelated)
return SVN_NO_ERROR;
/* Determine if we are looking at the child via its original path or
@@ -1327,9 +1327,8 @@ x_node_relation(svn_fs_node_relation_t *
svn_boolean_t b_is_root_dir
= (path_b[0] == '\0') || ((path_b[0] == '/') && (path_b[1] == '\0'));
- /* Root paths are never related to non-root paths and path from different
- * repository are always unrelated. */
- if (a_is_root_dir ^ b_is_root_dir || root_a->fs != root_b->fs)
+ /* Path from different repository are always unrelated. */
+ if (root_a->fs != root_b->fs)
{
*relation = svn_fs_node_unrelated;
return SVN_NO_ERROR;
@@ -1345,11 +1344,11 @@ x_node_relation(svn_fs_node_relation_t *
/* Are both (!) root paths? Then, they are related and we only test how
* direct the relation is. */
- if (a_is_root_dir)
+ if (a_is_root_dir && b_is_root_dir)
{
*relation = root_a->rev == root_b->rev
? svn_fs_node_same
- : svn_fs_node_common_anchestor;
+ : svn_fs_node_common_ancestor;
return SVN_NO_ERROR;
}
@@ -1368,7 +1367,7 @@ x_node_relation(svn_fs_node_relation_t *
if (svn_fs_x__id_part_eq(&noderev_id_a, &noderev_id_b))
*relation = svn_fs_node_same;
else if (svn_fs_x__id_part_eq(&node_id_a, &node_id_b))
- *relation = svn_fs_node_common_anchestor;
+ *relation = svn_fs_node_common_ancestor;
else
*relation = svn_fs_node_unrelated;
Propchange: subversion/branches/fsfs-lock-many/subversion/libsvn_ra/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Wed Mar 12 17:18:20 2014
@@ -7,3 +7,5 @@ Release
*~
.*~
libsvn_ra.def
+libsvn_ra.pc.in
+libsvn_ra.pc
Modified: subversion/branches/fsfs-lock-many/subversion/libsvn_ra/compat.c
URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-lock-many/subversion/libsvn_ra/compat.c?rev=1576824&r1=1576823&r2=1576824&view=diff
==============================================================================
--- subversion/branches/fsfs-lock-many/subversion/libsvn_ra/compat.c (original)
+++ subversion/branches/fsfs-lock-many/subversion/libsvn_ra/compat.c Wed Mar 12 17:18:20 2014
@@ -23,7 +23,6 @@
#include <apr_pools.h>
-#include "svn_private_config.h"
#include "svn_hash.h"
#include "svn_error.h"
#include "svn_pools.h"
@@ -38,6 +37,7 @@
#include "private/svn_fspath.h"
#include "private/svn_sorts_private.h"
#include "ra_loader.h"
+#include "svn_private_config.h"
Modified: subversion/branches/fsfs-lock-many/subversion/libsvn_ra/deprecated.c
URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-lock-many/subversion/libsvn_ra/deprecated.c?rev=1576824&r1=1576823&r2=1576824&view=diff
==============================================================================
--- subversion/branches/fsfs-lock-many/subversion/libsvn_ra/deprecated.c (original)
+++ subversion/branches/fsfs-lock-many/subversion/libsvn_ra/deprecated.c Wed Mar 12 17:18:20 2014
@@ -26,7 +26,6 @@
deprecated functions in this file. */
#define SVN_DEPRECATED
-#include "svn_private_config.h"
#include "svn_hash.h"
#include "svn_ra.h"
#include "svn_path.h"
@@ -37,6 +36,9 @@
#include "ra_loader.h"
#include "deprecated.h"
+#include "svn_private_config.h"
+
+
/*** From ra_loader.c ***/
Modified: subversion/branches/fsfs-lock-many/subversion/libsvn_ra/ra_loader.c
URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-lock-many/subversion/libsvn_ra/ra_loader.c?rev=1576824&r1=1576823&r2=1576824&view=diff
==============================================================================
--- subversion/branches/fsfs-lock-many/subversion/libsvn_ra/ra_loader.c (original)
+++ subversion/branches/fsfs-lock-many/subversion/libsvn_ra/ra_loader.c Wed Mar 12 17:18:20 2014
@@ -33,7 +33,6 @@
#include <apr_hash.h>
#include <apr_uri.h>
-#include "svn_private_config.h"
#include "svn_hash.h"
#include "svn_version.h"
#include "svn_time.h"
@@ -54,6 +53,7 @@
#include "deprecated.h"
#include "private/svn_ra_private.h"
+#include "svn_private_config.h"
Propchange: subversion/branches/fsfs-lock-many/subversion/libsvn_ra_local/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Wed Mar 12 17:18:20 2014
@@ -7,4 +7,5 @@ Debug
*.o
*~
.*~
-
+libsvn_ra_local.pc.in
+libsvn_ra_local.pc
Modified: subversion/branches/fsfs-lock-many/subversion/libsvn_ra_local/ra_plugin.c
URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-lock-many/subversion/libsvn_ra_local/ra_plugin.c?rev=1576824&r1=1576823&r2=1576824&view=diff
==============================================================================
--- subversion/branches/fsfs-lock-many/subversion/libsvn_ra_local/ra_plugin.c (original)
+++ subversion/branches/fsfs-lock-many/subversion/libsvn_ra_local/ra_plugin.c Wed Mar 12 17:18:20 2014
@@ -21,7 +21,6 @@
* ====================================================================
*/
-#include "svn_private_config.h"
#include "ra_local.h"
#include "svn_hash.h"
#include "svn_ra.h"
@@ -36,6 +35,7 @@
#include "svn_version.h"
#include "svn_cache_config.h"
+#include "svn_private_config.h"
#include "../libsvn_ra/ra_loader.h"
#include "private/svn_mergeinfo_private.h"
#include "private/svn_repos_private.h"
Propchange: subversion/branches/fsfs-lock-many/subversion/libsvn_ra_serf/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Wed Mar 12 17:18:20 2014
@@ -1 +1,3 @@
.libs
+libsvn_ra_serf.pc.in
+libsvn_ra_serf.pc
Modified: subversion/branches/fsfs-lock-many/subversion/libsvn_ra_serf/blame.c
URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-lock-many/subversion/libsvn_ra_serf/blame.c?rev=1576824&r1=1576823&r2=1576824&view=diff
==============================================================================
--- subversion/branches/fsfs-lock-many/subversion/libsvn_ra_serf/blame.c (original)
+++ subversion/branches/fsfs-lock-many/subversion/libsvn_ra_serf/blame.c Wed Mar 12 17:18:20 2014
@@ -24,7 +24,6 @@
#include <apr_uri.h>
#include <serf.h>
-#include "svn_private_config.h"
#include "svn_hash.h"
#include "svn_pools.h"
#include "svn_ra.h"
@@ -36,6 +35,8 @@
#include "svn_base64.h"
#include "svn_props.h"
+#include "svn_private_config.h"
+
#include "private/svn_string_private.h"
#include "ra_serf.h"
Modified: subversion/branches/fsfs-lock-many/subversion/libsvn_ra_serf/blncache.c
URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-lock-many/subversion/libsvn_ra_serf/blncache.c?rev=1576824&r1=1576823&r2=1576824&view=diff
==============================================================================
--- subversion/branches/fsfs-lock-many/subversion/libsvn_ra_serf/blncache.c (original)
+++ subversion/branches/fsfs-lock-many/subversion/libsvn_ra_serf/blncache.c Wed Mar 12 17:18:20 2014
@@ -23,7 +23,6 @@
#include <apr_pools.h>
-#include "svn_private_config.h"
#include "svn_hash.h"
#include "svn_dirent_uri.h"
#include "svn_types.h"
Modified: subversion/branches/fsfs-lock-many/subversion/libsvn_ra_serf/commit.c
URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-lock-many/subversion/libsvn_ra_serf/commit.c?rev=1576824&r1=1576823&r2=1576824&view=diff
==============================================================================
--- subversion/branches/fsfs-lock-many/subversion/libsvn_ra_serf/commit.c (original)
+++ subversion/branches/fsfs-lock-many/subversion/libsvn_ra_serf/commit.c Wed Mar 12 17:18:20 2014
@@ -24,7 +24,6 @@
#include <apr_uri.h>
#include <serf.h>
-#include "svn_private_config.h"
#include "svn_hash.h"
#include "svn_pools.h"
#include "svn_ra.h"
@@ -37,6 +36,7 @@
#include "svn_path.h"
#include "svn_props.h"
+#include "svn_private_config.h"
#include "private/svn_dep_compat.h"
#include "private/svn_fspath.h"
#include "private/svn_skel.h"
Modified: subversion/branches/fsfs-lock-many/subversion/libsvn_ra_serf/getlocations.c
URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-lock-many/subversion/libsvn_ra_serf/getlocations.c?rev=1576824&r1=1576823&r2=1576824&view=diff
==============================================================================
--- subversion/branches/fsfs-lock-many/subversion/libsvn_ra_serf/getlocations.c (original)
+++ subversion/branches/fsfs-lock-many/subversion/libsvn_ra_serf/getlocations.c Wed Mar 12 17:18:20 2014
@@ -27,12 +27,12 @@
#include <serf.h>
-#include "svn_private_config.h"
#include "svn_hash.h"
#include "svn_path.h"
#include "svn_pools.h"
#include "svn_ra.h"
#include "svn_xml.h"
+#include "svn_private_config.h"
#include "../libsvn_ra/ra_loader.h"
Modified: subversion/branches/fsfs-lock-many/subversion/libsvn_ra_serf/getlocationsegments.c
URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-lock-many/subversion/libsvn_ra_serf/getlocationsegments.c?rev=1576824&r1=1576823&r2=1576824&view=diff
==============================================================================
--- subversion/branches/fsfs-lock-many/subversion/libsvn_ra_serf/getlocationsegments.c (original)
+++ subversion/branches/fsfs-lock-many/subversion/libsvn_ra_serf/getlocationsegments.c Wed Mar 12 17:18:20 2014
@@ -27,12 +27,12 @@
#include <apr_uri.h>
#include <serf.h>
-#include "svn_private_config.h"
#include "svn_hash.h"
#include "svn_pools.h"
#include "svn_ra.h"
#include "svn_xml.h"
#include "svn_path.h"
+#include "svn_private_config.h"
#include "../libsvn_ra/ra_loader.h"
#include "ra_serf.h"
Modified: subversion/branches/fsfs-lock-many/subversion/libsvn_ra_serf/getlocks.c
URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-lock-many/subversion/libsvn_ra_serf/getlocks.c?rev=1576824&r1=1576823&r2=1576824&view=diff
==============================================================================
--- subversion/branches/fsfs-lock-many/subversion/libsvn_ra_serf/getlocks.c (original)
+++ subversion/branches/fsfs-lock-many/subversion/libsvn_ra_serf/getlocks.c Wed Mar 12 17:18:20 2014
@@ -27,7 +27,6 @@
#include <serf.h>
-#include "svn_private_config.h"
#include "svn_hash.h"
#include "svn_path.h"
#include "svn_pools.h"
@@ -38,6 +37,7 @@
#include "private/svn_dav_protocol.h"
#include "private/svn_fspath.h"
+#include "svn_private_config.h"
#include "../libsvn_ra/ra_loader.h"
Modified: subversion/branches/fsfs-lock-many/subversion/libsvn_ra_serf/inherited_props.c
URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-lock-many/subversion/libsvn_ra_serf/inherited_props.c?rev=1576824&r1=1576823&r2=1576824&view=diff
==============================================================================
--- subversion/branches/fsfs-lock-many/subversion/libsvn_ra_serf/inherited_props.c (original)
+++ subversion/branches/fsfs-lock-many/subversion/libsvn_ra_serf/inherited_props.c Wed Mar 12 17:18:20 2014
@@ -25,7 +25,6 @@
#include <apr_tables.h>
#include <apr_xml.h>
-#include "svn_private_config.h"
#include "svn_hash.h"
#include "svn_path.h"
#include "svn_ra.h"
@@ -38,6 +37,7 @@
#include "private/svn_dav_protocol.h"
#include "private/svn_sorts_private.h"
#include "../libsvn_ra/ra_loader.h"
+#include "svn_private_config.h"
#include "ra_serf.h"
Modified: subversion/branches/fsfs-lock-many/subversion/libsvn_ra_serf/log.c
URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-lock-many/subversion/libsvn_ra_serf/log.c?rev=1576824&r1=1576823&r2=1576824&view=diff
==============================================================================
--- subversion/branches/fsfs-lock-many/subversion/libsvn_ra_serf/log.c (original)
+++ subversion/branches/fsfs-lock-many/subversion/libsvn_ra_serf/log.c Wed Mar 12 17:18:20 2014
@@ -26,7 +26,6 @@
#include <apr_uri.h>
#include <serf.h>
-#include "svn_private_config.h"
#include "svn_hash.h"
#include "svn_pools.h"
#include "svn_ra.h"
@@ -40,6 +39,7 @@
#include "private/svn_dav_protocol.h"
#include "private/svn_string_private.h"
#include "private/svn_subr_private.h"
+#include "svn_private_config.h"
#include "ra_serf.h"
#include "../libsvn_ra/ra_loader.h"
Modified: subversion/branches/fsfs-lock-many/subversion/libsvn_ra_serf/merge.c
URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-lock-many/subversion/libsvn_ra_serf/merge.c?rev=1576824&r1=1576823&r2=1576824&view=diff
==============================================================================
--- subversion/branches/fsfs-lock-many/subversion/libsvn_ra_serf/merge.c (original)
+++ subversion/branches/fsfs-lock-many/subversion/libsvn_ra_serf/merge.c Wed Mar 12 17:18:20 2014
@@ -27,7 +27,6 @@
#include <serf.h>
-#include "svn_private_config.h"
#include "svn_hash.h"
#include "svn_pools.h"
#include "svn_ra.h"
@@ -39,6 +38,7 @@
#include "private/svn_dav_protocol.h"
#include "private/svn_fspath.h"
+#include "svn_private_config.h"
#include "ra_serf.h"
#include "../libsvn_ra/ra_loader.h"
Modified: subversion/branches/fsfs-lock-many/subversion/libsvn_ra_serf/mergeinfo.c
URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-lock-many/subversion/libsvn_ra_serf/mergeinfo.c?rev=1576824&r1=1576823&r2=1576824&view=diff
==============================================================================
--- subversion/branches/fsfs-lock-many/subversion/libsvn_ra_serf/mergeinfo.c (original)
+++ subversion/branches/fsfs-lock-many/subversion/libsvn_ra_serf/mergeinfo.c Wed Mar 12 17:18:20 2014
@@ -24,7 +24,6 @@
#include <apr_tables.h>
#include <apr_xml.h>
-#include "svn_private_config.h"
#include "svn_hash.h"
#include "svn_mergeinfo.h"
#include "svn_path.h"
@@ -34,6 +33,7 @@
#include "private/svn_dav_protocol.h"
#include "../libsvn_ra/ra_loader.h"
+#include "svn_private_config.h"
#include "ra_serf.h"
Modified: subversion/branches/fsfs-lock-many/subversion/libsvn_ra_serf/options.c
URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-lock-many/subversion/libsvn_ra_serf/options.c?rev=1576824&r1=1576823&r2=1576824&view=diff
==============================================================================
--- subversion/branches/fsfs-lock-many/subversion/libsvn_ra_serf/options.c (original)
+++ subversion/branches/fsfs-lock-many/subversion/libsvn_ra_serf/options.c Wed Mar 12 17:18:20 2014
@@ -27,7 +27,6 @@
#include <serf.h>
-#include "svn_private_config.h"
#include "svn_dirent_uri.h"
#include "svn_hash.h"
#include "svn_pools.h"
@@ -36,6 +35,7 @@
#include "svn_xml.h"
#include "../libsvn_ra/ra_loader.h"
+#include "svn_private_config.h"
#include "private/svn_fspath.h"
#include "ra_serf.h"
@@ -481,14 +481,16 @@ svn_ra_serf__v1_get_activity_collection(
svn_error_t *
svn_ra_serf__exchange_capabilities(svn_ra_serf__session_t *serf_sess,
const char **corrected_url,
- apr_pool_t *pool)
+ apr_pool_t *result_pool,
+ apr_pool_t *scratch_pool)
{
options_context_t *opt_ctx;
/* This routine automatically fills in serf_sess->capabilities */
- SVN_ERR(create_options_req(&opt_ctx, serf_sess, serf_sess->conns[0], pool));
+ SVN_ERR(create_options_req(&opt_ctx, serf_sess, serf_sess->conns[0],
+ scratch_pool));
- SVN_ERR(svn_ra_serf__context_run_one(opt_ctx->handler, pool));
+ SVN_ERR(svn_ra_serf__context_run_one(opt_ctx->handler, scratch_pool));
/* If our caller cares about server redirections, and our response
carries such a thing, report as much. We'll disregard ERR --
@@ -496,7 +498,7 @@ svn_ra_serf__exchange_capabilities(svn_r
successfully parsing as XML or somesuch. */
if (corrected_url && (opt_ctx->handler->sline.code == 301))
{
- *corrected_url = opt_ctx->handler->location;
+ *corrected_url = apr_pstrdup(result_pool, opt_ctx->handler->location);
return SVN_NO_ERROR;
}
@@ -594,7 +596,7 @@ svn_ra_serf__has_capability(svn_ra_sessi
/* If any capability is unknown, they're all unknown, so ask. */
if (cap_result == NULL)
- SVN_ERR(svn_ra_serf__exchange_capabilities(serf_sess, NULL, pool));
+ SVN_ERR(svn_ra_serf__exchange_capabilities(serf_sess, NULL, pool, pool));
/* Try again, now that we've fetched the capabilities. */
cap_result = svn_hash_gets(serf_sess->capabilities, capability);
Modified: subversion/branches/fsfs-lock-many/subversion/libsvn_ra_serf/property.c
URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-lock-many/subversion/libsvn_ra_serf/property.c?rev=1576824&r1=1576823&r2=1576824&view=diff
==============================================================================
--- subversion/branches/fsfs-lock-many/subversion/libsvn_ra_serf/property.c (original)
+++ subversion/branches/fsfs-lock-many/subversion/libsvn_ra_serf/property.c Wed Mar 12 17:18:20 2014
@@ -25,7 +25,6 @@
#include <serf.h>
-#include "svn_private_config.h"
#include "svn_hash.h"
#include "svn_path.h"
#include "svn_base64.h"
@@ -36,6 +35,7 @@
#include "private/svn_dav_protocol.h"
#include "private/svn_fspath.h"
#include "private/svn_string_private.h"
+#include "svn_private_config.h"
#include "ra_serf.h"
Modified: subversion/branches/fsfs-lock-many/subversion/libsvn_ra_serf/ra_serf.h
URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-lock-many/subversion/libsvn_ra_serf/ra_serf.h?rev=1576824&r1=1576823&r2=1576824&view=diff
==============================================================================
--- subversion/branches/fsfs-lock-many/subversion/libsvn_ra_serf/ra_serf.h (original)
+++ subversion/branches/fsfs-lock-many/subversion/libsvn_ra_serf/ra_serf.h Wed Mar 12 17:18:20 2014
@@ -1582,7 +1582,8 @@ svn_ra_serf__get_mergeinfo(svn_ra_sessio
svn_error_t *
svn_ra_serf__exchange_capabilities(svn_ra_serf__session_t *serf_sess,
const char **corrected_url,
- apr_pool_t *pool);
+ apr_pool_t *result_pool,
+ apr_pool_t *scratch_pool);
/* Implements svn_ra__vtable_t.has_capability(). */
svn_error_t *
Modified: subversion/branches/fsfs-lock-many/subversion/libsvn_ra_serf/replay.c
URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-lock-many/subversion/libsvn_ra_serf/replay.c?rev=1576824&r1=1576823&r2=1576824&view=diff
==============================================================================
--- subversion/branches/fsfs-lock-many/subversion/libsvn_ra_serf/replay.c (original)
+++ subversion/branches/fsfs-lock-many/subversion/libsvn_ra_serf/replay.c Wed Mar 12 17:18:20 2014
@@ -26,7 +26,6 @@
#include <apr_uri.h>
#include <serf.h>
-#include "svn_private_config.h"
#include "svn_pools.h"
#include "svn_ra.h"
#include "svn_dav.h"
@@ -37,6 +36,7 @@
#include "svn_delta.h"
#include "svn_base64.h"
#include "svn_path.h"
+#include "svn_private_config.h"
#include "private/svn_string_private.h"