Huh. Using the same counter for node ids and rep uniqifiers (instead
of adding a third counter to the next-ids file) wasn't exactly what I
was expecting, but it does look like it'll work. But you'll really
want to fix up a bunch of comments/docs to reflect that... at the very
least, get_new_txn_node_id/read_next_ids/write_next_ids docstrings,
and the description of the next-ids file in 'structure'.
--dave
On Mon, Dec 8, 2008 at 1:43 PM, Hyrum K. Wright <hyrum_at_hyrumwright.org> wrote:
> Author: hwright
> Date: Mon Dec 8 13:43:25 2008
> New Revision: 34616
>
> Log:
> Followup to r34588: Really uniquify representation strings by including the
> next_node_id as part of the uniquifier, and rename a structure member
> appropriately.
>
> * subversion/libsvn_fs_fs/fs_fs.c
> (read_rep_offsets, representation_string, svn_fs_fs__noderev_same_rep_key,
> rep_write_contents_close, svn_fs_fs__rep_copy): Update variable name.
> (svn_fs_fs__set_entry, rep_write_contents_close): Use the next node id to
> further uniquify the rep string within a txn.
>
> * subversion/libsvn_fs_fs/fs.h
> (representation_t): Rename orig_txn_id to uniquifier.
>
> Modified:
> trunk/subversion/libsvn_fs_fs/fs.h
> trunk/subversion/libsvn_fs_fs/fs_fs.c
>
> Modified: trunk/subversion/libsvn_fs_fs/fs.h
> URL: http://svn.collab.net/viewvc/svn/trunk/subversion/libsvn_fs_fs/fs.h?pathrev=34616&r1=34615&r2=34616
> ==============================================================================
> --- trunk/subversion/libsvn_fs_fs/fs.h Mon Dec 8 11:43:59 2008 (r34615)
> +++ trunk/subversion/libsvn_fs_fs/fs.h Mon Dec 8 13:43:25 2008 (r34616)
> @@ -297,8 +297,9 @@ typedef struct
>
> /* 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!) here. */
> - const char *orig_txn_id;
> + store the original txn of the node rev (not the rep!), along with some
> + intra-node uniqification content. */
> + const char *uniquifier;
> } representation_t;
>
>
>
> Modified: trunk/subversion/libsvn_fs_fs/fs_fs.c
> URL: http://svn.collab.net/viewvc/svn/trunk/subversion/libsvn_fs_fs/fs_fs.c?pathrev=34616&r1=34615&r2=34616
> ==============================================================================
> --- trunk/subversion/libsvn_fs_fs/fs_fs.c Mon Dec 8 11:43:59 2008 (r34615)
> +++ trunk/subversion/libsvn_fs_fs/fs_fs.c Mon Dec 8 13:43:25 2008 (r34616)
> @@ -1806,13 +1806,13 @@ read_rep_offsets(representation_t **rep_
> SVN_ERR(svn_checksum_parse_hex(&rep->sha1_checksum, svn_checksum_sha1, str,
> pool));
>
> - /* Read the original txn id. */
> + /* Read the uniquifier. */
> str = apr_strtok(NULL, " ", &last_str);
> if (str == NULL)
> return svn_error_create(SVN_ERR_FS_CORRUPT, NULL,
> _("Malformed text rep offset line in node-rev"));
>
> - rep->orig_txn_id = apr_pstrdup(pool, str);
> + rep->uniquifier = apr_pstrdup(pool, str);
>
> return SVN_NO_ERROR;
> }
> @@ -2048,7 +2048,7 @@ representation_string(representation_t *
> svn_checksum_to_cstring_display(rep->sha1_checksum,
> pool) :
> "0000000000000000000000000000000000000000",
> - rep->orig_txn_id);
> + rep->uniquifier);
> }
>
>
> @@ -3435,7 +3435,7 @@ svn_fs_fs__noderev_same_rep_key(represen
> if (a->revision != b->revision)
> return FALSE;
>
> - return strcmp(a->orig_txn_id, b->orig_txn_id) == 0;
> + return strcmp(a->uniquifier, b->uniquifier) == 0;
> }
>
> svn_error_t *
> @@ -3480,7 +3480,7 @@ 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->orig_txn_id = apr_pstrdup(pool, rep->orig_txn_id);
> + rep_new->uniquifier = apr_pstrdup(pool, rep->uniquifier);
>
> return rep_new;
> }
> @@ -4450,6 +4450,8 @@ svn_fs_fs__set_entry(svn_fs_t *fs,
>
> if (!rep || !rep->txn_id)
> {
> + const char *unique_suffix;
> +
> {
> apr_hash_t *entries;
> apr_pool_t *subpool = svn_pool_create(pool);
> @@ -4472,7 +4474,8 @@ svn_fs_fs__set_entry(svn_fs_t *fs,
> rep = apr_pcalloc(pool, sizeof(*rep));
> rep->revision = SVN_INVALID_REVNUM;
> rep->txn_id = txn_id;
> - rep->orig_txn_id = txn_id;
> + SVN_ERR(get_new_txn_node_id(&unique_suffix, fs, txn_id, pool));
> + rep->uniquifier = apr_psprintf(pool, "%s/%s", txn_id, unique_suffix);
> parent_noderev->data_rep = rep;
> SVN_ERR(svn_fs_fs__put_node_revision(fs, parent_noderev->id,
> parent_noderev, FALSE, pool));
> @@ -4782,6 +4785,7 @@ rep_write_contents_close(void *baton)
> {
> struct rep_write_baton *b = baton;
> fs_fs_data_t *ffd = b->fs->fsap_data;
> + const char *unique_suffix;
> representation_t *rep;
> representation_t *old_rep;
> apr_off_t offset;
> @@ -4801,7 +4805,9 @@ rep_write_contents_close(void *baton)
> /* Fill in the rest of the representation field. */
> rep->expanded_size = b->rep_size;
> rep->txn_id = svn_fs_fs__id_txn_id(b->noderev->id);
> - rep->orig_txn_id = rep->txn_id;
> + SVN_ERR(get_new_txn_node_id(&unique_suffix, b->fs, rep->txn_id, b->pool));
> + rep->uniquifier = apr_psprintf(b->parent_pool, "%s/%s", rep->txn_id,
> + unique_suffix);
> rep->revision = SVN_INVALID_REVNUM;
>
> /* Finalize the checksum. */
> @@ -4825,7 +4831,7 @@ rep_write_contents_close(void *baton)
>
> /* Use the old rep for this content. */
> old_rep->md5_checksum = rep->md5_checksum;
> - old_rep->orig_txn_id = rep->orig_txn_id;
> + old_rep->uniquifier = rep->uniquifier;
> b->noderev->data_rep = old_rep;
> }
> else
>
> ------------------------------------------------------
> http://subversion.tigris.org/ds/viewMessage.do?dsForumId=495&dsMessageId=981318
>
--
glasser_at_davidglasser.net | langtonlabs.org | flickr.com/photos/glasser/
------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=981338
Received on 2008-12-09 01:06:01 CET