Uploaded image for project: 'SonarQube'
  1. SonarQube
  2. SONAR-8390

Improve reliability of indexing of users in Elasticsearch

    Details

      Description

      Elasticsearch index of users is synchronised by loading all the rows in table USERS which update date is strictly greater than last synchronisation date. That has two limitations :

      • indexing is not isolated to the user who has been modified. Not a problem so far with users but still indexing should be restricted to only the user being touched (basically indexer.indexUser(String login) instead of indexer.indexAll()).
      • two changes in the same millisecond may conflict. The second one can be ignored and not indexed. The root cause is that the SQL request to search for changes is updated_at > :lastRefreshDate (strict comparison).
      Technical note

      See comment from Sebastien Lesaint : https://github.com/SonarSource/sonarqube/pull/1391#discussion_r88188675
      Unit test may not detect some potential bugs.

      in this UT (I haven't check the other UTs, but it very likely it is the case too), the indexer get injected with a mocked System2 instance which always returns the same value.

      I wonder if this could cause the indexer to never index more than once in UT and cause very bad behavior in the UT

        Attachments

          Activity

            People

            • Assignee:
              daniel.schwarz Daniel Schwarz (Inactive)
              Reporter:
              simon.brandhof Simon Brandhof
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: