]> Sergey Matveev's repositories - public-inbox.git/commitdiff
index+xcpdb: rename `--no-sync' to `--no-fsync'
authorEric Wong <e@yhbt.net>
Fri, 7 Aug 2020 01:14:06 +0000 (01:14 +0000)
committerEric Wong <e@yhbt.net>
Fri, 7 Aug 2020 23:45:39 +0000 (23:45 +0000)
We'll continue supporting `--no-sync' even if its yet-to-make it
it into a release, but the term `sync' is overloaded in our
codebase which may be confusing to new hackers and users.

None of our our code nor dependencies issue the sync(2) syscall,
either, only fsync(2) and fdatasync(2).

Documentation/public-inbox-index.pod
Documentation/public-inbox-xcpdb.pod
lib/PublicInbox/OverIdx.pm
lib/PublicInbox/SearchIdx.pm
lib/PublicInbox/V2Writable.pm
lib/PublicInbox/Xapcmd.pm
script/public-inbox-index

index f525ba549918fb2e4d27905ef8b25f0c0107c335..a4edc57a08bf6d0107f491437392a4282c5ef086 100644 (file)
@@ -117,7 +117,7 @@ below.
 
 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+.
index 7fe1e5fe2cc1f53aaa7b8c21b5c097016c987ccb..89eed079ddc497bc43986efffd70e2739831704e 100644 (file)
@@ -45,7 +45,7 @@ too many shards given the capabilities of the current hardware.
 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)>.
 
index c8f61e012e0977dc98b794357ee033b801dc8e0a..4543bfa1d9acba6e06c4dc3bbe3a91c309123404 100644 (file)
@@ -21,7 +21,7 @@ use Carp qw(croak);
 
 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,
index a1baa65bd2945dcc8885fc70735a1d60ecd5853b..2248973131d16ba690ce42c68be7082ee8e270c7 100644 (file)
@@ -67,7 +67,7 @@ sub new {
                $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";
@@ -138,7 +138,7 @@ sub idx_acquire {
                }
        }
        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: ", $@;
@@ -389,7 +389,7 @@ sub _msgmap_init ($) {
        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);
        };
 }
index 6b1effe58e133cebf3a74f107698b40952818fad..a029fe4c4075029115f330d1a692014c60b067b3 100644 (file)
@@ -122,7 +122,7 @@ sub new {
                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;
 }
@@ -292,7 +292,7 @@ sub _idx_init { # with_umask callback
        # 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;
 }
 
index 97a51d1bc8b3f7637cf5a7c35afaa9094de8e0c4..8423194fc410e65061ee3cd900482ff8c140ff8d 100644 (file)
@@ -418,7 +418,7 @@ sub cpdb ($$) {
        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);
index a52fb1bf399280218e8d01eff8a8e7bdb6d73d75..dc9bdde1408228e1a5bab3ebef99b28848e751dc 100755 (executable)
@@ -14,9 +14,9 @@ PublicInbox::Admin::require_or_die('-index');
 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";
@@ -73,7 +73,7 @@ for my $ibx (@ibxs) {
        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})) {