jsuto / piler

Email archiving application
https://www.mailpiler.org/
Other
50 stars 8 forks source link

[BUG] Do not show “Sphinx main (total) index” on health page, when RT=1 #139

Closed dilyanpalauzov closed 1 month ago

dilyanpalauzov commented 1 month ago

util/postinstall.sh.in contains

load_default_values() {
  RT=1  
}
make_cron_entries() {
      [[ $RT -eq 1 ]] || echo "5,35 * * * * ${LIBEXECDIR}/piler/indexer.delta.sh";
      [[ $RT -eq 1 ]] || echo "30   2 * * * ${LIBEXECDIR}/piler/indexer.main.sh";
      echo "40 3 * * * ${LIBEXECDIR}/piler/purge.sh";
      [[ $RT -eq 1 ]] || echo "*/15 * * * * ${INDEXER} --quiet tag1 --rotate --config ${PILER_CONFIG_DIR}/manticore.conf";
      [[ $RT -eq 1 ]] || echo "*/15 * * * * ${INDEXER} --quiet note1 --rotate --config ${PILER_CONFIG_DIR}/manticore.conf";
}

That is, when RT is enabled, the default, there is no need to run indexer.delta.sh and indexer.main.sh . However it is indexer.main.sh, which creates piler/stat/total_index_size and piler/stat/current_main_index_size . When the index_size files are missing, index.php?route=health/health shows “Sphinx main (total) index 1k (1k)”. My understanding is that under RT there is no “Sphinx main (total) index”, and therefore this should not be rendered on the web page.

jsuto commented 1 month ago

I've addressed this in #140

dilyanpalauzov commented 1 month ago

I do not see how is this relevant to https://github.com/jsuto/piler/issues/140 and permissions on the file system.

When real-time is enabled, piler/indexer.main.sh is not run (from crontab). When indexer.main.sh is not run, it does not create piler/stat/total_index_size and piler/stat/current_main_index_size. Then the web interface should not show the values for these index sizes (under Sphinx main (total) index).

In addition, indexer.main.sh could be executed from util/reindex.sh, which I do not calls, as for I do not what reindex.sh is good for.

jsuto commented 1 month ago

My bad, I confused it with the other. Anyway, the fix is on its way. It will query sphinx/manticore for the index size, so it hall work with both RT and plain index settings.