Available in public-inbox 1.6.0 (PENDING).
-=item --no-sync
+=item --no-fsync
Disables L<fsync(2)> and L<fdatasync(2)> operations on SQLite
and Xapian. This is only effective with Xapian 1.4+.
These options are passed directly to L<xapian-compact(1)> when
used with C<--compact>.
-=item --no-sync
+=item --no-fsync
Disable L<fsync(2)> and L<fdatasync(2)>.
sub dbh_new {
my ($self) = @_;
- my $dbh = $self->SUPER::dbh_new($self->{-no_sync} ? 2 : 1);
+ my $dbh = $self->SUPER::dbh_new($self->{-no_fsync} ? 2 : 1);
# TRUNCATE reduces I/O compared to the default (DELETE)
# We do not use WAL since we're optimized for read-only ops,
$self->{lock_path} = "$inboxdir/ssoma.lock";
my $dir = $self->xdir;
$self->{over} = PublicInbox::OverIdx->new("$dir/over.sqlite3");
- $self->{over}->{-no_sync} = 1 if $ibx->{-no_sync};
+ $self->{over}->{-no_fsync} = 1 if $ibx->{-no_fsync};
$self->{index_max_size} = $ibx->{index_max_size};
} elsif ($version == 2) {
defined $shard or die "shard is required for v2\n";
}
}
return unless defined $flag;
- $flag |= $DB_NO_SYNC if $self->{ibx}->{-no_sync};
+ $flag |= $DB_NO_SYNC if $self->{ibx}->{-no_fsync};
my $xdb = eval { ($X->{WritableDatabase})->new($dir, $flag) };
if ($@) {
die "Failed opening $dir: ", $@;
die "BUG: _msgmap_init is only for v1\n" if $self->{ibx_ver} != 1;
$self->{mm} //= eval {
require PublicInbox::Msgmap;
- my $rw = $self->{ibx}->{-no_sync} ? 2 : 1;
+ my $rw = $self->{ibx}->{-no_fsync} ? 2 : 1;
PublicInbox::Msgmap->new($self->{ibx}->{inboxdir}, $rw);
};
}
rotate_bytes => int((1024 * 1024 * 1024) / $PACKING_FACTOR),
last_commit => [], # git epoch -> commit
};
- $self->{over}->{-no_sync} = 1 if $v2ibx->{-no_sync};
+ $self->{over}->{-no_fsync} = 1 if $v2ibx->{-no_fsync};
$self->{shards} = count_shards($self) || nproc_shards($creat);
bless $self, $class;
}
# for SQLite:
my $mm = $self->{mm} = PublicInbox::Msgmap->new_file(
"$self->{ibx}->{inboxdir}/msgmap.sqlite3",
- $self->{ibx}->{-no_sync} ? 2 : 1);
+ $self->{ibx}->{-no_fsync} ? 2 : 1);
$mm->{dbh}->begin_work;
}
my $flag = eval($PublicInbox::Search::Xap.'::DB_CREATE()');
die if $@;
my $XapianWritableDatabase = $PublicInbox::Search::X{WritableDatabase};
- $flag |= $PublicInbox::SearchIdx::DB_NO_SYNC if !$opt->{sync};
+ $flag |= $PublicInbox::SearchIdx::DB_NO_SYNC if !$opt->{fsync};
my $dst = $XapianWritableDatabase->new($tmp, $flag);
my $pr = $opt->{-progress};
my $pfx = $opt->{-progress_pfx} = progress_pfx($new);
use PublicInbox::Xapcmd;
my $compact_opt;
-my $opt = { quiet => -1, compact => 0, maxsize => undef, sync => 1 };
-GetOptions($opt, qw(verbose|v+ reindex rethread compact|c+ jobs|j=i prune sync!
- xapianonly|xapian-only
+my $opt = { quiet => -1, compact => 0, maxsize => undef, fsync => 1 };
+GetOptions($opt, qw(verbose|v+ reindex rethread compact|c+ jobs|j=i prune
+ fsync|sync! xapianonly|xapian-only
indexlevel|L=s maxsize|max-size=s batchsize|batch-size=s
sequentialshard|seq-shard|sequential-shard))
or die "bad command-line args\n$usage";
if ($opt->{compact} >= 2) {
PublicInbox::Xapcmd::run($ibx, 'compact', $compact_opt);
}
- $ibx->{-no_sync} = 1 if !$opt->{sync};
+ $ibx->{-no_fsync} = 1 if !$opt->{fsync};
my $ibx_opt = $opt;
if (defined(my $s = $ibx->{indexsequentialshard})) {