about summary refs log tree commit homepage
path: root/lib
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2018-05-01 01:51:41 +0000
committerEric Wong <e@80x24.org>2018-05-01 01:52:34 +0000
commit9d5059d2904e7858460dc71a1f55c27d79583385 (patch)
treee6479fd21a4c035de62ecf73871d71edbeedffc0 /lib
parentc204da04aa24e85236f82ba5a7c6c7e19c8a20d3 (diff)
downloadpublic-inbox-9d5059d2904e7858460dc71a1f55c27d79583385.tar.gz
Xapian will replace files upon committing, so non-parallel
V2Writable users need to have umask preserved this way.
Diffstat (limited to 'lib')
-rw-r--r--lib/PublicInbox/SearchIdx.pm19
1 files changed, 12 insertions, 7 deletions
diff --git a/lib/PublicInbox/SearchIdx.pm b/lib/PublicInbox/SearchIdx.pm
index aeb363e0..74f9267e 100644
--- a/lib/PublicInbox/SearchIdx.pm
+++ b/lib/PublicInbox/SearchIdx.pm
@@ -752,18 +752,23 @@ sub remote_remove {
 sub begin_txn_lazy {
         my ($self) = @_;
         return if $self->{txn};
-        my $xdb = $self->{xdb} || $self->_xdb_acquire;
-        $self->{over}->begin_lazy if $self->{over};
-        $xdb->begin_transaction;
-        $self->{txn} = 1;
-        $xdb;
+
+        $self->{-inbox}->with_umask(sub {
+                my $xdb = $self->{xdb} || $self->_xdb_acquire;
+                $self->{over}->begin_lazy if $self->{over};
+                $xdb->begin_transaction;
+                $self->{txn} = 1;
+                $xdb;
+        });
 }
 
 sub commit_txn_lazy {
         my ($self) = @_;
         delete $self->{txn} or return;
-        $self->{xdb}->commit_transaction;
-        $self->{over}->commit_lazy if $self->{over};
+        $self->{-inbox}->with_umask(sub {
+                $self->{xdb}->commit_transaction;
+                $self->{over}->commit_lazy if $self->{over};
+        });
 }
 
 sub worker_done {