Uploaded image for project: 'Jira Data Center'
  1. Jira Data Center
  2. JRASERVER-64878

Integrity Checker Should Check and Fix Invalid Scheme References to Removed Projects

XMLWordPrintable

    • Icon: Suggestion Suggestion
    • Resolution: Unresolved
    • None
    • None
    • None
    • 1
    • 8
    • We collect Jira feedback from various sources, and we evaluate what we've collected when planning our product roadmap. To understand how this piece of feedback will be reviewed, see our Implementation of New Features Policy.

      NOTE: This suggestion is for JIRA Server. Using JIRA Cloud? See the corresponding suggestion.

      From time to time, JIRA's nodeassociation table has abandoned references between schemes and projects. This is suspected to occur if a project was deleted, but for some reason these references remain.

      The integrity checker should help detect when a non-valid project ID is referenced in nodeassociation and remove the reference.

      As of JIRA 7.x, for example, if there is a reference to a non-existent project, the UI will result in an error and prevent admins from modifying the schemes. The logs show:

      2017-03-10 14:51:25,249 http-nio-8080-exec-46 uri:/jira/secure/admin/views/permissions/viewschemes.jsp username: admin ERROR admin 891x118804x1 1ya7wma 10.102.167.67,0:0:0:0:0:0:0:1 /secure/admin/ViewPermissionSchemes.jspa [webwork.util.ValueStack] METHOD: "projects", exception: 
      java.lang.NullPointerException
      	at java.util.Comparator.lambda$comparing$77a9974f$1(Comparator.java:469)
      	at java.util.TimSort.binarySort(TimSort.java:296)
      	at java.util.TimSort.sort(TimSort.java:239)
      	at java.util.Arrays.sort(Arrays.java:1512)
      	at java.util.stream.SortedOps$SizedRefSortingSink.end(SortedOps.java:348)
      	at java.util.stream.Sink$ChainedReference.end(Sink.java:258)
      	at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:482)
      	at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
      	at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708)
      	at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
      	at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:499)
      	at com.atlassian.jira.scheme.AbstractSchemeManager.getProjects(AbstractSchemeManager.java:481)
      	at com.atlassian.jira.scheme.AbstractViewSchemes.getProjects(AbstractViewSchemes.java:13)
      	... 2 filtered
      	...
      

      A method to look for these bad references between projects and permission/notifcation schemes is via SQL:

      • For example, when looking for a permission scheme that refers to be non-existent project:
        SELECT * FROM nodeassociation WHERE source_node_entity='Project' AND sink_node_entity IN ('NotificationScheme', 'PermissionScheme') AND source_node_id NOT IN (select id from project);
        
      • This will return references that have an invalid project ID (source_node_id column)
      • This row should then be removed

            Unassigned Unassigned
            dchan David Chan
            Votes:
            7 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated: