[User-login] Restoring old Jira backup to 8.22.0 and newer
Links
- JRASERVER-70690Getting issue details... STATUS
[User-login] Restoring Jira 8.22 (and newer) backup to Cloud
Restoring old Jira backup to 8.22.0 and newer
Old backups with corrupted Membership
rows cannot be restored to Jira 8.22 and future releases, because of the new uniqueness constraint.
There is a number of workarounds to remove corrupted rows:
Workaround 1a - grep
Find violating rows by running the following script:
grep '<Membership' $BACKUP_FILE | sed -E 's|.*<Membership .*(membershipType=[^ ]+).*( lowerParentName=[^ ]+).*( lowerChildName=[^ ]+).*( directoryId=[^ ]+).*/>|\1\2\3\4|' | sort | uniq -d
e.g.
$ grep '<Membership' $BACKUP_FILE | sed -E 's|.*<Membership .*(membershipType=[^ ]+).*( lowerParentName=[^ ]+).*( lowerChildName=[^ ]+).*( directoryId=[^ ]+).*/>|\1\2\3\4|' | sort | uniq -dmembershipType="GROUP_USER" lowerParentName="jira-project-admins" lowerChildName="proadmin" directoryId="1"
and remove the duplicates from the backup (leave only one entry!).
Workaround 1b - xsltproc
Find violating rows by running the following script:
xsltproc membership_uniq.xslt $BACKUP_FILE | sort | uniq -d
with the following XLS transformation in membership_uniq.xslt file:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method='text'/>
<xsl:template match="/">
<xsl:for-each select="entity-engine-xml/Membership">lowerParentName="<xsl:value-of select="@lowerParentName"/>" lowerChildName=<xsl:value-of select="@lowerChildName"/>" membershipType="<xsl:value-of select="@membershipType"/>" directoryId="<xsl:value-of select="@directoryId"/>"
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
and remove the duplicates from the backup (leave one entry!).
Workaround 2
Import the backup into Jira < 8.22 and upgrade afterwards to Jira >= 8.22.
Workaround 3
Drop uk_mem_dir_parent_child
index and it will be recreated by the upgrade task.