mercurial@48574: 5 new changesets (2 on stable)

2022-01-20 Thread Mercurial Commits
5 new changesets (2 on stable) in mercurial:

https://www.mercurial-scm.org/repo/hg/rev/f38ae2d7390e
changeset:   48570:f38ae2d7390e
branch:  stable
parent:  48568:440972d2175d
user:Arseniy Alekseyev 
date:Thu Jan 20 14:02:58 2022 +
summary: revlog: demonstrate a bug where transaction can be aborted 
partially

https://www.mercurial-scm.org/repo/hg/rev/ccd9cb73125c
changeset:   48571:ccd9cb73125c
branch:  stable
user:Arseniy Alekseyev 
date:Thu Jan 20 14:06:36 2022 +
summary: revlog: fix a bug where transaction can be aborted partially

https://www.mercurial-scm.org/repo/hg/rev/fe4922564661
changeset:   48572:fe4922564661
parent:  48569:f13fb742e1d8
user:Valentin Gatien-Baron 
date:Mon Jan 17 20:47:46 2022 -0500
summary: blackbox: correct date format doc

https://www.mercurial-scm.org/repo/hg/rev/011f5218ff2d
changeset:   48573:011f5218ff2d
user:Valentin Gatien-Baron 
date:Mon Jan 17 21:00:33 2022 -0500
summary: blackbox: add milliseconds to blackbox logs by default

https://www.mercurial-scm.org/repo/hg/rev/abbecb5cd6f3
changeset:   48574:abbecb5cd6f3
bookmark:@
tag: tip
user:Valentin Gatien-Baron 
date:Mon Jan 17 21:20:46 2022 -0500
summary: blackbox: change year in logs to ISO 8601 format

-- 
Repository URL: https://www.mercurial-scm.org/repo/hg
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D12009: revlog: fix a bug where transaction can be aborted partially

2022-01-20 Thread aalekseyev (Arseniy Alekseyev)
aalekseyev created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  Fix a repo corruption bug caused by a partial transaction rollback.

REPOSITORY
  rHG Mercurial

BRANCH
  stable

REVISION DETAIL
  https://phab.mercurial-scm.org/D12009

AFFECTED FILES
  mercurial/revlog.py
  tests/test-transaction-rollback-on-revlog-split.t

CHANGE DETAILS

diff --git a/tests/test-transaction-rollback-on-revlog-split.t 
b/tests/test-transaction-rollback-on-revlog-split.t
--- a/tests/test-transaction-rollback-on-revlog-split.t
+++ b/tests/test-transaction-rollback-on-revlog-split.t
@@ -63,7 +63,7 @@
   [80]
 #endif
   $ cat .hg/store/journal | tr -s '\000' ' ' | grep data/file | tail -1
-  data/file.i 192
+  data/file.i 128
 
 The first file.i entry should match the "Reference size" above.
 The first file.d entry is the temporary record during the split,
@@ -73,14 +73,14 @@
   $ cat .hg/store/journal | tr -s '\000' ' ' | grep data/file
   data/file.i 1174
   data/file.d 0
-  data/file.d 1067
-  data/file.i 192
+  data/file.d 1046
+  data/file.i 128
   $ hg recover
   rolling back interrupted transaction
   (verify step skipped, run `hg verify` to check your repository content)
   $ f -s .hg/store/data/file*
-  .hg/store/data/file.d: size=1067
-  .hg/store/data/file.i: size=192
+  .hg/store/data/file.d: size=1046
+  .hg/store/data/file.i: size=128
   $ hg tip
   changeset:   1:cfa8d6e60429
   tag: tip
@@ -90,23 +90,12 @@
   
   $ hg verify -q
warning: revlog 'data/file.d' not in fncache!
-   file@?: rev 2 points to nonexistent changeset 2
-   (expected )
-   file@?: fa1120531cc1 not in manifests
-  2 warnings encountered!
+  1 warnings encountered!
   hint: run "hg debugrebuildfncache" to recover from corrupt fncache
-  2 integrity errors encountered!
-  [1]
   $ hg debugrebuildfncache --only-data
   adding data/file.d
   1 items added, 0 removed from fncache
   $ hg verify -q
-   file@?: rev 2 points to nonexistent changeset 2
-   (expected )
-   file@?: fa1120531cc1 not in manifests
-  1 warnings encountered!
-  2 integrity errors encountered!
-  [1]
   $ cd ..
 
 
@@ -134,13 +123,13 @@
   $ cat .hg/store/journal | tr -s '\000' ' ' | grep data/file
   data/file.i 1174
   data/file.d 0
-  data/file.d 1067
+  data/file.d 1046
 
   $ hg recover
   rolling back interrupted transaction
   (verify step skipped, run `hg verify` to check your repository content)
   $ f -s .hg/store/data/file*
-  .hg/store/data/file.d: size=1067
+  .hg/store/data/file.d: size=1046
   .hg/store/data/file.i: size=1174
   $ hg tip
   changeset:   1:cfa8d6e60429
@@ -172,8 +161,8 @@
   abort: pretxnchangegroup hook exited with status 1
   [40]
   $ f -s .hg/store/data/file*
-  .hg/store/data/file.d: size=1067
-  .hg/store/data/file.i: size=192
+  .hg/store/data/file.d: size=1046
+  .hg/store/data/file.i: size=128
   $ hg tip
   changeset:   1:cfa8d6e60429
   tag: tip
@@ -183,12 +172,7 @@
   
   $ hg verify -q
warning: revlog 'data/file.d' not in fncache!
-   file@?: rev 2 points to nonexistent changeset 2
-   (expected )
-   file@?: fa1120531cc1 not in manifests
-  2 warnings encountered!
+  1 warnings encountered!
   hint: run "hg debugrebuildfncache" to recover from corrupt fncache
-  2 integrity errors encountered!
-  [1]
   $ cd ..
 
diff --git a/mercurial/revlog.py b/mercurial/revlog.py
--- a/mercurial/revlog.py
+++ b/mercurial/revlog.py
@@ -2006,7 +2006,7 @@
 raise error.RevlogError(
 _(b"%s not found in the transaction") % self._indexfile
 )
-trindex = 0
+trindex = None
 tr.add(self._datafile, 0)
 
 existing_handles = False
@@ -2029,10 +2029,17 @@
 with self._indexfp() as read_ifh:
 for r in self:
 new_dfh.write(self._getsegmentforrevs(r, r, 
df=read_ifh)[1])
-if troffset <= self.start(r) + r * self.index.entry_size:
+if (
+trindex is None
+and troffset
+<= self.start(r) + r * self.index.entry_size
+):
 trindex = r
 new_dfh.flush()
 
+if trindex is None:
+trindex = 0
+
 with self.__index_new_fp() as fp:
 self._format_flags &= ~FLAG_INLINE_DATA
 self._inline = False



To: aalekseyev, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D12008: revlog: demonstrate a bug where transaction can be aborted partially

2022-01-20 Thread aalekseyev (Arseniy Alekseyev)
aalekseyev created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REPOSITORY
  rHG Mercurial

BRANCH
  stable

REVISION DETAIL
  https://phab.mercurial-scm.org/D12008

AFFECTED FILES
  tests/test-transaction-rollback-on-revlog-split.t

CHANGE DETAILS

diff --git a/tests/test-transaction-rollback-on-revlog-split.t 
b/tests/test-transaction-rollback-on-revlog-split.t
--- a/tests/test-transaction-rollback-on-revlog-split.t
+++ b/tests/test-transaction-rollback-on-revlog-split.t
@@ -17,22 +17,28 @@
   > extensions.wrapfunction(util.atomictempfile, 'close', close)
   > EOF
 
-Test offset computation to correctly factor in the index entries themselve.
+Test offset computation to correctly factor in the index entries themselves.
 Also test that the new data size has the correct size if the transaction is 
aborted
 after the index has been replaced.
 
-Test repo has one small, one moderate and one big change. The clone has
-the small and moderate change and will transition to non-inline storage when
-adding the big change.
+Test repo has commits a, b, c, D, where D is large (grows the revlog enough 
that it
+transitions to non-inline storage). The clone initially has changes a, b
+and will transition to non-inline storage when adding c, D.
+
+If the transaction adding c, D is rolled back, then we don't undo the revlog 
split,
+but truncate the index and the data to remove both c and D.
 
   $ hg init troffset-computation --config format.revlog-compression=none
   $ cd troffset-computation
   $ printf '%20d' '1' > file
-  $ hg commit -Aqm_
+  $ hg commit -Aqma
   $ printf '%1024d' '1' > file
-  $ hg commit -Aqm_
+  $ hg commit -Aqmb
+  $ printf '%20d' '1' > file
+  $ hg commit -Aqmc
   $ dd if=/dev/zero of=file bs=1k count=128 > /dev/null 2>&1
-  $ hg commit -Aqm_
+  $ hg commit -AqmD
+
   $ cd ..
 
   $ hg clone -r 1 troffset-computation troffset-computation-copy --config 
format.revlog-compression=none -q
@@ -57,9 +63,9 @@
   [80]
 #endif
   $ cat .hg/store/journal | tr -s '\000' ' ' | grep data/file | tail -1
-  data/file.i 128
+  data/file.i 192
 
-The first file.i entry should match the size above.
+The first file.i entry should match the "Reference size" above.
 The first file.d entry is the temporary record during the split,
 the second entry after the split happened. The sum of the second file.d
 and the second file.i entry should match the first file.i entry.
@@ -67,29 +73,40 @@
   $ cat .hg/store/journal | tr -s '\000' ' ' | grep data/file
   data/file.i 1174
   data/file.d 0
-  data/file.d 1046
-  data/file.i 128
+  data/file.d 1067
+  data/file.i 192
   $ hg recover
   rolling back interrupted transaction
   (verify step skipped, run `hg verify` to check your repository content)
   $ f -s .hg/store/data/file*
-  .hg/store/data/file.d: size=1046
-  .hg/store/data/file.i: size=128
+  .hg/store/data/file.d: size=1067
+  .hg/store/data/file.i: size=192
   $ hg tip
-  changeset:   1:3ce491143aec
+  changeset:   1:cfa8d6e60429
   tag: tip
   user:test
   date:Thu Jan 01 00:00:00 1970 +
-  summary: _
+  summary: b
   
   $ hg verify -q
warning: revlog 'data/file.d' not in fncache!
-  1 warnings encountered!
+   file@?: rev 2 points to nonexistent changeset 2
+   (expected )
+   file@?: fa1120531cc1 not in manifests
+  2 warnings encountered!
   hint: run "hg debugrebuildfncache" to recover from corrupt fncache
+  2 integrity errors encountered!
+  [1]
   $ hg debugrebuildfncache --only-data
   adding data/file.d
   1 items added, 0 removed from fncache
   $ hg verify -q
+   file@?: rev 2 points to nonexistent changeset 2
+   (expected )
+   file@?: fa1120531cc1 not in manifests
+  1 warnings encountered!
+  2 integrity errors encountered!
+  [1]
   $ cd ..
 
 
@@ -117,20 +134,20 @@
   $ cat .hg/store/journal | tr -s '\000' ' ' | grep data/file
   data/file.i 1174
   data/file.d 0
-  data/file.d 1046
+  data/file.d 1067
 
   $ hg recover
   rolling back interrupted transaction
   (verify step skipped, run `hg verify` to check your repository content)
   $ f -s .hg/store/data/file*
-  .hg/store/data/file.d: size=1046
+  .hg/store/data/file.d: size=1067
   .hg/store/data/file.i: size=1174
   $ hg tip
-  changeset:   1:3ce491143aec
+  changeset:   1:cfa8d6e60429
   tag: tip
   user:test
   date:Thu Jan 01 00:00:00 1970 +
-  summary: _
+  summary: b
   
   $ hg verify -q
   $ cd ..
@@ -155,18 +172,23 @@
   abort: pretxnchangegroup hook exited with status 1
   [40]
   $ f -s .hg/store/data/file*
-  .hg/store/data/file.d: size=1046
-  .hg/store/data/file.i: size=128
+  .hg/store/data/file.d: size=1067
+  .hg/store/data/file.i: size=192
   $ hg tip
-  changeset:   1:3ce491143aec
+  changeset:   1:cfa8d6e60429
   tag: tip
   user:test
   date:Thu Jan 01 00:00:00 1970 +
-  summary: _
+  summary: b
   
   $ hg verify -q
warning: revlog 'data/file.d'