##// 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 # TODO before getting `persistent-nodemap` out of experimental
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 # * decide for a "status" of the persistent nodemap and associated location
410 # * decide for a "status" of the persistent nodemap and associated location
412 # - part of the store next the revlog itself (new requirements)
411 # - part of the store next the revlog itself (new requirements)
413 # - part of the cache directory
412 # - part of the cache directory
@@ -143,13 +143,16 b' def _persist_nodemap(tr, revlog, pending'
143 data_changed_count,
143 data_changed_count,
144 data,
144 data,
145 ) = revlog.index.nodemap_data_incremental()
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 if src_docket != target_docket:
148 if src_docket != target_docket:
147 data = None
149 data = None
150 elif new_length <= (new_unused * 10): # under 10% of unused data
151 data = None
148 else:
152 else:
149 datafile = _rawdata_filepath(revlog, target_docket)
153 datafile = _rawdata_filepath(revlog, target_docket)
150 # EXP-TODO: if this is a cache, this should use a cache vfs, not a
154 # EXP-TODO: if this is a cache, this should use a cache vfs, not a
151 # store vfs
155 # store vfs
152 new_length = target_docket.data_length + len(data)
153 tr.add(datafile, target_docket.data_length)
156 tr.add(datafile, target_docket.data_length)
154 with revlog.opener(datafile, b'r+') as fd:
157 with revlog.opener(datafile, b'r+') as fd:
155 fd.seek(target_docket.data_length)
158 fd.seek(target_docket.data_length)
@@ -162,7 +165,7 b' def _persist_nodemap(tr, revlog, pending'
162 fd.flush()
165 fd.flush()
163 new_data = util.buffer(util.mmapread(fd, new_length))
166 new_data = util.buffer(util.mmapread(fd, new_length))
164 target_docket.data_length = new_length
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 if data is None:
170 if data is None:
168 # otherwise fallback to a full new export
171 # otherwise fallback to a full new export
@@ -278,12 +278,12 b' the nodemap should detect the changelog '
278 tip-rev: 5002
278 tip-rev: 5002
279 tip-node: 42bf3068c7ddfdfded53c4eb11d02266faeebfee
279 tip-node: 42bf3068c7ddfdfded53c4eb11d02266faeebfee
280 data-length: 123456 (pure !)
280 data-length: 123456 (pure !)
281 data-length: 246464 (rust !)
281 data-length: 123008 (rust !)
282 data-length: 123008 (no-pure no-rust !)
282 data-length: 123008 (no-pure no-rust !)
283 data-unused: 448 (pure !)
283 data-unused: 448 (pure !)
284 data-unused: 123904 (rust !)
284 data-unused: 0 (rust !)
285 data-unused: 0 (no-pure no-rust !)
285 data-unused: 0 (no-pure no-rust !)
286 data-unused: 50.273% (rust !)
286 data-unused: 0.000% (rust !)
287 data-unused: 0.363% (pure !)
287 data-unused: 0.363% (pure !)
288 data-unused: 0.000% (no-pure no-rust !)
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