Mercurial > hg
comparison tests/test-sparse-revlog.t @ 39493:3ca144f1c8dd
snapshot: search for unrelated but reusable full-snapshot
# New Strategy Step: Reusing Snapshot Outside Of Parents' Chain.
If no suitable bases were found in the parent's chains, see if we could reuse
a full snapshot not directly related to the current revision. Such search can
be expensive, so we only search for snapshots appended to the revlog *after*
the bases used by the parents of the current revision (the one we just
tested). We assume the parent's bases were created because the previous
snapshots were unsuitable, so there are low odds they would be useful now.
This search gives a chance to reuse a delta chain unrelated to the current
revision. Without this re-use, topological branches would keep reopening new
full chains. Creating more and more snapshots as the repository grow.
In repositories with many topological branches, the lack of delta reuse can
create too many snapshots reducing overall compression to nothing. This
results in a very large repository and other usability issues.
For now, we still focus on creating level-1 snapshots. However, this principle
will play a large part in how we avoid snapshot explosion once we have more
snapshot levels.
# Effects On The Test Repository
In the test repository we created, we can see the beneficial effect of such
reuse. We need very few level-0 snapshots and the overall revlog size has
decreased.
The `hg debugrevlog` call, show a "lvl-2" snapshot. It comes from the existing
delta logic using the `prev` revision (revlog's tip) as the base. In this
specific case, it turns out the tip was a level-1 snapshot. This is a
coincidence that can be ignored.
Finding and testing against all these unrelated snapshots can have a
performance impact at write time. We currently focus on building good deltas
chain we build. Performance concern will be dealt with later in another
series.
author | Boris Feld <boris.feld@octobus.net> |
---|---|
date | Fri, 07 Sep 2018 11:17:30 -0400 |
parents | a33f394b2bfd |
children | e72130f58f5d |
comparison
equal
deleted
inserted
replaced
39492:a33f394b2bfd | 39493:3ca144f1c8dd |
---|---|
75 SPARSE-REVLOG-TEST-FILE | 1068 +++++++++++++++++++++++----------------------- | 75 SPARSE-REVLOG-TEST-FILE | 1068 +++++++++++++++++++++++----------------------- |
76 1 files changed, 534 insertions(+), 534 deletions(-) | 76 1 files changed, 534 insertions(+), 534 deletions(-) |
77 | 77 |
78 | 78 |
79 $ f -s .hg/store/data/*.d | 79 $ f -s .hg/store/data/*.d |
80 .hg/store/data/_s_p_a_r_s_e-_r_e_v_l_o_g-_t_e_s_t-_f_i_l_e.d: size=72315280 | 80 .hg/store/data/_s_p_a_r_s_e-_r_e_v_l_o_g-_t_e_s_t-_f_i_l_e.d: size=67810463 |
81 $ hg debugrevlog * | 81 $ hg debugrevlog * |
82 format : 1 | 82 format : 1 |
83 flags : generaldelta | 83 flags : generaldelta |
84 | 84 |
85 revisions : 5001 | 85 revisions : 5001 |
87 normal : 4376 (87.50%) | 87 normal : 4376 (87.50%) |
88 revisions : 5001 | 88 revisions : 5001 |
89 empty : 0 ( 0.00%) | 89 empty : 0 ( 0.00%) |
90 text : 0 (100.00%) | 90 text : 0 (100.00%) |
91 delta : 0 (100.00%) | 91 delta : 0 (100.00%) |
92 snapshot : 145 ( 2.90%) | 92 snapshot : 126 ( 2.52%) |
93 lvl-0 : 15 ( 0.30%) | 93 lvl-0 : 4 ( 0.08%) |
94 lvl-1 : 130 ( 2.60%) | 94 lvl-1 : 120 ( 2.40%) |
95 deltas : 4856 (97.10%) | 95 lvl-2 : 2 ( 0.04%) |
96 revision size : 72315280 | 96 deltas : 4875 (97.48%) |
97 snapshot : 18481085 (25.56%) | 97 revision size : 67810463 |
98 lvl-0 : 3016019 ( 4.17%) | 98 snapshot : 14373347 (21.20%) |
99 lvl-1 : 15465066 (21.39%) | 99 lvl-0 : 804235 ( 1.19%) |
100 deltas : 53834195 (74.44%) | 100 lvl-1 : 13535903 (19.96%) |
101 lvl-2 : 33209 ( 0.05%) | |
102 deltas : 53437116 (78.80%) | |
101 | 103 |
102 chunks : 5001 | 104 chunks : 5001 |
103 0x78 (x) : 5001 (100.00%) | 105 0x78 (x) : 5001 (100.00%) |
104 chunks size : 72315280 | 106 chunks size : 67810463 |
105 0x78 (x) : 72315280 (100.00%) | 107 0x78 (x) : 67810463 (100.00%) |
106 | 108 |
107 avg chain length : 18 | 109 avg chain length : 18 |
108 max chain length : 45 | 110 max chain length : 45 |
109 max chain reach : 32095083 | 111 max chain reach : 25808240 |
110 compression ratio : 23 | 112 compression ratio : 25 |
111 | 113 |
112 uncompressed data size (min/max/avg) : 346468 / 346472 / 346471 | 114 uncompressed data size (min/max/avg) : 346468 / 346472 / 346471 |
113 full revision size (min/max/avg) : 200990 / 201151 / 201067 | 115 full revision size (min/max/avg) : 201014 / 201116 / 201058 |
114 inter-snapshot size (min/max/avg) : 37202 / 173034 / 118962 | 116 inter-snapshot size (min/max/avg) : 11623 / 173150 / 111222 |
115 level-1 (min/max/avg) : 37202 / 173034 / 118962 | 117 level-1 (min/max/avg) : 11623 / 173150 / 112799 |
116 delta size (min/max/avg) : 10649 / 104791 / 11086 | 118 level-2 (min/max/avg) : 14151 / 19058 / 16604 |
119 delta size (min/max/avg) : 10649 / 101790 / 10961 | |
117 | 120 |
118 deltas against prev : 4185 (86.18%) | 121 deltas against prev : 4207 (86.30%) |
119 where prev = p1 : 4139 (98.90%) | 122 where prev = p1 : 4164 (98.98%) |
120 where prev = p2 : 0 ( 0.00%) | 123 where prev = p2 : 0 ( 0.00%) |
121 other : 46 ( 1.10%) | 124 other : 43 ( 1.02%) |
122 deltas against p1 : 647 (13.32%) | 125 deltas against p1 : 653 (13.39%) |
123 deltas against p2 : 24 ( 0.49%) | 126 deltas against p2 : 15 ( 0.31%) |
124 deltas against other : 0 ( 0.00%) | 127 deltas against other : 0 ( 0.00%) |