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

[tor-commits] [metrics-web/release] Re-add missing COMMIT commands to bwhist module.



commit 9dd35e29084ed9380cb374c80a4f9bfb0d9a91e2
Author: Karsten Loesing <karsten.loesing@xxxxxxx>
Date:   Thu Dec 20 11:28:46 2018 +0100

    Re-add missing COMMIT commands to bwhist module.
    
    Last month, in commit f8fa108 where we modernized the legacy module
    and renamed it to bwhist, we split up the closeConnection() into one
    method commit() to commit changes and another method closeConnection()
    to close the connection. However, we somehow forgot to invoke the
    commit() method.
    
    This had two effects:
    
     1. Newly added data was not made persistent in the database. This
        lead to a moving window of roughly one week for new data and an
        increasing gap between the last committed data and this 1-week
        window.
    
     2. The result of aggregating newly added data was not made
        persistent. So, even after fixing the first issue above, we
        accumulated newly added data, rather than only keeping the most
        recent two weeks. This made the database slower over time.
    
    This change adds two commit() calls at the right places.
---
 .../metrics/stats/bwhist/RelayDescriptorDatabaseImporter.java           | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/main/java/org/torproject/metrics/stats/bwhist/RelayDescriptorDatabaseImporter.java b/src/main/java/org/torproject/metrics/stats/bwhist/RelayDescriptorDatabaseImporter.java
index a6cf0cc..9f9ecff 100644
--- a/src/main/java/org/torproject/metrics/stats/bwhist/RelayDescriptorDatabaseImporter.java
+++ b/src/main/java/org/torproject/metrics/stats/bwhist/RelayDescriptorDatabaseImporter.java
@@ -532,6 +532,7 @@ public final class RelayDescriptorDatabaseImporter {
         this.addExtraInfoDescriptor((ExtraInfoDescriptor) descriptor);
       }
     }
+    this.commit();
     reader.saveHistoryFile(this.historyFile);
   }
 
@@ -615,6 +616,7 @@ public final class RelayDescriptorDatabaseImporter {
   void aggregate() throws SQLException {
     Statement st = this.conn.createStatement();
     st.executeQuery("SELECT refresh_all()");
+    this.commit();
   }
 
   /** Query the servers_platforms view. */



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits