# # patch "ChangeLog" # from [540734e35347771f3329c0afc13962e026cc88af] # to [763634239be07147982294a75d4ab0ed31719c2e] # # patch "schema_migration.cc" # from [dbe70c577761111a22e6bc47649411c335399bdf] # to [f9205058568c4e8b4b496d8b655a870f05edf0be] # --- ChangeLog +++ ChangeLog @@ -1,5 +1,10 @@ 2005-07-12 Nathaniel Smith + * schema_migration.cc (migrator::migrate): When there is nothing + to be done, do nothing. + +2005-07-12 Nathaniel Smith + * netsync.cc (rebuild_merkle_trees): Reduce memory usage a bit, and don't insert branch certs that the other side will just end up throwing away (reduces network traffic). --- schema_migration.cc +++ schema_migration.cc @@ -14,6 +14,7 @@ #include +#include "sanity.hh" #include "schema_migration.hh" #include "cryptopp/filters.h" #include "cryptopp/sha.h" @@ -188,11 +189,17 @@ void migrate(sqlite3 *sql, string target_id) { string init; - calculate_schema_id(sql, init); if (sql == NULL) throw runtime_error("NULL sqlite object given to migrate"); + calculate_schema_id(sql, init); + if (target_id == init) + { + P(F("nothing to migrate; schema %s is up-to-date\n") % init); + return; + } + if (sqlite3_create_function(sql, "sha1", -1, SQLITE_UTF8, NULL, &sqlite_sha1_fn, NULL, NULL)) throw runtime_error("error registering sha1 function with sqlite");