[or-cvs] r11994: Remove nearly all calls to routerlist_remove_old(). Backport (in tor/trunk: . src/or)

nickm at seul.org nickm at seul.org
Tue Oct 16 18:19:02 UTC 2007


Author: nickm
Date: 2007-10-16 14:19:02 -0400 (Tue, 16 Oct 2007)
New Revision: 11994

Modified:
   tor/trunk/
   tor/trunk/ChangeLog
   tor/trunk/src/or/main.c
   tor/trunk/src/or/routerlist.c
Log:
 r15868 at catbus:  nickm | 2007-10-16 14:18:29 -0400
 Remove nearly all calls to routerlist_remove_old().  Backport candidate.



Property changes on: tor/trunk
___________________________________________________________________
 svk:merge ticket from /tor/trunk [r15868] on 8246c3cf-6607-4228-993b-4d95d33730f1

Modified: tor/trunk/ChangeLog
===================================================================
--- tor/trunk/ChangeLog	2007-10-16 17:44:52 UTC (rev 11993)
+++ tor/trunk/ChangeLog	2007-10-16 18:19:02 UTC (rev 11994)
@@ -16,6 +16,10 @@
       than 28 days unmodified, then most likely it's a leftover from when we
       upgraded to 0.2.0.8-alpha.  Remove it.  It has no good routers anyway.
 
+  o Minor features (performance):
+    - Call routerlist_remove_old_routers() much less often.  This should
+      speed startup, especially on directory caches.
+
   o Minor bugfixes (directory authorities):
     - Correct the implementation of "download votes by digest."  Bugfix on
       0.2.0.8-alpha.

Modified: tor/trunk/src/or/main.c
===================================================================
--- tor/trunk/src/or/main.c	2007-10-16 17:44:52 UTC (rev 11993)
+++ tor/trunk/src/or/main.c	2007-10-16 18:19:02 UTC (rev 11994)
@@ -994,8 +994,9 @@
     /* If any networkstatus documents are no longer recent, we need to
      * update all the descriptors' running status. */
     /* purge obsolete entries */
+    networkstatus_v2_list_clean(now);
+    /* Remove dead routers. */
     routerlist_remove_old_routers();
-    networkstatus_v2_list_clean(now);
 #if 0
     networkstatus_v2_list_update_recent(now);
 #endif

Modified: tor/trunk/src/or/routerlist.c
===================================================================
--- tor/trunk/src/or/routerlist.c	2007-10-16 17:44:52 UTC (rev 11993)
+++ tor/trunk/src/or/routerlist.c	2007-10-16 18:19:02 UTC (rev 11994)
@@ -475,7 +475,7 @@
   if (!routerlist)
     return 0;
 
-  routerlist_assert_ok(routerlist);
+  //routerlist_assert_ok(routerlist);
 
   /* Don't save deadweight. */
   routerlist_remove_old_routers();
@@ -2140,6 +2140,7 @@
       smartlist_len(routerlist->old_routers), U64_PRINTF_ARG(olddescs));
 }
 
+#if 0
 /** Return non-zero if we have a lot of extra descriptors in our
  * routerlist, and should get rid of some of them. Else return 0.
  *
@@ -2158,6 +2159,7 @@
     return smartlist_len(rl->old_routers) > smartlist_len(rl->routers)*2;
   }
 }
+#endif
 
 static INLINE int
 _routerlist_find_elt(smartlist_t *sl, void *ri, int idx)
@@ -2613,8 +2615,10 @@
     return -1;
   }
 
+#if 0
   if (routerlist_is_overfull(routerlist))
     routerlist_remove_old_routers();
+#endif
 
   if (authdir) {
     if (authdir_wants_to_reject_router(router, msg,
@@ -2907,7 +2911,7 @@
   if (!routerlist || !consensus)
     return;
 
-  routerlist_assert_ok(routerlist);
+  // routerlist_assert_ok(routerlist);
 
   retain = digestmap_new();
   cutoff = now - OLD_ROUTER_DESC_MAX_AGE;
@@ -2959,7 +2963,7 @@
     }
   }
 
-  routerlist_assert_ok(routerlist);
+  //routerlist_assert_ok(routerlist);
 
   /* Remove far-too-old members of routerlist->old_routers. */
   cutoff = now - OLD_ROUTER_DESC_MAX_AGE;
@@ -2972,7 +2976,7 @@
     }
   }
 
-  routerlist_assert_ok(routerlist);
+  //routerlist_assert_ok(routerlist);
 
   /* Now we might have to look at routerlist->old_routers for extraneous
    * members. (We'd keep all the members if we could, but we need to save
@@ -3002,7 +3006,7 @@
   }
   if (hi>=0)
     routerlist_remove_old_cached_routers_with_id(cutoff, 0, hi, retain);
-  routerlist_assert_ok(routerlist);
+  //routerlist_assert_ok(routerlist);
 
  done:
   digestmap_free(retain, NULL);
@@ -3477,6 +3481,10 @@
     /* Most caches probably don't have this descriptor yet. */
     return 0;
   }
+  if (rs->published_on + OLD_ROUTER_DESC_MAX_AGE < now) {
+    /* We'd drop it immediately for being too old. */
+    return 0;
+  }
   return 1;
 }
 



More information about the tor-commits mailing list