[User-login] Restoring Jira 8.22 (and newer) backup to Cloud

お困りですか?

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

コミュニティに質問

リソース

JRASERVER-70690 - 課題詳細を取得中... ステータス

ユーザーログインの Jira Stats 記録

[User-login] Restoring old Jira backup to 8.22.0 and newer

Restoring Jira 8.22 (and newer) backup to Cloud

In Data Center’s UpgradeTask_Build822000 we modify indexes on cwd_membership table.

Server and DC < 8.22 and current Cloud mandates uniqueness of (parentId, childId, membershipType), while DC >=8.22 mandates uniqueness of (lowerParentName, lowerChildName, membershipType, directoryId).

Since DC >=8.22 ignores parentId and childId, there might be some incorrect values in those columns, violating uniqueness of the cloud index.

We cannot fix those ids in this upgrade task, though, because the order of operations is:

  1. Load DB schema from entitymodel.xml, including the unique indexes.

  2. Load data from backup

  3. Run downgrade/upgrade tasks.

Operation #2 fails if the imported data violates the index constraints. Hence, we need to fix the data before exporting from Server.

  1. Create a backup of the database

  2. Remove blocking (inconsistent) user from cwd_membership and consequently update cwd_user:

DROP INDEX UK_MEM_PARENT_CHILD_TYPE;

update cwd_membership
set child_id = U.id
from cwd_user U
where cwd_membership.lower_child_name = U.lower_user_name
and cwd_membership.directory_id = U.directory_id
and cwd_membership.membership_type = 'GROUP_USER'
and child_id != U.id;

update cwd_membership
set child_id = G.id
from cwd_group G
where cwd_membership.lower_child_name = G.lower_group_name
and cwd_membership.directory_id = G.directory_id
and cwd_membership.membership_type = 'GROUP_GROUP'
and child_id != G.id;

update cwd_membership
set parent_id = G.id
from cwd_group G
where cwd_membership.lower_parent_name = G.lower_group_name
and cwd_membership.directory_id = G.directory_id
and parent_id != G.id;

delete from cwd_membership 
where lower_child_name not in
(
  select lower_user_name 
  from cwd_user
)
and membership_type = 'GROUP_USER';

delete from cwd_membership 
where lower_child_name not in
(
  select lower_group_name
  from cwd_group
)
and membership_type = 'GROUP_GROUP';

delete from cwd_membership 
where lower_parent_name not in 
(
  select lower_group_name
  from cwd_group
);

create unique index uk_mem_parent_child_type
on public.cwd_membership 
using
btree (parent_id, child_id, membership_type)


3. A cold restart is needed to rebuilt the cache with the correct data.

最終更新日: 2022 年 1 月 24 日

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

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