]> Sergey Matveev's repositories - public-inbox.git/commitdiff
extindex: --gc: avoid SQLite lock conflict on shard cleanup
authorEric Wong <e@80x24.org>
Tue, 6 Jul 2021 12:42:03 +0000 (12:42 +0000)
committerEric Wong <e@80x24.org>
Tue, 6 Jul 2021 13:36:55 +0000 (13:36 +0000)
Xapian shard cleanup only requires read-only access to
over.sqlite3, so avoid opening it with read-write access since
create_tables will hit lock conflicts on "INSERT OR IGNORE"
statements.

lib/PublicInbox/SearchIdxShard.pm

index 1598faebdc9b53b621ef369b9a249198723ca705..8635f5858a8ac37b14c6707b412ce69a6d828d08 100644 (file)
@@ -78,8 +78,9 @@ sub shard_close {
 sub shard_over_check {
        my ($self, $over) = @_;
        if ($self->{-ipc_req} && $over->{dbh}) {
-               # can't send DB handles over IPC
-               $over = ref($over)->new($over->{dbh}->sqlite_db_filename);
+               # can't send DB handles over IPC, and use read-only to avoid
+               # create_tables lock conflict:
+               $over = PublicInbox::Over->new($over->{dbh}->sqlite_db_filename)
        }
        $self->ipc_do('over_check', $over);
 }