Author: stefan2
Date: Wed Jul 24 14:32:48 2013
New Revision: 1506576
URL: http://svn.apache.org/r1506576
Log:
On the fsfs-improvements branch: With the new ID types in place,
we can now replace other string with a struct
* subversion/libsvn_fs_fs/fs.h
(representation_t): replace the uniquifier string by a proper struct
* subversion/libsvn_fs_fs/fs_fs.c
(svn_fs_fs__noderev_same_rep_key,
svn_fs_fs__rep_copy): simplify as uniquifiers can now simply memory blocks
* subversion/libsvn_fs_fs/low_level.c
(svn_fs_fs__parse_representation,
svn_fs_fs__unparse_representation): update parser and writer
* subversion/libsvn_fs_fs/temp_serializer.c
(serialize_representation,
deserialize_representation): embedded structs don't need a special handling
* subversion/libsvn_fs_fs/transaction.c
(set_uniquifier): update / simplify
Modified:
subversion/branches/fsfs-improvements/subversion/libsvn_fs_fs/fs.h
subversion/branches/fsfs-improvements/subversion/libsvn_fs_fs/fs_fs.c
subversion/branches/fsfs-improvements/subversion/libsvn_fs_fs/low_level.c
subversion/branches/fsfs-improvements/subversion/libsvn_fs_fs/temp_serializer.c
subversion/branches/fsfs-improvements/subversion/libsvn_fs_fs/transaction.c
Modified: subversion/branches/fsfs-improvements/subversion/libsvn_fs_fs/fs.h
URL:
http://svn.apache.org/viewvc/subversion/branches/fsfs-improvements/subversion/libsvn_fs_fs/fs.h?rev=1506576&r1=1506575&r2=1506576&view=diff
==============================================================================
--- subversion/branches/fsfs-improvements/subversion/libsvn_fs_fs/fs.h
(original)
+++ subversion/branches/fsfs-improvements/subversion/libsvn_fs_fs/fs.h Wed Jul
24 14:32:48 2013
@@ -431,11 +431,12 @@ typedef struct representation_t
/* For rep-sharing, we need a way of uniquifying node-revs which share the
same representation (see svn_fs_fs__noderev_same_rep_key() ). So, we
store the original txn of the node rev (not the rep!), along with some
- intra-node uniqification content.
-
- May be NULL, in which case, it is considered to match other NULL
- values.*/
- const char *uniquifier;
+ intra-node uniqification content. */
+ struct
+ {
+ svn_fs_fs__id_part_t txn_id;
+ apr_uint64_t number;
+ } uniquifier;
} representation_t;
Modified: subversion/branches/fsfs-improvements/subversion/libsvn_fs_fs/fs_fs.c
URL:
http://svn.apache.org/viewvc/subversion/branches/fsfs-improvements/subversion/libsvn_fs_fs/fs_fs.c?rev=1506576&r1=1506575&r2=1506576&view=diff
==============================================================================
--- subversion/branches/fsfs-improvements/subversion/libsvn_fs_fs/fs_fs.c
(original)
+++ subversion/branches/fsfs-improvements/subversion/libsvn_fs_fs/fs_fs.c Wed
Jul 24 14:32:48 2013
@@ -939,13 +939,7 @@ svn_fs_fs__noderev_same_rep_key(represen
if (a->revision != b->revision)
return FALSE;
- if (a->uniquifier == b->uniquifier)
- return TRUE;
-
- if (a->uniquifier == NULL || b->uniquifier == NULL)
- return FALSE;
-
- return strcmp(a->uniquifier, b->uniquifier) == 0;
+ return memcmp(&a->uniquifier, &b->uniquifier, sizeof(a->uniquifier)) == 0;
}
svn_error_t *
@@ -990,7 +984,6 @@ svn_fs_fs__rep_copy(representation_t *re
memcpy(rep_new, rep, sizeof(*rep_new));
rep_new->md5_checksum = svn_checksum_dup(rep->md5_checksum, pool);
rep_new->sha1_checksum = svn_checksum_dup(rep->sha1_checksum, pool);
- rep_new->uniquifier = apr_pstrdup(pool, rep->uniquifier);
return rep_new;
}
Modified:
subversion/branches/fsfs-improvements/subversion/libsvn_fs_fs/low_level.c
URL:
http://svn.apache.org/viewvc/subversion/branches/fsfs-improvements/subversion/libsvn_fs_fs/low_level.c?rev=1506576&r1=1506575&r2=1506576&view=diff
==============================================================================
--- subversion/branches/fsfs-improvements/subversion/libsvn_fs_fs/low_level.c
(original)
+++ subversion/branches/fsfs-improvements/subversion/libsvn_fs_fs/low_level.c
Wed Jul 24 14:32:48 2013
@@ -593,12 +593,19 @@ svn_fs_fs__parse_representation(represen
pool));
/* Read the uniquifier. */
+ str = svn_cstring_tokenize("/", &string);
+ if (str == NULL)
+ return svn_error_create(SVN_ERR_FS_CORRUPT, NULL,
+ _("Malformed text representation offset line in
node-rev"));
+
+ SVN_ERR(svn_fs_fs__id_txn_parse(&rep->uniquifier.txn_id, str));
+
str = svn_cstring_tokenize(" ", &string);
if (str == NULL)
return svn_error_create(SVN_ERR_FS_CORRUPT, NULL,
_("Malformed text representation offset line in
node-rev"));
- rep->uniquifier = apr_pstrdup(pool, str);
+ rep->uniquifier.number = svn__base36toui64(NULL, str);
return SVN_NO_ERROR;
}
@@ -794,6 +801,7 @@ svn_fs_fs__unparse_representation(repres
svn_boolean_t may_be_corrupt,
apr_pool_t *pool)
{
+ char buffer[SVN_INT64_BUFFER_SIZE];
if (svn_fs_fs__id_txn_used(&rep->txn_id) && mutable_rep_truncated)
return svn_stringbuf_ncreate("-1", 2, pool);
@@ -810,14 +818,16 @@ svn_fs_fs__unparse_representation(repres
rep->expanded_size,
DISPLAY_MAYBE_NULL_CHECKSUM(rep->md5_checksum));
+ svn__ui64tobase36(buffer, rep->uniquifier.number);
return svn_stringbuf_createf
(pool, "%ld %" APR_OFF_T_FMT " %" SVN_FILESIZE_T_FMT
- " %" SVN_FILESIZE_T_FMT " %s %s %s",
+ " %" SVN_FILESIZE_T_FMT " %s %s %s/_%s",
rep->revision, rep->offset, rep->size,
rep->expanded_size,
DISPLAY_MAYBE_NULL_CHECKSUM(rep->md5_checksum),
DISPLAY_MAYBE_NULL_CHECKSUM(rep->sha1_checksum),
- rep->uniquifier);
+ svn_fs_fs__id_txn_unparse(&rep->uniquifier.txn_id, pool),
+ buffer);
#undef DISPLAY_MAYBE_NULL_CHECKSUM
Modified:
subversion/branches/fsfs-improvements/subversion/libsvn_fs_fs/temp_serializer.c
URL:
http://svn.apache.org/viewvc/subversion/branches/fsfs-improvements/subversion/libsvn_fs_fs/temp_serializer.c?rev=1506576&r1=1506575&r2=1506576&view=diff
==============================================================================
---
subversion/branches/fsfs-improvements/subversion/libsvn_fs_fs/temp_serializer.c
(original)
+++
subversion/branches/fsfs-improvements/subversion/libsvn_fs_fs/temp_serializer.c
Wed Jul 24 14:32:48 2013
@@ -183,8 +183,6 @@ serialize_representation(svn_temp_serial
serialize_checksum(context, &rep->md5_checksum);
serialize_checksum(context, &rep->sha1_checksum);
- svn_temp_serializer__add_string(context, &rep->uniquifier);
-
/* return to the caller's nesting level */
svn_temp_serializer__pop(context);
}
@@ -206,8 +204,6 @@ deserialize_representation(void *buffer,
/* fixup of sub-structures */
deserialize_checksum(rep, &rep->md5_checksum);
deserialize_checksum(rep, &rep->sha1_checksum);
-
- svn_temp_deserializer__resolve(rep, (void **)&rep->uniquifier);
}
/* auxilliary structure representing the content of a directory hash */
Modified:
subversion/branches/fsfs-improvements/subversion/libsvn_fs_fs/transaction.c
URL:
http://svn.apache.org/viewvc/subversion/branches/fsfs-improvements/subversion/libsvn_fs_fs/transaction.c?rev=1506576&r1=1506575&r2=1506576&view=diff
==============================================================================
--- subversion/branches/fsfs-improvements/subversion/libsvn_fs_fs/transaction.c
(original)
+++ subversion/branches/fsfs-improvements/subversion/libsvn_fs_fs/transaction.c
Wed Jul 24 14:32:48 2013
@@ -1370,15 +1370,10 @@ set_uniquifier(svn_fs_t *fs,
apr_pool_t *pool)
{
svn_fs_fs__id_part_t temp;
- char buffer[SVN_INT64_BUFFER_SIZE];
SVN_ERR(get_new_txn_node_id(&temp, fs, &rep->txn_id, pool));
- svn__ui64tobase36(buffer, temp.number);
-
- rep->uniquifier
- = apr_psprintf(pool, "%s/_%s",
- svn_fs_fs__id_txn_unparse(&rep->txn_id, pool),
- buffer);
+ rep->uniquifier.txn_id = rep->txn_id;
+ rep->uniquifier.number = temp.number;
return SVN_NO_ERROR;
}