From e60982c851adf2de23b4d6463703e7ea4e4388c7 Mon Sep 17 00:00:00 2001
From: Brian Warner <warner@lothar.com>
Date: Mon, 21 May 2012 21:13:11 -0700
Subject: [PATCH] helper: remove timings["existence_check"], aka
 "Already-In-Grid Check"

This measured how long the Helper took to do a filecheck before asking
for ciphertext. The "Contacting Helper" report includes both
existence_check and the client-helper RTT.

For non-overlapping uploads, it was being returned correctly. But when
multiple upload requests overlapped, and the file was not already in the
grid, the filecheck would only run once, and its existence_check time
would be reported for all uploaders (even if they didn't have to wait
for that time). Cleaning that up proved too difficult: the only correct
place to report this time is from the initial remote_upload_chk() call,
but the return value of that is too constrained to accomodate it in the
needs-upload case.

So I'm removing it altogether. Eventually I plan to add a proper
events/times field and record more data, including this check, in a form
that can be drawn on a nice zoomable timeline view.

Old clients talking to a new Helper (which doesn't supply the value)
will tolerate the loss (they'll just display an empty field on the web
view).
---
 src/allmydata/immutable/offloaded.py   | 3 ---
 src/allmydata/interfaces.py            | 1 -
 src/allmydata/web/status.py            | 3 ---
 src/allmydata/web/upload-results.xhtml | 3 ---
 src/allmydata/web/upload-status.xhtml  | 3 ---
 5 files changed, 13 deletions(-)

diff --git a/src/allmydata/immutable/offloaded.py b/src/allmydata/immutable/offloaded.py
index 02b1386e..7ff19c38 100644
--- a/src/allmydata/immutable/offloaded.py
+++ b/src/allmydata/immutable/offloaded.py
@@ -567,7 +567,6 @@ class Helper(Referenceable):
     def remote_upload_chk(self, storage_index):
         self.count("chk_upload_helper.upload_requests")
         r = upload.UploadResults()
-        started = time.time()
         si_s = si_b2a(storage_index)
         lp = self.log(format="helper: upload_chk query for SI %(si)s", si=si_s)
         incoming_file = os.path.join(self._chk_incoming, si_s)
@@ -579,8 +578,6 @@ class Helper(Referenceable):
 
         d = self._check_for_chk_already_in_grid(storage_index, r, lp)
         def _checked(already_present):
-            elapsed = time.time() - started
-            r.timings['existence_check'] = elapsed
             if already_present:
                 # the necessary results are placed in the UploadResults
                 self.count("chk_upload_helper.upload_already_present")
diff --git a/src/allmydata/interfaces.py b/src/allmydata/interfaces.py
index a73ce860..5f6f8388 100644
--- a/src/allmydata/interfaces.py
+++ b/src/allmydata/interfaces.py
@@ -1948,7 +1948,6 @@ class IUploadResults(Interface):
        storage_index : time to compute the storage index
        peer_selection : time to decide which peers will be used
        contacting_helper : initial helper query to upload/no-upload decision
-       existence_check : helper pre-upload existence check
        helper_total : initial helper query to helper finished pushing
        cumulative_fetch : helper waiting for ciphertext requests
        total_fetch : helper start to last ciphertext response
diff --git a/src/allmydata/web/status.py b/src/allmydata/web/status.py
index 068e3a9f..a1df1029 100644
--- a/src/allmydata/web/status.py
+++ b/src/allmydata/web/status.py
@@ -81,9 +81,6 @@ class UploadResultsRendererMixin(RateAndTimeMixin):
     def data_time_contacting_helper(self, ctx, data):
         return self._get_time("contacting_helper")
 
-    def data_time_existence_check(self, ctx, data):
-        return self._get_time("existence_check")
-
     def data_time_cumulative_fetch(self, ctx, data):
         return self._get_time("cumulative_fetch")
 
diff --git a/src/allmydata/web/upload-results.xhtml b/src/allmydata/web/upload-results.xhtml
index 6c46118d..fa8894dc 100644
--- a/src/allmydata/web/upload-results.xhtml
+++ b/src/allmydata/web/upload-results.xhtml
@@ -24,9 +24,6 @@
       <li>Storage Index: <span n:render="time" n:data="time_storage_index" />
      (<span n:render="rate" n:data="rate_storage_index" />)</li>
       <li>[Contacting Helper]: <span n:render="time" n:data="time_contacting_helper" /></li>
-      <ul>
-        <li>[Helper Already-In-Grid Check]: <span n:render="time" n:data="time_existence_check" /></li>
-      </ul>
       <li>[Upload Ciphertext To Helper]: <span n:render="time" n:data="time_cumulative_fetch" />
      (<span n:render="rate" n:data="rate_ciphertext_fetch" />)</li>
 
diff --git a/src/allmydata/web/upload-status.xhtml b/src/allmydata/web/upload-status.xhtml
index 2b4b7fa2..8aaecd47 100644
--- a/src/allmydata/web/upload-status.xhtml
+++ b/src/allmydata/web/upload-status.xhtml
@@ -36,9 +36,6 @@
         <li>Storage Index: <span n:render="time" n:data="time_storage_index" />
         (<span n:render="rate" n:data="rate_storage_index" />)</li>
         <li>[Contacting Helper]: <span n:render="time" n:data="time_contacting_helper" /></li>
-        <ul>
-          <li>[Helper Already-In-Grid Check]: <span n:render="time" n:data="time_existence_check" /></li>
-        </ul>
         <li>[Upload Ciphertext To Helper]: <span n:render="time" n:data="time_cumulative_fetch" />
         (<span n:render="rate" n:data="rate_ciphertext_fetch" />)</li>
 
-- 
2.45.2