diff options
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/mu-store.cc | 7 | ||||
| -rw-r--r-- | lib/mu-xapian-db.cc | 8 | ||||
| -rw-r--r-- | lib/mu-xapian-db.hh | 10 |
3 files changed, 21 insertions, 4 deletions
diff --git a/lib/mu-store.cc b/lib/mu-store.cc index dd9f114..927b38c 100644 --- a/lib/mu-store.cc +++ b/lib/mu-store.cc @@ -75,8 +75,11 @@ struct Store::Private { config_{make_config(xapian_db_, root_maildir, conf)}, contacts_cache_{config_}, root_maildir_{remove_slash(config_.get<Config::Id::RootMaildir>())}, - message_opts_{make_message_options(config_)} - {} + message_opts_{make_message_options(config_)} { + // so tell xapian-db to update its internal cacheed values from + // config. In practice: batch-size. + xapian_db_.reinit(); + } ~Private() try { mu_debug("closing store @ {}", xapian_db_.path()); diff --git a/lib/mu-xapian-db.cc b/lib/mu-xapian-db.cc index a8c897a..bce9bf7 100644 --- a/lib/mu-xapian-db.cc +++ b/lib/mu-xapian-db.cc @@ -101,7 +101,7 @@ make_db(const std::string& db_path, Flavor flavor) XapianDb::XapianDb(const std::string& db_path, Flavor flavor): path_(make_path(db_path, flavor)), db_(make_db(path_, flavor)), - batch_size_{Config(*this).get<Config::Id::BatchSize>()} + batch_size_{Config(*this).get<Config::Id::BatchSize>()} // default { if (flavor == Flavor::CreateOverwrite) set_timestamp(MetadataIface::created_key); @@ -109,6 +109,12 @@ XapianDb::XapianDb(const std::string& db_path, Flavor flavor): mu_debug("created {} / {} (batch-size: {})", flavor, *this, batch_size_); } +void +XapianDb::reinit() { + batch_size_ = Config(*this).get<Config::Id::BatchSize>(); + mu_debug("set batch-size to {}", batch_size_); +} + #ifdef BUILD_TESTS /* diff --git a/lib/mu-xapian-db.hh b/lib/mu-xapian-db.hh index f9753c6..f0a977f 100644 --- a/lib/mu-xapian-db.hh +++ b/lib/mu-xapian-db.hh @@ -223,6 +223,14 @@ public: } /** + * Reinitialize from inner-config. Needed after CreateOverwrite. + * + * This is bit of a hack, needed since we cannot setup the config + * before we have a database. + */ + void reinit(); + + /** * Is the database read-only? * * @return true or false @@ -545,7 +553,7 @@ private: std::string path_; DbType db_; size_t tx_level_{}; - const size_t batch_size_; + size_t batch_size_; size_t changes_{}; }; |
