Patchwork [2,of,2] obsstore: issue debug message when adding duplicate markers

login
register
mail settings
Submitter Eric Sumner
Date April 14, 2015, 7:13 p.m.
Message ID <c8fd0a4978ea764b321f.1429038797@waste.org>
Download mbox | patch
Permalink /patch/8667/
State Rejected
Headers show

Comments

Eric Sumner - April 14, 2015, 7:13 p.m.
# HG changeset patch
# User Eric Sumner <ericsumner@fb.com>
# Date 1429037944 14400
#      Tue Apr 14 14:59:04 2015 -0400
# Node ID c8fd0a4978ea764b321faa1a98f29c4eec510300
# Parent  b30cb32ea6821e165aab65051767aa810fdb8464
obsstore: issue debug message when adding duplicate markers

One of the performance issues with evolve right now is the sending of redundant
obsolete information; this patch tracks and reports this via a debug message
Pierre-Yves David - April 14, 2015, 7:49 p.m.
On 04/14/2015 03:13 PM, Eric Sumner wrote:
> # HG changeset patch
> # User Eric Sumner <ericsumner@fb.com>
> # Date 1429037944 14400
> #      Tue Apr 14 14:59:04 2015 -0400
> # Node ID c8fd0a4978ea764b321faa1a98f29c4eec510300
> # Parent  b30cb32ea6821e165aab65051767aa810fdb8464
> obsstore: issue debug message when adding duplicate markers
>
> One of the performance issues with evolve right now is the sending of redundant
> obsolete information; this patch tracks and reports this via a debug message

After talking with eric in real life I'm going to drop that second 
patch. The first one seems sensible and I'll eventually get to it.

Patch

diff --git a/mercurial/obsolete.py b/mercurial/obsolete.py
--- a/mercurial/obsolete.py
+++ b/mercurial/obsolete.py
@@ -583,11 +583,19 @@ 
             raise util.Abort('creating obsolete markers is not enabled on this '
                              'repo')
         known = set(self._all)
+        duplicate = set()
+        count = 0
         new = []
         for m in markers:
+            count += 1
             if m not in known:
                 known.add(m)
                 new.append(m)
+            else:
+                duplicate.add(m)
+        if duplicate:
+            self.ui.debug(_('obsolete: %i/%i added markers are duplicates\n')
+                          % (len(duplicate), count))
         if new:
             f = self.sopener('obsstore', 'ab')
             try: