Uploaded image for project: 'Crucible'
  1. Crucible
  2. CRUC-8416

Viewing files in a code review does not update the review progress

    XMLWordPrintable

Details

    Description

      Issue Summary

      Environment

      • Subversion repository

      Steps to Reproduce

      1. Repository indexing must be in progress
      2. Create a code review with few recently committed files
      3. Open files in a code review to mark them as read

      Expected Results

      Review progress should increase up to 100%

      Actual Results

      Review progress stays at 0% (or at some arbitrary percentage) and does not increase.

      Page reload does not help.

      Notes

      Whenever user adds a file to a code review, Crucible fetches necessary data from Fisheye's repository index and stores it in the SQL database. Whenever Crucible needs the data, it is being read from the SQL database. It happens that also a number of lines added and removed in given file revision is persisted in the DB. You can find this data in the cru_fr_detail table - the cru_name column contains linesAdded or linesRemoved properties and cru_value column stores the value of a property.

      Unfortunately, when Subversion repository is being indexed, LOC calculation is calculated in a later phase. It can happen that when user adds a file to a code review, its added/removed lines are 0 and this is persisted in the DB. As a result, even if indexing is finished, old value remains in the code review. As a result, review progress can get stuck at 0% (or another percentage, if some of the files in a code review had LOC available).

      Workaround

      Please follow steps below to reindex the data on repository start. It happens only if an undocumented 'rescan.crucible.revisions' repository property is set to 'true'.

      1. Download the byteman_resccan_crucible_revisions.btm file to your Fisheye server. Edit the fie and replace REPOSITORY_NAME with name of repository you want to refresh.

      Install the Byteman rule. Example commands:

      $ export FISHEYE_LOAD_BYTEMAN=1
      
      $ ./bin/start.sh
      (wait until Crucible starts)
      
      $ ./tools/byteman/list-rules.sh
      no rules installed
      
      $ ./tools/byteman/load-rules.sh byteman_resccan_crucible_revisions.btm
      install rule RepositoryPropertyManager_rescan_crucible_revisions
      
      $ ./tools/byteman/list-rules.sh 
      # File byteman_resccan_crucible_revisions.btm line 5
      RULE RepositoryPropertyManager_rescan_crucible_revisions
      CLASS com.atlassian.fecru.properties.RepositoryPropertyManagerImpl
      METHOD loadProperty
      AT EXIT
      IF "REPOSITORY_NAME".equals($1) && "rescan.crucible.revisions".equals($2)
      DO
      org.slf4j.LoggerFactory.getLogger("Byteman").info("RepositoryPropertyManagerImpl#loadProperty({}, {}) returning true", new Object[] \{$0, $1});
      return "true"
      ENDRULE
      Transformed in:
      loader: com.cenqua.fisheye.FishEyeClassLoader@1be6f5c3
      trigger method: com.atlassian.fecru.properties.RepositoryPropertyManagerImpl.loadProperty(java.lang.String,java.lang.String) java.lang.String
      

      3. Go to Administration > Server. Turn debugging on.

      4. Go to Administration > Repositories > REPOSITORY_NAME > Summary tab. Click 'Stop' and next 'Start'.

      5. Check logs that Crucible reindex has started and completed for this repository. Look for lines similar to the following:

      2019-08-09 13:13:35,141 INFO [qtp400103862-182 ] Byteman NativeMethodAccessorImpl-invoke0 - RepositoryPropertyManagerImpl#loadProperty(REPOSITORY_NAME, rescan.crucible.revision) returning true
      

      means Byteman rule triggered properly and set a hidden 'rescan.crucible.revision' repository property

      2019-08-09 13:51:23,412 INFO [qtp1925785585-182 ] fisheye CrucibleRevisionDetailsRescanListener-onRepositoryStartedEvent - Repository REPOSITORY_NAME (REPOSITORY_NAME) has started and requires property details rescan for Crucible revisions. Scheduling it right now
      

      means that rescan has been queued

      2019-08-09 13:52:08,880 DEBUG [AtlassianEvent::pool-3-thread-7 ] fisheye Timer-output - -> Crucible Revisions and FileRevision details sync mem_usage = 363810432 heapsize = 722468864 freemem = 358658432
      2019-08-09 13:52:08,894 DEBUG [AtlassianEvent::pool-3-thread-7 ] fisheye Timer-output - -- Crucible Revisions and FileRevision details sync at Updated 2 CrucibleRevisions time 13 millis mem_usage = 365703136 heapsize = 722468864 freemem = 356765728
      2019-08-09 13:52:08,894 DEBUG [AtlassianEvent::pool-3-thread-7 ] fisheye Timer-output - <- Crucible Revisions and FileRevision details sync time 13 millis mem_usage = 365703136 heapsize = 722468864 freemem = 356765728
      

      means that queued request started and finished - note the "Updated 2 CrucibleRevisions" message.

      6. Log in as a reviewer and go to the problematic code review. Review progress should be correct now.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              mparfianowicz Marek Parfianowicz
              Votes:
              1 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: