monotone-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Monotone-devel] Re: Error in Pull


From: graydon hoare
Subject: [Monotone-devel] Re: Error in Pull
Date: Tue, 08 Feb 2005 14:54:15 -0500
User-agent: Mozilla Thunderbird 1.0 (X11/20041206)

graydon hoare wrote:

whoops! try applying this.

whoops again! that just makes it enter an infinite loop :(
try this instead:

-graydon

--- database.cc
+++ database.cc
@@ -859,13 +859,17 @@
% rand() % rand() % rand() % rand() % rand()).str();
         std::map<hexenc<id>, base64< gzip<data> > >::const_iterator i;
         i = cache.lower_bound(hexenc<id>(key));
-        if (i != cache.end())
+        if (i == cache.end())
           {
-            L(F("version cache expiring %s\n") % i->first);
-            I(i->second().size() >= use);
-            use -= i->second().size();
-            cache.erase(i->first);
+            // we can't find a random entry, probably there's only one
+            // entry and we missed it. delete first entry instead.
+            i = cache.begin();
           }
+        I(i != cache.end());
+        I(use >= i->second().size());
+        L(F("version cache expiring %s\n") % i->first);
+        use -= i->second().size();
+        cache.erase(i->first);
       }
     cache.insert(std::make_pair(ident, dat));
     use += dat().size();




reply via email to

[Prev in Thread] Current Thread [Next in Thread]