ISISComputingGroup / IBEX

Top level repository for IBEX stories
5 stars 2 forks source link

MySQL msg_log: Automate truncation #8364

Closed GRyall closed 3 months ago

GRyall commented 6 months ago

As a systems administrator, I would like us to automate our currently manual truncation of the msg_log table.

Acceptance Criteria

Extra Information

We currently have a truncate database script which we run manually when disk space is running out on Instrument PCs, or between cycles as part of our housekeeping. This dumps the table contents to a file, then removes them from the DB. This takes up development/support time and its automation would increase efficiency.

By regularly running a process to remove data over x days old, we will give certainty of what age of detail will be available in the Ibex GUI, whilst reducing the effort required in system maintenance.

In order to define how long we keep records in the DB, we need to balance the needs of the users against the disk available. It is believed the current users of the IBEX GUI feature this table supports (IOC Log) are the Muon beam-lines and technical groups. As such we should understand their needs before making the change. It is suggested a good starting point for consultation would be retaining records up to 30 days old (increasing this if there is a clear use case, decreasing it if we find this still results in manual intervention being required to reduce disk usage).

This ticket is a result of the discussion that took place as part of #8321 .

See also: developer wiki page.

How to Test

verbose instructions for reviewer to test changes (Add before making a PR)

Discussed ~00:43 20/06/24

There is a fairly comprehensive README.md file inC:\Instrument\Apps\EPICS\ISIS\IocLogServer\master\tests

For new systems with no pre-exiting database, the described test procedure can be invoked once the msg_log database has been built by running: C:\Instrument\Apps\EPICS\SystemSetup\confg_mysql.bat.

For systems with an existing msg_log database, there is a SQL script which simply creates the SQL event and procedures necessary for the automatic truncation, without affecting any existing database content: cd C:\Instrument\Apps\EPICS\ISIS\IocLogServer\master C:\Instrument\Apps\MySQL\bin\mysql.exe -u root --password=<db root password> < log-truncation-schema.sql

Note that the checks that the script is running correctly is by examining a new database table debug_messages, which is emptied before each truncation process. Details of the process are recorded in the table as simple text, which includes information on the progress of the binary search procedure.

iangillingham-stfc commented 4 months ago

A discussion to clarify acceptance criteria agreed unanimously to remove the requirement to dump the deleted records and move them to stage_deleted.