Skip to content

Commit

Permalink
doc: add note about --scrub, VACUUM SQLite 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
optional argument 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 optional
argument 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 25, 2024
1 parent d4b59ac commit fa0982e
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions doc/guide/accounting-guide.rst
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,32 @@ 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 pass the ``--scrub`` optional argument to
``flux account-fetch-job-records`` to also remove old job records. By default,
passing ``--scrub`` 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 fetch new job
records and remove any job record more than 4 weeks old:

.. code-block:: console
$ flux account-fetch-job-records --scrub 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;
***********************
Database Administration
***********************
Expand Down

0 comments on commit fa0982e

Please sign in to comment.