[or-cvs] [metrics-db/master] Add stats to RelayDescriptorDatabaseImporter.

karsten at torproject.org karsten at torproject.org
Fri Jan 14 12:16:44 UTC 2011


commit 4e739616f919a44dd69701d7ad7e6068c11d896c
Author: Karsten Loesing <karsten.loesing at gmx.net>
Date:   Fri Jan 14 11:07:52 2011 +0100

    Add stats to RelayDescriptorDatabaseImporter.
---
 .../ernie/db/RelayDescriptorDatabaseImporter.java  |   16 ++++++++--------
 1 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/src/org/torproject/ernie/db/RelayDescriptorDatabaseImporter.java b/src/org/torproject/ernie/db/RelayDescriptorDatabaseImporter.java
index be30ea2..b023227 100644
--- a/src/org/torproject/ernie/db/RelayDescriptorDatabaseImporter.java
+++ b/src/org/torproject/ernie/db/RelayDescriptorDatabaseImporter.java
@@ -369,7 +369,6 @@ public final class RelayDescriptorDatabaseImporter {
           rrsCount++;
           if (rrsCount % autoCommitCount == 0)  {
             this.conn.commit();
-            rrsCount = 0;
           }
         }
       }
@@ -456,7 +455,6 @@ public final class RelayDescriptorDatabaseImporter {
           rdsCount++;
           if (rdsCount % autoCommitCount == 0)  {
             this.conn.commit();
-            rdsCount = 0;
           }
         }
       }
@@ -519,7 +517,6 @@ public final class RelayDescriptorDatabaseImporter {
           resCount++;
           if (resCount % autoCommitCount == 0)  {
             this.conn.commit();
-            resCount = 0;
           }
         }
       }
@@ -622,7 +619,6 @@ public final class RelayDescriptorDatabaseImporter {
             rhsCount++;
             if (rhsCount % autoCommitCount == 0)  {
               this.conn.commit();
-              rhsCount = 0;
             }
           }
         }
@@ -669,7 +665,6 @@ public final class RelayDescriptorDatabaseImporter {
           rcsCount++;
           if (rcsCount % autoCommitCount == 0)  {
             this.conn.commit();
-            rcsCount = 0;
           }
         }
       }
@@ -717,7 +712,6 @@ public final class RelayDescriptorDatabaseImporter {
           rvsCount++;
           if (rvsCount % autoCommitCount == 0)  {
             this.conn.commit();
-            rvsCount = 0;
           }
         }
       }
@@ -777,7 +771,6 @@ public final class RelayDescriptorDatabaseImporter {
           rbsCount++;
           if (rbsCount % autoCommitCount == 0)  {
             this.conn.commit();
-            rbsCount = 0;
           }
         }
       } catch (SQLException e) {
@@ -840,7 +833,6 @@ public final class RelayDescriptorDatabaseImporter {
             rqsCount++;
             if (rqsCount % autoCommitCount == 0)  {
               this.conn.commit();
-              rqsCount = 0;
             }
           }
         }
@@ -874,6 +866,14 @@ public final class RelayDescriptorDatabaseImporter {
    */
   public void closeConnection() {
 
+    /* Log stats about imported descriptors. */
+    this.logger.info(String.format("Finished importing relay "
+        + "descriptors: %d consensuses, %d network status entries, %d "
+        + "votes, %d server descriptors, %d extra-info descriptors, %d "
+        + "bandwidth history elements, %d dirreq stats elements, and %d "
+        + "conn-bi-direct stats lines", rcsCount, rrsCount, rvsCount,
+        rdsCount, resCount, rhsCount, rqsCount, rbsCount));
+
     /* Commit any stragglers before closing. */
     if (this.conn != null) {
       try {



More information about the tor-commits mailing list