You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by Daniel Shahaf <da...@elego.de> on 2013/06/19 00:37:26 UTC

Re: svn commit: r1358725 - /subversion/trunk/subversion/libsvn_fs_fs/fs_fs.c

stefan2@apache.org wrote on Sun, Jul 08, 2012 at 12:21:37 -0000:
> Author: stefan2
> Date: Sun Jul  8 12:21:36 2012
> New Revision: 1358725
> 
> URL: http://svn.apache.org/viewvc?rev=1358725&view=rev
> Log:
> When upgrading to format 6 (or later), we must make sure that
> revprop shard packing is in sync with revision data shard packing.
> 
> * subversion/libsvn_fs_fs/fs_fs.c
>   (upgrade_pack_revprops): new function
>   (upgrade_body): use the new function to pack revprop shards
> 
> Modified:
>     subversion/trunk/subversion/libsvn_fs_fs/fs_fs.c
> 
> Modified: subversion/trunk/subversion/libsvn_fs_fs/fs_fs.c
> URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_fs/fs_fs.c?rev=1358725&r1=1358724&r2=1358725&view=diff
> ==============================================================================
> --- subversion/trunk/subversion/libsvn_fs_fs/fs_fs.c (original)
> +++ subversion/trunk/subversion/libsvn_fs_fs/fs_fs.c Sun Jul  8 12:21:36 2012
> @@ -1398,6 +1398,85 @@ create_file_ignore_eexist(const char *fi
>    return svn_error_trace(err);
>  }
>  
> +/* In the filesystem FS, pack all revprop shards up to min_unpacked_rev.
> + * Use SCRATCH_POOL for temporary allocations.
> + */
> +static svn_error_t *
> +upgrade_pack_revprops(svn_fs_t *fs,
> +                      apr_pool_t *scratch_pool)
> +{
> +  fs_fs_data_t *ffd = fs->fsap_data;
> +  const char *revprops_shard_path;
> +  const char *revprops_pack_file_dir;
> +  apr_int64_t shard;
> +  apr_int64_t first_unpacked_shard
> +    =  ffd->min_unpacked_rev / ffd->max_files_per_dir;
> +
> +  apr_pool_t *iterpool = svn_pool_create(scratch_pool);
> +  const char *revsprops_dir = svn_dirent_join(fs->path, PATH_REVPROPS_DIR,
> +                                              scratch_pool);
> +  int compression_level = ffd->compress_packed_revprops
> +                           ? SVN_DELTA_COMPRESSION_LEVEL_DEFAULT
> +                           : SVN_DELTA_COMPRESSION_LEVEL_NONE;
> +
> +  /* first, pack all revprops shards to match the packed revision shards */
> +  for (shard = 0; shard < first_unpacked_shard; ++shard)
> +    {

Would it be useful to have a progress_func here, that is called once per
shard or so?  Otherwise, this may perform an arbitrary amount of work
(proportional to number of shards, i.e., O(HEAD)) with no feedback
during it.

Daniel

> +      revprops_pack_file_dir = svn_dirent_join(revsprops_dir,
> +                   apr_psprintf(iterpool,
> +                                "%" APR_INT64_T_FMT PATH_EXT_PACKED_SHARD,
> +                                shard),
> +                   iterpool);
> +      revprops_shard_path = svn_dirent_join(revsprops_dir,
> +                       apr_psprintf(iterpool, "%" APR_INT64_T_FMT, shard),
> +                       iterpool);
> +
> +      SVN_ERR(pack_revprops_shard(revprops_pack_file_dir, revprops_shard_path,
> +                                  shard, ffd->max_files_per_dir,
> +                                  (int)(0.9 * ffd->revprop_pack_size),
> +                                  compression_level,
> +                                  NULL, NULL, iterpool));
> +      svn_pool_clear(iterpool);
> +    }
> +
> +  svn_pool_destroy(iterpool);
> +
> +  return SVN_NO_ERROR;
> +}
> +
>  static svn_error_t *
>  upgrade_body(void *baton, apr_pool_t *pool)
>  {
> @@ -1456,6 +1535,12 @@ upgrade_body(void *baton, apr_pool_t *po
>    if (format < SVN_FS_FS__MIN_PACKED_FORMAT)
>      SVN_ERR(svn_io_file_create(path_min_unpacked_rev(fs, pool), "0\n", pool));
>  
> +  /* If the file system supports revision packing but not revprop packing,
> +     pack the revprops up to the point that revision data has been packed. */
> +  if (   format >= SVN_FS_FS__MIN_PACKED_FORMAT
> +      && format < SVN_FS_FS__MIN_PACKED_REVPROP_FORMAT)
> +    SVN_ERR(upgrade_pack_revprops(fs, pool));
> +
>    /* Bump the format file. */
>    return write_format(format_path, SVN_FS_FS__FORMAT_NUMBER, max_files_per_dir,
>                        TRUE, pool);
> 
> 

Re: svn commit: r1358725 - /subversion/trunk/subversion/libsvn_fs_fs/fs_fs.c

Posted by Daniel Shahaf <da...@apache.org>.
On Fri, Jun 21, 2013 at 09:16:16PM +0200, Stefan Fuhrmann wrote:
> On Wed, Jun 19, 2013 at 12:37 AM, Daniel Shahaf <da...@elego.de> wrote:
> 
> > stefan2@apache.org wrote on Sun, Jul 08, 2012 at 12:21:37 -0000:
> > > Author: stefan2
> > > Date: Sun Jul  8 12:21:36 2012
> > > New Revision: 1358725
> > >
> > > URL: http://svn.apache.org/viewvc?rev=1358725&view=rev
> > > Log:
> > > When upgrading to format 6 (or later), we must make sure that
> > > revprop shard packing is in sync with revision data shard packing.
> > >
> > > * subversion/libsvn_fs_fs/fs_fs.c
> > >   (upgrade_pack_revprops): new function
> > >   (upgrade_body): use the new function to pack revprop shards
> > >
> > > Modified:
> > >     subversion/trunk/subversion/libsvn_fs_fs/fs_fs.c
> > >
> > > Modified: subversion/trunk/subversion/libsvn_fs_fs/fs_fs.c
> > > URL:
> > http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_fs/fs_fs.c?rev=1358725&r1=1358724&r2=1358725&view=diff
> > >
> > ==============================================================================
> > > --- subversion/trunk/subversion/libsvn_fs_fs/fs_fs.c (original)
> > > +++ subversion/trunk/subversion/libsvn_fs_fs/fs_fs.c Sun Jul  8 12:21:36
> > 2012
> > > @@ -1398,6 +1398,85 @@ create_file_ignore_eexist(const char *fi
> > >    return svn_error_trace(err);
> > >  }
> > >
> > > +/* In the filesystem FS, pack all revprop shards up to min_unpacked_rev.
> > > + * Use SCRATCH_POOL for temporary allocations.
> > > + */
> > > +static svn_error_t *
> > > +upgrade_pack_revprops(svn_fs_t *fs,
> > > +                      apr_pool_t *scratch_pool)
> > > +{
> > > +  fs_fs_data_t *ffd = fs->fsap_data;
> > > +  const char *revprops_shard_path;
> > > +  const char *revprops_pack_file_dir;
> > > +  apr_int64_t shard;
> > > +  apr_int64_t first_unpacked_shard
> > > +    =  ffd->min_unpacked_rev / ffd->max_files_per_dir;
> > > +
> > > +  apr_pool_t *iterpool = svn_pool_create(scratch_pool);
> > > +  const char *revsprops_dir = svn_dirent_join(fs->path,
> > PATH_REVPROPS_DIR,
> > > +                                              scratch_pool);
> > > +  int compression_level = ffd->compress_packed_revprops
> > > +                           ? SVN_DELTA_COMPRESSION_LEVEL_DEFAULT
> > > +                           : SVN_DELTA_COMPRESSION_LEVEL_NONE;
> > > +
> > > +  /* first, pack all revprops shards to match the packed revision
> > shards */
> > > +  for (shard = 0; shard < first_unpacked_shard; ++shard)
> > > +    {
> >
> > Would it be useful to have a progress_func here, that is called once per
> > shard or so?  Otherwise, this may perform an arbitrary amount of work
> > (proportional to number of shards, i.e., O(HEAD)) with no feedback
> > during it.
> >
> 
> Implemented in r1495545.

Thanks!

Re: svn commit: r1358725 - /subversion/trunk/subversion/libsvn_fs_fs/fs_fs.c

Posted by Daniel Shahaf <da...@apache.org>.
On Fri, Jun 21, 2013 at 09:16:16PM +0200, Stefan Fuhrmann wrote:
> On Wed, Jun 19, 2013 at 12:37 AM, Daniel Shahaf <da...@elego.de> wrote:
> 
> > stefan2@apache.org wrote on Sun, Jul 08, 2012 at 12:21:37 -0000:
> > > Author: stefan2
> > > Date: Sun Jul  8 12:21:36 2012
> > > New Revision: 1358725
> > >
> > > URL: http://svn.apache.org/viewvc?rev=1358725&view=rev
> > > Log:
> > > When upgrading to format 6 (or later), we must make sure that
> > > revprop shard packing is in sync with revision data shard packing.
> > >
> > > * subversion/libsvn_fs_fs/fs_fs.c
> > >   (upgrade_pack_revprops): new function
> > >   (upgrade_body): use the new function to pack revprop shards
> > >
> > > Modified:
> > >     subversion/trunk/subversion/libsvn_fs_fs/fs_fs.c
> > >
> > > Modified: subversion/trunk/subversion/libsvn_fs_fs/fs_fs.c
> > > URL:
> > http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_fs/fs_fs.c?rev=1358725&r1=1358724&r2=1358725&view=diff
> > >
> > ==============================================================================
> > > --- subversion/trunk/subversion/libsvn_fs_fs/fs_fs.c (original)
> > > +++ subversion/trunk/subversion/libsvn_fs_fs/fs_fs.c Sun Jul  8 12:21:36
> > 2012
> > > @@ -1398,6 +1398,85 @@ create_file_ignore_eexist(const char *fi
> > >    return svn_error_trace(err);
> > >  }
> > >
> > > +/* In the filesystem FS, pack all revprop shards up to min_unpacked_rev.
> > > + * Use SCRATCH_POOL for temporary allocations.
> > > + */
> > > +static svn_error_t *
> > > +upgrade_pack_revprops(svn_fs_t *fs,
> > > +                      apr_pool_t *scratch_pool)
> > > +{
> > > +  fs_fs_data_t *ffd = fs->fsap_data;
> > > +  const char *revprops_shard_path;
> > > +  const char *revprops_pack_file_dir;
> > > +  apr_int64_t shard;
> > > +  apr_int64_t first_unpacked_shard
> > > +    =  ffd->min_unpacked_rev / ffd->max_files_per_dir;
> > > +
> > > +  apr_pool_t *iterpool = svn_pool_create(scratch_pool);
> > > +  const char *revsprops_dir = svn_dirent_join(fs->path,
> > PATH_REVPROPS_DIR,
> > > +                                              scratch_pool);
> > > +  int compression_level = ffd->compress_packed_revprops
> > > +                           ? SVN_DELTA_COMPRESSION_LEVEL_DEFAULT
> > > +                           : SVN_DELTA_COMPRESSION_LEVEL_NONE;
> > > +
> > > +  /* first, pack all revprops shards to match the packed revision
> > shards */
> > > +  for (shard = 0; shard < first_unpacked_shard; ++shard)
> > > +    {
> >
> > Would it be useful to have a progress_func here, that is called once per
> > shard or so?  Otherwise, this may perform an arbitrary amount of work
> > (proportional to number of shards, i.e., O(HEAD)) with no feedback
> > during it.
> >
> 
> Implemented in r1495545.

Thanks!

Re: svn commit: r1358725 - /subversion/trunk/subversion/libsvn_fs_fs/fs_fs.c

Posted by Stefan Fuhrmann <st...@wandisco.com>.
On Wed, Jun 19, 2013 at 12:37 AM, Daniel Shahaf <da...@elego.de> wrote:

> stefan2@apache.org wrote on Sun, Jul 08, 2012 at 12:21:37 -0000:
> > Author: stefan2
> > Date: Sun Jul  8 12:21:36 2012
> > New Revision: 1358725
> >
> > URL: http://svn.apache.org/viewvc?rev=1358725&view=rev
> > Log:
> > When upgrading to format 6 (or later), we must make sure that
> > revprop shard packing is in sync with revision data shard packing.
> >
> > * subversion/libsvn_fs_fs/fs_fs.c
> >   (upgrade_pack_revprops): new function
> >   (upgrade_body): use the new function to pack revprop shards
> >
> > Modified:
> >     subversion/trunk/subversion/libsvn_fs_fs/fs_fs.c
> >
> > Modified: subversion/trunk/subversion/libsvn_fs_fs/fs_fs.c
> > URL:
> http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_fs/fs_fs.c?rev=1358725&r1=1358724&r2=1358725&view=diff
> >
> ==============================================================================
> > --- subversion/trunk/subversion/libsvn_fs_fs/fs_fs.c (original)
> > +++ subversion/trunk/subversion/libsvn_fs_fs/fs_fs.c Sun Jul  8 12:21:36
> 2012
> > @@ -1398,6 +1398,85 @@ create_file_ignore_eexist(const char *fi
> >    return svn_error_trace(err);
> >  }
> >
> > +/* In the filesystem FS, pack all revprop shards up to min_unpacked_rev.
> > + * Use SCRATCH_POOL for temporary allocations.
> > + */
> > +static svn_error_t *
> > +upgrade_pack_revprops(svn_fs_t *fs,
> > +                      apr_pool_t *scratch_pool)
> > +{
> > +  fs_fs_data_t *ffd = fs->fsap_data;
> > +  const char *revprops_shard_path;
> > +  const char *revprops_pack_file_dir;
> > +  apr_int64_t shard;
> > +  apr_int64_t first_unpacked_shard
> > +    =  ffd->min_unpacked_rev / ffd->max_files_per_dir;
> > +
> > +  apr_pool_t *iterpool = svn_pool_create(scratch_pool);
> > +  const char *revsprops_dir = svn_dirent_join(fs->path,
> PATH_REVPROPS_DIR,
> > +                                              scratch_pool);
> > +  int compression_level = ffd->compress_packed_revprops
> > +                           ? SVN_DELTA_COMPRESSION_LEVEL_DEFAULT
> > +                           : SVN_DELTA_COMPRESSION_LEVEL_NONE;
> > +
> > +  /* first, pack all revprops shards to match the packed revision
> shards */
> > +  for (shard = 0; shard < first_unpacked_shard; ++shard)
> > +    {
>
> Would it be useful to have a progress_func here, that is called once per
> shard or so?  Otherwise, this may perform an arbitrary amount of work
> (proportional to number of shards, i.e., O(HEAD)) with no feedback
> during it.
>

Implemented in r1495545.

-- Stefan^2.

Re: svn commit: r1358725 - /subversion/trunk/subversion/libsvn_fs_fs/fs_fs.c

Posted by Stefan Fuhrmann <st...@wandisco.com>.
On Wed, Jun 19, 2013 at 12:37 AM, Daniel Shahaf <da...@elego.de> wrote:

> stefan2@apache.org wrote on Sun, Jul 08, 2012 at 12:21:37 -0000:
> > Author: stefan2
> > Date: Sun Jul  8 12:21:36 2012
> > New Revision: 1358725
> >
> > URL: http://svn.apache.org/viewvc?rev=1358725&view=rev
> > Log:
> > When upgrading to format 6 (or later), we must make sure that
> > revprop shard packing is in sync with revision data shard packing.
> >
> > * subversion/libsvn_fs_fs/fs_fs.c
> >   (upgrade_pack_revprops): new function
> >   (upgrade_body): use the new function to pack revprop shards
> >
> > Modified:
> >     subversion/trunk/subversion/libsvn_fs_fs/fs_fs.c
> >
> > Modified: subversion/trunk/subversion/libsvn_fs_fs/fs_fs.c
> > URL:
> http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_fs/fs_fs.c?rev=1358725&r1=1358724&r2=1358725&view=diff
> >
> ==============================================================================
> > --- subversion/trunk/subversion/libsvn_fs_fs/fs_fs.c (original)
> > +++ subversion/trunk/subversion/libsvn_fs_fs/fs_fs.c Sun Jul  8 12:21:36
> 2012
> > @@ -1398,6 +1398,85 @@ create_file_ignore_eexist(const char *fi
> >    return svn_error_trace(err);
> >  }
> >
> > +/* In the filesystem FS, pack all revprop shards up to min_unpacked_rev.
> > + * Use SCRATCH_POOL for temporary allocations.
> > + */
> > +static svn_error_t *
> > +upgrade_pack_revprops(svn_fs_t *fs,
> > +                      apr_pool_t *scratch_pool)
> > +{
> > +  fs_fs_data_t *ffd = fs->fsap_data;
> > +  const char *revprops_shard_path;
> > +  const char *revprops_pack_file_dir;
> > +  apr_int64_t shard;
> > +  apr_int64_t first_unpacked_shard
> > +    =  ffd->min_unpacked_rev / ffd->max_files_per_dir;
> > +
> > +  apr_pool_t *iterpool = svn_pool_create(scratch_pool);
> > +  const char *revsprops_dir = svn_dirent_join(fs->path,
> PATH_REVPROPS_DIR,
> > +                                              scratch_pool);
> > +  int compression_level = ffd->compress_packed_revprops
> > +                           ? SVN_DELTA_COMPRESSION_LEVEL_DEFAULT
> > +                           : SVN_DELTA_COMPRESSION_LEVEL_NONE;
> > +
> > +  /* first, pack all revprops shards to match the packed revision
> shards */
> > +  for (shard = 0; shard < first_unpacked_shard; ++shard)
> > +    {
>
> Would it be useful to have a progress_func here, that is called once per
> shard or so?  Otherwise, this may perform an arbitrary amount of work
> (proportional to number of shards, i.e., O(HEAD)) with no feedback
> during it.
>

Implemented in r1495545.

-- Stefan^2.