Project

General

Profile

Actions

Feature #31147

closed

Extend StatusCalculator to make use of 64 bits

Added by Lukas Zapletal about 4 years ago. Updated over 2 years ago.

Status:
Closed
Priority:
Normal
Category:
Reporting
Target version:
-
Fixed in Releases:
Found in Releases:

Description

ConfigReportStatusCalculator class is too tightly coupled with ConfigReport (using MAX and other constants). This needs to be decoupled there is no reason to have it like that, this will also enable using this class in the modernized report engine.

Also we currently do not indicate that the maximum number has been reached (e.g. 63 currently for puppet). There should be a helper method that returns numbers as strings returning "63+" in case the ceiling is reached. This should be used in templates to render those number correctly so users can actually recognize this hidden fact.

Next up, status is a "BIG INT" in our database schema which is 64 bits however currently the class does not make use of all bits for some reason: 36 bits are used for some strange reason in Puppet case. This will allow larger numbers. Migration must be done to convert current reports into the wider format.

Finally, there is an existing index named index_reports_on_status on the status column, but this is useless - this will never be used since scoped_search use bitwise shift and and operators: https://github.com/wvanbergen/scoped_search/blob/6fe6b86c223d7ba8eb14207bae8f4c28f676d9d0/lib/scoped_search/query_builder.rb#L343

In order to use an index, it would have to be a dynamic index on (status >> 8) but this can't be done since it is unknown how many bits are used in each plugin. The index should be simply dropped as unused.


Related issues 1 (0 open1 closed)

Related to Foreman - Feature #31145: Create ReportTranscript model, import API and Puppet importer and view APIRejectedLukas ZapletalActions
Actions

Also available in: Atom PDF