You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by ju...@apache.org on 2015/08/13 17:54:56 UTC
svn commit: r1695730 [2/9] - in /subversion/branches/move-tracking-2: ./
build/ build/ac-macros/ notes/ subversion/
subversion/bindings/javahl/native/ subversion/bindings/swig/
subversion/include/ subversion/include/private/ subversion/libsvn_client/
s...
Modified: subversion/branches/move-tracking-2/subversion/libsvn_fs_fs/caching.c
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/libsvn_fs_fs/caching.c?rev=1695730&r1=1695729&r2=1695730&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/libsvn_fs_fs/caching.c (original)
+++ subversion/branches/move-tracking-2/subversion/libsvn_fs_fs/caching.c Thu Aug 13 15:54:54 2015
@@ -274,7 +274,8 @@ init_callbacks(svn_cache__t *cache,
* MEMBUFFER is not NULL. Fallbacks to inprocess cache if MEMCACHE and
* MEMBUFFER are NULL and pages is non-zero. Sets *CACHE_P to NULL
* otherwise. Use the given PRIORITY class for the new cache. If it
- * is 0, then use the default priority class.
+ * is 0, then use the default priority class. HAS_NAMESPACE indicates
+ * whether we prefixed this cache instance with a namespace.
*
* Unless NO_HANDLER is true, register an error handler that reports errors
* as warnings to the FS warning callback.
@@ -292,6 +293,7 @@ create_cache(svn_cache__t **cache_p,
apr_ssize_t klen,
const char *prefix,
apr_uint32_t priority,
+ svn_boolean_t has_namespace,
svn_fs_t *fs,
svn_boolean_t no_handler,
apr_pool_t *result_pool,
@@ -314,9 +316,12 @@ create_cache(svn_cache__t **cache_p,
}
else if (membuffer)
{
+ /* We assume caches with namespaces to be relatively short-lived,
+ * i.e. their data will not be needed after a while. */
SVN_ERR(svn_cache__create_membuffer_cache(
cache_p, membuffer, serializer, deserializer,
- klen, prefix, priority, FALSE, result_pool, scratch_pool));
+ klen, prefix, priority, FALSE, has_namespace,
+ result_pool, scratch_pool));
}
else if (pages)
{
@@ -349,6 +354,7 @@ svn_fs_fs__initialize_caches(svn_fs_t *f
svn_boolean_t cache_txdeltas;
svn_boolean_t cache_fulltexts;
const char *cache_namespace;
+ svn_boolean_t has_namespace;
/* Evaluating the cache configuration. */
SVN_ERR(read_config(&cache_namespace,
@@ -358,6 +364,7 @@ svn_fs_fs__initialize_caches(svn_fs_t *f
pool));
prefix = apr_pstrcat(pool, "ns:", cache_namespace, ":", prefix, SVN_VA_NULL);
+ has_namespace = strlen(cache_namespace) > 0;
membuffer = svn_cache__get_global_membuffer_cache();
@@ -386,34 +393,35 @@ svn_fs_fs__initialize_caches(svn_fs_t *f
* commands, this is only going to contain a few entries (svnadmin
* dump/verify is an exception here), so to reduce overhead let's
* try to keep it to just one page. I estimate each entry has about
- * 72 bytes of overhead (svn_revnum_t key, svn_fs_id_t +
- * id_private_t + 3 strings for value, and the cache_entry); the
- * default pool size is 8192, so about a hundred should fit
- * comfortably. */
+ * 130 bytes of overhead (svn_revnum_t key, ID struct, and the cache_entry);
+ * the default pool size is 8192, so about a fifty should fit comfortably.
+ */
SVN_ERR(create_cache(&(ffd->rev_root_id_cache),
NULL,
membuffer,
- 1, 100,
+ 1, 50,
svn_fs_fs__serialize_id,
svn_fs_fs__deserialize_id,
sizeof(svn_revnum_t),
apr_pstrcat(pool, prefix, "RRI", SVN_VA_NULL),
0,
+ has_namespace,
fs,
no_handler,
fs->pool, pool));
- /* Rough estimate: revision DAG nodes have size around 320 bytes, so
- * let's put 16 on a page. */
+ /* Rough estimate: revision DAG nodes have size around 1kBytes, so
+ * let's put 8 on a page. */
SVN_ERR(create_cache(&(ffd->rev_node_cache),
NULL,
membuffer,
- 1024, 16,
+ 1, 8,
svn_fs_fs__dag_serialize,
svn_fs_fs__dag_deserialize,
APR_HASH_KEY_STRING,
apr_pstrcat(pool, prefix, "DAG", SVN_VA_NULL),
SVN_CACHE__MEMBUFFER_LOW_PRIORITY,
+ has_namespace,
fs,
no_handler,
fs->pool, pool));
@@ -425,28 +433,30 @@ svn_fs_fs__initialize_caches(svn_fs_t *f
SVN_ERR(create_cache(&(ffd->dir_cache),
NULL,
membuffer,
- 1024, 8,
+ 1, 8,
svn_fs_fs__serialize_dir_entries,
svn_fs_fs__deserialize_dir_entries,
sizeof(pair_cache_key_t),
apr_pstrcat(pool, prefix, "DIR", SVN_VA_NULL),
SVN_CACHE__MEMBUFFER_DEFAULT_PRIORITY,
+ has_namespace,
fs,
no_handler,
fs->pool, pool));
- /* Only 16 bytes per entry (a revision number + the corresponding offset).
- Since we want ~8k pages, that means 512 entries per page. */
+ /* 8 kBytes per entry (1000 revs / shared, one file offset per rev).
+ Covering about 8 pack files gives us an "o.k." hit rate. */
SVN_ERR(create_cache(&(ffd->packed_offset_cache),
NULL,
membuffer,
- 32, 1,
+ 8, 1,
svn_fs_fs__serialize_manifest,
svn_fs_fs__deserialize_manifest,
sizeof(svn_revnum_t),
apr_pstrcat(pool, prefix, "PACK-MANIFEST",
SVN_VA_NULL),
SVN_CACHE__MEMBUFFER_HIGH_PRIORITY,
+ has_namespace,
fs,
no_handler,
fs->pool, pool));
@@ -455,12 +465,13 @@ svn_fs_fs__initialize_caches(svn_fs_t *f
SVN_ERR(create_cache(&(ffd->node_revision_cache),
NULL,
membuffer,
- 32, 32, /* ~200 byte / entry; 1k entries total */
+ 2, 16, /* ~500 byte / entry; 32 entries total */
svn_fs_fs__serialize_node_revision,
svn_fs_fs__deserialize_node_revision,
sizeof(pair_cache_key_t),
apr_pstrcat(pool, prefix, "NODEREVS", SVN_VA_NULL),
SVN_CACHE__MEMBUFFER_HIGH_PRIORITY,
+ has_namespace,
fs,
no_handler,
fs->pool, pool));
@@ -469,12 +480,13 @@ svn_fs_fs__initialize_caches(svn_fs_t *f
SVN_ERR(create_cache(&(ffd->rep_header_cache),
NULL,
membuffer,
- 1, 1000, /* ~8 bytes / entry; 1k entries total */
+ 1, 200, /* ~40 bytes / entry; 200 entries total */
svn_fs_fs__serialize_rep_header,
svn_fs_fs__deserialize_rep_header,
sizeof(pair_cache_key_t),
apr_pstrcat(pool, prefix, "REPHEADER", SVN_VA_NULL),
SVN_CACHE__MEMBUFFER_DEFAULT_PRIORITY,
+ has_namespace,
fs,
no_handler,
fs->pool, pool));
@@ -489,6 +501,7 @@ svn_fs_fs__initialize_caches(svn_fs_t *f
sizeof(svn_revnum_t),
apr_pstrcat(pool, prefix, "CHANGES", SVN_VA_NULL),
0,
+ has_namespace,
fs,
no_handler,
fs->pool, pool));
@@ -499,12 +512,13 @@ svn_fs_fs__initialize_caches(svn_fs_t *f
SVN_ERR(create_cache(&(ffd->fulltext_cache),
ffd->memcache,
membuffer,
- 0, 0, /* Do not use inprocess cache */
+ 0, 0, /* Do not use the inprocess cache */
/* Values are svn_stringbuf_t */
NULL, NULL,
sizeof(pair_cache_key_t),
apr_pstrcat(pool, prefix, "TEXT", SVN_VA_NULL),
SVN_CACHE__MEMBUFFER_DEFAULT_PRIORITY,
+ has_namespace,
fs,
no_handler,
fs->pool, pool));
@@ -512,13 +526,14 @@ svn_fs_fs__initialize_caches(svn_fs_t *f
SVN_ERR(create_cache(&(ffd->properties_cache),
NULL,
membuffer,
- 0, 0, /* Do not use inprocess cache */
+ 0, 0, /* Do not use the inprocess cache */
svn_fs_fs__serialize_properties,
svn_fs_fs__deserialize_properties,
sizeof(pair_cache_key_t),
apr_pstrcat(pool, prefix, "PROP",
SVN_VA_NULL),
SVN_CACHE__MEMBUFFER_DEFAULT_PRIORITY,
+ has_namespace,
fs,
no_handler,
fs->pool, pool));
@@ -526,13 +541,14 @@ svn_fs_fs__initialize_caches(svn_fs_t *f
SVN_ERR(create_cache(&(ffd->mergeinfo_cache),
NULL,
membuffer,
- 0, 0, /* Do not use inprocess cache */
+ 0, 0, /* Do not use the inprocess cache */
svn_fs_fs__serialize_mergeinfo,
svn_fs_fs__deserialize_mergeinfo,
APR_HASH_KEY_STRING,
apr_pstrcat(pool, prefix, "MERGEINFO",
SVN_VA_NULL),
0,
+ has_namespace,
fs,
no_handler,
fs->pool, pool));
@@ -540,13 +556,14 @@ svn_fs_fs__initialize_caches(svn_fs_t *f
SVN_ERR(create_cache(&(ffd->mergeinfo_existence_cache),
NULL,
membuffer,
- 0, 0, /* Do not use inprocess cache */
+ 0, 0, /* Do not use the inprocess cache */
/* Values are svn_stringbuf_t */
NULL, NULL,
APR_HASH_KEY_STRING,
apr_pstrcat(pool, prefix, "HAS_MERGEINFO",
SVN_VA_NULL),
0,
+ has_namespace,
fs,
no_handler,
fs->pool, pool));
@@ -565,13 +582,14 @@ svn_fs_fs__initialize_caches(svn_fs_t *f
SVN_ERR(create_cache(&(ffd->raw_window_cache),
NULL,
membuffer,
- 0, 0, /* Do not use inprocess cache */
+ 0, 0, /* Do not use the inprocess cache */
svn_fs_fs__serialize_raw_window,
svn_fs_fs__deserialize_raw_window,
sizeof(window_cache_key_t),
apr_pstrcat(pool, prefix, "RAW_WINDOW",
SVN_VA_NULL),
SVN_CACHE__MEMBUFFER_LOW_PRIORITY,
+ has_namespace,
fs,
no_handler,
fs->pool, pool));
@@ -579,13 +597,14 @@ svn_fs_fs__initialize_caches(svn_fs_t *f
SVN_ERR(create_cache(&(ffd->txdelta_window_cache),
NULL,
membuffer,
- 0, 0, /* Do not use inprocess cache */
+ 0, 0, /* Do not use the inprocess cache */
svn_fs_fs__serialize_txdelta_window,
svn_fs_fs__deserialize_txdelta_window,
sizeof(window_cache_key_t),
apr_pstrcat(pool, prefix, "TXDELTA_WINDOW",
SVN_VA_NULL),
SVN_CACHE__MEMBUFFER_LOW_PRIORITY,
+ has_namespace,
fs,
no_handler,
fs->pool, pool));
@@ -593,13 +612,14 @@ svn_fs_fs__initialize_caches(svn_fs_t *f
SVN_ERR(create_cache(&(ffd->combined_window_cache),
NULL,
membuffer,
- 0, 0, /* Do not use inprocess cache */
+ 0, 0, /* Do not use the inprocess cache */
/* Values are svn_stringbuf_t */
NULL, NULL,
sizeof(window_cache_key_t),
apr_pstrcat(pool, prefix, "COMBINED_WINDOW",
SVN_VA_NULL),
SVN_CACHE__MEMBUFFER_LOW_PRIORITY,
+ has_namespace,
fs,
no_handler,
fs->pool, pool));
@@ -613,28 +633,34 @@ svn_fs_fs__initialize_caches(svn_fs_t *f
SVN_ERR(create_cache(&(ffd->l2p_header_cache),
NULL,
membuffer,
- 64, 16, /* entry size varies but we must cover
- a reasonable number of revisions (1k) */
+ 8, 16, /* entry size varies but we must cover a
+ reasonable number of rev / pack files
+ to allow for delta chains to be walked
+ efficiently etc. */
svn_fs_fs__serialize_l2p_header,
svn_fs_fs__deserialize_l2p_header,
sizeof(pair_cache_key_t),
apr_pstrcat(pool, prefix, "L2P_HEADER",
(char *)NULL),
SVN_CACHE__MEMBUFFER_HIGH_PRIORITY,
+ has_namespace,
fs,
no_handler,
fs->pool, pool));
SVN_ERR(create_cache(&(ffd->l2p_page_cache),
NULL,
membuffer,
- 64, 16, /* entry size varies but we must cover
- a reasonable number of revisions (1k) */
+ 8, 16, /* entry size varies but we must cover a
+ reasonable number of rev / pack files
+ to allow for delta chains to be walked
+ efficiently etc. */
svn_fs_fs__serialize_l2p_page,
svn_fs_fs__deserialize_l2p_page,
sizeof(svn_fs_fs__page_cache_key_t),
apr_pstrcat(pool, prefix, "L2P_PAGE",
(char *)NULL),
SVN_CACHE__MEMBUFFER_HIGH_PRIORITY,
+ has_namespace,
fs,
no_handler,
fs->pool, pool));
@@ -648,19 +674,21 @@ svn_fs_fs__initialize_caches(svn_fs_t *f
apr_pstrcat(pool, prefix, "P2L_HEADER",
(char *)NULL),
SVN_CACHE__MEMBUFFER_HIGH_PRIORITY,
+ has_namespace,
fs,
no_handler,
fs->pool, pool));
SVN_ERR(create_cache(&(ffd->p2l_page_cache),
NULL,
membuffer,
- 4, 16, /* Variably sized entries. Rarely used. */
+ 4, 1, /* Variably sized entries. Rarely used. */
svn_fs_fs__serialize_p2l_page,
svn_fs_fs__deserialize_p2l_page,
sizeof(svn_fs_fs__page_cache_key_t),
apr_pstrcat(pool, prefix, "P2L_PAGE",
(char *)NULL),
SVN_CACHE__MEMBUFFER_HIGH_PRIORITY,
+ has_namespace,
fs,
no_handler,
fs->pool, pool));
@@ -807,6 +835,7 @@ svn_fs_fs__initialize_txn_caches(svn_fs_
apr_pstrcat(pool, prefix, "TXNDIR",
SVN_VA_NULL),
0,
+ TRUE, /* The TXN-ID is our namespace. */
fs,
TRUE,
pool, pool));
Modified: subversion/branches/move-tracking-2/subversion/libsvn_fs_fs/util.c
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/libsvn_fs_fs/util.c?rev=1695730&r1=1695729&r2=1695730&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/libsvn_fs_fs/util.c (original)
+++ subversion/branches/move-tracking-2/subversion/libsvn_fs_fs/util.c Thu Aug 13 15:54:54 2015
@@ -674,7 +674,7 @@ svn_fs_fs__move_into_place(const char *o
if (err)
return svn_error_trace(err);
-#if SVN_ON_POSIX
+#ifdef SVN_ON_POSIX
{
/* On POSIX, the file name is stored in the file's directory entry.
Hence, we need to fsync() that directory as well.
Modified: subversion/branches/move-tracking-2/subversion/libsvn_fs_fs/verify.c
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/libsvn_fs_fs/verify.c?rev=1695730&r1=1695729&r2=1695730&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/libsvn_fs_fs/verify.c (original)
+++ subversion/branches/move-tracking-2/subversion/libsvn_fs_fs/verify.c Thu Aug 13 15:54:54 2015
@@ -816,8 +816,15 @@ verify_f7_metadata_consistency(svn_fs_t
/* concurrent packing is one of the reasons why verification may fail.
Make sure, we operate on up-to-date information. */
if (err)
- SVN_ERR(svn_fs_fs__read_min_unpacked_rev(&ffd->min_unpacked_rev,
- fs, pool));
+ {
+ svn_error_t *err2
+ = svn_fs_fs__read_min_unpacked_rev(&ffd->min_unpacked_rev,
+ fs, pool);
+
+ /* Be careful to not leak ERR. */
+ if (err2)
+ return svn_error_trace(svn_error_compose_create(err, err2));
+ }
/* retry the whole shard if it got packed in the meantime */
if (err && count != pack_size(fs, revision))
Propchange: subversion/branches/move-tracking-2/subversion/libsvn_fs_x/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Aug 13 15:54:54 2015
@@ -1,3 +1,4 @@
+/subversion/branches/1.10-cache-improvements/subversion/libsvn_fs_x:1669168-1694487
/subversion/branches/1.5.x-r30215/subversion/libsvn_fs_x:870312
/subversion/branches/1.7.x-fs-verify/subversion/libsvn_fs_x:1146708,1161180
/subversion/branches/10Gb/subversion/libsvn_fs_x:1388102,1388163-1388190,1388195,1388202,1388205,1388211,1388276,1388362,1388375,1388394,1388636,1388639-1388640,1388643-1388644,1388654,1388720,1388789,1388795,1388801,1388805,1388807,1388810,1388816,1389044,1389276,1389289,1389662,1389867,1390017,1390209,1390216,1390407,1390409,1390414,1390419,1390955
@@ -21,6 +22,7 @@
/subversion/branches/fsfs-lock-many/subversion/libsvn_fs_x:1571740-1577217
/subversion/branches/fsfs-pack/subversion/libsvn_fs_x:873717-874575
/subversion/branches/fsx/subversion/libsvn_fs_x:1507845-1508040
+/subversion/branches/fsx-1.10/subversion/libsvn_fs_x:1658219-1694500
/subversion/branches/fsx-id/subversion/libsvn_fs_x:1645603-1649011
/subversion/branches/gnome-keyring/subversion/libsvn_fs_x:870558-871410
/subversion/branches/gpg-agent-password-store/subversion/libsvn_fs_x:1005036-1150766
@@ -90,4 +92,4 @@
/subversion/branches/verify-keep-going/subversion/libsvn_fs_x:1439280-1492639,1546002-1546110
/subversion/branches/wc-collate-path/subversion/libsvn_fs_x:1402685-1480384
/subversion/trunk/subversion/libsvn_fs_fs:1415133-1596500,1596567,1597414,1597989,1598273,1599140,1600872,1601633,1603485-1603487,1603499,1603605,1604128,1604188,1604413-1604414,1604416-1604417,1604421,1604442,1604700,1604717,1604720,1604726,1604755,1604794,1604802,1604824,1604836,1604844,1604902-1604903,1604911,1604925,1604933,1604947,1605059-1605060,1605064-1605065,1605068,1605071-1605073,1605075,1605123,1605188-1605189,1605191,1605197,1605444,1605633,1606132,1606142,1606144,1606514,1606526,1606528,1606551,1606554,1606564,1606598-1606599,1606656,1606658,1606662,1606744,1606840,1607085,1607572,1612407,1612810,1613339,1613872,1614611,1615348,1615351-1615352,1615356,1616338-1616339,1616613,1617586,1617688,1618138,1618151,1618153,1618226,1618641,1618653,1618662,1619068,1619358,1619413,1619769,1619774,1620602,1620909,1620912,1620928,1620930,1621275,1621635,1622931,1622937,1622942,1622946,1622959-1622960,1622963,1622987,1623007,1623368,1623373,1623377,1623379,1623381,1623398,1623402,162
4011,1624265,1624512,1626246,1626871,1626873,1626886,1627497-1627498,1627502,1627947-1627949,1627966,1628083,1628093,1628158-1628159,1628161,1628392-1628393,1628415,1628427,1628676,1628738,1628762,1628764,1629854-1629855,1629857,1629865,1629873,1629875,1629879,1630067,1630070,1631049-1631051,1631075,1631115,1631171,1631180,1631185-1631186,1631196-1631197,1631239-1631240,1631548,1631550,1631563,1631567,1631588,1631598,1632646,1632776,1632849,1632851-1632853,1632856-1632857,1632868,1632908,1632926,1633232,1633617-1633618,1634872,1634875,1634879-1634880,1634920,1636478,1636483,1636629,1636644,1637184,1637186,1637330,1637358,1637363,1637393,1639319,1639322,1639335,1639348,1639352,1639355,1639358,1639414,1639419,1639426,1639430,1639436,1639440,1639549,1640061-1640062,1640197,1640915,1640966,1641013,1643139,1643233,1645567,1646021,1646712,1646716,1647537,1647540-1647541,1647820,1647905,1648230,1648238,1648241-1648243,1648253,1648272,1648532,1648537-1648539,1648542,1648591,1648612,1653608,
1658482
-/subversion/trunk/subversion/libsvn_fs_x:1414756-1509914,1606692-1692852
+/subversion/trunk/subversion/libsvn_fs_x:1414756-1509914,1606692-1695728
Modified: subversion/branches/move-tracking-2/subversion/libsvn_fs_x/cached_data.c
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/libsvn_fs_x/cached_data.c?rev=1695730&r1=1695729&r2=1695730&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/libsvn_fs_x/cached_data.c (original)
+++ subversion/branches/move-tracking-2/subversion/libsvn_fs_x/cached_data.c Thu Aug 13 15:54:54 2015
@@ -173,21 +173,6 @@ dgb__log_access(svn_fs_t *fs,
return SVN_NO_ERROR;
}
-/* Convenience wrapper around svn_io_file_aligned_seek, taking filesystem
- FS instead of a block size. */
-static svn_error_t *
-aligned_seek(svn_fs_t *fs,
- apr_file_t *file,
- apr_off_t *buffer_start,
- apr_off_t offset,
- apr_pool_t *scratch_pool)
-{
- svn_fs_x__data_t *ffd = fs->fsap_data;
- return svn_error_trace(svn_io_file_aligned_seek(file, ffd->block_size,
- buffer_start, offset,
- scratch_pool));
-}
-
/* Open the revision file for the item given by ID in filesystem FS and
store the newly opened file in FILE. Seek to the item's location before
returning.
@@ -207,11 +192,10 @@ open_and_seek_revision(svn_fs_x__revisio
SVN_ERR(svn_fs_x__ensure_revision_exists(rev, fs, scratch_pool));
- SVN_ERR(svn_fs_x__open_pack_or_rev_file(&rev_file, fs, rev, result_pool,
- scratch_pool));
+ SVN_ERR(svn_fs_x__rev_file_init(&rev_file, fs, rev, result_pool));
SVN_ERR(svn_fs_x__item_offset(&offset, &sub_item, fs, rev_file, id,
scratch_pool));
- SVN_ERR(aligned_seek(fs, rev_file->file, NULL, offset, scratch_pool));
+ SVN_ERR(svn_fs_x__rev_file_seek(rev_file, NULL, offset));
*file = rev_file;
@@ -233,12 +217,12 @@ open_and_seek_transaction(svn_fs_x__revi
apr_uint32_t sub_item = 0;
apr_int64_t txn_id = svn_fs_x__get_txn_id(rep->id.change_set);
- SVN_ERR(svn_fs_x__open_proto_rev_file(file, fs, txn_id, result_pool,
- scratch_pool));
+ SVN_ERR(svn_fs_x__rev_file_open_proto_rev(file, fs, txn_id, result_pool,
+ scratch_pool));
SVN_ERR(svn_fs_x__item_offset(&offset, &sub_item, fs, *file, &rep->id,
scratch_pool));
- SVN_ERR(aligned_seek(fs, (*file)->file, NULL, offset, scratch_pool));
+ SVN_ERR(svn_fs_x__rev_file_seek(*file, NULL, offset));
return SVN_NO_ERROR;
}
@@ -294,6 +278,7 @@ get_node_revision_body(svn_fs_x__noderev
if (svn_fs_x__is_txn(id->change_set))
{
apr_file_t *file;
+ svn_stream_t *stream;
/* This is a transaction node-rev. Its storage logic is very
different from that of rev / pack files. */
@@ -314,10 +299,9 @@ get_node_revision_body(svn_fs_x__noderev
return svn_error_trace(err);
}
- SVN_ERR(svn_fs_x__read_noderev(noderev_p,
- svn_stream_from_aprfile2(file,
- FALSE,
- scratch_pool),
+ /* Be sure to close the file ASAP. */
+ stream = svn_stream_from_aprfile2(file, FALSE, scratch_pool);
+ SVN_ERR(svn_fs_x__read_noderev(noderev_p, stream,
result_pool, scratch_pool));
}
else
@@ -328,8 +312,8 @@ get_node_revision_body(svn_fs_x__noderev
svn_revnum_t revision = svn_fs_x__get_revnum(id->change_set);
svn_fs_x__pair_cache_key_t key;
- SVN_ERR(svn_fs_x__open_pack_or_rev_file(&revision_file, fs, revision,
- scratch_pool, scratch_pool));
+ SVN_ERR(svn_fs_x__rev_file_init(&revision_file, fs, revision,
+ scratch_pool));
/* First, try a noderevs container cache lookup. */
if ( svn_fs_x__is_packed_rev(fs, revision)
@@ -355,16 +339,13 @@ get_node_revision_body(svn_fs_x__noderev
/* Not found or not applicable. Try a noderev cache lookup.
* If that succeeds, we are done here. */
- if (ffd->node_revision_cache)
- {
- SVN_ERR(svn_cache__get((void **) noderev_p,
- &is_cached,
- ffd->node_revision_cache,
- &key,
- result_pool));
- if (is_cached)
- return SVN_NO_ERROR;
- }
+ SVN_ERR(svn_cache__get((void **) noderev_p,
+ &is_cached,
+ ffd->node_revision_cache,
+ &key,
+ result_pool));
+ if (is_cached)
+ return SVN_NO_ERROR;
/* block-read will parse the whole block and will also return
the one noderev that we need right now. */
@@ -423,8 +404,8 @@ svn_fs_x__get_mergeinfo_count(apr_int64_
svn_revnum_t revision = svn_fs_x__get_revnum(id->change_set);
svn_fs_x__revision_file_t *rev_file;
- SVN_ERR(svn_fs_x__open_pack_or_rev_file(&rev_file, fs, revision,
- scratch_pool, scratch_pool));
+ SVN_ERR(svn_fs_x__rev_file_init(&rev_file, fs, revision,
+ scratch_pool));
if ( svn_fs_x__is_packed_rev(fs, revision)
&& ffd->noderevs_container_cache)
@@ -505,39 +486,13 @@ typedef struct rep_state_t
int chunk_index; /* number of the window to read */
} rep_state_t;
-/* Simple wrapper around svn_fs_x__get_file_offset to simplify callers. */
-static svn_error_t *
-get_file_offset(apr_off_t *offset,
- rep_state_t *rs,
- apr_pool_t *scratch_pool)
-{
- return svn_error_trace(svn_fs_x__get_file_offset(offset,
- rs->sfile->rfile->file,
- scratch_pool));
-}
-
-/* Simple wrapper around svn_io_file_aligned_seek to simplify callers. */
-static svn_error_t *
-rs_aligned_seek(rep_state_t *rs,
- apr_off_t *buffer_start,
- apr_off_t offset,
- apr_pool_t *scratch_pool)
-{
- svn_fs_x__data_t *ffd = rs->sfile->fs->fsap_data;
- return svn_error_trace(svn_io_file_aligned_seek(rs->sfile->rfile->file,
- ffd->block_size,
- buffer_start, offset,
- scratch_pool));
-}
-
/* Open FILE->FILE and FILE->STREAM if they haven't been opened, yet. */
static svn_error_t*
auto_open_shared_file(shared_file_t *file)
{
if (file->rfile == NULL)
- SVN_ERR(svn_fs_x__open_pack_or_rev_file(&file->rfile, file->fs,
- file->revision, file->pool,
- file->pool));
+ SVN_ERR(svn_fs_x__rev_file_init(&file->rfile, file->fs,
+ file->revision, file->pool));
return SVN_NO_ERROR;
}
@@ -571,9 +526,8 @@ auto_read_diff_version(rep_state_t *rs,
if (rs->ver == -1)
{
char buf[4];
- SVN_ERR(rs_aligned_seek(rs, NULL, rs->start, scratch_pool));
- SVN_ERR(svn_io_file_read_full2(rs->sfile->rfile->file, buf,
- sizeof(buf), NULL, NULL, scratch_pool));
+ SVN_ERR(svn_fs_x__rev_file_seek(rs->sfile->rfile, NULL, rs->start));
+ SVN_ERR(svn_fs_x__rev_file_read(rs->sfile->rfile, buf, sizeof(buf)));
/* ### Layering violation */
if (! ((buf[0] == 'S') && (buf[1] == 'V') && (buf[2] == 'N')))
@@ -655,7 +609,7 @@ create_rep_state_body(rep_state_t **rep_
: NULL;
/* cache lookup, i.e. skip reading the rep header if possible */
- if (ffd->rep_header_cache && SVN_IS_VALID_REVNUM(revision))
+ if (SVN_IS_VALID_REVNUM(revision))
SVN_ERR(svn_cache__get((void **) &rh, &is_cached,
ffd->rep_header_cache, &key, result_pool));
@@ -680,6 +634,8 @@ create_rep_state_body(rep_state_t **rep_
/* read rep header, if necessary */
if (!is_cached)
{
+ svn_stream_t *stream;
+
/* we will need the on-disk location for non-txn reps */
apr_off_t offset;
svn_boolean_t in_container = TRUE;
@@ -731,21 +687,21 @@ create_rep_state_body(rep_state_t **rep_
return SVN_NO_ERROR;
}
- SVN_ERR(rs_aligned_seek(rs, NULL, offset, scratch_pool));
+ SVN_ERR(svn_fs_x__rev_file_seek(rs->sfile->rfile, NULL, offset));
}
- SVN_ERR(svn_fs_x__read_rep_header(&rh, rs->sfile->rfile->stream,
+ SVN_ERR(svn_fs_x__rev_file_stream(&stream, rs->sfile->rfile));
+ SVN_ERR(svn_fs_x__read_rep_header(&rh, stream,
result_pool, scratch_pool));
- SVN_ERR(get_file_offset(&rs->start, rs, result_pool));
+ SVN_ERR(svn_fs_x__rev_file_offset(&rs->start, rs->sfile->rfile));
/* populate the cache if appropriate */
if (SVN_IS_VALID_REVNUM(revision))
{
SVN_ERR(block_read(NULL, fs, &rs->rep_id, rs->sfile->rfile,
result_pool, scratch_pool));
- if (ffd->rep_header_cache)
- SVN_ERR(svn_cache__set(ffd->rep_header_cache, &key, rh,
- scratch_pool));
+ SVN_ERR(svn_cache__set(ffd->rep_header_cache, &key, rh,
+ scratch_pool));
}
}
@@ -820,8 +776,7 @@ svn_fs_x__check_rep(svn_fs_x__representa
svn_revnum_t revision = svn_fs_x__get_revnum(rep->id.change_set);
svn_fs_x__revision_file_t *rev_file;
- SVN_ERR(svn_fs_x__open_pack_or_rev_file(&rev_file, fs, revision,
- scratch_pool, scratch_pool));
+ SVN_ERR(svn_fs_x__rev_file_init(&rev_file, fs, revision, scratch_pool));
/* Does REP->ID refer to an actual item? Which one is it? */
SVN_ERR(svn_fs_x__item_offset(&offset, &sub_item, fs, rev_file, &rep->id,
@@ -1075,22 +1030,14 @@ get_cached_window_sizes(window_sizes_t *
svn_boolean_t *is_cached,
apr_pool_t *pool)
{
- if (! rs->window_cache)
- {
- /* txdelta window has not been enabled */
- *is_cached = FALSE;
- }
- else
- {
- svn_fs_x__window_cache_key_t key = { 0 };
- SVN_ERR(svn_cache__get_partial((void **)sizes,
- is_cached,
- rs->window_cache,
- get_window_key(&key, rs),
- get_cached_window_sizes_func,
- NULL,
- pool));
- }
+ svn_fs_x__window_cache_key_t key = { 0 };
+ SVN_ERR(svn_cache__get_partial((void **)sizes,
+ is_cached,
+ rs->window_cache,
+ get_window_key(&key, rs),
+ get_cached_window_sizes_func,
+ NULL,
+ pool));
return SVN_NO_ERROR;
}
@@ -1103,33 +1050,25 @@ get_cached_window(svn_txdelta_window_t *
apr_pool_t *result_pool,
apr_pool_t *scratch_pool)
{
- if (! rs->window_cache)
- {
- /* txdelta window has not been enabled */
- *is_cached = FALSE;
- }
- else
- {
- /* ask the cache for the desired txdelta window */
- svn_fs_x__txdelta_cached_window_t *cached_window;
- svn_fs_x__window_cache_key_t key = { 0 };
- get_window_key(&key, rs);
- key.chunk_index = chunk_index;
- SVN_ERR(svn_cache__get((void **) &cached_window,
- is_cached,
- rs->window_cache,
- &key,
- result_pool));
-
- if (*is_cached)
- {
- /* found it. Pass it back to the caller. */
- *window_p = cached_window->window;
-
- /* manipulate the RS as if we just read the data */
- rs->current = cached_window->end_offset;
- rs->chunk_index = chunk_index;
- }
+ /* ask the cache for the desired txdelta window */
+ svn_fs_x__txdelta_cached_window_t *cached_window;
+ svn_fs_x__window_cache_key_t key = { 0 };
+ get_window_key(&key, rs);
+ key.chunk_index = chunk_index;
+ SVN_ERR(svn_cache__get((void **) &cached_window,
+ is_cached,
+ rs->window_cache,
+ &key,
+ result_pool));
+
+ if (*is_cached)
+ {
+ /* found it. Pass it back to the caller. */
+ *window_p = cached_window->window;
+
+ /* manipulate the RS as if we just read the data */
+ rs->current = cached_window->end_offset;
+ rs->chunk_index = chunk_index;
}
return SVN_NO_ERROR;
@@ -1145,23 +1084,20 @@ set_cached_window(svn_txdelta_window_t *
apr_off_t start_offset,
apr_pool_t *scratch_pool)
{
- if (rs->window_cache)
- {
- /* store the window and the first offset _past_ it */
- svn_fs_x__txdelta_cached_window_t cached_window;
- svn_fs_x__window_cache_key_t key = {0};
-
- cached_window.window = window;
- cached_window.start_offset = start_offset - rs->start;
- cached_window.end_offset = rs->current;
-
- /* but key it with the start offset because that is the known state
- * when we will look it up */
- SVN_ERR(svn_cache__set(rs->window_cache,
- get_window_key(&key, rs),
- &cached_window,
- scratch_pool));
- }
+ /* store the window and the first offset _past_ it */
+ svn_fs_x__txdelta_cached_window_t cached_window;
+ svn_fs_x__window_cache_key_t key = {0};
+
+ cached_window.window = window;
+ cached_window.start_offset = start_offset - rs->start;
+ cached_window.end_offset = rs->current;
+
+ /* but key it with the start offset because that is the known state
+ * when we will look it up */
+ SVN_ERR(svn_cache__set(rs->window_cache,
+ get_window_key(&key, rs),
+ &cached_window,
+ scratch_pool));
return SVN_NO_ERROR;
}
@@ -1178,23 +1114,13 @@ get_cached_combined_window(svn_stringbuf
svn_boolean_t *is_cached,
apr_pool_t *pool)
{
- if (! rs->combined_cache)
- {
- /* txdelta window has not been enabled */
- *is_cached = FALSE;
- }
- else
- {
- /* ask the cache for the desired txdelta window */
- svn_fs_x__window_cache_key_t key = { 0 };
- return svn_cache__get((void **)window_p,
- is_cached,
- rs->combined_cache,
- get_window_key(&key, rs),
- pool);
- }
-
- return SVN_NO_ERROR;
+ /* ask the cache for the desired txdelta window */
+ svn_fs_x__window_cache_key_t key = { 0 };
+ return svn_cache__get((void **)window_p,
+ is_cached,
+ rs->combined_cache,
+ get_window_key(&key, rs),
+ pool);
}
/* Store the WINDOW read for the rep state RS in the current FSX session's
@@ -1205,18 +1131,13 @@ set_cached_combined_window(svn_stringbuf
rep_state_t *rs,
apr_pool_t *scratch_pool)
{
- if (rs->combined_cache)
- {
- /* but key it with the start offset because that is the known state
- * when we will look it up */
- svn_fs_x__window_cache_key_t key = { 0 };
- return svn_cache__set(rs->combined_cache,
- get_window_key(&key, rs),
- window,
- scratch_pool);
- }
-
- return SVN_NO_ERROR;
+ /* but key it with the start offset because that is the known state
+ * when we will look it up */
+ svn_fs_x__window_cache_key_t key = { 0 };
+ return svn_cache__set(rs->combined_cache,
+ get_window_key(&key, rs),
+ window,
+ scratch_pool);
}
/* Build an array of rep_state structures in *LIST giving the delta
@@ -1364,6 +1285,8 @@ read_delta_window(svn_txdelta_window_t *
apr_off_t start_offset;
apr_off_t end_offset;
apr_pool_t *iterpool;
+ svn_stream_t *stream;
+ svn_fs_x__revision_file_t *file;
SVN_ERR_ASSERT(rs->chunk_index <= this_chunk);
@@ -1378,6 +1301,7 @@ read_delta_window(svn_txdelta_window_t *
/* someone has to actually read the data from file. Open it */
SVN_ERR(auto_open_shared_file(rs->sfile));
+ file = rs->sfile->rfile;
/* invoke the 'block-read' feature for non-txn data.
However, don't do that if we are in the middle of some representation,
@@ -1386,8 +1310,8 @@ read_delta_window(svn_txdelta_window_t *
&& svn_fs_x__is_revision(rs->rep_id.change_set)
&& rs->window_cache)
{
- SVN_ERR(block_read(NULL, rs->sfile->fs, &rs->rep_id,
- rs->sfile->rfile, result_pool, scratch_pool));
+ SVN_ERR(block_read(NULL, rs->sfile->fs, &rs->rep_id, file,
+ result_pool, scratch_pool));
/* reading the whole block probably also provided us with the
desired txdelta window */
@@ -1405,18 +1329,19 @@ read_delta_window(svn_txdelta_window_t *
/* RS->FILE may be shared between RS instances -> make sure we point
* to the right data. */
start_offset = rs->start + rs->current;
- SVN_ERR(rs_aligned_seek(rs, NULL, start_offset, scratch_pool));
+ SVN_ERR(svn_fs_x__rev_file_seek(file, NULL, start_offset));
/* Skip windows to reach the current chunk if we aren't there yet. */
iterpool = svn_pool_create(scratch_pool);
while (rs->chunk_index < this_chunk)
{
- apr_file_t *file = rs->sfile->rfile->file;
+ apr_file_t *apr_file;
svn_pool_clear(iterpool);
- SVN_ERR(svn_txdelta_skip_svndiff_window(file, rs->ver, iterpool));
+ SVN_ERR(svn_fs_x__rev_file_get(&apr_file, file));
+ SVN_ERR(svn_txdelta_skip_svndiff_window(apr_file, rs->ver, iterpool));
rs->chunk_index++;
- SVN_ERR(svn_fs_x__get_file_offset(&start_offset, file, iterpool));
+ SVN_ERR(svn_fs_x__get_file_offset(&start_offset, apr_file, iterpool));
rs->current = start_offset - rs->start;
if (rs->current >= rs->size)
@@ -1428,9 +1353,10 @@ read_delta_window(svn_txdelta_window_t *
svn_pool_destroy(iterpool);
/* Actually read the next window. */
- SVN_ERR(svn_txdelta_read_svndiff_window(nwin, rs->sfile->rfile->stream,
- rs->ver, result_pool));
- SVN_ERR(get_file_offset(&end_offset, rs, scratch_pool));
+ SVN_ERR(svn_fs_x__rev_file_stream(&stream, file));
+ SVN_ERR(svn_txdelta_read_svndiff_window(nwin, stream, rs->ver,
+ result_pool));
+ SVN_ERR(svn_fs_x__rev_file_offset(&end_offset, file));
rs->current = end_offset - rs->start;
if (rs->current > rs->size)
return svn_error_create(SVN_ERR_FS_CORRUPT, NULL,
@@ -1458,24 +1384,21 @@ read_container_window(svn_stringbuf_t **
svn_fs_x__data_t *ffd = fs->fsap_data;
svn_fs_x__pair_cache_key_t key;
svn_revnum_t revision = svn_fs_x__get_revnum(rs->rep_id.change_set);
+ svn_boolean_t is_cached = FALSE;
+ svn_fs_x__reps_baton_t baton;
SVN_ERR(auto_set_start_offset(rs, scratch_pool));
key.revision = svn_fs_x__packed_base_rev(fs, revision);
key.second = rs->start;
/* already in cache? */
- if (ffd->reps_container_cache)
- {
- svn_boolean_t is_cached = FALSE;
- svn_fs_x__reps_baton_t baton;
- baton.fs = fs;
- baton.idx = rs->sub_item;
-
- SVN_ERR(svn_cache__get_partial((void**)&extractor, &is_cached,
- ffd->reps_container_cache, &key,
- svn_fs_x__reps_get_func, &baton,
- result_pool));
- }
+ baton.fs = fs;
+ baton.idx = rs->sub_item;
+
+ SVN_ERR(svn_cache__get_partial((void**)&extractor, &is_cached,
+ ffd->reps_container_cache, &key,
+ svn_fs_x__reps_get_func, &baton,
+ result_pool));
/* read from disk, if necessary */
if (extractor == NULL)
@@ -1690,23 +1613,23 @@ cache_windows(svn_filesize_t *fulltext_l
else
{
svn_txdelta_window_t *window;
+ svn_fs_x__revision_file_t *file = rs->sfile->rfile;
+ svn_stream_t *stream;
apr_off_t start_offset = rs->start + rs->current;
apr_off_t end_offset;
apr_off_t block_start;
/* navigate to & read the current window */
- SVN_ERR(rs_aligned_seek(rs, &block_start, start_offset, iterpool));
- SVN_ERR(svn_txdelta_read_svndiff_window(&window,
- rs->sfile->rfile->stream,
- rs->ver, iterpool));
+ SVN_ERR(svn_fs_x__rev_file_stream(&stream, file));
+ SVN_ERR(svn_fs_x__rev_file_seek(file, &block_start, start_offset));
+ SVN_ERR(svn_txdelta_read_svndiff_window(&window, stream, rs->ver,
+ iterpool));
/* aggregate expanded window size */
*fulltext_len += window->tview_len;
/* determine on-disk window size */
- SVN_ERR(svn_fs_x__get_file_offset(&end_offset,
- rs->sfile->rfile->file,
- iterpool));
+ SVN_ERR(svn_fs_x__rev_file_offset(&end_offset, rs->sfile->rfile));
rs->current = end_offset - rs->start;
if (rs->current > rs->size)
return svn_error_create(SVN_ERR_FS_CORRUPT, NULL,
@@ -1735,25 +1658,22 @@ cache_windows(svn_filesize_t *fulltext_l
static svn_error_t *
read_rep_header(svn_fs_x__rep_header_t **rep_header,
svn_fs_t *fs,
- svn_stream_t *stream,
+ svn_fs_x__revision_file_t *file,
svn_fs_x__representation_cache_key_t *key,
apr_pool_t *pool)
{
svn_fs_x__data_t *ffd = fs->fsap_data;
+ svn_stream_t *stream;
svn_boolean_t is_cached = FALSE;
- if (ffd->rep_header_cache)
- {
- SVN_ERR(svn_cache__get((void**)rep_header, &is_cached,
- ffd->rep_header_cache, key, pool));
- if (is_cached)
- return SVN_NO_ERROR;
- }
+ SVN_ERR(svn_cache__get((void**)rep_header, &is_cached,
+ ffd->rep_header_cache, key, pool));
+ if (is_cached)
+ return SVN_NO_ERROR;
+ SVN_ERR(svn_fs_x__rev_file_stream(&stream, file));
SVN_ERR(svn_fs_x__read_rep_header(rep_header, stream, pool, pool));
-
- if (ffd->rep_header_cache)
- SVN_ERR(svn_cache__set(ffd->rep_header_cache, key, *rep_header, pool));
+ SVN_ERR(svn_cache__set(ffd->rep_header_cache, key, *rep_header, pool));
return SVN_NO_ERROR;
}
@@ -1779,8 +1699,7 @@ svn_fs_x__get_representation_length(svn_
key.revision = svn_fs_x__get_revnum(entry->items[0].change_set);
key.is_packed = svn_fs_x__is_packed_rev(fs, key.revision);
key.item_index = entry->items[0].number;
- SVN_ERR(read_rep_header(&rep_header, fs, rev_file->stream, &key,
- scratch_pool));
+ SVN_ERR(read_rep_header(&rep_header, fs, rev_file, &key, scratch_pool));
/* prepare representation reader state (rs) structure */
SVN_ERR(init_rep_state(&rs, rep_header, fs, rev_file, entry,
@@ -2186,7 +2105,7 @@ svn_fs_x__get_contents(svn_stream_t **co
/* Make the stream attempt fulltext cache lookups if the fulltext
* is cacheable. If it is not, then also don't try to buffer and
* cache it. */
- if (ffd->fulltext_cache && cache_fulltext
+ if ( cache_fulltext
&& SVN_IS_VALID_REVNUM(revision)
&& fulltext_size_is_cachable(ffd, len))
{
@@ -2257,8 +2176,7 @@ svn_fs_x__try_process_file_contents(svn_
fulltext_cache_key.revision = svn_fs_x__get_revnum(rep->id.change_set);
fulltext_cache_key.second = rep->id.number;
- if (ffd->fulltext_cache
- && SVN_IS_VALID_REVNUM(fulltext_cache_key.revision)
+ if ( SVN_IS_VALID_REVNUM(fulltext_cache_key.revision)
&& fulltext_size_is_cachable(ffd, rep->expanded_size))
{
cache_access_wrapper_baton_t wrapper_baton;
@@ -2344,12 +2262,11 @@ svn_fs_x__get_file_delta_stream(svn_txde
svn_stream_t *source_stream, *target_stream;
rep_state_t *rep_state;
svn_fs_x__rep_header_t *rep_header;
- svn_fs_x__data_t *ffd = fs->fsap_data;
/* Try a shortcut: if the target is stored as a delta against the source,
then just use that delta. However, prefer using the fulltext cache
whenever that is available. */
- if (target->data_rep && (source || !ffd->fulltext_cache))
+ if (target->data_rep && source)
{
/* Read target's base rep if any. */
SVN_ERR(create_rep_state(&rep_state, &rep_header, NULL,
@@ -2654,23 +2571,19 @@ svn_fs_x__rep_contents_dir(apr_array_hea
/* find the cache we may use */
svn_cache__t *cache = locate_dir_cache(fs, &key, noderev);
- if (cache)
- {
- svn_boolean_t found;
+ svn_boolean_t found;
- SVN_ERR(svn_cache__get((void **)entries_p, &found, cache, &key,
- result_pool));
- if (found)
- return SVN_NO_ERROR;
- }
+ SVN_ERR(svn_cache__get((void **)entries_p, &found, cache, &key,
+ result_pool));
+ if (found)
+ return SVN_NO_ERROR;
/* Read in the directory contents. */
SVN_ERR(get_dir_contents(entries_p, fs, noderev, result_pool,
scratch_pool));
/* Update the cache, if we are to use one. */
- if (cache)
- SVN_ERR(svn_cache__set(cache, &key, *entries_p, scratch_pool));
+ SVN_ERR(svn_cache__set(cache, &key, *entries_p, scratch_pool));
return SVN_NO_ERROR;
}
@@ -2699,25 +2612,22 @@ svn_fs_x__rep_contents_dir_entry(svn_fs_
/* find the cache we may use */
svn_fs_x__id_t key;
svn_cache__t *cache = locate_dir_cache(fs, &key, noderev);
- if (cache)
- {
- svn_fs_x__ede_baton_t baton;
- baton.hint = *hint;
- baton.name = name;
-
- /* Cache lookup. */
- SVN_ERR(svn_cache__get_partial((void **)dirent,
- &found,
- cache,
- &key,
- svn_fs_x__extract_dir_entry,
- &baton,
- result_pool));
-
- /* Remember the new clue only if we found something at that spot. */
- if (found)
- *hint = baton.hint;
- }
+ svn_fs_x__ede_baton_t baton;
+ baton.hint = *hint;
+ baton.name = name;
+
+ /* Cache lookup. */
+ SVN_ERR(svn_cache__get_partial((void **)dirent,
+ &found,
+ cache,
+ &key,
+ svn_fs_x__extract_dir_entry,
+ &baton,
+ result_pool));
+
+ /* Remember the new clue only if we found something at that spot. */
+ if (found)
+ *hint = baton.hint;
/* fetch data from disk if we did not find it in the cache */
if (! found)
@@ -2778,7 +2688,7 @@ svn_fs_x__get_proplist(apr_hash_t **prop
key.revision = svn_fs_x__get_revnum(rep->id.change_set);
key.second = rep->id.number;
- if (ffd->properties_cache && SVN_IS_VALID_REVNUM(key.revision))
+ if (SVN_IS_VALID_REVNUM(key.revision))
{
svn_boolean_t is_cached;
SVN_ERR(svn_cache__get((void **) proplist_p, &is_cached,
@@ -2794,7 +2704,7 @@ svn_fs_x__get_proplist(apr_hash_t **prop
result_pool));
SVN_ERR(svn_stream_close(stream));
- if (ffd->properties_cache && SVN_IS_VALID_REVNUM(rep->id.change_set))
+ if (SVN_IS_VALID_REVNUM(rep->id.change_set))
SVN_ERR(svn_cache__set(ffd->properties_cache, &key, proplist,
scratch_pool));
}
@@ -2829,12 +2739,11 @@ svn_fs_x__get_changes(apr_array_header_t
/* Provide revision file. */
SVN_ERR(svn_fs_x__ensure_revision_exists(rev, fs, scratch_pool));
- SVN_ERR(svn_fs_x__open_pack_or_rev_file(&revision_file, fs, rev,
- scratch_pool, scratch_pool));
+ SVN_ERR(svn_fs_x__rev_file_init(&revision_file, fs, rev, scratch_pool));
/* try cache lookup first */
- if (ffd->changes_container_cache && svn_fs_x__is_packed_rev(fs, rev))
+ if (svn_fs_x__is_packed_rev(fs, rev))
{
apr_off_t offset;
apr_uint32_t sub_item;
@@ -2850,15 +2759,11 @@ svn_fs_x__get_changes(apr_array_header_t
svn_fs_x__changes_get_list_func,
&sub_item, result_pool));
}
- else if (ffd->changes_cache)
+ else
{
SVN_ERR(svn_cache__get((void **) changes, &found, ffd->changes_cache,
&rev, result_pool));
}
- else
- {
- found = FALSE;
- }
if (!found)
{
@@ -2890,20 +2795,16 @@ block_read_contents(svn_fs_t *fs,
apr_off_t max_offset,
apr_pool_t *scratch_pool)
{
- svn_fs_x__data_t *ffd = fs->fsap_data;
svn_fs_x__representation_cache_key_t header_key = { 0 };
rep_state_t rs = { 0 };
svn_filesize_t fulltext_len;
svn_fs_x__rep_header_t *rep_header;
- if (!ffd->txdelta_window_cache || !ffd->combined_window_cache)
- return SVN_NO_ERROR;
-
header_key.revision = (apr_int32_t)key->revision;
header_key.is_packed = svn_fs_x__is_packed_rev(fs, header_key.revision);
header_key.item_index = key->second;
- SVN_ERR(read_rep_header(&rep_header, fs, rev_file->stream, &header_key,
+ SVN_ERR(read_rep_header(&rep_header, fs, rev_file, &header_key,
scratch_pool));
SVN_ERR(init_rep_state(&rs, rep_header, fs, rev_file, entry, scratch_pool));
SVN_ERR(cache_windows(&fulltext_len, fs, &rs, max_offset, scratch_pool));
@@ -2930,8 +2831,7 @@ read_item(svn_stream_t **stream,
svn_stringbuf_t *text = svn_stringbuf_create_ensure(entry->size, pool);
text->len = entry->size;
text->data[text->len] = 0;
- SVN_ERR(svn_io_file_read_full2(rev_file->file, text->data, text->len,
- NULL, NULL, pool));
+ SVN_ERR(svn_fs_x__rev_file_read(rev_file, text->data, text->len));
/* Return (construct, calculate) stream and checksum. */
*stream = svn_stream_from_stringbuf(text, pool);
@@ -2976,14 +2876,13 @@ block_read_changes(apr_array_header_t **
svn_fs_x__data_t *ffd = fs->fsap_data;
svn_stream_t *stream;
svn_revnum_t revision = svn_fs_x__get_revnum(entry->items[0].change_set);
- if (!must_read && !ffd->changes_cache)
- return SVN_NO_ERROR;
+ apr_size_t estimated_size;
/* we don't support containers, yet */
SVN_ERR_ASSERT(entry->item_count == 1);
/* already in cache? */
- if (!must_read && ffd->changes_cache)
+ if (!must_read)
{
svn_boolean_t is_cached = FALSE;
SVN_ERR(svn_cache__has_key(&is_cached, ffd->changes_cache, &revision,
@@ -2995,24 +2894,20 @@ block_read_changes(apr_array_header_t **
SVN_ERR(read_item(&stream, fs, rev_file, entry, scratch_pool));
/* read changes from revision file */
-
SVN_ERR(svn_fs_x__read_changes(changes, stream, result_pool, scratch_pool));
/* cache for future reference */
- if (ffd->changes_cache)
- {
- /* Guesstimate for the size of the in-cache representation. */
- apr_size_t estimated_size = (apr_size_t)250 * (*changes)->nelts;
+ /* Guesstimate for the size of the in-cache representation. */
+ estimated_size = (apr_size_t)250 * (*changes)->nelts;
- /* Don't even serialize data that probably won't fit into the
- * cache. This often implies that either CHANGES is very
- * large, memory is scarce or both. Having a huge temporary
- * copy would not be a good thing in either case. */
- if (svn_cache__is_cachable(ffd->changes_cache, estimated_size))
- SVN_ERR(svn_cache__set(ffd->changes_cache, &revision, *changes,
- scratch_pool));
- }
+ /* Don't even serialize data that probably won't fit into the
+ * cache. This often implies that either CHANGES is very
+ * large, memory is scarce or both. Having a huge temporary
+ * copy would not be a good thing in either case. */
+ if (svn_cache__is_cachable(ffd->changes_cache, estimated_size))
+ SVN_ERR(svn_cache__set(ffd->changes_cache, &revision, *changes,
+ scratch_pool));
return SVN_NO_ERROR;
}
@@ -3037,7 +2932,7 @@ block_read_changes_container(apr_array_h
key.second = entry->offset;
/* already in cache? */
- if (!must_read && ffd->changes_container_cache)
+ if (!must_read)
{
svn_boolean_t is_cached = FALSE;
SVN_ERR(svn_cache__has_key(&is_cached, ffd->changes_container_cache,
@@ -3058,10 +2953,8 @@ block_read_changes_container(apr_array_h
if (must_read)
SVN_ERR(svn_fs_x__changes_get_list(changes, container, sub_item,
result_pool));
-
- if (ffd->changes_container_cache)
- SVN_ERR(svn_cache__set(ffd->changes_container_cache, &key, container,
- scratch_pool));
+ SVN_ERR(svn_cache__set(ffd->changes_container_cache, &key, container,
+ scratch_pool));
return SVN_NO_ERROR;
}
@@ -3078,14 +2971,12 @@ block_read_noderev(svn_fs_x__noderev_t *
{
svn_fs_x__data_t *ffd = fs->fsap_data;
svn_stream_t *stream;
- if (!must_read && !ffd->node_revision_cache)
- return SVN_NO_ERROR;
/* we don't support containers, yet */
SVN_ERR_ASSERT(entry->item_count == 1);
/* already in cache? */
- if (!must_read && ffd->node_revision_cache)
+ if (!must_read)
{
svn_boolean_t is_cached = FALSE;
SVN_ERR(svn_cache__has_key(&is_cached, ffd->node_revision_cache, key,
@@ -3100,9 +2991,8 @@ block_read_noderev(svn_fs_x__noderev_t *
SVN_ERR(svn_fs_x__read_noderev(noderev_p, stream, result_pool,
scratch_pool));
- if (ffd->node_revision_cache)
- SVN_ERR(svn_cache__set(ffd->node_revision_cache, key, *noderev_p,
- scratch_pool));
+ SVN_ERR(svn_cache__set(ffd->node_revision_cache, key, *noderev_p,
+ scratch_pool));
return SVN_NO_ERROR;
}
@@ -3127,7 +3017,7 @@ block_read_noderevs_container(svn_fs_x__
key.second = entry->offset;
/* already in cache? */
- if (!must_read && ffd->noderevs_container_cache)
+ if (!must_read)
{
svn_boolean_t is_cached = FALSE;
SVN_ERR(svn_cache__has_key(&is_cached, ffd->noderevs_container_cache,
@@ -3147,9 +3037,8 @@ block_read_noderevs_container(svn_fs_x__
SVN_ERR(svn_fs_x__noderevs_get(noderev_p, container, sub_item,
result_pool));
- if (ffd->noderevs_container_cache)
- SVN_ERR(svn_cache__set(ffd->noderevs_container_cache, &key, container,
- scratch_pool));
+ SVN_ERR(svn_cache__set(ffd->noderevs_container_cache, &key, container,
+ scratch_pool));
return SVN_NO_ERROR;
}
@@ -3174,7 +3063,7 @@ block_read_reps_container(svn_fs_x__rep_
key.second = entry->offset;
/* already in cache? */
- if (!must_read && ffd->reps_container_cache)
+ if (!must_read)
{
svn_boolean_t is_cached = FALSE;
SVN_ERR(svn_cache__has_key(&is_cached, ffd->reps_container_cache,
@@ -3195,9 +3084,8 @@ block_read_reps_container(svn_fs_x__rep_
SVN_ERR(svn_fs_x__reps_get(extractor, fs, container, sub_item,
result_pool));
- if (ffd->noderevs_container_cache)
- SVN_ERR(svn_cache__set(ffd->reps_container_cache, &key, container,
- scratch_pool));
+ SVN_ERR(svn_cache__set(ffd->reps_container_cache, &key, container,
+ scratch_pool));
return SVN_NO_ERROR;
}
@@ -3232,8 +3120,7 @@ block_read(void **result,
do
{
/* fetch list of items in the block surrounding OFFSET */
- SVN_ERR(aligned_seek(fs, revision_file->file, &block_start, offset,
- iterpool));
+ SVN_ERR(svn_fs_x__rev_file_seek(revision_file, &block_start, offset));
SVN_ERR(svn_fs_x__p2l_index_lookup(&entries, fs, revision_file,
revision, block_start,
ffd->block_size, scratch_pool,
@@ -3272,8 +3159,8 @@ block_read(void **result,
key.revision = svn_fs_x__get_revnum(entry->items[0].change_set);
key.second = entry->items[0].number;
- SVN_ERR(svn_io_file_seek(revision_file->file, SEEK_SET,
- &entry->offset, iterpool));
+ SVN_ERR(svn_fs_x__rev_file_seek(revision_file, NULL,
+ entry->offset));
switch (entry->type)
{
case SVN_FS_X__ITEM_TYPE_FILE_REP:
@@ -3289,11 +3176,10 @@ block_read(void **result,
break;
case SVN_FS_X__ITEM_TYPE_NODEREV:
- if (ffd->node_revision_cache || is_result)
- SVN_ERR(block_read_noderev((svn_fs_x__noderev_t **)&item,
- fs, revision_file,
- entry, &key, is_result,
- pool, iterpool));
+ SVN_ERR(block_read_noderev((svn_fs_x__noderev_t **)&item,
+ fs, revision_file,
+ entry, &key, is_result,
+ pool, iterpool));
break;
case SVN_FS_X__ITEM_TYPE_CHANGES:
Modified: subversion/branches/move-tracking-2/subversion/libsvn_fs_x/cached_data.h
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/libsvn_fs_x/cached_data.h?rev=1695730&r1=1695729&r2=1695730&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/libsvn_fs_x/cached_data.h (original)
+++ subversion/branches/move-tracking-2/subversion/libsvn_fs_x/cached_data.h Thu Aug 13 15:54:54 2015
@@ -20,8 +20,8 @@
* ====================================================================
*/
-#ifndef SVN_LIBSVN_FS__CACHED_DATA_H
-#define SVN_LIBSVN_FS__CACHED_DATA_H
+#ifndef SVN_LIBSVN_FS_X_CACHED_DATA_H
+#define SVN_LIBSVN_FS_X_CACHED_DATA_H
#include "svn_pools.h"
#include "svn_fs.h"
Modified: subversion/branches/move-tracking-2/subversion/libsvn_fs_x/caching.c
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/libsvn_fs_x/caching.c?rev=1695730&r1=1695729&r2=1695730&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/libsvn_fs_x/caching.c (original)
+++ subversion/branches/move-tracking-2/subversion/libsvn_fs_x/caching.c Thu Aug 13 15:54:54 2015
@@ -23,8 +23,7 @@
#include "fs.h"
#include "fs_x.h"
#include "id.h"
-#include "dag.h"
-#include "tree.h"
+#include "dag_cache.h"
#include "index.h"
#include "changes.h"
#include "noderevs.h"
@@ -260,42 +259,42 @@ init_callbacks(svn_cache__t *cache,
svn_cache__error_handler_t error_handler,
apr_pool_t *pool)
{
- if (cache != NULL)
- {
#ifdef SVN_DEBUG_CACHE_DUMP_STATS
- /* schedule printing the access statistics upon pool cleanup,
- * i.e. end of FSX session.
- */
- dump_cache_baton_t *baton;
-
- baton = apr_palloc(pool, sizeof(*baton));
- baton->pool = pool;
- baton->cache = cache;
-
- apr_pool_cleanup_register(pool,
- baton,
- dump_cache_statistics,
- apr_pool_cleanup_null);
-#endif
+ /* schedule printing the access statistics upon pool cleanup,
+ * i.e. end of FSX session.
+ */
+ dump_cache_baton_t *baton;
- if (error_handler)
- SVN_ERR(svn_cache__set_error_handler(cache,
- error_handler,
- fs,
- pool));
+ baton = apr_palloc(pool, sizeof(*baton));
+ baton->pool = pool;
+ baton->cache = cache;
+
+ apr_pool_cleanup_register(pool,
+ baton,
+ dump_cache_statistics,
+ apr_pool_cleanup_null);
+#endif
- }
+ if (error_handler)
+ SVN_ERR(svn_cache__set_error_handler(cache,
+ error_handler,
+ fs,
+ pool));
return SVN_NO_ERROR;
}
/* Sets *CACHE_P to cache instance based on provided options.
- * Creates memcache if MEMCACHE is not NULL. Creates membuffer cache if
- * MEMBUFFER is not NULL. Fallbacks to inprocess cache if MEMCACHE and
- * MEMBUFFER are NULL and pages is non-zero. Sets *CACHE_P to NULL
- * otherwise. Use the given PRIORITY class for the new cache. If it
- * is 0, then use the default priority class.
+ *
+ * If DUMMY_CACHE is set, create a null cache. Otherwise, creates a memcache
+ * if MEMCACHE is not NULL or a membuffer cache if MEMBUFFER is not NULL.
+ * Falls back to inprocess cache if no other cache type has been selected
+ * and PAGES is not 0. Create a null cache otherwise.
+ *
+ * Use the given PRIORITY class for the new cache. If PRIORITY is 0, then
+ * use the default priority class. HAS_NAMESPACE indicates whether we
+ * prefixed this cache instance with a namespace.
*
* Unless NO_HANDLER is true, register an error handler that reports errors
* as warnings to the FS warning callback.
@@ -313,8 +312,10 @@ create_cache(svn_cache__t **cache_p,
apr_ssize_t klen,
const char *prefix,
apr_uint32_t priority,
+ svn_boolean_t has_namespace,
svn_fs_t *fs,
svn_boolean_t no_handler,
+ svn_boolean_t dummy_cache,
apr_pool_t *result_pool,
apr_pool_t *scratch_pool)
{
@@ -324,7 +325,11 @@ create_cache(svn_cache__t **cache_p,
if (priority == 0)
priority = SVN_CACHE__MEMBUFFER_DEFAULT_PRIORITY;
- if (memcache)
+ if (dummy_cache)
+ {
+ SVN_ERR(svn_cache__create_null(cache_p, prefix, result_pool));
+ }
+ else if (memcache)
{
SVN_ERR(svn_cache__create_memcache(cache_p, memcache,
serializer, deserializer, klen,
@@ -335,9 +340,12 @@ create_cache(svn_cache__t **cache_p,
}
else if (membuffer)
{
+ /* We assume caches with namespaces to be relatively short-lived,
+ * i.e. their data will not be needed after a while. */
SVN_ERR(svn_cache__create_membuffer_cache(
cache_p, membuffer, serializer, deserializer,
- klen, prefix, priority, FALSE, result_pool, scratch_pool));
+ klen, prefix, priority, FALSE, has_namespace,
+ result_pool, scratch_pool));
}
else if (pages)
{
@@ -347,7 +355,7 @@ create_cache(svn_cache__t **cache_p,
}
else
{
- *cache_p = NULL;
+ SVN_ERR(svn_cache__create_null(cache_p, prefix, result_pool));
}
SVN_ERR(init_callbacks(*cache_p, fs, error_handler, result_pool));
@@ -372,6 +380,7 @@ svn_fs_x__initialize_caches(svn_fs_t *fs
svn_boolean_t cache_fulltexts;
svn_boolean_t cache_revprops;
const char *cache_namespace;
+ svn_boolean_t has_namespace;
/* Evaluating the cache configuration. */
SVN_ERR(read_config(&cache_namespace,
@@ -383,6 +392,7 @@ svn_fs_x__initialize_caches(svn_fs_t *fs
prefix = apr_pstrcat(scratch_pool, "ns:", cache_namespace, ":", prefix,
SVN_VA_NULL);
+ has_namespace = strlen(cache_namespace) > 0;
membuffer = svn_cache__get_global_membuffer_cache();
@@ -407,21 +417,6 @@ svn_fs_x__initialize_caches(svn_fs_t *fs
apr_pool_cleanup_null);
#endif
- /* Rough estimate: revision DAG nodes have size around 320 bytes, so
- * let's put 16 on a page. */
- SVN_ERR(create_cache(&(ffd->rev_node_cache),
- NULL,
- membuffer,
- 1024, 16,
- svn_fs_x__dag_serialize,
- svn_fs_x__dag_deserialize,
- APR_HASH_KEY_STRING,
- apr_pstrcat(scratch_pool, prefix, "DAG", SVN_VA_NULL),
- SVN_CACHE__MEMBUFFER_LOW_PRIORITY,
- fs,
- no_handler,
- fs->pool, scratch_pool));
-
/* 1st level DAG node cache */
ffd->dag_node_cache = svn_fs_x__create_dag_cache(fs->pool);
@@ -435,24 +430,9 @@ svn_fs_x__initialize_caches(svn_fs_t *fs
sizeof(svn_fs_x__id_t),
apr_pstrcat(scratch_pool, prefix, "DIR", SVN_VA_NULL),
SVN_CACHE__MEMBUFFER_DEFAULT_PRIORITY,
+ has_namespace,
fs,
- no_handler,
- fs->pool, scratch_pool));
-
- /* Only 16 bytes per entry (a revision number + the corresponding offset).
- Since we want ~8k pages, that means 512 entries per page. */
- SVN_ERR(create_cache(&(ffd->packed_offset_cache),
- NULL,
- membuffer,
- 32, 1,
- svn_fs_x__serialize_manifest,
- svn_fs_x__deserialize_manifest,
- sizeof(svn_revnum_t),
- apr_pstrcat(scratch_pool, prefix, "PACK-MANIFEST",
- SVN_VA_NULL),
- SVN_CACHE__MEMBUFFER_HIGH_PRIORITY,
- fs,
- no_handler,
+ no_handler, FALSE,
fs->pool, scratch_pool));
/* initialize node revision cache, if caching has been enabled */
@@ -466,8 +446,9 @@ svn_fs_x__initialize_caches(svn_fs_t *fs
apr_pstrcat(scratch_pool, prefix, "NODEREVS",
SVN_VA_NULL),
SVN_CACHE__MEMBUFFER_HIGH_PRIORITY,
+ has_namespace,
fs,
- no_handler,
+ no_handler, FALSE,
fs->pool, scratch_pool));
/* initialize representation header cache, if caching has been enabled */
@@ -481,8 +462,9 @@ svn_fs_x__initialize_caches(svn_fs_t *fs
apr_pstrcat(scratch_pool, prefix, "REPHEADER",
SVN_VA_NULL),
SVN_CACHE__MEMBUFFER_DEFAULT_PRIORITY,
+ has_namespace,
fs,
- no_handler,
+ no_handler, FALSE,
fs->pool, scratch_pool));
/* initialize node change list cache, if caching has been enabled */
@@ -496,136 +478,90 @@ svn_fs_x__initialize_caches(svn_fs_t *fs
apr_pstrcat(scratch_pool, prefix, "CHANGES",
SVN_VA_NULL),
0,
+ has_namespace,
fs,
- no_handler,
+ no_handler, FALSE,
fs->pool, scratch_pool));
/* if enabled, cache fulltext and other derived information */
- if (cache_fulltexts)
- {
- SVN_ERR(create_cache(&(ffd->fulltext_cache),
- ffd->memcache,
- membuffer,
- 0, 0, /* Do not use inprocess cache */
- /* Values are svn_stringbuf_t */
- NULL, NULL,
- sizeof(svn_fs_x__pair_cache_key_t),
- apr_pstrcat(scratch_pool, prefix, "TEXT",
- SVN_VA_NULL),
- SVN_CACHE__MEMBUFFER_DEFAULT_PRIORITY,
- fs,
- no_handler,
- fs->pool, scratch_pool));
-
- SVN_ERR(create_cache(&(ffd->properties_cache),
- NULL,
- membuffer,
- 0, 0, /* Do not use inprocess cache */
- svn_fs_x__serialize_properties,
- svn_fs_x__deserialize_properties,
- sizeof(svn_fs_x__pair_cache_key_t),
- apr_pstrcat(scratch_pool, prefix, "PROP",
- SVN_VA_NULL),
- SVN_CACHE__MEMBUFFER_DEFAULT_PRIORITY,
- fs,
- no_handler,
- fs->pool, scratch_pool));
-
- SVN_ERR(create_cache(&(ffd->mergeinfo_cache),
- NULL,
- membuffer,
- 0, 0, /* Do not use inprocess cache */
- svn_fs_x__serialize_mergeinfo,
- svn_fs_x__deserialize_mergeinfo,
- APR_HASH_KEY_STRING,
- apr_pstrcat(scratch_pool, prefix, "MERGEINFO",
- SVN_VA_NULL),
- 0,
- fs,
- no_handler,
- fs->pool, scratch_pool));
-
- SVN_ERR(create_cache(&(ffd->mergeinfo_existence_cache),
- NULL,
- membuffer,
- 0, 0, /* Do not use inprocess cache */
- /* Values are svn_stringbuf_t */
- NULL, NULL,
- APR_HASH_KEY_STRING,
- apr_pstrcat(scratch_pool, prefix, "HAS_MERGEINFO",
- SVN_VA_NULL),
- 0,
- fs,
- no_handler,
- fs->pool, scratch_pool));
- }
- else
- {
- ffd->fulltext_cache = NULL;
- ffd->properties_cache = NULL;
- ffd->mergeinfo_cache = NULL;
- ffd->mergeinfo_existence_cache = NULL;
- }
+ SVN_ERR(create_cache(&(ffd->fulltext_cache),
+ ffd->memcache,
+ membuffer,
+ 0, 0, /* Do not use inprocess cache */
+ /* Values are svn_stringbuf_t */
+ NULL, NULL,
+ sizeof(svn_fs_x__pair_cache_key_t),
+ apr_pstrcat(scratch_pool, prefix, "TEXT",
+ SVN_VA_NULL),
+ SVN_CACHE__MEMBUFFER_DEFAULT_PRIORITY,
+ has_namespace,
+ fs,
+ no_handler, !cache_fulltexts,
+ fs->pool, scratch_pool));
+
+ SVN_ERR(create_cache(&(ffd->properties_cache),
+ NULL,
+ membuffer,
+ 0, 0, /* Do not use inprocess cache */
+ svn_fs_x__serialize_properties,
+ svn_fs_x__deserialize_properties,
+ sizeof(svn_fs_x__pair_cache_key_t),
+ apr_pstrcat(scratch_pool, prefix, "PROP",
+ SVN_VA_NULL),
+ SVN_CACHE__MEMBUFFER_DEFAULT_PRIORITY,
+ has_namespace,
+ fs,
+ no_handler, !cache_fulltexts,
+ fs->pool, scratch_pool));
/* if enabled, cache revprops */
- if (cache_revprops)
- {
- SVN_ERR(create_cache(&(ffd->revprop_cache),
- NULL,
- membuffer,
- 0, 0, /* Do not use inprocess cache */
- svn_fs_x__serialize_properties,
- svn_fs_x__deserialize_properties,
- sizeof(svn_fs_x__pair_cache_key_t),
- apr_pstrcat(scratch_pool, prefix, "REVPROP",
- SVN_VA_NULL),
- SVN_CACHE__MEMBUFFER_DEFAULT_PRIORITY,
- fs,
- no_handler,
- fs->pool, scratch_pool));
- }
- else
- {
- ffd->revprop_cache = NULL;
- }
+ SVN_ERR(create_cache(&(ffd->revprop_cache),
+ NULL,
+ membuffer,
+ 0, 0, /* Do not use inprocess cache */
+ svn_fs_x__serialize_properties,
+ svn_fs_x__deserialize_properties,
+ sizeof(svn_fs_x__pair_cache_key_t),
+ apr_pstrcat(scratch_pool, prefix, "REVPROP",
+ SVN_VA_NULL),
+ SVN_CACHE__MEMBUFFER_DEFAULT_PRIORITY,
+ has_namespace,
+ fs,
+ no_handler, !cache_revprops,
+ fs->pool, scratch_pool));
/* if enabled, cache text deltas and their combinations */
- if (cache_txdeltas)
- {
- SVN_ERR(create_cache(&(ffd->txdelta_window_cache),
- NULL,
- membuffer,
- 0, 0, /* Do not use inprocess cache */
- svn_fs_x__serialize_txdelta_window,
- svn_fs_x__deserialize_txdelta_window,
- sizeof(svn_fs_x__window_cache_key_t),
- apr_pstrcat(scratch_pool, prefix, "TXDELTA_WINDOW",
- SVN_VA_NULL),
- SVN_CACHE__MEMBUFFER_LOW_PRIORITY,
- fs,
- no_handler,
- fs->pool, scratch_pool));
-
- SVN_ERR(create_cache(&(ffd->combined_window_cache),
- NULL,
- membuffer,
- 0, 0, /* Do not use inprocess cache */
- /* Values are svn_stringbuf_t */
- NULL, NULL,
- sizeof(svn_fs_x__window_cache_key_t),
- apr_pstrcat(scratch_pool, prefix, "COMBINED_WINDOW",
- SVN_VA_NULL),
- SVN_CACHE__MEMBUFFER_LOW_PRIORITY,
- fs,
- no_handler,
- fs->pool, scratch_pool));
- }
- else
- {
- ffd->txdelta_window_cache = NULL;
- ffd->combined_window_cache = NULL;
- }
+ SVN_ERR(create_cache(&(ffd->txdelta_window_cache),
+ NULL,
+ membuffer,
+ 0, 0, /* Do not use inprocess cache */
+ svn_fs_x__serialize_txdelta_window,
+ svn_fs_x__deserialize_txdelta_window,
+ sizeof(svn_fs_x__window_cache_key_t),
+ apr_pstrcat(scratch_pool, prefix, "TXDELTA_WINDOW",
+ SVN_VA_NULL),
+ SVN_CACHE__MEMBUFFER_LOW_PRIORITY,
+ has_namespace,
+ fs,
+ no_handler, !cache_txdeltas,
+ fs->pool, scratch_pool));
+
+ SVN_ERR(create_cache(&(ffd->combined_window_cache),
+ NULL,
+ membuffer,
+ 0, 0, /* Do not use inprocess cache */
+ /* Values are svn_stringbuf_t */
+ NULL, NULL,
+ sizeof(svn_fs_x__window_cache_key_t),
+ apr_pstrcat(scratch_pool, prefix, "COMBINED_WINDOW",
+ SVN_VA_NULL),
+ SVN_CACHE__MEMBUFFER_LOW_PRIORITY,
+ has_namespace,
+ fs,
+ no_handler, !cache_txdeltas,
+ fs->pool, scratch_pool));
+ /* Caches for our various container types. */
SVN_ERR(create_cache(&(ffd->noderevs_container_cache),
NULL,
membuffer,
@@ -636,8 +572,9 @@ svn_fs_x__initialize_caches(svn_fs_t *fs
apr_pstrcat(scratch_pool, prefix, "NODEREVSCNT",
SVN_VA_NULL),
SVN_CACHE__MEMBUFFER_HIGH_PRIORITY,
+ has_namespace,
fs,
- no_handler,
+ no_handler, FALSE,
fs->pool, scratch_pool));
SVN_ERR(create_cache(&(ffd->changes_container_cache),
NULL,
@@ -649,8 +586,9 @@ svn_fs_x__initialize_caches(svn_fs_t *fs
apr_pstrcat(scratch_pool, prefix, "CHANGESCNT",
SVN_VA_NULL),
0,
+ has_namespace,
fs,
- no_handler,
+ no_handler, FALSE,
fs->pool, scratch_pool));
SVN_ERR(create_cache(&(ffd->reps_container_cache),
NULL,
@@ -662,10 +600,12 @@ svn_fs_x__initialize_caches(svn_fs_t *fs
apr_pstrcat(scratch_pool, prefix, "REPSCNT",
SVN_VA_NULL),
0,
+ has_namespace,
fs,
- no_handler,
+ no_handler, FALSE,
fs->pool, scratch_pool));
+ /* Cache index info. */
SVN_ERR(create_cache(&(ffd->l2p_header_cache),
NULL,
membuffer,
@@ -677,8 +617,9 @@ svn_fs_x__initialize_caches(svn_fs_t *fs
apr_pstrcat(scratch_pool, prefix, "L2P_HEADER",
SVN_VA_NULL),
SVN_CACHE__MEMBUFFER_HIGH_PRIORITY,
+ has_namespace,
fs,
- no_handler,
+ no_handler, FALSE,
fs->pool, scratch_pool));
SVN_ERR(create_cache(&(ffd->l2p_page_cache),
NULL,
@@ -691,8 +632,9 @@ svn_fs_x__initialize_caches(svn_fs_t *fs
apr_pstrcat(scratch_pool, prefix, "L2P_PAGE",
SVN_VA_NULL),
SVN_CACHE__MEMBUFFER_HIGH_PRIORITY,
+ has_namespace,
fs,
- no_handler,
+ no_handler, FALSE,
fs->pool, scratch_pool));
SVN_ERR(create_cache(&(ffd->p2l_header_cache),
NULL,
@@ -704,8 +646,9 @@ svn_fs_x__initialize_caches(svn_fs_t *fs
apr_pstrcat(scratch_pool, prefix, "P2L_HEADER",
SVN_VA_NULL),
SVN_CACHE__MEMBUFFER_HIGH_PRIORITY,
+ has_namespace,
fs,
- no_handler,
+ no_handler, FALSE,
fs->pool, scratch_pool));
SVN_ERR(create_cache(&(ffd->p2l_page_cache),
NULL,
@@ -717,8 +660,9 @@ svn_fs_x__initialize_caches(svn_fs_t *fs
apr_pstrcat(scratch_pool, prefix, "P2L_PAGE",
SVN_VA_NULL),
SVN_CACHE__MEMBUFFER_HIGH_PRIORITY,
+ has_namespace,
fs,
- no_handler,
+ no_handler, FALSE,
fs->pool, scratch_pool));
return SVN_NO_ERROR;
Modified: subversion/branches/move-tracking-2/subversion/libsvn_fs_x/changes.c
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/libsvn_fs_x/changes.c?rev=1695730&r1=1695729&r2=1695730&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/libsvn_fs_x/changes.c (original)
+++ subversion/branches/move-tracking-2/subversion/libsvn_fs_x/changes.c Thu Aug 13 15:54:54 2015
@@ -222,7 +222,7 @@ svn_error_t *
svn_fs_x__changes_get_list(apr_array_header_t **list,
const svn_fs_x__changes_t *changes,
apr_size_t idx,
- apr_pool_t *pool)
+ apr_pool_t *result_pool)
{
int first;
int last;
@@ -235,7 +235,7 @@ svn_fs_x__changes_get_list(apr_array_hea
/* validate index */
if (idx + 1 >= (apr_size_t)changes->offsets->nelts)
return svn_error_createf(SVN_ERR_FS_CONTAINER_INDEX, NULL,
- apr_psprintf(pool,
+ apr_psprintf(result_pool,
_("Changes list index %%%s"
" exceeds container size %%d"),
APR_SIZE_T_FMT),
@@ -246,18 +246,19 @@ svn_fs_x__changes_get_list(apr_array_hea
last = APR_ARRAY_IDX(changes->offsets, (int)idx + 1, int);
/* construct result */
- *list = apr_array_make(pool, last - first, sizeof(svn_fs_x__change_t*));
+ *list = apr_array_make(result_pool, last - first,
+ sizeof(svn_fs_x__change_t*));
for (i = first; i < last; ++i)
{
const binary_change_t *binary_change
= &APR_ARRAY_IDX(changes->changes, i, binary_change_t);
/* convert BINARY_CHANGE into a standard FSX svn_fs_x__change_t */
- svn_fs_x__change_t *change = apr_pcalloc(pool, sizeof(*change));
+ svn_fs_x__change_t *change = apr_pcalloc(result_pool, sizeof(*change));
change->path.data = svn_fs_x__string_table_get(changes->paths,
binary_change->path,
&change->path.len,
- pool);
+ result_pool);
if (binary_change->noderev_id.change_set != SVN_FS_X__INVALID_CHANGE_SET)
change->noderev_id = binary_change->noderev_id;
@@ -276,7 +277,7 @@ svn_fs_x__changes_get_list(apr_array_hea
= svn_fs_x__string_table_get(changes->paths,
binary_change->copyfrom_path,
NULL,
- pool);
+ result_pool);
/* add it to the result */
APR_ARRAY_PUSH(*list, svn_fs_x__change_t*) = change;
@@ -437,14 +438,14 @@ svn_error_t *
svn_fs_x__deserialize_changes_container(void **out,
void *data,
apr_size_t data_len,
- apr_pool_t *pool)
+ apr_pool_t *result_pool)
{
svn_fs_x__changes_t *changes = (svn_fs_x__changes_t *)data;
/* de-serialize sub-structures */
svn_fs_x__deserialize_string_table(changes, &changes->paths);
- svn_fs_x__deserialize_apr_array(changes, &changes->changes, pool);
- svn_fs_x__deserialize_apr_array(changes, &changes->offsets, pool);
+ svn_fs_x__deserialize_apr_array(changes, &changes->changes, result_pool);
+ svn_fs_x__deserialize_apr_array(changes, &changes->offsets, result_pool);
/* done */
*out = changes;
Modified: subversion/branches/move-tracking-2/subversion/libsvn_fs_x/changes.h
URL: http://svn.apache.org/viewvc/subversion/branches/move-tracking-2/subversion/libsvn_fs_x/changes.h?rev=1695730&r1=1695729&r2=1695730&view=diff
==============================================================================
--- subversion/branches/move-tracking-2/subversion/libsvn_fs_x/changes.h (original)
+++ subversion/branches/move-tracking-2/subversion/libsvn_fs_x/changes.h Thu Aug 13 15:54:54 2015
@@ -20,8 +20,8 @@
* ====================================================================
*/
-#ifndef SVN_LIBSVN_FS__CHANGES_H
-#define SVN_LIBSVN_FS__CHANGES_H
+#ifndef SVN_LIBSVN_FS_X_CHANGES_H
+#define SVN_LIBSVN_FS_X_CHANGES_H
#include "svn_io.h"
#include "fs.h"
@@ -78,7 +78,7 @@ svn_error_t *
svn_fs_x__changes_get_list(apr_array_header_t **list,
const svn_fs_x__changes_t *changes,
apr_size_t idx,
- apr_pool_t *pool);
+ apr_pool_t *result_pool);
/* I/O interface. */
@@ -114,7 +114,7 @@ svn_error_t *
svn_fs_x__deserialize_changes_container(void **out,
void *data,
apr_size_t data_len,
- apr_pool_t *pool);
+ apr_pool_t *result_pool);
/* Implements svn_cache__partial_getter_func_t for svn_fs_x__changes_t,
* setting *OUT to the change list (apr_array_header_t *) selected by