* [PATCH] searchidx: preserve umask when starting/committing transactions
@ 2018-05-01 1:51 Eric Wong
0 siblings, 0 replies; only message in thread
From: Eric Wong @ 2018-05-01 1:51 UTC (permalink / raw)
To: meta
Xapian will replace files upon committing, so non-parallel
V2Writable users need to have umask preserved this way.
---
lib/PublicInbox/SearchIdx.pm | 19 ++++++++++++-------
1 file changed, 12 insertions(+), 7 deletions(-)
diff --git a/lib/PublicInbox/SearchIdx.pm b/lib/PublicInbox/SearchIdx.pm
index aeb363e..74f9267 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 {
--
EW
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2018-05-01 1:51 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-05-01 1:51 [PATCH] searchidx: preserve umask when starting/committing transactions Eric Wong
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).