You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by br...@apache.org on 2013/04/05 16:11:49 UTC

svn commit: r1464985 - in /subversion/trunk/subversion: svnadmin/svnadmin.c tests/cmdline/svntest/main.py

Author: brane
Date: Fri Apr  5 14:11:49 2013
New Revision: 1464985

URL: http://svn.apache.org/r1464985
Log:
Make "svnadmin create --fs-type=bdb" warn about the BDB back-end deprecation.

* subversion/svnadmin/svnadmin.c (subcommand_create): Print a warning to stderr
   if the requested filesystem type is "bdb".

* subversion/tests/cmdline/svntest/main.py (create_repos): Expect the output
   of "svnadmin create" to contain that warning.

Modified:
    subversion/trunk/subversion/svnadmin/svnadmin.c
    subversion/trunk/subversion/tests/cmdline/svntest/main.py

Modified: subversion/trunk/subversion/svnadmin/svnadmin.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svnadmin/svnadmin.c?rev=1464985&r1=1464984&r2=1464985&view=diff
==============================================================================
--- subversion/trunk/subversion/svnadmin/svnadmin.c (original)
+++ subversion/trunk/subversion/svnadmin/svnadmin.c Fri Apr  5 14:11:49 2013
@@ -643,7 +643,19 @@ subcommand_create(apr_getopt_t *os, void
                 (opt_state->bdb_log_keep ? "0" :"1"));
 
   if (opt_state->fs_type)
-    svn_hash_sets(fs_config, SVN_FS_CONFIG_FS_TYPE, opt_state->fs_type);
+    {
+      /* The non-default Berkeley DB backend is deprecated. */
+      if (0 == strcmp(opt_state->fs_type, "bdb"))
+        {
+          svn_error_t *const warning = svn_error_create(
+              SVN_WARNING, NULL,
+              "The 'bdb' repository back-end is deprecated,"
+              " consider using 'fsfs' instead.");
+          svn_handle_warning2(stderr, warning, "svnadmin: ");
+          svn_error_clear(warning);
+        }
+      svn_hash_sets(fs_config, SVN_FS_CONFIG_FS_TYPE, opt_state->fs_type);
+    }
 
   /* Prior to 1.8, we had explicit options to specify compatibility
      with a handful of prior Subversion releases. */

Modified: subversion/trunk/subversion/tests/cmdline/svntest/main.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/svntest/main.py?rev=1464985&r1=1464984&r2=1464985&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/svntest/main.py (original)
+++ subversion/trunk/subversion/tests/cmdline/svntest/main.py Fri Apr  5 14:11:49 2013
@@ -881,12 +881,26 @@ def create_repos(path, minor_version = N
 
   # Skip tests if we can't create the repository.
   if stderr:
+    stderr_lines = 0
+    using_bdb_backend = (options.fs_type == "bdb")
+    bdb_deprecation_warning = False
     for line in stderr:
+      stderr_lines += 1
       if line.find('Unknown FS type') != -1:
         raise Skip
-    # If the FS type is known, assume the repos couldn't be created
-    # (e.g. due to a missing 'svnadmin' binary).
-    raise SVNRepositoryCreateFailure("".join(stderr).rstrip())
+      if using_bdb_backend:
+        if line.find("The 'bdb' repository back-end is deprecated") != -1:
+          bdb_deprecation_warning = True
+
+    # Creating BDB repositories will cause svnadmin to print a warning
+    # which should be ignored.
+    if using_bdb_backend and bdb_deprecation_warning and stderr_lines == 1:
+      pass
+    else:
+      # If the FS type is known and we noticed more than just the
+      # BDB-specific warning, assume the repos couldn't be created
+      # (e.g. due to a missing 'svnadmin' binary).
+      raise SVNRepositoryCreateFailure("".join(stderr).rstrip())
 
   # Require authentication to write to the repos, for ra_svn testing.
   file_write(get_svnserve_conf_file_path(path),



Re: svn commit: r1464985 - in /subversion/trunk/subversion: svnadmin/svnadmin.c tests/cmdline/svntest/main.py

Posted by Ben Reser <be...@reser.org>.
On Sat, Apr 6, 2013 at 3:55 AM, Branko Čibej <br...@wandisco.com> wrote:
> In many ways your change is better than mine. So if you don't mind, I'll
> merge the two (and adjust the test infrastructure accordingly).

Go for it.

Re: svn commit: r1464985 - in /subversion/trunk/subversion: svnadmin/svnadmin.c tests/cmdline/svntest/main.py

Posted by Ben Reser <be...@reser.org>.
On Sat, Apr 6, 2013 at 3:55 AM, Branko Čibej <br...@wandisco.com> wrote:
> In many ways your change is better than mine. So if you don't mind, I'll
> merge the two (and adjust the test infrastructure accordingly).

Go for it.

Re: svn commit: r1464985 - in /subversion/trunk/subversion: svnadmin/svnadmin.c tests/cmdline/svntest/main.py

Posted by Branko Čibej <br...@wandisco.com>.
On 06.04.2013 05:14, Ben Reser wrote:
> On Fri, Apr 5, 2013 at 7:11 AM,  <br...@apache.org> wrote:
>> Author: brane
>> Date: Fri Apr  5 14:11:49 2013
>> New Revision: 1464985
>>
>> URL: http://svn.apache.org/r1464985
>> Log:
>> Make "svnadmin create --fs-type=bdb" warn about the BDB back-end deprecation.
>>
>> * subversion/svnadmin/svnadmin.c (subcommand_create): Print a warning to stderr
>>    if the requested filesystem type is "bdb".
>>
>> * subversion/tests/cmdline/svntest/main.py (create_repos): Expect the output
>>    of "svnadmin create" to contain that warning.
> I actually started doing this today while I was on a plane since you
> hadn't gotten around to it.
>
> My code ended up looking very similar to yours:
> [[[
>       /* With 1.8 we are announcing that BDB is deprecated.  No support
>        * has been removed and it will continue to work until some future
>        * date.  The purpose here is to discourage people from creating
>        * new BDB repositories which they will need to dump/load into
>        * FSFS or some new FS type in the future. */
>       if (0 == strcmp(opt_state->fs_type, SVN_FS_TYPE_BDB))
>         {
>           SVN_ERR(svn_cmdline_fprintf(stderr, pool, _("%swarning: FS type '%s'"
>                                                       " has been deprecated\n"),
>                                       "svnadmin: ", opt_state->fs_type));
>           fflush(stderr);
>         }
>       svn_hash_sets(fs_config, SVN_FS_CONFIG_FS_TYPE, opt_state->fs_type);
> ]]]
>
> I've gone ahead and wrapped the error string in _() so it can be
> translated and switched to using the constants for the fs type strings
> in r1465170.
>
> I didn't end up using svn_handle_warning2() because it just felt dirty
> to build a svn_error_t just to print a warning (especially since
> producing global pools is so slow).  Nor did a generic warning code
> seem useful.  But I'm not going to change it now unless you agree.
>
> I did like your fsfs suggestion though.

In many ways your change is better than mine. So if you don't mind, I'll
merge the two (and adjust the test infrastructure accordingly).

-- Brane

-- 
Branko Čibej
Director of Subversion | WANdisco | www.wandisco.com


Re: svn commit: r1464985 - in /subversion/trunk/subversion: svnadmin/svnadmin.c tests/cmdline/svntest/main.py

Posted by Ben Reser <be...@reser.org>.
On Fri, Apr 5, 2013 at 7:11 AM,  <br...@apache.org> wrote:
> Author: brane
> Date: Fri Apr  5 14:11:49 2013
> New Revision: 1464985
>
> URL: http://svn.apache.org/r1464985
> Log:
> Make "svnadmin create --fs-type=bdb" warn about the BDB back-end deprecation.
>
> * subversion/svnadmin/svnadmin.c (subcommand_create): Print a warning to stderr
>    if the requested filesystem type is "bdb".
>
> * subversion/tests/cmdline/svntest/main.py (create_repos): Expect the output
>    of "svnadmin create" to contain that warning.

I actually started doing this today while I was on a plane since you
hadn't gotten around to it.

My code ended up looking very similar to yours:
[[[
      /* With 1.8 we are announcing that BDB is deprecated.  No support
       * has been removed and it will continue to work until some future
       * date.  The purpose here is to discourage people from creating
       * new BDB repositories which they will need to dump/load into
       * FSFS or some new FS type in the future. */
      if (0 == strcmp(opt_state->fs_type, SVN_FS_TYPE_BDB))
        {
          SVN_ERR(svn_cmdline_fprintf(stderr, pool, _("%swarning: FS type '%s'"
                                                      " has been deprecated\n"),
                                      "svnadmin: ", opt_state->fs_type));
          fflush(stderr);
        }
      svn_hash_sets(fs_config, SVN_FS_CONFIG_FS_TYPE, opt_state->fs_type);
]]]

I've gone ahead and wrapped the error string in _() so it can be
translated and switched to using the constants for the fs type strings
in r1465170.

I didn't end up using svn_handle_warning2() because it just felt dirty
to build a svn_error_t just to print a warning (especially since
producing global pools is so slow).  Nor did a generic warning code
seem useful.  But I'm not going to change it now unless you agree.

I did like your fsfs suggestion though.

Re: svn commit: r1464985 - in /subversion/trunk/subversion: svnadmin/svnadmin.c tests/cmdline/svntest/main.py

Posted by Ben Reser <be...@reser.org>.
On Fri, Apr 5, 2013 at 7:11 AM,  <br...@apache.org> wrote:
> Author: brane
> Date: Fri Apr  5 14:11:49 2013
> New Revision: 1464985
>
> URL: http://svn.apache.org/r1464985
> Log:
> Make "svnadmin create --fs-type=bdb" warn about the BDB back-end deprecation.
>
> * subversion/svnadmin/svnadmin.c (subcommand_create): Print a warning to stderr
>    if the requested filesystem type is "bdb".
>
> * subversion/tests/cmdline/svntest/main.py (create_repos): Expect the output
>    of "svnadmin create" to contain that warning.

I actually started doing this today while I was on a plane since you
hadn't gotten around to it.

My code ended up looking very similar to yours:
[[[
      /* With 1.8 we are announcing that BDB is deprecated.  No support
       * has been removed and it will continue to work until some future
       * date.  The purpose here is to discourage people from creating
       * new BDB repositories which they will need to dump/load into
       * FSFS or some new FS type in the future. */
      if (0 == strcmp(opt_state->fs_type, SVN_FS_TYPE_BDB))
        {
          SVN_ERR(svn_cmdline_fprintf(stderr, pool, _("%swarning: FS type '%s'"
                                                      " has been deprecated\n"),
                                      "svnadmin: ", opt_state->fs_type));
          fflush(stderr);
        }
      svn_hash_sets(fs_config, SVN_FS_CONFIG_FS_TYPE, opt_state->fs_type);
]]]

I've gone ahead and wrapped the error string in _() so it can be
translated and switched to using the constants for the fs type strings
in r1465170.

I didn't end up using svn_handle_warning2() because it just felt dirty
to build a svn_error_t just to print a warning (especially since
producing global pools is so slow).  Nor did a generic warning code
seem useful.  But I'm not going to change it now unless you agree.

I did like your fsfs suggestion though.