From c56b4a4ee94c4532719981417f0c055480d200f4 Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Sat, 31 Oct 2020 07:02:41 -0700 Subject: [PATCH] ircd::m::dbs: Add conf item toggling indexer prefetching. --- include/ircd/m/dbs/dbs.h | 1 + matrix/dbs.cc | 13 ++++++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/include/ircd/m/dbs/dbs.h b/include/ircd/m/dbs/dbs.h index e1f8fd670..1a2473350 100644 --- a/include/ircd/m/dbs/dbs.h +++ b/include/ircd/m/dbs/dbs.h @@ -21,6 +21,7 @@ namespace ircd::m::dbs // General confs extern conf::item cache_enable; extern conf::item cache_comp_enable; + extern conf::item prefetch_enable; extern conf::item mem_write_buffer_size; extern conf::item sst_write_buffer_size; diff --git a/matrix/dbs.cc b/matrix/dbs.cc index b3c1a3853..c5fe6ccd2 100644 --- a/matrix/dbs.cc +++ b/matrix/dbs.cc @@ -32,6 +32,17 @@ ircd::m::dbs::cache_comp_enable { "default", false }, }; +/// Coarse toggle for the prefetch phase before the transaction building +/// handlers (indexers) are called. If this is false, prefetching will be +/// disabled; otherwise the write_opts passed to write() control whether +/// prefetching is enabled. +decltype(ircd::m::dbs::prefetch_enable) +ircd::m::dbs::prefetch_enable +{ + { "name", "ircd.m.dbs.prefetch.enable" }, + { "default", true }, +}; + /// The size of the memory buffer for new writes to the DB (backed by the WAL /// on disk). When this buffer is full it is flushed to sorted SST files on /// disk. If this is 0, a per-column value can be used; otherwise this value @@ -195,7 +206,7 @@ try }; size_t ret(0); - if(likely(opts.prefetch)) + if(prefetch_enable && opts.prefetch) ret = _prefetch(txn, event, opts); if(likely(opts.index))