You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by st...@apache.org on 2013/11/12 23:51:57 UTC

svn commit: r1541293 - in /subversion/trunk/subversion: include/private/svn_repos_private.h libsvn_repos/repos_pool.c

Author: stefan2
Date: Tue Nov 12 22:51:57 2013
New Revision: 1541293

URL: http://svn.apache.org/r1541293
Log:
To support our test suite, teach the repos pool to optionally
require a specific repository UUID and to re-read from disk
upon mismatch.  This allows our test suite to replace repositories
without restarting the server.

* subversion/include/private/svn_repos_private.h
  (svn_repos__repos_pool_get): add UUID parameter

* subversion/libsvn_repos/repos_pool.c
  (svn_repos__repos_pool_get): update implementation

Modified:
    subversion/trunk/subversion/include/private/svn_repos_private.h
    subversion/trunk/subversion/libsvn_repos/repos_pool.c

Modified: subversion/trunk/subversion/include/private/svn_repos_private.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/private/svn_repos_private.h?rev=1541293&r1=1541292&r2=1541293&view=diff
==============================================================================
--- subversion/trunk/subversion/include/private/svn_repos_private.h (original)
+++ subversion/trunk/subversion/include/private/svn_repos_private.h Tue Nov 12 22:51:57 2013
@@ -282,9 +282,12 @@ svn_repos__repos_pool_create(svn_repos__
                              apr_pool_t *pool);
 
 /* Set *REPOS_P to an open repository object for the repository at local
- * path REPOS_ROOT.  Once POOL gets cleared or destroyed, REPOS_POOL will
- * store the repository instance and make further callers may return that
- * same instance.  POOL determines the minimum lifetime of *REPOS_P.
+ * path REPOS_ROOT.  If UUID is given, the repository's UUID must match it;
+ * otherwise we re-read from disk.
+ *
+ * Once POOL gets cleared or destroyed, REPOS_POOL will store the repository
+ * instance and make further callers may return that same instance.  POOL
+ * determines the minimum lifetime of *REPOS_P.
  *
  * Note that you may need to update the youngest revision info cached
  * inside *REPOS_P. 
@@ -293,6 +296,7 @@ svn_error_t *
 svn_repos__repos_pool_get(svn_repos_t **repos_p,
                           svn_repos__repos_pool_t *repos_pool,
                           const char *repos_root,
+                          const char *uuid,
                           apr_pool_t *pool);
 
 /** @} */

Modified: subversion/trunk/subversion/libsvn_repos/repos_pool.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_repos/repos_pool.c?rev=1541293&r1=1541292&r2=1541293&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_repos/repos_pool.c (original)
+++ subversion/trunk/subversion/libsvn_repos/repos_pool.c Tue Nov 12 22:51:57 2013
@@ -88,6 +88,7 @@ svn_error_t *
 svn_repos__repos_pool_get(svn_repos_t **repos_p,
                           svn_repos__repos_pool_t *repos_pool,
                           const char *repos_root,
+                          const char *uuid,
                           apr_pool_t *pool)
 {
   svn_repos_t *repos;
@@ -98,7 +99,21 @@ svn_repos__repos_pool_get(svn_repos_t **
   SVN_ERR(svn_object_pool__lookup((void **)repos_p, repos_pool->object_pool,
                                   key, NULL, pool));
   if (*repos_p)
-    return SVN_NO_ERROR;
+    {
+      if (uuid)
+        {
+          /* use a cached repo only if it matches the given UUID */
+          const char *actual;
+          SVN_ERR(svn_fs_get_uuid(svn_repos_fs(*repos_p), &actual, pool));
+          if (strcmp(actual, uuid) == 0)
+            return SVN_NO_ERROR;
+        }
+      else
+        {
+          /* no UUID specified by caller -> all repos match */
+          return SVN_NO_ERROR;
+        }
+    }
 
   /* open repos in its private pool */
   wrapper_pool