Details
-
Bug
-
Resolution: Obsolete
-
Medium
-
16
-
Severity 2 - Major
-
Description
NOTE: This bug report is for JIRA Cloud. Using JIRA Server? See the corresponding bug report.
Steps to reproduce:
- Create a test issue and add two or three users as a watcher
- Export the backup of this instance
- Import the project using the "Project Import" tool
- When the import is complete, check the issue that had the watchers
- Try removing the watchers, they should disappear from the watchers list
- Refresh the issue, the watchers will still be listed
This is caused by the watches column not matching the number of rows in the userassociation table.
For example, here are the list of watchers of issue 10008:
jira=# select * from userassociation where association_type = 'WatchIssue' and sink_node_id = 10008; source_name | sink_node_id | sink_node_entity | association_type | sequence | created -------------+--------------+------------------+------------------+----------+---------------------------- user 1 | 10008 | Issue | WatchIssue | | 2013-11-01 18:36:20.324+00 user 2 | 10008 | Issue | WatchIssue | | 2013-11-01 18:36:20.321+00 sysadmin | 10008 | Issue | WatchIssue | | 2013-11-01 18:36:20.314+00 (3 rows)
And that's not being taken under consideration on the watches column of the jiraissue table:
jira=# select id, project, issuenum, watches from jiraissue where project = 10003 and id = 10008; id | project | issuenum | watches -------+---------+----------+--------- 10008 | 10003 | 3 | 0 (1 row) jira=#
The following query can help detect all the issues that have the watches columns not matching the number of watches:
select count(*) as total, sink_node_id, i.id, i.watches, p.pkey, i.issuenum from userassociation, jiraissue i , project p where association_type = 'WatchIssue' and i.id = sink_node_id and i.project = p.id group by sink_node_id, i.id, i.watches, p.pkey, i.issuenum having count(*) != (select watches from jiraissue where jiraissue.id = userassociation.sink_node_id);
Workaround: update the watches column on jiraissue table to match the number of watchers of the issue in the userassociation table:
UPDATE jiraissue i SET watches = (SELECT COUNT(*) FROM userassociation WHERE association_type = 'WatchIssue' AND userassociation.sink_node_id = i.id );
Attachments
Issue Links
- causes
-
JRACLOUD-37757 Removing Watchers
- Closed
- is related to
-
JRASERVER-35622 Cannot delete watchers from an issue that was imported using the Project Import
- Closed
- relates to
-
JRACLOUD-36626 Discrepancy between watcher count on issue navigator compared to issue
- Closed