Maximum values of SonarQube DB Cleaner's Keys/Constants

Tags: sonarqube

SonarQube is automatically deleting measurement data for files for the older snapshots. When a new snapshot is taken, the old one get deleted. I can see measurement data for files only for the latest snapshot. My db cleaner settings are as as below.

Database Cleaner Settings

What are the maximum allowed values for the keys/constants? Am I using too high value for the keys that they somehow overflow and does not work? What should I do if I do not want SonarQube to auto delete any measurement data for older snapshots?

I am using SonarQube version: 6.0.


Automatic clean-up of old analysis cannot be disabled. Still setting high values like 100'000 (days) means that analysis are kept during 274 years. Maybe the ability to disable auto-cleaning will be implemented during this period.

You can debug your mongo queries in multiple ways.

Start with your index usage using below command :
db.images.aggregate( [ { $indexStats: { } } ] )

If this don't give you any useful information, then check the execution plan of the slow queries using : db.setProfilingLevel(2)

db.system.profile will give you complete profile of your queries.

C++11 solution:

#include <type_traits>

template<typename From, typename To>
To map(From e) {
    return static_cast<To>(
        static_cast<typename std::underlying_type<To>::type>(
        static_cast<typename std::underlying_type<From>::type>(e)));

This casting cascade is very explicit and supports enum classes.

For older C++ versions and for enums without class, static_cast<Enum2>(e) would suffice.


With template specialization, you can use map without specifying any types explicitly:

enum class Enum1: int {A, B, C, D};
enum class Enum2: char {A1, B1, C1, D1};

template<typename T>
struct target_enum {

struct target_enum<Enum1> {
    typedef Enum2 type;

template<typename From>
typename target_enum<From>::type map(From e) {
    typedef typename target_enum<From>::type To;
    return static_cast<To>(
        static_cast<typename std::underlying_type<To>::type>(
        static_cast<typename std::underlying_type<From>::type>(e)));

You can then call map(Enum1::A). Also works with simple, non-class enums.

By : flyx

This video can help you solving your question :)
By: admin