From ee4726bcf5357a8b364326a1e3ef90220710b21c Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sat, 6 Sep 2025 19:45:06 +0000 Subject: [PATCH] *index: increase default --commit-interval to 15s The DBD::SQLite(3pm) sqlite_busy_timeout is 30s and we don't currently have a way to override this. Thus 15s should be adequate assuming we can keep SQLite commit times <10s. Currently, the worst case commit times can exceed even 30s for Xapian, but that doesn't affect over.sqlite3 which commits fairly quickly. --- lib/PublicInbox/ExtSearchIdx.pm | 5 +++-- lib/PublicInbox/SearchIdx.pm | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/PublicInbox/ExtSearchIdx.pm b/lib/PublicInbox/ExtSearchIdx.pm index 4719c8805..c60b6f43f 100644 --- a/lib/PublicInbox/ExtSearchIdx.pm +++ b/lib/PublicInbox/ExtSearchIdx.pm @@ -1333,8 +1333,9 @@ sub on_inbox_unlock { # called by PublicInbox::InboxIdle $pr->("indexing $ekey\n") if $pr; $self->idx_init($opt); sync_inbox $self, $ibx; - $self->{-commit_timer} //= add_timer($opt->{'commit-interval'} // 10, - \&_watch_commit, $self); + $self->{-commit_timer} //= add_timer($opt->{'commit-interval'} // + $PublicInbox::SearchIdx::CHECKPOINT_INTVL, + \&_watch_commit, $self); } sub eidx_reload { # -extindex --watch SIGHUP handler diff --git a/lib/PublicInbox/SearchIdx.pm b/lib/PublicInbox/SearchIdx.pm index fef1892b1..0cd7a046b 100644 --- a/lib/PublicInbox/SearchIdx.pm +++ b/lib/PublicInbox/SearchIdx.pm @@ -36,7 +36,7 @@ my $X = \%PublicInbox::Search::X; our ($DB_CREATE_OR_OPEN, $DB_OPEN); our $DB_NO_SYNC = 0; our $DB_DANGEROUS = 0; -our $CHECKPOINT_INTVL = 5; # seconds +our $CHECKPOINT_INTVL = 15; # seconds our $DEFRAG_NR = 100000; # document count our $BATCH_BYTES = $ENV{XAPIAN_FLUSH_THRESHOLD} ? 0x7fffffff : # assume a typical 64-bit system has 8x more RAM than a -- 2.47.3