You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Greg Stein <gs...@gmail.com> on 2008/10/16 09:02:06 UTC

Re: svn commit: r33682 - branches/fsfs-pack/subversion/libsvn_fs_fs

Reading the commit log, I understand what you're doing, but if I were
to just read the code... it is unclear why you delete the pack file.
I'd suggest adding a comment rather than relying on people looking up
log messages...

On Wed, Oct 15, 2008 at 5:30 PM,  <hw...@tigris.org> wrote:
> Author: hwright
> Date: Wed Oct 15 17:30:50 2008
> New Revision: 33682
>
> Log:
> On the fsfs-pack branch:
> Do a little bit of consistency checking before proceeding with packing.
>
> * subversion/libsvn_fs_fs/fs_fs.c
>  (pack_shard): If both the packed shard and the old shard exist, assume the
>    packed_shard wasn't completed, and just delete it.
>
> Modified:
>   branches/fsfs-pack/subversion/libsvn_fs_fs/fs_fs.c
>
> Modified: branches/fsfs-pack/subversion/libsvn_fs_fs/fs_fs.c
> URL: http://svn.collab.net/viewvc/svn/branches/fsfs-pack/subversion/libsvn_fs_fs/fs_fs.c?pathrev=33682&r1=33681&r2=33682
> ==============================================================================
> --- branches/fsfs-pack/subversion/libsvn_fs_fs/fs_fs.c  Wed Oct 15 16:43:58 2008        (r33681)
> +++ branches/fsfs-pack/subversion/libsvn_fs_fs/fs_fs.c  Wed Oct 15 17:30:50 2008        (r33682)
> @@ -6376,6 +6376,27 @@ pack_shard(const char *revs_dir,
>            apr_int64_t shard,
>            apr_pool_t *pool)
>  {
> +  svn_node_kind_t pack_kind;
> +  svn_node_kind_t shard_kind;
> +  const char *pack_file_path = svn_path_join(revs_dir,
> +                                             apr_psprintf(pool, "%ld.pack",
> +                                                          shard), pool);
> +  const char *shard_path = svn_path_join(revs_dir,
> +                                         apr_psprintf(pool, "%ld", shard),
> +                                         pool);
> +
> +  /* Do some consistency checking. */
> +  SVN_ERR(svn_io_check_path(pack_file_path, &pack_kind, pool));
> +  SVN_ERR(svn_io_check_path(shard_path, &shard_kind, pool));
> +  if (pack_kind == svn_node_file)
> +    {
> +      if (shard_kind == svn_node_dir)
> +        SVN_ERR(svn_io_remove_file(pack_file_path, pool));
> +      else
> +        /* We have already packed this shard, so just leave. */
> +        return SVN_NO_ERROR;
> +    }
> +
>   return SVN_NO_ERROR;
>  }
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: svn-unsubscribe@subversion.tigris.org
> For additional commands, e-mail: svn-help@subversion.tigris.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: svn commit: r33682 - branches/fsfs-pack/subversion/libsvn_fs_fs

Posted by "Hyrum K. Wright" <hy...@mail.utexas.edu>.
Greg Stein wrote:
> Reading the commit log, I understand what you're doing, but if I were
> to just read the code... it is unclear why you delete the pack file.
> I'd suggest adding a comment rather than relying on people looking up
> log messages...

Yeah, the code is decidedly lacking in comments (including the functions
themselves).  The patch I'm currently working on hopefully adds enough comments
to make things a bit more understandable.

-Hyrum

> On Wed, Oct 15, 2008 at 5:30 PM,  <hw...@tigris.org> wrote:
>> Author: hwright
>> Date: Wed Oct 15 17:30:50 2008
>> New Revision: 33682
>>
>> Log:
>> On the fsfs-pack branch:
>> Do a little bit of consistency checking before proceeding with packing.
>>
>> * subversion/libsvn_fs_fs/fs_fs.c
>>  (pack_shard): If both the packed shard and the old shard exist, assume the
>>    packed_shard wasn't completed, and just delete it.
>>
>> Modified:
>>   branches/fsfs-pack/subversion/libsvn_fs_fs/fs_fs.c
>>
>> Modified: branches/fsfs-pack/subversion/libsvn_fs_fs/fs_fs.c
>> URL: http://svn.collab.net/viewvc/svn/branches/fsfs-pack/subversion/libsvn_fs_fs/fs_fs.c?pathrev=33682&r1=33681&r2=33682
>> ==============================================================================
>> --- branches/fsfs-pack/subversion/libsvn_fs_fs/fs_fs.c  Wed Oct 15 16:43:58 2008        (r33681)
>> +++ branches/fsfs-pack/subversion/libsvn_fs_fs/fs_fs.c  Wed Oct 15 17:30:50 2008        (r33682)
>> @@ -6376,6 +6376,27 @@ pack_shard(const char *revs_dir,
>>            apr_int64_t shard,
>>            apr_pool_t *pool)
>>  {
>> +  svn_node_kind_t pack_kind;
>> +  svn_node_kind_t shard_kind;
>> +  const char *pack_file_path = svn_path_join(revs_dir,
>> +                                             apr_psprintf(pool, "%ld.pack",
>> +                                                          shard), pool);
>> +  const char *shard_path = svn_path_join(revs_dir,
>> +                                         apr_psprintf(pool, "%ld", shard),
>> +                                         pool);
>> +
>> +  /* Do some consistency checking. */
>> +  SVN_ERR(svn_io_check_path(pack_file_path, &pack_kind, pool));
>> +  SVN_ERR(svn_io_check_path(shard_path, &shard_kind, pool));
>> +  if (pack_kind == svn_node_file)
>> +    {
>> +      if (shard_kind == svn_node_dir)
>> +        SVN_ERR(svn_io_remove_file(pack_file_path, pool));
>> +      else
>> +        /* We have already packed this shard, so just leave. */
>> +        return SVN_NO_ERROR;
>> +    }
>> +
>>   return SVN_NO_ERROR;
>>  }
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: svn-unsubscribe@subversion.tigris.org
>> For additional commands, e-mail: svn-help@subversion.tigris.org
>>
>>
>