subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From stef...@apache.org
Subject svn commit: r998843 - in /subversion/branches/integrate-cache-membuffer: ./ subversion/include/private/svn_fs_private.h subversion/include/svn_fs.h subversion/libsvn_fs_fs/caching.c subversion/libsvn_fs_util/caching.c
Date Mon, 20 Sep 2010 09:27:17 GMT
Author: stefan2
Date: Mon Sep 20 09:27:17 2010
New Revision: 998843

URL: http://svn.apache.org/viewvc?rev=998843&view=rev
Log:
This patch combines all patches from the performance branch that
implement the membuffer cache configuration but without the UI change.
A process-global membuffer cache will now be used for full-texts 
unless memcached has been enabled for the respective directory.

To minimize the number of future conflicts, the configuration structure 
has been brought up to its final state even if some options (cached file
handle count, txdelta caching etc.) will have no effect right now. 

Merged revisions from /branches/performance:
981684, 982043, 988319
Merged only partially (excluding all changes not related to the
membuffer cache):
987886

* subversion/include/private/svn_fs_private.h
  (svn_fs__get_global_membuffer_cache): 
   declare new internal API function
* subversion/include/svn_fs.h
  (svn_fs_cache_config_t): new cache config struct
  (svn_fs_get_cache_config, svn_fs_set_cache_config): new public API
   to get & modify the cache config; currently evaluated by FSFS only

* subversion/libsvn_fs_util/caching.c
  (cache_settings): new global cache settings + their defaults
  (svn_fs__get_global_membuffer_cache, svn_fs_get_cache_config, 
   svn_fs_set_cache_config): implement new public and internal API functions
* subversion/libsvn_fs_fs/caching.c
  (svn_fs_fs__initialize_caches): use membuffer cache for full-texts

Added:
    subversion/branches/integrate-cache-membuffer/subversion/libsvn_fs_util/caching.c
      - copied, changed from r987886, subversion/branches/performance/subversion/libsvn_fs/caching.c
Modified:
    subversion/branches/integrate-cache-membuffer/   (props changed)
    subversion/branches/integrate-cache-membuffer/subversion/include/private/svn_fs_private.h
    subversion/branches/integrate-cache-membuffer/subversion/include/svn_fs.h
    subversion/branches/integrate-cache-membuffer/subversion/libsvn_fs_fs/caching.c

Propchange: subversion/branches/integrate-cache-membuffer/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Sep 20 09:27:17 2010
@@ -22,7 +22,7 @@
 /subversion/branches/log-g-performance:870941-871032
 /subversion/branches/merge-skips-obstructions:874525-874615
 /subversion/branches/nfc-nfd-aware-client:870276,870376
-/subversion/branches/performance:979193,980118,981087,983764,983766,984927,984973,985014,985037,985046,985669,986605,986832,987893,990541,990568,990572,990600,990759,992899,992904,992911,994956,995507,995603
+/subversion/branches/performance:979193,980118,981087,981684,982043,983764,983766,984927,984973,985014,985037,985046,985669,986605,986832,987893,988319,990541,990568,990572,990600,990759,992899,992904,992911,994956,995507,995603
 /subversion/branches/ra_serf-digest-authn:875693-876404
 /subversion/branches/reintegrate-improvements:873853-874164
 /subversion/branches/subtree-mergeinfo:876734-878766

Modified: subversion/branches/integrate-cache-membuffer/subversion/include/private/svn_fs_private.h
URL: http://svn.apache.org/viewvc/subversion/branches/integrate-cache-membuffer/subversion/include/private/svn_fs_private.h?rev=998843&r1=998842&r2=998843&view=diff
==============================================================================
--- subversion/branches/integrate-cache-membuffer/subversion/include/private/svn_fs_private.h
(original)
+++ subversion/branches/integrate-cache-membuffer/subversion/include/private/svn_fs_private.h
Mon Sep 20 09:27:17 2010
@@ -91,6 +91,15 @@ svn_fs__commit_obliteration_txn(svn_revn
                                 apr_pool_t *pool);
 
 
+/* Access the process-global (singleton) membuffer cache. The first call
+ * will automatically allocate the cache using the current cache config.
+ * NULL will be returned if the desired cache size is 0.
+ *
+ * @since New in 1.7.
+ */
+struct svn_membuffer_t *
+svn_fs__get_global_membuffer_cache(void);
+
 #ifdef __cplusplus
 }
 #endif /* __cplusplus */

Modified: subversion/branches/integrate-cache-membuffer/subversion/include/svn_fs.h
URL: http://svn.apache.org/viewvc/subversion/branches/integrate-cache-membuffer/subversion/include/svn_fs.h?rev=998843&r1=998842&r2=998843&view=diff
==============================================================================
--- subversion/branches/integrate-cache-membuffer/subversion/include/svn_fs.h (original)
+++ subversion/branches/integrate-cache-membuffer/subversion/include/svn_fs.h Mon Sep 20 09:27:17
2010
@@ -2224,8 +2224,52 @@ svn_fs_pack(const char *db_path,
             apr_pool_t *pool);
 
 
+/** @defgroup svn_fs_cach_config Filesystem caching configuration
+ * @{
+ * @since New in 1.7. */
+
+/* FSFS cache settings. It controls what caches, in what size and
+   how they will be created. The settings apply for the whole process.
+ */
+typedef struct svn_fs_cache_config_t
+{
+  /* total cache size in bytes. May be 0, resulting in no cache being used */
+  apr_uint64_t cache_size;
+
+  /* maximum number of files kept open */
+  apr_size_t file_handle_count;
+
+  /* shall fulltexts be cached? */
+  svn_boolean_t cache_fulltexts;
+
+  /* shall text deltas be cached? */
+  svn_boolean_t cache_txdeltas;
+
+  /* is this a guaranteed single-threaded application? */
+  svn_boolean_t single_threaded;
+} svn_fs_cache_config_t;
+
+/* Get the current FSFS cache configuration. If it has not been set,
+   this function will return the default settings.
+ */
+const svn_fs_cache_config_t *
+svn_fs_get_cache_config(void);
+
+/* Set the FSFS cache configuration. Please note that it may not change
+   the actual configuration *in use*. Therefore, call it before reading
+   data from any FSFS repo and call it only once.
+
+   This function is not thread-safe. Therefore, it should be called once
+   from the processes' initialization code only.
+ */
+void
+svn_fs_set_cache_config(const svn_fs_cache_config_t *settings);
+
 /** @} */
 
+/** @} */
+
+
 #ifdef __cplusplus
 }
 #endif /* __cplusplus */

Modified: subversion/branches/integrate-cache-membuffer/subversion/libsvn_fs_fs/caching.c
URL: http://svn.apache.org/viewvc/subversion/branches/integrate-cache-membuffer/subversion/libsvn_fs_fs/caching.c?rev=998843&r1=998842&r2=998843&view=diff
==============================================================================
--- subversion/branches/integrate-cache-membuffer/subversion/libsvn_fs_fs/caching.c (original)
+++ subversion/branches/integrate-cache-membuffer/subversion/libsvn_fs_fs/caching.c Mon Sep
20 09:27:17 2010
@@ -300,12 +300,27 @@ svn_fs_fs__initialize_caches(svn_fs_t *f
                                          apr_pstrcat(pool, prefix, "TEXT",
                                                      NULL),
                                          fs->pool));
-      if (! no_handler)
-        SVN_ERR(svn_cache__set_error_handler(ffd->fulltext_cache,
-                                             warn_on_cache_errors, fs, pool));
+    }
+  else if (svn_fs__get_global_membuffer_cache() && 
+           svn_fs_get_cache_config()->cache_fulltexts)
+    {
+      SVN_ERR(svn_cache__create_membuffer_cache(&(ffd->fulltext_cache),
+                                                svn_fs__get_global_membuffer_cache(),
+                                                /* Values are svn_string_t */
+                                                NULL, NULL,
+                                                APR_HASH_KEY_STRING,
+                                                apr_pstrcat(pool, prefix, "TEXT",
+                                                            NULL),
+                                                fs->pool));
     }
   else
-    ffd->fulltext_cache = NULL;
+    {
+      ffd->fulltext_cache = NULL;
+    }
+
+  if (ffd->fulltext_cache && ! no_handler)
+    SVN_ERR(svn_cache__set_error_handler(ffd->fulltext_cache,
+            warn_on_cache_errors, fs, pool));
 
   return SVN_NO_ERROR;
 }

Copied: subversion/branches/integrate-cache-membuffer/subversion/libsvn_fs_util/caching.c
(from r987886, subversion/branches/performance/subversion/libsvn_fs/caching.c)
URL: http://svn.apache.org/viewvc/subversion/branches/integrate-cache-membuffer/subversion/libsvn_fs_util/caching.c?p2=subversion/branches/integrate-cache-membuffer/subversion/libsvn_fs_util/caching.c&p1=subversion/branches/performance/subversion/libsvn_fs/caching.c&r1=987886&r2=998843&rev=998843&view=diff
==============================================================================
--- subversion/branches/performance/subversion/libsvn_fs/caching.c (original)
+++ subversion/branches/integrate-cache-membuffer/subversion/libsvn_fs_util/caching.c Mon
Sep 20 09:27:17 2010
@@ -23,7 +23,6 @@
 #include "svn_fs.h"
 #include "private/svn_fs_private.h"
 #include "private/svn_cache.h"
-#include "private/svn_file_handle_cache.h"
 
 #include "svn_pools.h"
 
@@ -86,24 +85,6 @@ svn_fs__get_global_membuffer_cache(void)
   return cache;
 }
 
-/* Access the process-global (singleton) open file handle cache. The first
- * call will automatically allocate the cache using the current cache config.
- * Even for file handle limit of 0, a cache object will be returned.
- */
-svn_file_handle_cache_t *
-svn_fs__get_global_file_handle_cache(void)
-{
-  static svn_file_handle_cache_t *cache = NULL;
-
-  if (!cache)
-    svn_file_handle_cache__create_cache(&cache,
-                                        cache_settings.file_handle_count,
-                                        !cache_settings.single_threaded,
-                                        svn_pool_create(NULL));
-
-  return cache;
-}
-
 void 
 svn_fs_set_cache_config(const svn_fs_cache_config_t *settings)
 {
@@ -112,8 +93,5 @@ svn_fs_set_cache_config(const svn_fs_cac
   /* Allocate global membuffer cache as a side-effect.
    * Only the first call will actually take affect. */
   svn_fs__get_global_membuffer_cache();
-
-  /* Same for the file handle cache. */
-  svn_fs__get_global_file_handle_cache();
 }
 



Mime
View raw message