Mercurial > public > mercurial-scm > hg
diff mercurial/revlog.py @ 51178:dcaa2df1f688
changelog: never inline changelog
The test suite mostly use small repositories, that implies that most changelog in the
tests are inlined. As a result, non-inlined changelog are quite poorly tested.
Since non-inline changelog are most common case for serious repositories, this
lack of testing is a significant problem that results in high profile issue like
the one recently fixed by 66417f55ea33 and 849745d7da89.
Inlining the changelog does not bring much to the table, the number of total
file saved is negligible, and the changelog will be read by most operation
anyway.
So this changeset is make it so we never inline the changelog, and de-inline the
one that are still inlined whenever we touch them.
By doing that, we remove the "dual code path" situation for writing new entry to
the changelog and move to a "single code path" situation. Having a single
code path simplify the code and make sure it is covered by test (if test cover
that situation obviously)
This impact all tests that care about the number of file and the exchange size,
but there is nothing too complicated in them just a lot of churn.
The churn is made "worse" by the fact rust will use the persistent nodemap on
any changelog now. Which is overall a win as it means testing the persistent
nodemap more and having less special cases.
In short, having inline changelog is mostly useless and an endless source of
pain. We get rid of it.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Mon, 11 Dec 2023 22:27:59 +0100 |
parents | 849745d7da89 |
children | a93e52f0b6ff |
line wrap: on
line diff
--- a/mercurial/revlog.py Mon Dec 11 11:50:55 2023 +0100 +++ b/mercurial/revlog.py Mon Dec 11 22:27:59 2023 +0100 @@ -1391,194 +1391,6 @@ self._load_inner(chunk_cache) self._concurrencychecker = concurrencychecker - @property - def _generaldelta(self): - """temporary compatibility proxy""" - util.nouideprecwarn( - b"use revlog.delta_config.general_delta", b"6.6", stacklevel=2 - ) - return self.delta_config.general_delta - - @property - def _checkambig(self): - """temporary compatibility proxy""" - util.nouideprecwarn( - b"use revlog.data_config.checkambig", b"6.6", stacklevel=2 - ) - return self.data_config.check_ambig - - @property - def _mmaplargeindex(self): - """temporary compatibility proxy""" - util.nouideprecwarn( - b"use revlog.data_config.mmap_large_index", b"6.6", stacklevel=2 - ) - return self.data_config.mmap_large_index - - @property - def _censorable(self): - """temporary compatibility proxy""" - util.nouideprecwarn( - b"use revlog.feature_config.censorable", b"6.6", stacklevel=2 - ) - return self.feature_config.censorable - - @property - def _chunkcachesize(self): - """temporary compatibility proxy""" - util.nouideprecwarn( - b"use revlog.data_config.chunk_cache_size", b"6.6", stacklevel=2 - ) - return self.data_config.chunk_cache_size - - @property - def _maxchainlen(self): - """temporary compatibility proxy""" - util.nouideprecwarn( - b"use revlog.delta_config.max_chain_len", b"6.6", stacklevel=2 - ) - return self.delta_config.max_chain_len - - @property - def _deltabothparents(self): - """temporary compatibility proxy""" - util.nouideprecwarn( - b"use revlog.delta_config.delta_both_parents", b"6.6", stacklevel=2 - ) - return self.delta_config.delta_both_parents - - @property - def _candidate_group_chunk_size(self): - """temporary compatibility proxy""" - util.nouideprecwarn( - b"use revlog.delta_config.candidate_group_chunk_size", - b"6.6", - stacklevel=2, - ) - return self.delta_config.candidate_group_chunk_size - - @property - def _debug_delta(self): - """temporary compatibility proxy""" - util.nouideprecwarn( - b"use revlog.delta_config.debug_delta", b"6.6", stacklevel=2 - ) - return self.delta_config.debug_delta - - @property - def _compengine(self): - """temporary compatibility proxy""" - util.nouideprecwarn( - b"use revlog.feature_config.compression_engine", - b"6.6", - stacklevel=2, - ) - return self.feature_config.compression_engine - - @property - def upperboundcomp(self): - """temporary compatibility proxy""" - util.nouideprecwarn( - b"use revlog.delta_config.upper_bound_comp", - b"6.6", - stacklevel=2, - ) - return self.delta_config.upper_bound_comp - - @property - def _compengineopts(self): - """temporary compatibility proxy""" - util.nouideprecwarn( - b"use revlog.feature_config.compression_engine_options", - b"6.6", - stacklevel=2, - ) - return self.feature_config.compression_engine_options - - @property - def _maxdeltachainspan(self): - """temporary compatibility proxy""" - util.nouideprecwarn( - b"use revlog.delta_config.max_deltachain_span", b"6.6", stacklevel=2 - ) - return self.delta_config.max_deltachain_span - - @property - def _withsparseread(self): - """temporary compatibility proxy""" - util.nouideprecwarn( - b"use revlog.data_config.with_sparse_read", b"6.6", stacklevel=2 - ) - return self.data_config.with_sparse_read - - @property - def _sparserevlog(self): - """temporary compatibility proxy""" - util.nouideprecwarn( - b"use revlog.delta_config.sparse_revlog", b"6.6", stacklevel=2 - ) - return self.delta_config.sparse_revlog - - @property - def hassidedata(self): - """temporary compatibility proxy""" - util.nouideprecwarn( - b"use revlog.feature_config.has_side_data", b"6.6", stacklevel=2 - ) - return self.feature_config.has_side_data - - @property - def _srdensitythreshold(self): - """temporary compatibility proxy""" - util.nouideprecwarn( - b"use revlog.data_config.sr_density_threshold", - b"6.6", - stacklevel=2, - ) - return self.data_config.sr_density_threshold - - @property - def _srmingapsize(self): - """temporary compatibility proxy""" - util.nouideprecwarn( - b"use revlog.data_config.sr_min_gap_size", b"6.6", stacklevel=2 - ) - return self.data_config.sr_min_gap_size - - @property - def _compute_rank(self): - """temporary compatibility proxy""" - util.nouideprecwarn( - b"use revlog.feature_config.compute_rank", b"6.6", stacklevel=2 - ) - return self.feature_config.compute_rank - - @property - def canonical_parent_order(self): - """temporary compatibility proxy""" - util.nouideprecwarn( - b"use revlog.feature_config.canonical_parent_order", - b"6.6", - stacklevel=2, - ) - return self.feature_config.canonical_parent_order - - @property - def _lazydelta(self): - """temporary compatibility proxy""" - util.nouideprecwarn( - b"use revlog.delta_config.lazy_delta", b"6.6", stacklevel=2 - ) - return self.delta_config.lazy_delta - - @property - def _lazydeltabase(self): - """temporary compatibility proxy""" - util.nouideprecwarn( - b"use revlog.delta_config.lazy_delta_base", b"6.6", stacklevel=2 - ) - return self.delta_config.lazy_delta_base - def _init_opts(self): """process options (from above/config) to setup associated default revlog mode @@ -3026,13 +2838,17 @@ msg = b"inline revlog should not have a docket" raise error.ProgrammingError(msg) + # In the common case, we enforce inline size because the revlog has + # been appened too. And in such case, it must have an initial offset + # recorded in the transaction. troffset = tr.findoffset(self._inner.canonical_index_file) - if troffset is None: + pre_touched = troffset is not None + if not pre_touched and self.target[0] != KIND_CHANGELOG: raise error.RevlogError( _(b"%s not found in the transaction") % self._indexfile ) - if troffset: - tr.addbackup(self._inner.canonical_index_file, for_offset=True) + + tr.addbackup(self._inner.canonical_index_file, for_offset=pre_touched) tr.add(self._datafile, 0) new_index_file_path = None