You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by iv...@apache.org on 2015/11/24 08:40:34 UTC

svn commit: r1716047 - /subversion/trunk/subversion/libsvn_fs_fs/caching.c

Author: ivan
Date: Tue Nov 24 07:40:34 2015
New Revision: 1716047

URL: http://svn.apache.org/viewvc?rev=1716047&view=rev
Log:
* subversion/libsvn_fs_fs/caching.c
  (svn_fs_fs__initialize_txn_caches): Build txn directory cache prefix using
   one apr_strcat() call. 

Modified:
    subversion/trunk/subversion/libsvn_fs_fs/caching.c

Modified: subversion/trunk/subversion/libsvn_fs_fs/caching.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_fs/caching.c?rev=1716047&r1=1716046&r2=1716047&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_fs/caching.c (original)
+++ subversion/trunk/subversion/libsvn_fs_fs/caching.c Tue Nov 24 07:40:34 2015
@@ -816,18 +816,7 @@ svn_fs_fs__initialize_txn_caches(svn_fs_
                                  apr_pool_t *pool)
 {
   fs_fs_data_t *ffd = fs->fsap_data;
-
-  /* Transaction content needs to be carefully prefixed to virtually
-     eliminate any chance for conflicts. The (repo, txn_id) pair
-     should be unique but if a transaction fails, it might be possible
-     to start a new transaction later that receives the same id.
-     Therefore, throw in a uuid as well - just to be sure. */
-  const char *prefix = apr_pstrcat(pool,
-                                   "fsfs:", fs->uuid,
-                                   "/", fs->path,
-                                   ":", txn_id,
-                                   ":", svn_uuid_generate(pool), ":",
-                                   SVN_VA_NULL);
+  const char *prefix;
 
   /* We don't support caching for concurrent transactions in the SAME
    * FSFS session. Maybe, you forgot to clean POOL. */
@@ -839,6 +828,19 @@ svn_fs_fs__initialize_txn_caches(svn_fs_
       return SVN_NO_ERROR;
     }
 
+  /* Transaction content needs to be carefully prefixed to virtually
+     eliminate any chance for conflicts. The (repo, txn_id) pair
+     should be unique but if a transaction fails, it might be possible
+     to start a new transaction later that receives the same id.
+     Therefore, throw in a uuid as well - just to be sure. */
+  prefix = apr_pstrcat(pool,
+                       "fsfs:", fs->uuid,
+                       "/", fs->path,
+                       ":", txn_id,
+                       ":", svn_uuid_generate(pool),
+                       ":", "TXNDIR",
+                       SVN_VA_NULL);
+
   /* create a txn-local directory cache */
   SVN_ERR(create_cache(&ffd->txn_dir_cache,
                        NULL,
@@ -847,8 +849,7 @@ svn_fs_fs__initialize_txn_caches(svn_fs_
                        svn_fs_fs__serialize_dir_entries,
                        svn_fs_fs__deserialize_dir_entries,
                        APR_HASH_KEY_STRING,
-                       apr_pstrcat(pool, prefix, "TXNDIR",
-                                   SVN_VA_NULL),
+                       prefix,
                        0,
                        TRUE, /* The TXN-ID is our namespace. */
                        fs,