lib/PublicInbox/Over.pm | 4 ++-- lib/PublicInbox/OverIdx.pm | 6 +++--- lib/PublicInbox/V2Writable.pm | 4 ++-- t/over.t | 2 +- diff --git a/lib/PublicInbox/Over.pm b/lib/PublicInbox/Over.pm index 0ebc800314888827ea8778232cccc43aa6f5b6ee..a2cf9f217a88506e1dbe0f8bdf3d952ebaa888ec 100644 --- a/lib/PublicInbox/Over.pm +++ b/lib/PublicInbox/Over.pm @@ -72,7 +72,7 @@ my ($class, $f) = @_; bless { filename => $f }, $class; } -sub disconnect { +sub dbh_close { my ($self) = @_; if (my $dbh = delete $self->{dbh}) { delete $self->{-get_art}; @@ -328,7 +328,7 @@ if (my @st = stat($f)) { # did st_dev, st_ino change? my $st = pack('dd', $st[0], $st[1]); # don't actually reopen, just let {dbh} be recreated later - disconnect($self) if $st ne ($self->{st} // $st); + dbh_close($self) if $st ne ($self->{st} // $st); } else { warn "W: stat $f: $!\n"; } diff --git a/lib/PublicInbox/OverIdx.pm b/lib/PublicInbox/OverIdx.pm index c521464a7447cc5725f7c5db11b6bde56493cd34..512c5f463f008f0c3e3532ccd803e2d7ca54fc69 100644 --- a/lib/PublicInbox/OverIdx.pm +++ b/lib/PublicInbox/OverIdx.pm @@ -455,10 +455,10 @@ delete $self->{txn} or return; $self->{dbh}->rollback; } -sub disconnect { +sub dbh_close { my ($self) = @_; die "in transaction" if $self->{txn}; - $self->SUPER::disconnect; + $self->SUPER::dbh_close; } sub create { @@ -470,7 +470,7 @@ File::Path::mkpath(File::Basename::dirname($self->{filename})); } # create the DB: PublicInbox::Over::dbh($self); - $self->disconnect; + $self->dbh_close; } sub rethread_prepare { diff --git a/lib/PublicInbox/V2Writable.pm b/lib/PublicInbox/V2Writable.pm index c926446c87ef0697057fdf1973228891ce2a8194..f2288904638e98e147af30bc68a1678a5dcda7f7 100644 --- a/lib/PublicInbox/V2Writable.pm +++ b/lib/PublicInbox/V2Writable.pm @@ -679,8 +679,8 @@ eval { $_->shard_close }; $err .= "shard close: $@\n" if $@; } } - eval { $self->{over}->disconnect }; - $err .= "over disconnect: $@\n" if $@; + eval { $self->{over}->dbh_close }; + $err .= "over close: $@\n" if $@; delete $self->{bnote}; my $nbytes = $self->{total_bytes}; $self->{total_bytes} = 0; diff --git a/t/over.t b/t/over.t index 6c4c8ee6b0b356b39d7facdf64b03dc63f740f1f..41c13872c4e94095cede8b3eddd08e839a7085c7 100644 --- a/t/over.t +++ b/t/over.t @@ -23,7 +23,7 @@ $y = $over->sid('hello-WORLD'); is($y, $x+1, 'sid increases'); is($over->sid('hello-world'), $x, 'idempotent'); ok(!$over->{dbh}->{ReadOnly}, 'OverIdx is not ReadOnly'); -$over->disconnect; +$over->dbh_close; $over = PublicInbox::Over->new("$tmpdir/over.sqlite3"); ok($over->dbh->{ReadOnly}, 'Over is ReadOnly');