-
Bug
-
Resolution: Unresolved
-
Low
-
None
-
8.20.20, 8.20.30, 9.4.25, 9.12.12
-
8.2
-
15
-
Severity 3 - Minor
-
37
-
Issue Summary
Creating comments using CommentManager without dispatching an event resulting in comments without an entity version
This is reproducible on Data Center: yes
Steps to Reproduce
- Create a comment using this method. Set dispatchEvent to false.
- Example code
import com.atlassian.jira.component.ComponentAccessor import com.atlassian.jira.util.json.JSONObject final boolean dispatchEvent = false def issueManager = ComponentAccessor.getIssueManager() def commentManager = ComponentAccessor.getCommentManager() def issue = issueManager.getIssueObject("TASK-1") commentManager.create(issue, "JIRAUSER10000", "This is a comment created using JAVA API dispatchEvent = false", dispatchEvent)
- Example code
- Verify if the comment is created successfully by browsing the issue.
- Check the atlassian-jira.log for any warning messages about the new comment.
Expected Results
- The comment is created successfully with a row inserted into the jiraaction database table for the comment and a corresponding row in the comment_version table
Actual Results
The comment is created successfully. However, the below exception may be seen repetitively in the atlasian-jira.log file:
2024-06-07 11:26:10,949+0200 NodeReindexServiceThread:thread-0 WARN [c.a.j.issue.index.DefaultIssueIndexer] COMMENT with id=5253545 should have a version by now
The SQL query below checks for comments without a version in the database. The comments added with the example above show up in the SQL result.
select * from jiraaction WHERE actiontype = 'comment' AND id not in (select comment_id from comment_version);
Despite without an entity version, this doesn’t affect the index search functionality.
Workaround
- Reindexing the comments using Java API reIndexComments
- Manually inserting a row into the comment_version table. Example row:
comment_id|parent_issue_id|update_time |index_version|deleted| ----------+---------------+-----------------------------+-------------+-------+ 10003| 10110|2024-05-29 15:27:07.094 +0200| 1|N |
The value of comment_id and parent_issue_id can be retrieved from the jiraaction table using the previous query to identify the "version-less comments".
update_time is usually the current time.
index_version should be 1 (as a workaround for this bug).
deleted is N.
- derived from
-
JRASERVER-77841 issue_version and comment_version missing data from project import
-
- In Progress
-
- relates to
-
JRASERVER-78662 Deleting Jira issue comments using the Jira Java API "com.atlassian.jira.issue.comments.CommentManager.delete" does not update the comment_version table if we set dispatchEvent as false.
-
- Gathering Impact
-