You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Ivan Zhakov <iv...@visualsvn.com> on 2016/10/13 14:36:34 UTC

Re: svn commit: r1764676 - /subversion/trunk/subversion/libsvn_fs_fs/pack.c

On 13 October 2016 at 15:49,  <st...@apache.org> wrote:
> Author: stefan2
> Date: Thu Oct 13 13:49:47 2016
> New Revision: 1764676
>
> URL: http://svn.apache.org/viewvc?rev=1764676&view=rev
> Log:
> Make the FSFS pack no longer depend on a working file trunc() operation.
>
> * subversion/libsvn_fs_fs/pack.c
>   (reset_pack_context): Instead of emptying the temporary files, close,
>                         auto-delete and re-create them.
>
> Modified:
>     subversion/trunk/subversion/libsvn_fs_fs/pack.c
>
> Modified: subversion/trunk/subversion/libsvn_fs_fs/pack.c
> URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_fs/pack.c?rev=1764676&r1=1764675&r2=1764676&view=diff
> ==============================================================================
> --- subversion/trunk/subversion/libsvn_fs_fs/pack.c (original)
> +++ subversion/trunk/subversion/libsvn_fs_fs/pack.c Thu Oct 13 13:49:47 2016
> @@ -341,20 +341,38 @@ static svn_error_t *
>  reset_pack_context(pack_context_t *context,
>                     apr_pool_t *pool)
>  {
> +  const char *temp_dir;
> +
>    apr_array_clear(context->changes);
> -  SVN_ERR(svn_io_file_trunc(context->changes_file, 0, pool));
> +  SVN_ERR(svn_io_file_close(context->changes_file, pool));
>    apr_array_clear(context->file_props);
> -  SVN_ERR(svn_io_file_trunc(context->file_props_file, 0, pool));
> +  SVN_ERR(svn_io_file_close(context->file_props_file, pool));
>    apr_array_clear(context->dir_props);
> -  SVN_ERR(svn_io_file_trunc(context->dir_props_file, 0, pool));
> +  SVN_ERR(svn_io_file_close(context->dir_props_file, pool));
>
>    apr_array_clear(context->rev_offsets);
>    apr_array_clear(context->path_order);
>    apr_array_clear(context->references);
>    apr_array_clear(context->reps);
> -  SVN_ERR(svn_io_file_trunc(context->reps_file, 0, pool));
> +  SVN_ERR(svn_io_file_close(context->reps_file, pool));
>
>    svn_pool_clear(context->info_pool);
> +
> +  /* The new temporary files must live at least as long as any other info
> +   * object in CONTEXT. */
> +  SVN_ERR(svn_io_temp_dir(&temp_dir, pool));
> +  SVN_ERR(svn_io_open_unique_file3(&context->changes_file, NULL, temp_dir,
> +                                   svn_io_file_del_on_close,
> +                                   context->info_pool, pool));
> +  SVN_ERR(svn_io_open_unique_file3(&context->file_props_file, NULL, temp_dir,
> +                                   svn_io_file_del_on_close,
> +                                   context->info_pool, pool));
> +  SVN_ERR(svn_io_open_unique_file3(&context->dir_props_file, NULL, temp_dir,
> +                                   svn_io_file_del_on_close,
> +                                   context->info_pool, pool));
> +  SVN_ERR(svn_io_open_unique_file3(&context->reps_file, NULL, temp_dir,
> +                                   svn_io_file_del_on_close,
> +                                   context->info_pool, pool));
Probably we should update code in initialize_pack_context() to use
CONTEX->INFO_POOL when opening these files initially?

-- 
Ivan Zhakov

Re: svn commit: r1764676 - /subversion/trunk/subversion/libsvn_fs_fs/pack.c

Posted by Stefan Fuhrmann <st...@apache.org>.
On 13.10.2016 16:36, Ivan Zhakov wrote:
> On 13 October 2016 at 15:49,  <st...@apache.org> wrote:
>> Author: stefan2
>> Date: Thu Oct 13 13:49:47 2016
>> New Revision: 1764676
>>
>> URL: http://svn.apache.org/viewvc?rev=1764676&view=rev
>> Log:
>> Make the FSFS pack no longer depend on a working file trunc() operation.
>>
>> * subversion/libsvn_fs_fs/pack.c
>>    (reset_pack_context): Instead of emptying the temporary files, close,
>>                          auto-delete and re-create them.
>>
>> Modified:
>>      subversion/trunk/subversion/libsvn_fs_fs/pack.c
>>
>> Modified: subversion/trunk/subversion/libsvn_fs_fs/pack.c
>> URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_fs/pack.c?rev=1764676&r1=1764675&r2=1764676&view=diff
>> ==============================================================================
>> --- subversion/trunk/subversion/libsvn_fs_fs/pack.c (original)
>> +++ subversion/trunk/subversion/libsvn_fs_fs/pack.c Thu Oct 13 13:49:47 2016
>> @@ -341,20 +341,38 @@ static svn_error_t *
>>   reset_pack_context(pack_context_t *context,
>>                      apr_pool_t *pool)
>>   {
>> +  const char *temp_dir;
>> +
>>     apr_array_clear(context->changes);
>> -  SVN_ERR(svn_io_file_trunc(context->changes_file, 0, pool));
>> +  SVN_ERR(svn_io_file_close(context->changes_file, pool));
>>     apr_array_clear(context->file_props);
>> -  SVN_ERR(svn_io_file_trunc(context->file_props_file, 0, pool));
>> +  SVN_ERR(svn_io_file_close(context->file_props_file, pool));
>>     apr_array_clear(context->dir_props);
>> -  SVN_ERR(svn_io_file_trunc(context->dir_props_file, 0, pool));
>> +  SVN_ERR(svn_io_file_close(context->dir_props_file, pool));
>>
>>     apr_array_clear(context->rev_offsets);
>>     apr_array_clear(context->path_order);
>>     apr_array_clear(context->references);
>>     apr_array_clear(context->reps);
>> -  SVN_ERR(svn_io_file_trunc(context->reps_file, 0, pool));
>> +  SVN_ERR(svn_io_file_close(context->reps_file, pool));
>>
>>     svn_pool_clear(context->info_pool);
>> +
>> +  /* The new temporary files must live at least as long as any other info
>> +   * object in CONTEXT. */
>> +  SVN_ERR(svn_io_temp_dir(&temp_dir, pool));
>> +  SVN_ERR(svn_io_open_unique_file3(&context->changes_file, NULL, temp_dir,
>> +                                   svn_io_file_del_on_close,
>> +                                   context->info_pool, pool));
>> +  SVN_ERR(svn_io_open_unique_file3(&context->file_props_file, NULL, temp_dir,
>> +                                   svn_io_file_del_on_close,
>> +                                   context->info_pool, pool));
>> +  SVN_ERR(svn_io_open_unique_file3(&context->dir_props_file, NULL, temp_dir,
>> +                                   svn_io_file_del_on_close,
>> +                                   context->info_pool, pool));
>> +  SVN_ERR(svn_io_open_unique_file3(&context->reps_file, NULL, temp_dir,
>> +                                   svn_io_file_del_on_close,
>> +                                   context->info_pool, pool));
> Probably we should update code in initialize_pack_context() to use
> CONTEX->INFO_POOL when opening these files initially?
Yes, we should. Done in r1795612.

-- Stefan^2.