Skip to content

Commit

Permalink
doc: add note about scrub-old-jobs, VACUUM command
Browse files Browse the repository at this point in the history
Problem: The flux-accounting guide does not make a note of the
scrub-old-jobs command or running VACUUM on the database file if space
needs to be reclaimed.

Add a note to the flux-accounting guide about what the scrub-old-jobs
command does and how to tune it.

Make a note about connecting to the database file and running VACUUM if
we want to clean up and optimize the space occupied by the file.
  • Loading branch information
cmoussa1 committed Jun 26, 2024
1 parent 89ac131 commit d8382fa
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions doc/guide/accounting-guide.rst
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,36 @@ The scripts should be run by :core:man1:`flux-cron`:
30 * * * * bash -c "flux account-fetch-job-records; flux account update-usage; flux account-update-fshare; flux account-priority-update"
Periodically fetching and storing job records in the flux-accounting database
can cause the DB to grow large in size. Since there comes a point where job
records become no longer useful to flux-accounting in terms of job usage and
fair-share calculation, you can run ``flux account scrub-old-jobs`` to
remove old job records. If no argument is passed to this command, it will
delete any job record that has completed more than 6 months ago. This can be
tuned by specifying the number of weeks to go back when determining which
records to remove. The example below will remove any job record more than 4
weeks old:

.. code-block:: console
$ flux account scrub-old-jobs 4
By default, the memory occupied by a SQLite database does not decrease when
records are ``DELETE``'d from the database. After scrubbing old job records
from the flux-accounting database, if space is still an issue, the ``VACUUM``
command will clean up the space previously occupied by those deleted records.
You can run this command by connecting to the flux-accounting database in a
SQLite shell:

.. code-block:: console
$ sqlite3 FluxAccounting.db
sqlite> VACUUM;
Note that running ``VACUUM`` can take minutes to run and also requires an
exclusive lock on the database; it will fail if the database has a pending SQL
statement or open transaction.

***********************
Database Administration
***********************
Expand Down

0 comments on commit d8382fa

Please sign in to comment.