-
Bug
-
Resolution: Timed out
-
Low
-
3
-
Severity 3 - Minor
-
NOTE: This bug report is for Confluence Cloud.
This is a REGRESSION BUG that is carried over after migration from a server environment that does not have the database workaround fix applied.
This issue has been resolved in Confluence 5.9.8.
The fix we implemented is in the front end, and stops duplicate user records from displaying anywhere in Confluence - in the People Directory, Shares, or Mentions. The underlying duplicates may still exist in the database, and new duplicates may be created, however these are harmless and can be safely ignored. As of Confluence 5.9.8, you should no longer see duplicate users in People Directory, shares, mentions in Confluence. For duplicated users displayed in the search result, refer to CONFSERVER-56554
Symptoms
- Users appear twice in the People Directory, in shares, and mentions
- Users have two USERINFO records with no 'prevver' value (ie two current records), eg:
select * from content where contenttype like 'USERINFO' and prevver is null;
USERINFO records that do not have an entry in prevver are the currently active records. This is a little counter-intuitive given the name of the field, however older records that are no longer active contain the id of the superseding record in prevver. If prevver is null, the record is considered active.
Steps to Reproduce
This may not be the only way to have this happen, but doing the following sequence will cause this to happen:
- Click on the '+' icon to create a new page.
- Select the 'Retrospective Template'.
- In the 'Participants' field, while adding some users, search returns duplicated records.
- Upon checking the database, duplicate USERINFO records in the 'content' table will be available:
SELECT c.username FROM CONTENT c WHERE contenttype LIKE 'USERINFO' AND prevver is null GROUP BY c.username HAVING count(c.username)>1;
Known Triggers
This has been confirmed to occur on upgrade to 5.1.3, and possibly earlier or later versions. Carried over to cloud when migrated from server
Diagnosis - is this affecting you?
First, try a content reindex. If this doesn't help, run this query (on any version). If it returns any results, this bug is the cause of your duplicates.
SELECT c.username FROM CONTENT c WHERE contenttype LIKE 'USERINFO' AND prevver is null GROUP BY c.username HAVING count(c.username)>1;
If this query returns nothing, have a look at CONF-36018 as well.
Work Around
- Make a site backup, database backup.
- Run this SQL command to find the usernames of affected users - ensure these match what you are seeing in the People Directory before deleting
// FOR CONFLUENCE 5.3 AND ABOVE SELECT m.username FROM content c JOIN user_mapping m ON c.username = m.user_key WHERE c.username IN (SELECT c.username FROM CONTENT c WHERE contenttype LIKE 'USERINFO' AND prevver is null GROUP BY c.username HAVING count(c.username)>1) GROUP BY m.username; // FOR CONFLUENCE 5.2 AND BELOW SELECT c.username FROM CONTENT c WHERE c.username IN (SELECT c.username FROM CONTENT c WHERE contenttype LIKE 'USERINFO' AND prevver is null GROUP BY c.username HAVING count(c.username)>1) GROUP BY c.username;
- Run this command to delete the duplicate entries (all versions). The row with the higher contentid will be deleted.
DELETE FROM CONTENT WHERE prevver IN (SELECT DISTINCT c1.contentid AS "pageid" FROM CONTENT c1 JOIN CONTENT c2 ON c1.username = c2.username WHERE c1.contenttype = 'USERINFO' AND c2.contenttype = 'USERINFO' AND c1.prevver is null AND c2.prevver is null AND c1.contentid > c2.contentid); DELETE FROM CONTENT WHERE contentid IN (SELECT DISTINCT c1.contentid AS "pageid" FROM CONTENT c1 JOIN CONTENT c2 ON c1.username = c2.username WHERE c1.contenttype = 'USERINFO' AND c2.contenttype = 'USERINFO' AND c1.prevver is null AND c2.prevver is null AND c1.contentid > c2.contentid);
- Run a Confluence site content re-index.
- is cloned from
-
CONFSERVER-30050 Users are duplicated in the People Directory, shares, mentions, and have two USERINFO records in the database
- Closed