##// END OF EJS Templates
nodemap: automatically "vacuum" the persistent nodemap when too sparse...
marmoute -
r45126:c70bcaf7 default
parent child Browse files
Show More
@@ -407,7 +407,6 b' coreconfigitem('
407 407 )
408 408 # TODO before getting `persistent-nodemap` out of experimental
409 409 #
410 # * regenerate a new nodemap when the unused/total ration is to high
411 410 # * decide for a "status" of the persistent nodemap and associated location
412 411 # - part of the store next the revlog itself (new requirements)
413 412 # - part of the cache directory
@@ -143,13 +143,16 b' def _persist_nodemap(tr, revlog, pending'
143 143 data_changed_count,
144 144 data,
145 145 ) = revlog.index.nodemap_data_incremental()
146 new_length = target_docket.data_length + len(data)
147 new_unused = target_docket.data_unused + data_changed_count
146 148 if src_docket != target_docket:
147 149 data = None
150 elif new_length <= (new_unused * 10): # under 10% of unused data
151 data = None
148 152 else:
149 153 datafile = _rawdata_filepath(revlog, target_docket)
150 154 # EXP-TODO: if this is a cache, this should use a cache vfs, not a
151 155 # store vfs
152 new_length = target_docket.data_length + len(data)
153 156 tr.add(datafile, target_docket.data_length)
154 157 with revlog.opener(datafile, b'r+') as fd:
155 158 fd.seek(target_docket.data_length)
@@ -162,7 +165,7 b' def _persist_nodemap(tr, revlog, pending'
162 165 fd.flush()
163 166 new_data = util.buffer(util.mmapread(fd, new_length))
164 167 target_docket.data_length = new_length
165 target_docket.data_unused += data_changed_count
168 target_docket.data_unused = new_unused
166 169
167 170 if data is None:
168 171 # otherwise fallback to a full new export
@@ -278,12 +278,12 b' the nodemap should detect the changelog '
278 278 tip-rev: 5002
279 279 tip-node: 42bf3068c7ddfdfded53c4eb11d02266faeebfee
280 280 data-length: 123456 (pure !)
281 data-length: 246464 (rust !)
281 data-length: 123008 (rust !)
282 282 data-length: 123008 (no-pure no-rust !)
283 283 data-unused: 448 (pure !)
284 data-unused: 123904 (rust !)
284 data-unused: 0 (rust !)
285 285 data-unused: 0 (no-pure no-rust !)
286 data-unused: 50.273% (rust !)
286 data-unused: 0.000% (rust !)
287 287 data-unused: 0.363% (pure !)
288 288 data-unused: 0.000% (no-pure no-rust !)
289 289
General Comments 0
You need to be logged in to leave comments. Login now