[User-login] Restoring Jira 8.22 (and newer) backup to Cloud
Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.
Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. 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.
*Except Fisheye and Crucible
Resources
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:
Load DB schema from
entitymodel.xml
, including the unique indexes.Load data from backup
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.
Create a backup of the database
Remove blocking (inconsistent) user from
cwd_membership
and consequently updatecwd_user
:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
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.
Was this helpful?