[Bps-public-commit] Prophet branch, master, updated. 82f5e6d8cef158170fb78484da26767479810074

Alex M Vandiver alexmv at bestpractical.com
Mon Apr 27 13:52:14 EDT 2009


The branch, master has been updated
       via  82f5e6d8cef158170fb78484da26767479810074 (commit)
       via  c9403afd2b5527efde9e7288ba91f0c14ac9737c (commit)
      from  6775dd19eb09519d479f4c721653a041b17313b6 (commit)

Summary of changes:
 lib/Prophet/Replica/prophet.pm |    4 ++++
 lib/Prophet/Replica/sqlite.pm  |    2 +-
 2 files changed, 5 insertions(+), 1 deletions(-)

- Log -----------------------------------------------------------------
commit c9403afd2b5527efde9e7288ba91f0c14ac9737c
Author: Alex Vandiver <alexmv at mit.edu>
Date:   Mon Apr 27 13:51:16 2009 -0400

    Add a not-degenerate replica_exists for prophet replicas

diff --git a/lib/Prophet/Replica/prophet.pm b/lib/Prophet/Replica/prophet.pm
index 5375765..a42ea79 100644
--- a/lib/Prophet/Replica/prophet.pm
+++ b/lib/Prophet/Replica/prophet.pm
@@ -110,6 +110,10 @@ use constant userdata_dir    => 'userdata';
 use constant changeset_index => 'changesets.idx';
 use constant local_metadata_dir => 'local_metadata';
 
+sub replica_exists {
+    my $self = shift;
+    return -d $self->fs_root ? 1 : 0;
+}
 
 =head1 Replica Format
 

commit 82f5e6d8cef158170fb78484da26767479810074
Author: Alex Vandiver <alexmv at mit.edu>
Date:   Mon Apr 27 13:51:50 2009 -0400

    When disconnecting, ->dbh is lazy, and thus might try to connect; ensure db exists first

diff --git a/lib/Prophet/Replica/sqlite.pm b/lib/Prophet/Replica/sqlite.pm
index f4d2712..4d9c391 100644
--- a/lib/Prophet/Replica/sqlite.pm
+++ b/lib/Prophet/Replica/sqlite.pm
@@ -922,7 +922,7 @@ sub _do_db_upgrades {
 
 sub DEMOLISH {
     my $self = shift;
-    $self->dbh->disconnect if ( $self->dbh );
+    $self->dbh->disconnect if ( $self->replica_exists and $self->dbh );
 }
 
 

-----------------------------------------------------------------------



More information about the Bps-public-commit mailing list