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 2013/03/07 11:39:05 UTC
svn commit: r1453765 - in
/subversion/branches/fsfs-format7/subversion/libsvn_fs_fs: hotcopy.c
key-gen.c key-gen.h recovery.c recovery.h transaction.c util.c util.h
Author: stefan2
Date: Thu Mar 7 10:39:05 2013
New Revision: 1453765
URL: http://svn.apache.org/r1453765
Log:
On the fsfs-format7 branch: Represent the "next IDs" counters internally
as the unsigned integers that they are. At that point, we can drop the
key-gen functionality that operated on base36 strings.
This is the first larger step in the "numerical IDs" patch series.
* subversion/libsvn_fs_fs/util.h
(write_current): expect integers for node and copy IDs
(get_file_offset): fix a comment string
* subversion/libsvn_fs_fs/util.c
(write_current): update implementation to convert unsigned to base36
* subversion/libsvn_fs_fs/transaction.c
(get_and_increment_txn_key_baton,
get_and_increment_txn_key_body,
create_txn_dir): do txn ID arithmetics on ints instead of strings
(write_next_ids,
read_next_ids): convert int <-> base36 at the file interface
(get_new_txn_node_id,
svn_fs_fs__reserve_copy_id,
get_next_revision_ids): update callers; simplify
(get_final_id): new utility function
(write_final_rev): update caller; global IDs are now ints
(write_final_current,
commit_body): update callers
* subversion/libsvn_fs_fs/hotcopy.c
(hotcopy_update_current): update caller
* subversion/libsvn_fs_fs/recovery.h
(svn_fs_fs__find_max_ids): for IDs, use integers instead of strings
* subversion/libsvn_fs_fs/recovery.c
(count_from_id): new utility function
(recover_find_max_ids,
svn_fs_fs__find_max_ids,
recover_body): use integers to record the largest IDs
* subversion/libsvn_fs_fs/key-gen.c
(): drop file
* subversion/libsvn_fs_fs/key-gen.h
(): drop file
Removed:
subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/key-gen.c
subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/key-gen.h
Modified:
subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/hotcopy.c
subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/recovery.c
subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/recovery.h
subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/transaction.c
subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/util.c
subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/util.h
Modified: subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/hotcopy.c
URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/hotcopy.c?rev=1453765&r1=1453764&r2=1453765&view=diff
==============================================================================
--- subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/hotcopy.c (original)
+++ subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/hotcopy.c Thu Mar 7 10:39:05 2013
@@ -28,7 +28,6 @@
#include "util.h"
#include "revprops.h"
#include "rep-cache.h"
-#include "key-gen.h"
#include "transaction.h"
#include "recovery.h"
@@ -359,8 +358,8 @@ hotcopy_update_current(svn_revnum_t *dst
svn_revnum_t new_youngest,
apr_pool_t *scratch_pool)
{
- char next_node_id[MAX_KEY_SIZE] = "0";
- char next_copy_id[MAX_KEY_SIZE] = "0";
+ apr_uint64_t next_node_id = 0;
+ apr_uint64_t next_copy_id = 0;
fs_fs_data_t *dst_ffd = dst_fs->fsap_data;
if (*dst_youngest >= new_youngest)
@@ -369,7 +368,7 @@ 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)
SVN_ERR(svn_fs_fs__find_max_ids(dst_fs, new_youngest,
- next_node_id, next_copy_id,
+ &next_node_id, &next_copy_id,
scratch_pool));
/* Update 'current'. */
Modified: subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/recovery.c
URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/recovery.c?rev=1453765&r1=1453764&r2=1453765&view=diff
==============================================================================
--- subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/recovery.c (original)
+++ subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/recovery.c Thu Mar 7 10:39:05 2013
@@ -24,8 +24,8 @@
#include "svn_hash.h"
#include "svn_pools.h"
+#include "private/svn_string_private.h"
-#include "key-gen.h"
#include "low_level.h"
#include "rep-cache.h"
#include "revprops.h"
@@ -135,6 +135,21 @@ read_handler_recover(void *baton, char *
return svn_stream_read(b->stream, buffer, &bytes_to_read);
}
+/* From the node or copy ID, extract the counter sub-string and return it
+ * as integer.
+ */
+static apr_uint64_t
+count_from_id(const char *id)
+{
+ if (id == NULL || *id == '\0')
+ return 0;
+
+ if (*id == '_')
+ return svn__base36toui64(NULL, id + 1);
+
+ return svn__base36toui64(NULL, id);
+}
+
/* Part of the recovery procedure. Read the directory noderev at offset
OFFSET of file REV_FILE (the revision file of revision REV of
filesystem FS), and set MAX_NODE_ID and MAX_COPY_ID to be the node-id
@@ -148,7 +163,8 @@ read_handler_recover(void *baton, char *
static svn_error_t *
recover_find_max_ids(svn_fs_t *fs, svn_revnum_t rev,
apr_file_t *rev_file, apr_off_t offset,
- char *max_node_id, char *max_copy_id,
+ apr_uint64_t *max_node_id,
+ apr_uint64_t *max_copy_id,
apr_pool_t *pool)
{
svn_fs_fs__rep_header_t *header;
@@ -215,7 +231,7 @@ recover_find_max_ids(svn_fs_t *fs, svn_r
char *str;
svn_node_kind_t kind;
svn_fs_id_t *id;
- const char *node_id, *copy_id;
+ apr_uint64_t node_id, copy_id;
apr_off_t child_dir_offset;
const svn_string_t *path = svn__apr_hash_index_val(hi);
@@ -252,19 +268,13 @@ recover_find_max_ids(svn_fs_t *fs, svn_r
continue;
}
- node_id = svn_fs_fs__id_node_id(id);
- copy_id = svn_fs_fs__id_copy_id(id);
+ node_id = count_from_id(svn_fs_fs__id_node_id(id));
+ copy_id = count_from_id(svn_fs_fs__id_copy_id(id));
- if (svn_fs_fs__key_compare(node_id, max_node_id) > 0)
- {
- SVN_ERR_ASSERT(strlen(node_id) < MAX_KEY_SIZE);
- apr_cpystrn(max_node_id, node_id, MAX_KEY_SIZE);
- }
- if (svn_fs_fs__key_compare(copy_id, max_copy_id) > 0)
- {
- SVN_ERR_ASSERT(strlen(copy_id) < MAX_KEY_SIZE);
- apr_cpystrn(max_copy_id, copy_id, MAX_KEY_SIZE);
- }
+ if (node_id > *max_node_id)
+ *max_node_id = node_id;
+ if (copy_id > *max_copy_id)
+ *max_copy_id = copy_id;
if (kind == svn_node_file)
continue;
@@ -285,7 +295,8 @@ recover_find_max_ids(svn_fs_t *fs, svn_r
svn_error_t *
svn_fs_fs__find_max_ids(svn_fs_t *fs, svn_revnum_t youngest,
- char *max_node_id, char *max_copy_id,
+ apr_uint64_t *max_node_id,
+ apr_uint64_t *max_copy_id,
apr_pool_t *pool)
{
fs_fs_data_t *ffd = fs->fsap_data;
@@ -328,8 +339,8 @@ recover_body(void *baton, apr_pool_t *po
svn_fs_t *fs = b->fs;
fs_fs_data_t *ffd = fs->fsap_data;
svn_revnum_t max_rev;
- char next_node_id_buf[MAX_KEY_SIZE], next_copy_id_buf[MAX_KEY_SIZE];
- char *next_node_id = NULL, *next_copy_id = NULL;
+ apr_uint64_t next_node_id = 0;
+ apr_uint64_t next_copy_id = 0;
svn_revnum_t youngest_rev;
svn_node_kind_t youngest_revprops_kind;
@@ -389,8 +400,6 @@ recover_body(void *baton, apr_pool_t *po
we go along. */
svn_revnum_t rev;
apr_pool_t *iterpool = svn_pool_create(pool);
- char max_node_id[MAX_KEY_SIZE] = "0", max_copy_id[MAX_KEY_SIZE] = "0";
- apr_size_t len;
for (rev = 0; rev <= max_rev; rev++)
{
@@ -399,19 +408,15 @@ recover_body(void *baton, apr_pool_t *po
if (b->cancel_func)
SVN_ERR(b->cancel_func(b->cancel_baton));
- SVN_ERR(svn_fs_fs__find_max_ids(fs, rev, max_node_id, max_copy_id,
- iterpool));
+ SVN_ERR(svn_fs_fs__find_max_ids(fs, rev, &next_node_id,
+ &next_copy_id, iterpool));
}
svn_pool_destroy(iterpool);
/* Now that we finally have the maximum revision, node-id and copy-id, we
can bump the two ids to get the next of each. */
- len = strlen(max_node_id);
- svn_fs_fs__next_key(max_node_id, &len, next_node_id_buf);
- next_node_id = next_node_id_buf;
- len = strlen(max_copy_id);
- svn_fs_fs__next_key(max_copy_id, &len, next_copy_id_buf);
- next_copy_id = next_copy_id_buf;
+ next_node_id++;
+ next_copy_id++;
}
/* Before setting current, verify that there is a revprops file
Modified: subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/recovery.h
URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/recovery.h?rev=1453765&r1=1453764&r2=1453765&view=diff
==============================================================================
--- subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/recovery.h (original)
+++ subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/recovery.h Thu Mar 7 10:39:05 2013
@@ -31,8 +31,8 @@
svn_error_t *
svn_fs_fs__find_max_ids(svn_fs_t *fs,
svn_revnum_t youngest,
- char *max_node_id,
- char *max_copy_id,
+ apr_uint64_t *max_node_id,
+ apr_uint64_t *max_copy_id,
apr_pool_t *pool);
/* Recover the fsfs associated with filesystem FS.
Modified: subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/transaction.c
URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/transaction.c?rev=1453765&r1=1453764&r2=1453765&view=diff
==============================================================================
--- subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/transaction.c (original)
+++ subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/transaction.c Thu Mar 7 10:39:05 2013
@@ -38,7 +38,6 @@
#include "low_level.h"
#include "temp_serializer.h"
#include "cached_data.h"
-#include "key-gen.h"
#include "lock.h"
#include "rep-cache.h"
#include "index.h"
@@ -986,7 +985,7 @@ create_new_txn_noderev_from_rev(svn_fs_t
/* A structure used by get_and_increment_txn_key_body(). */
struct get_and_increment_txn_key_baton {
svn_fs_t *fs;
- char *txn_id;
+ apr_uint64_t txn_number;
apr_pool_t *pool;
};
@@ -999,27 +998,21 @@ get_and_increment_txn_key_body(void *bat
struct get_and_increment_txn_key_baton *cb = baton;
const char *txn_current_filename = path_txn_current(cb->fs, pool);
const char *tmp_filename;
- char next_txn_id[MAX_KEY_SIZE+3];
- apr_size_t len;
+ char new_id_str[SVN_INT64_BUFFER_SIZE];
svn_stringbuf_t *buf;
SVN_ERR(read_content(&buf, txn_current_filename, cb->pool));
/* remove trailing newlines */
- svn_stringbuf_strip_whitespace(buf);
- cb->txn_id = buf->data;
- len = buf->len;
+ cb->txn_number = svn__base36toui64(NULL, buf->data);
/* Increment the key and add a trailing \n to the string so the
txn-current file has a newline in it. */
- svn_fs_fs__next_key(cb->txn_id, &len, next_txn_id);
- next_txn_id[len] = '\n';
- ++len;
- next_txn_id[len] = '\0';
-
SVN_ERR(svn_io_write_unique(&tmp_filename,
svn_dirent_dirname(txn_current_filename, pool),
- next_txn_id, len, svn_io_file_del_none, pool));
+ new_id_str,
+ svn__ui64tobase36(new_id_str, cb->txn_number+1),
+ svn_io_file_del_none, pool));
SVN_ERR(move_into_place(tmp_filename, txn_current_filename,
txn_current_filename, pool));
@@ -1035,6 +1028,7 @@ create_txn_dir(const char **id_p, svn_fs
{
struct get_and_increment_txn_key_baton cb;
const char *txn_dir;
+ char buffer[SVN_INT64_BUFFER_SIZE];
/* Get the current transaction sequence value, which is a base-36
number, from the txn-current file, and write an
@@ -1046,7 +1040,9 @@ create_txn_dir(const char **id_p, svn_fs
get_and_increment_txn_key_body,
&cb,
pool));
- *id_p = apr_psprintf(pool, "%ld-%s", rev, cb.txn_id);
+
+ svn__ui64tobase36(buffer, cb.txn_number);
+ *id_p = apr_psprintf(pool, "%ld-%s", rev, buffer);
txn_dir = svn_dirent_join_many(pool,
fs->path,
@@ -1274,22 +1270,24 @@ svn_fs_fs__get_txn(transaction_t **txn_p
static svn_error_t *
write_next_ids(svn_fs_t *fs,
const char *txn_id,
- const char *node_id,
- const char *copy_id,
+ apr_uint64_t node_id,
+ apr_uint64_t copy_id,
apr_pool_t *pool)
{
apr_file_t *file;
- svn_stream_t *out_stream;
+ char buffer[2 * SVN_INT64_BUFFER_SIZE + 2];
+ char *p = buffer;
+
+ p += svn__ui64tobase36(p, node_id);
+ *(p++) = ' ';
+ p += svn__ui64tobase36(p, copy_id);
+ *(p++) = '\n';
+ *(p++) = '\0';
SVN_ERR(svn_io_file_open(&file, path_txn_next_ids(fs, txn_id, pool),
APR_WRITE | APR_TRUNCATE,
APR_OS_DEFAULT, pool));
-
- out_stream = svn_stream_from_aprfile2(file, TRUE, pool);
-
- SVN_ERR(svn_stream_printf(out_stream, pool, "%s %s\n", node_id, copy_id));
-
- SVN_ERR(svn_stream_close(out_stream));
+ SVN_ERR(svn_io_file_write_full(file, buffer, p - buffer, NULL, pool));
return svn_io_file_close(file, pool);
}
@@ -1299,41 +1297,29 @@ write_next_ids(svn_fs_t *fs,
nodes for the given transaction, as well as uniquifying representations.
Perform all allocations in POOL. */
static svn_error_t *
-read_next_ids(const char **node_id,
- const char **copy_id,
+read_next_ids(apr_uint64_t *node_id,
+ apr_uint64_t *copy_id,
svn_fs_t *fs,
const char *txn_id,
apr_pool_t *pool)
{
- apr_file_t *file;
- char buf[MAX_KEY_SIZE*2+3];
- apr_size_t limit;
- char *str, *last_str = buf;
-
- SVN_ERR(svn_io_file_open(&file, path_txn_next_ids(fs, txn_id, pool),
- APR_READ | APR_BUFFERED, APR_OS_DEFAULT, pool));
-
- limit = sizeof(buf);
- SVN_ERR(svn_io_read_length_line(file, buf, &limit, pool));
-
- SVN_ERR(svn_io_file_close(file, pool));
+ svn_stringbuf_t *buf;
+ const char *str;
+ SVN_ERR(read_content(&buf, path_txn_next_ids(fs, txn_id, pool), pool));
/* Parse this into two separate strings. */
- str = svn_cstring_tokenize(" ", &last_str);
- if (! str)
+ str = buf->data;
+ *node_id = svn__base36toui64(&str, str);
+ if (*str != ' ')
return svn_error_create(SVN_ERR_FS_CORRUPT, NULL,
_("next-id file corrupt"));
- *node_id = apr_pstrdup(pool, str);
-
- str = svn_cstring_tokenize(" ", &last_str);
- if (! str)
+ *copy_id = svn__base36toui64(&str, ++str);
+ if (*str != '\n')
return svn_error_create(SVN_ERR_FS_CORRUPT, NULL,
_("next-id file corrupt"));
- *copy_id = apr_pstrdup(pool, str);
-
return SVN_NO_ERROR;
}
@@ -1347,22 +1333,17 @@ get_new_txn_node_id(const char **node_id
const char *txn_id,
apr_pool_t *pool)
{
- const char *cur_node_id, *cur_copy_id;
- char *node_id;
- apr_size_t len;
+ apr_uint64_t node_id, copy_id;
+ char cur_node_id[SVN_INT64_BUFFER_SIZE];
/* First read in the current next-ids file. */
- SVN_ERR(read_next_ids(&cur_node_id, &cur_copy_id, fs, txn_id, pool));
-
- node_id = apr_pcalloc(pool, strlen(cur_node_id) + 2);
-
- len = strlen(cur_node_id);
- svn_fs_fs__next_key(cur_node_id, &len, node_id);
-
- SVN_ERR(write_next_ids(fs, txn_id, node_id, cur_copy_id, pool));
+ SVN_ERR(read_next_ids(&node_id, ©_id, fs, txn_id, pool));
+ svn__ui64tobase36(cur_node_id, node_id);
*node_id_p = apr_pstrcat(pool, "_", cur_node_id, (char *)NULL);
+ SVN_ERR(write_next_ids(fs, txn_id, ++node_id, copy_id, pool));
+
return SVN_NO_ERROR;
}
@@ -1372,22 +1353,17 @@ svn_fs_fs__reserve_copy_id(const char **
const char *txn_id,
apr_pool_t *pool)
{
- const char *cur_node_id, *cur_copy_id;
- char *copy_id;
- apr_size_t len;
+ apr_uint64_t node_id, copy_id;
+ char cur_copy_id[SVN_INT64_BUFFER_SIZE];
/* First read in the current next-ids file. */
- SVN_ERR(read_next_ids(&cur_node_id, &cur_copy_id, fs, txn_id, pool));
-
- copy_id = apr_pcalloc(pool, strlen(cur_copy_id) + 2);
-
- len = strlen(cur_copy_id);
- svn_fs_fs__next_key(cur_copy_id, &len, copy_id);
-
- SVN_ERR(write_next_ids(fs, txn_id, cur_node_id, copy_id, pool));
+ SVN_ERR(read_next_ids(&node_id, ©_id, fs, txn_id, pool));
+ svn__ui64tobase36(cur_copy_id, copy_id);
*copy_id_p = apr_pstrcat(pool, "_", cur_copy_id, (char *)NULL);
+ SVN_ERR(write_next_ids(fs, txn_id, node_id, ++copy_id, pool));
+
return SVN_NO_ERROR;
}
@@ -2259,8 +2235,8 @@ svn_fs_fs__set_proplist(svn_fs_t *fs,
available node id in *NODE_ID, and the next available copy id in
*COPY_ID. Allocations are performed from POOL. */
static svn_error_t *
-get_next_revision_ids(const char **node_id,
- const char **copy_id,
+get_next_revision_ids(apr_uint64_t *node_id,
+ apr_uint64_t *copy_id,
svn_fs_t *fs,
apr_pool_t *pool)
{
@@ -2281,14 +2257,14 @@ get_next_revision_ids(const char **node_
return svn_error_create(SVN_ERR_FS_CORRUPT, NULL,
_("Corrupt 'current' file"));
- *node_id = apr_pstrdup(pool, str);
+ *node_id = svn__base36toui64(NULL, str);
str = svn_cstring_tokenize(" \n", &buf);
if (! str)
return svn_error_create(SVN_ERR_FS_CORRUPT, NULL,
_("Corrupt 'current' file"));
- *copy_id = apr_pstrdup(pool, str);
+ *copy_id = svn__base36toui64(NULL, str);
return SVN_NO_ERROR;
}
@@ -2590,6 +2566,30 @@ validate_root_noderev(svn_fs_t *fs,
return SVN_NO_ERROR;
}
+/* Given the potentially txn-local ID, return the permanent ID based on
+ * the REVISION currently written and the START_ID for that revision.
+ * Use the repository FORMAT to decide which implementation to use.
+ * Use POOL for allocations.
+ */
+static const char*
+get_final_id(const char *id,
+ svn_revnum_t revision,
+ apr_uint64_t start_id,
+ int format,
+ apr_pool_t *pool)
+{
+ char buffer[SVN_INT64_BUFFER_SIZE];
+ apr_uint64_t global_id;
+ if (*id != '_')
+ return id;
+
+ if (format >= SVN_FS_FS__MIN_NO_GLOBAL_IDS_FORMAT)
+ return apr_psprintf(pool, "%s-%ld", id + 1, revision);
+
+ global_id = start_id + svn__base36toui64(NULL, id + 1);
+ return apr_pstrmemdup(pool, buffer, svn__ui64tobase36(buffer, global_id));
+}
+
/* Copy a node-revision specified by id ID in fileystem FS from a
transaction into the proto-rev-file FILE. Set *NEW_ID_P to a
pointer to the new node-id which will be allocated in POOL.
@@ -2622,8 +2622,8 @@ write_final_rev(const svn_fs_id_t **new_
svn_revnum_t rev,
svn_fs_t *fs,
const svn_fs_id_t *id,
- const char *start_node_id,
- const char *start_copy_id,
+ apr_uint64_t start_node_id,
+ apr_uint64_t start_copy_id,
apr_off_t initial_offset,
apr_array_header_t *reps_to_cache,
apr_hash_t *reps_hash,
@@ -2633,10 +2633,8 @@ write_final_rev(const svn_fs_id_t **new_
{
node_revision_t *noderev;
apr_off_t my_offset;
- char my_node_id_buf[MAX_KEY_SIZE + 2];
- char my_copy_id_buf[MAX_KEY_SIZE + 2];
const svn_fs_id_t *new_id;
- const char *node_id, *copy_id, *my_node_id, *my_copy_id;
+ const char *node_id, *copy_id;
fs_fs_data_t *ffd = fs->fsap_data;
apr_uint64_t item_index;
const char *txn_id = svn_fs_fs__id_txn_id(id);
@@ -2746,33 +2744,10 @@ write_final_rev(const svn_fs_id_t **new_
}
/* Convert our temporary ID into a permanent revision one. */
- node_id = svn_fs_fs__id_node_id(noderev->id);
- if (*node_id == '_')
- {
- if (ffd->format >= SVN_FS_FS__MIN_NO_GLOBAL_IDS_FORMAT)
- my_node_id = apr_psprintf(pool, "%s-%ld", node_id + 1, rev);
- else
- {
- svn_fs_fs__add_keys(start_node_id, node_id + 1, my_node_id_buf);
- my_node_id = my_node_id_buf;
- }
- }
- else
- my_node_id = node_id;
-
- copy_id = svn_fs_fs__id_copy_id(noderev->id);
- if (*copy_id == '_')
- {
- if (ffd->format >= SVN_FS_FS__MIN_NO_GLOBAL_IDS_FORMAT)
- my_copy_id = apr_psprintf(pool, "%s-%ld", copy_id + 1, rev);
- else
- {
- svn_fs_fs__add_keys(start_copy_id, copy_id + 1, my_copy_id_buf);
- my_copy_id = my_copy_id_buf;
- }
- }
- else
- my_copy_id = copy_id;
+ node_id = get_final_id(svn_fs_fs__id_node_id(noderev->id),
+ rev, start_node_id, ffd->format, pool);
+ copy_id = get_final_id(svn_fs_fs__id_copy_id(noderev->id),
+ rev, start_copy_id, ffd->format, pool);
if (noderev->copyroot_rev == SVN_INVALID_REVNUM)
noderev->copyroot_rev = rev;
@@ -2786,8 +2761,7 @@ write_final_rev(const svn_fs_id_t **new_
}
else
SVN_ERR(allocate_item_index(&item_index, fs, txn_id, my_offset, pool));
- new_id = svn_fs_fs__id_rev_create(my_node_id, my_copy_id, rev,
- item_index, pool);
+ new_id = svn_fs_fs__id_rev_create(node_id, copy_id, rev, item_index, pool);
noderev->id = new_id;
@@ -2908,26 +2882,25 @@ static svn_error_t *
write_final_current(svn_fs_t *fs,
const char *txn_id,
svn_revnum_t rev,
- const char *start_node_id,
- const char *start_copy_id,
+ apr_uint64_t start_node_id,
+ apr_uint64_t start_copy_id,
apr_pool_t *pool)
{
- const char *txn_node_id, *txn_copy_id;
- char new_node_id[MAX_KEY_SIZE + 2];
- char new_copy_id[MAX_KEY_SIZE + 2];
+ apr_uint64_t txn_node_id;
+ apr_uint64_t txn_copy_id;
fs_fs_data_t *ffd = fs->fsap_data;
if (ffd->format >= SVN_FS_FS__MIN_NO_GLOBAL_IDS_FORMAT)
- return write_current(fs, rev, NULL, NULL, pool);
+ return write_current(fs, rev, 0, 0, pool);
/* To find the next available ids, we add the id that used to be in
the 'current' file, to the next ids from the transaction file. */
SVN_ERR(read_next_ids(&txn_node_id, &txn_copy_id, fs, txn_id, pool));
- svn_fs_fs__add_keys(start_node_id, txn_node_id, new_node_id);
- svn_fs_fs__add_keys(start_copy_id, txn_copy_id, new_copy_id);
+ start_node_id += txn_node_id;
+ start_copy_id += txn_copy_id;
- return write_current(fs, rev, new_node_id, new_copy_id, pool);
+ return write_current(fs, rev, start_node_id, start_copy_id, pool);
}
/* Verify that the user registed with FS has all the locks necessary to
@@ -3026,7 +2999,8 @@ commit_body(void *baton, apr_pool_t *poo
const char *old_rev_filename, *rev_filename, *proto_filename;
const char *revprop_filename, *final_revprop;
const svn_fs_id_t *root_id, *new_root_id;
- const char *start_node_id = NULL, *start_copy_id = NULL;
+ apr_uint64_t start_node_id = 0;
+ apr_uint64_t start_copy_id = 0;
svn_revnum_t old_rev, new_rev;
apr_file_t *proto_file;
void *proto_file_lockcookie;
Modified: subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/util.c
URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/util.c?rev=1453765&r1=1453764&r2=1453765&view=diff
==============================================================================
--- subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/util.c (original)
+++ subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/util.c Thu Mar 7 10:39:05 2013
@@ -24,6 +24,7 @@
#include "svn_ctype.h"
#include "svn_dirent_uri.h"
+#include "private/svn_string_private.h"
#include "fs_fs.h"
#include "id.h"
@@ -449,8 +450,8 @@ write_revnum_file(svn_fs_t *fs,
ignored and may be NULL if the FS format does not use them.)
Perform temporary allocations in POOL. */
svn_error_t *
-write_current(svn_fs_t *fs, svn_revnum_t rev, const char *next_node_id,
- const char *next_copy_id, apr_pool_t *pool)
+write_current(svn_fs_t *fs, svn_revnum_t rev, apr_uint64_t next_node_id,
+ apr_uint64_t next_copy_id, apr_pool_t *pool)
{
char *buf;
const char *tmp_name, *name;
@@ -458,9 +459,18 @@ write_current(svn_fs_t *fs, svn_revnum_t
/* Now we can just write out this line. */
if (ffd->format >= SVN_FS_FS__MIN_NO_GLOBAL_IDS_FORMAT)
- buf = apr_psprintf(pool, "%ld\n", rev);
+ {
+ buf = apr_psprintf(pool, "%ld\n", rev);
+ }
else
- buf = apr_psprintf(pool, "%ld %s %s\n", rev, next_node_id, next_copy_id);
+ {
+ char node_id_str[SVN_INT64_BUFFER_SIZE];
+ char copy_id_str[SVN_INT64_BUFFER_SIZE];
+ svn__ui64tobase36(node_id_str, next_node_id);
+ svn__ui64tobase36(copy_id_str, next_copy_id);
+
+ buf = apr_psprintf(pool, "%ld %s %s\n", rev, node_id_str, copy_id_str);
+ }
name = svn_fs_fs__path_current(fs, pool);
SVN_ERR(svn_io_write_unique(&tmp_name,
Modified: subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/util.h
URL: http://svn.apache.org/viewvc/subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/util.h?rev=1453765&r1=1453764&r2=1453765&view=diff
==============================================================================
--- subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/util.h (original)
+++ subversion/branches/fsfs-format7/subversion/libsvn_fs_fs/util.h Thu Mar 7 10:39:05 2013
@@ -255,13 +255,13 @@ write_revnum_file(svn_fs_t *fs,
/* Atomically update the 'current' file to hold the specifed REV,
NEXT_NODE_ID, and NEXT_COPY_ID. (The two next-ID parameters are
- ignored and may be NULL if the FS format does not use them.)
+ ignored and may be 0 if the FS format does not use them.)
Perform temporary allocations in POOL. */
svn_error_t *
write_current(svn_fs_t *fs,
svn_revnum_t rev,
- const char *next_node_id,
- const char *next_copy_id,
+ apr_uint64_t next_node_id,
+ apr_uint64_t next_copy_id,
apr_pool_t *pool);
/* Read the file at PATH and return its content in *CONTENT. *CONTENT will
@@ -286,7 +286,7 @@ get_file_offset(apr_off_t *offset_p,
apr_file_t *file,
apr_pool_t *pool);
-/* Read the 'current' file FNAME and store the contents in *BUF.
+/* Read the file FNAME and store the contents in *BUF.
Allocations are performed in POOL. */
svn_error_t *
read_content(svn_stringbuf_t **content,