Crowd upgrade fails with 'Duplicate entry 'xxx' for key 'app_dir_mapping_id'

お困りですか?

アトラシアン コミュニティをご利用ください。

コミュニティに質問

プラットフォームについて: Server および Data Center のみ。この記事は、Server および Data Center プラットフォームのアトラシアン製品にのみ適用されます。

Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.

*Fisheye および Crucible は除く

問題

Crowd will not start up after an upgrade. The following appears in the atlassian-crowd.log

2016-09-21 22:30:20,348 localhost-startStop-1 INFO [crowd.upgrade.tasks.UpgradeTask645IntroduceUserPermissions] Group mapping for '<somegroup>' is being added in directory 'somedirectory'
2016-09-21 22:30:20,452 localhost-startStop-1 WARN [engine.jdbc.spi.SqlExceptionHelper] SQL Error: 1062, SQLState: 23000
2016-09-21 22:30:20,453 localhost-startStop-1 ERROR [engine.jdbc.spi.SqlExceptionHelper] Duplicate entry '<somegroup>' for key 'app_dir_mapping_id'
2016-09-21 22:30:20,454 localhost-startStop-1 ERROR [jdbc.batch.internal.BatchingBatch] HHH000315: Exception executing batch [could not perform addBatch]

診断

Diagnostic Steps

Run the following SQL query to see all the groups in your Crowd instance. 

SELECT d.directory_name, g.group_name, COUNT(lower_user_name) FROM cwd_user u
LEFT JOIN cwd_membership m
ON u.id = m.id
LEFT JOIN cwd_directory d
ON u.directory_id = d.id
LEFT JOIN cwd_group g
ON u.directory_id = g.directory_id
GROUP BY d.directory_name, g.group_name
ORDER BY d.directory_name;
SELECT * FROM cwd_group;
SELECT * FROM cwd_directory;

原因

This error occurs when the default 'crowd-administrator' group does not exist in the Crowd internal directory or another internal directory that was created. A new admin group was created in the internal directory. The upgrade is trying to duplicate the group and errors. 

回避策

You can workaround this issue by following the steps below: 

  1. Add a temporary Crowd administrator group into all of your internal directories where it does not exist. Name it 'crowd-administrators'.
  2. Assign all of the existing 'admin (role) group members to this newly created crowd-administrators group.
  3. Add this group to each of your Atlassian Applications, as necessary.
  4. Delete the problematic _admin_ group from your Crowd instance. This group is identified in the error above. 
  5. Reattempt the upgrade process.
  6. Once you've successfully upgraded, you can execute the following SQL queries to rename back the temporary group to _admin (role) _ as desired:

    UPDATE cwd_group 
    SET group_name = 'System Administrator'
    WHERE group_name = 'crowd-administrators';
    
    UPDATE cwd_group 
    SET lower_group_name = 'system administrator'
    WHERE lower_group_name = 'crowd-administrators';
    
    UPDATE cwd_app_dir_group_mapping 
    SET group_name = 'System Administrator'
    WHERE group_name = 'crowd-administrators';
    
    UPDATE cwd_membership 
    SET parent_name = 'System Administrator'
    WHERE parent_name = 'crowd-administrators';
    
    UPDATE cwd_membership 
    SET lower_parent_name = 'system administrator'
    WHERE lower_parent_name = 'crowd-administrators';

データベースの変更を行う場合は必ず事前にバックアップを取得してください。可能な場合は、まずステージング サーバーで SQL コマンドの変更、挿入、更新、または削除を行うようにします。

 

 

最終更新日 2018 年 11 月 2 日

この内容はお役に立ちましたか?

はい
いいえ
この記事についてのフィードバックを送信する
Powered by Confluence and Scroll Viewport.