changeset 49155:c69adc82e7f7 stable

rust-dirstate-v2: show `unused_bytes` counter is not reset on total rewrite This was picked up by @aalekseyev when doing unrelated debugging. The Rust implementation was never resetting this counter, so a brand new file would carry over the old counter. As I write this, my counter is a supposed 7389089 unused bytes for a total of 170978 bytes in the data file. Feel free to post your own high score. Differential Revision: https://phab.mercurial-scm.org/D12593
author Raphaël Gomès <rgomes@octobus.net>
date Thu, 28 Apr 2022 17:11:51 +0200
parents 51262af89efe
children 09984dc70352
files tests/test-dirstate.t
diffstat 1 files changed, 27 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/tests/test-dirstate.t	Thu Apr 28 16:24:55 2022 +0200
+++ b/tests/test-dirstate.t	Thu Apr 28 17:11:51 2022 +0200
@@ -166,6 +166,25 @@
    *1 (re)
   $ dirstate_uuid_has_not_changed
 
+Unused bytes counter is non-0 when appending
+  $ touch file
+  $ hg add file
+  $ current_uid=$(find_dirstate_uuid)
+
+Trigger a rust/rhg run which updates the unused bytes value
+  $ hg st
+  M dir2/f
+  A file
+  $ dirstate_data_files | wc -l
+   *1 (re)
+  $ dirstate_uuid_has_not_changed
+
+  $ hg debugstate --docket | grep unused
+  number of unused bytes: 0 (no-rust no-rhg !)
+  number of unused bytes: [1-9]\d* (re) (rhg no-rust !)
+  number of unused bytes: [1-9]\d* (re) (rust no-rhg !)
+  number of unused bytes: [1-9]\d* (re) (rust rhg !)
+
 Delete most of the dirstate to trigger a non-append
   $ hg rm dir/a dir/b dir/c dir/d
   $ dirstate_data_files | wc -l
@@ -173,5 +192,12 @@
   $ dirstate_uuid_has_not_changed also-if-python
   [1]
 
+Check that unused bytes counter is reset when creating a new docket
+
+  $ hg debugstate --docket | grep unused
+  number of unused bytes: 0 (no-rust !)
+  number of unused bytes: [1-9]\d* (re) (rust known-bad-output !)
+
+#endif
+
   $ cd ..
-#endif