subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul Burba <ptbu...@gmail.com>
Subject Re: svn commit: r1381800 - /subversion/trunk/subversion/libsvn_subr/io.c
Date Fri, 07 Sep 2012 19:00:40 GMT
On Thu, Sep 6, 2012 at 7:32 PM,  <stefan2@apache.org> wrote:
> Author: stefan2
> Date: Thu Sep  6 23:32:11 2012
> New Revision: 1381800
>
> URL: http://svn.apache.org/viewvc?rev=1381800&view=rev
> Log:
> Re-implement svn_io_read_length_line as this is one of the
> most-called functions in SVN. Instead of reading data a byte
> at a time, read 128 byte chunks and scan those.
>
> * subversion/libsvn_subr/io.c
>   (svn_io_read_length_line): reimplement
>
> Modified:
>     subversion/trunk/subversion/libsvn_subr/io.c
>
> Modified: subversion/trunk/subversion/libsvn_subr/io.c
> URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_subr/io.c?rev=1381800&r1=1381799&r2=1381800&view=diff
> ==============================================================================
> --- subversion/trunk/subversion/libsvn_subr/io.c (original)
> +++ subversion/trunk/subversion/libsvn_subr/io.c Thu Sep  6 23:32:11 2012
> @@ -3427,30 +3427,60 @@ svn_error_t *
>  svn_io_read_length_line(apr_file_t *file, char *buf, apr_size_t *limit,
>                          apr_pool_t *pool)
>  {
> +  /* variables */
> +  apr_size_t total_read = 0;
> +  svn_boolean_t eof = FALSE;
>    const char *name;
>    svn_error_t *err;
> -  apr_size_t i;
> -  char c;
> +  apr_size_t buf_size = *limit;
>
> -  for (i = 0; i < *limit; i++)
> +  while (buf_size > 0)
>      {
> -      SVN_ERR(svn_io_file_getc(&c, file, pool));
> -      /* Note: this error could be APR_EOF, which
> -         is totally fine.  The caller should be aware of
> -         this. */
> -
> -      if (c == '\n')
> +      /* read a fair chunk of data at once. But don't get too ambitious
> +       * as that would result in too much waste. Also make sure we can
> +       * put a NUL after the last byte read.
> +       */
> +      apr_size_t to_read = buf_size < 129 ? buf_size - 1 : 128;
> +      apr_size_t bytes_read = 0;
> +      char *eol;
> +
> +      /* read data block (or just a part of it) */
> +      SVN_ERR(svn_io_file_read_full2(file, buf, to_read,
> +                                     &bytes_read, &eof, pool));
> +
> +      /* look or a newline char */
> +      buf[bytes_read] = 0;
> +      eol = strchr(buf, '\n');
> +      if (eol)
>          {
> -          buf[i] = '\0';
> -          *limit = i;
> +          apr_off_t offset = (eol + 1 - buf) - bytes_read;
> +
> +          *eol = 0;
> +          *limit = total_read + (eol - buf);
> +
> +          /* correct the file pointer:
> +           * appear as though we just had read the newline char
> +           */
> +          SVN_ERR(svn_io_file_seek(file, APR_CUR, &offset, pool));
> +
>            return SVN_NO_ERROR;
>          }
> -      else
> +      else if (eof)
>          {
> -          buf[i] = c;
> +          /* no EOL found but we hit the end of the file.
> +           * Generate a nice EOF error object and return it.
> +           */
> +          char dummy;
> +          SVN_ERR(svn_io_file_getc(&dummy, file, pool));
>          }
> +
> +      /* next data chunk */
> +      buf_size -= bytes_read;
> +      buf += bytes_read;
> +      total_read += bytes_read;
>      }
>
> +  /* buffer limit has been exceeded without finding the EOL */
>    err = svn_io_file_name_get(&name, file, pool);
>    if (err)
>      name = NULL;
>
>

Anybody else seeing this?

I haven't figured out why yet, but r1381800 is causing failures on my
Windows box, all similar to this:

C:\SVN\src-trunk>win-tests.py -d -c --test=basic#1 --log-to-stdout
--log-level=DEBUG
Testing Debug configuration on local repository.
START: basic_tests.py
I: CMD: svnadmin.exe create svn-test-work\local_tmp\repos
--bdb-txn-nosync --fs-type=fsfs
I: <TIME = 1.990000>
I: CMD: svn.exe import -m "Log message for revision 1."
svn-test-work\local_tmp\greekfiles
file:///C:/SVN/src-trunk/Debug/subversion/tests/cmdline/svn-test-work
/local_tmp/repos --config-dir
C:\SVN\src-trunk\Debug\subversion\tests\cmdline\svn-test-work\local_tmp\config
--password rayjandom --no-auth-cache --username jra
ndom
I: CMD: C:\SVN\src-trunk\Debug\subversion\svn\svn.exe import -m "Log
message for revision 1." svn-test-work\local_tmp\greekfiles
file:///C:/SVN/src-trunk/Debug/
subversion/tests/cmdline/svn-test-work/local_tmp/repos --config-dir
C:\SVN\src-trunk\Debug\subversion\tests\cmdline\svn-test-work\local_tmp\config
--password ra
yjandom --no-auth-cache --username jrandom exited with 1
I: <TIME = 4.514000>
I: ..\..\..\subversion\svn\import-cmd.c:128: (apr_err=70014)
I: ..\..\..\subversion\libsvn_client\commit.c:976: (apr_err=70014)
I: ..\..\..\subversion\libsvn_client\commit.c:712: (apr_err=70014)
I: ..\..\..\subversion\libsvn_client\commit.c:442: (apr_err=70014)
I: ..\..\..\subversion\libsvn_client\commit.c:535: (apr_err=70014)
I: ..\..\..\subversion\libsvn_repos\commit.c:348: (apr_err=70014)
I: ..\..\..\subversion\libsvn_fs\fs-loader.c:1123: (apr_err=70014)
I: ..\..\..\subversion\libsvn_fs_fs\tree.c:1827: (apr_err=70014)
I: ..\..\..\subversion\libsvn_fs_fs\tree.c:675: (apr_err=70014)
I: ..\..\..\subversion\libsvn_fs_fs\dag.c:1147: (apr_err=70014)
I: ..\..\..\subversion\libsvn_fs_fs\dag.c:315: (apr_err=70014)
I: ..\..\..\subversion\libsvn_fs_fs\fs_fs.c:5340: (apr_err=70014)
I: ..\..\..\subversion\libsvn_fs_fs\fs_fs.c:5291: (apr_err=70014)
I: ..\..\..\subversion\libsvn_fs_fs\fs_fs.c:5136: (apr_err=70014)
I: ..\..\..\subversion\libsvn_subr\stream.c:143: (apr_err=70014)
I: ..\..\..\subversion\libsvn_fs_fs\fs_fs.c:4905: (apr_err=70014)
I: ..\..\..\subversion\libsvn_fs_fs\fs_fs.c:4839: (apr_err=70014)
I: ..\..\..\subversion\libsvn_subr\io.c:3215: (apr_err=70014)
I: svn: E070014: Can't read file
'C:\SVN\src-trunk\Debug\subversion\tests\cmdline\svn-test-work\local_tmp\repos\db\revs\0\0':
End of file found
W: ..\..\..\subversion\svn\import-cmd.c:128: (apr_err=70014)
W: ..\..\..\subversion\libsvn_client\commit.c:976: (apr_err=70014)
W: ..\..\..\subversion\libsvn_client\commit.c:712: (apr_err=70014)
W: ..\..\..\subversion\libsvn_client\commit.c:442: (apr_err=70014)
W: ..\..\..\subversion\libsvn_client\commit.c:535: (apr_err=70014)
W: ..\..\..\subversion\libsvn_repos\commit.c:348: (apr_err=70014)
W: ..\..\..\subversion\libsvn_fs\fs-loader.c:1123: (apr_err=70014)
W: ..\..\..\subversion\libsvn_fs_fs\tree.c:1827: (apr_err=70014)
W: ..\..\..\subversion\libsvn_fs_fs\tree.c:675: (apr_err=70014)
W: ..\..\..\subversion\libsvn_fs_fs\dag.c:1147: (apr_err=70014)
W: ..\..\..\subversion\libsvn_fs_fs\dag.c:315: (apr_err=70014)
W: ..\..\..\subversion\libsvn_fs_fs\fs_fs.c:5340: (apr_err=70014)
W: ..\..\..\subversion\libsvn_fs_fs\fs_fs.c:5291: (apr_err=70014)
W: ..\..\..\subversion\libsvn_fs_fs\fs_fs.c:5136: (apr_err=70014)
W: ..\..\..\subversion\libsvn_subr\stream.c:143: (apr_err=70014)
W: ..\..\..\subversion\libsvn_fs_fs\fs_fs.c:4905: (apr_err=70014)
W: ..\..\..\subversion\libsvn_fs_fs\fs_fs.c:4839: (apr_err=70014)
W: ..\..\..\subversion\libsvn_subr\io.c:3215: (apr_err=70014)
W: svn: E070014: Can't read file
'C:\SVN\src-trunk\Debug\subversion\tests\cmdline\svn-test-work\local_tmp\repos\db\revs\0\0':
End of file found
END: basic_tests.py
ELAPSED: basic_tests.py 0:00:06.609000

-- 
Paul T. Burba
CollabNet, Inc. -- www.collab.net -- Enterprise Cloud Development
Skype: ptburba

Mime
View raw message