[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[or-cvs] r10246: Backport r12842: Make stores get rebuild at the proper time, (in tor/branches/tor-0_1_2-patches: . src/or)



Author: nickm
Date: 2007-05-21 21:55:48 -0400 (Mon, 21 May 2007)
New Revision: 10246

Modified:
   tor/branches/tor-0_1_2-patches/
   tor/branches/tor-0_1_2-patches/ChangeLog
   tor/branches/tor-0_1_2-patches/src/or/routerlist.c
Log:
 r12847@catbus:  nickm | 2007-05-21 21:55:47 -0400
 Backport r12842: Make stores get rebuild at the proper time, and note dropped bytes better.



Property changes on: tor/branches/tor-0_1_2-patches
___________________________________________________________________
 svk:merge ticket from /tor/012 [r12847] on 8246c3cf-6607-4228-993b-4d95d33730f1

Modified: tor/branches/tor-0_1_2-patches/ChangeLog
===================================================================
--- tor/branches/tor-0_1_2-patches/ChangeLog	2007-05-22 01:52:22 UTC (rev 10245)
+++ tor/branches/tor-0_1_2-patches/ChangeLog	2007-05-22 01:55:48 UTC (rev 10246)
@@ -26,6 +26,9 @@
       having a hard time downloading.
     - Read resolv.conf files correctly on platforms where read() returns
       partial results on small file reads.
+    - Don't rebuild the entire router store every time we get 32K of
+      routers: rebuild it when the journal gets very large, or when
+      the gaps in the store get very large.
 
   o Minor features:
     - When routers publish SVN revisions in their router descriptors,

Modified: tor/branches/tor-0_1_2-patches/src/or/routerlist.c
===================================================================
--- tor/branches/tor-0_1_2-patches/src/or/routerlist.c	2007-05-22 01:52:22 UTC (rev 10245)
+++ tor/branches/tor-0_1_2-patches/src/or/routerlist.c	2007-05-22 01:55:48 UTC (rev 10246)
@@ -241,7 +241,6 @@
 static int
 router_rebuild_store(int force)
 {
-  size_t len = 0;
   or_options_t *options;
   size_t fname_len;
   smartlist_t *chunk_list = NULL;
@@ -337,7 +336,8 @@
   write_str_to_file(fname, "", 1);
 
   r = 0;
-  router_store_len = len;
+  tor_assert(offset >= 0);
+  router_store_len = (size_t) offset;
   router_journal_len = 0;
   router_bytes_dropped = 0;
  done:
@@ -1715,6 +1715,7 @@
       digestmap_remove(rl->desc_digest_map,
                        ri_old->cache_info.signed_descriptor_digest);
     }
+    router_bytes_dropped += ri_old->cache_info.signed_descriptor_len;
     routerinfo_free(ri_old);
   }
   // routerlist_assert_ok(rl);