Details
-
Type:
Bug
-
Status:
Open
-
Priority:
Major
-
Resolution: Unresolved
-
Affects Version/s: 4.1.3, 4.2-milestone-2, 4.2
-
Fix Version/s: None
-
Component/s: Old Core
-
Labels:None
-
Difficulty:Unknown
-
Similar issues:
XWIKI-8828 Old stats table may contains the same record with two different fullName XWIKI-7050com.xpn.xwiki.internal.cache.DefaultDocumentCache use the same id for two different caches XWIKI-7791IDs of stats objects are not properly computed and cause duplicated primary key issues during migration to 4.0 XWIKI-2210Can't use differents uid name configuration for the same ldap server for two differents wikis XWIKI-4527Stats service is broken XWIKI-8124 Statistics cannot deal with spaces that have a dot (“.”) in their name XWIKI-8049Duplicated ID for properties of type List - checkbox/radio on displaying two objects of the same type (same class) in edit mode XWIKI-6436The tables in syntax 1 & in syntax 2 should have the same layout XWIKI-5542Different rights in view and rest mode XWIKI-2836Property validation does not report classname in context
Description
From version 2.2, the storage of stats object has been changed. A compatibility solution was put into place to confound null classname with classname containing 'internal'. However, it appears that old database may contains the same record (same name and number) with and without the 'internal' classname. This cause the R40000XWIKI6990 migration to fails, since ids for the two record result to the same value.
To properly clean a MySQL database before migrating to 4.x, you may use the following SQL statements:
delete s1 from xwikistatsdoc s1 join xwikistatsdoc s2 on s1.XWS_NUMBER=s2.XWS_NUMBER and s1.XWS_NAME=s2.XWS_NAME where s1.XWS_CLASSNAME = 'internal' and (s2.XWS_CLASSNAME != 'internal' or s2.XWS_CLASSNAME is null); update xwikistatsdoc set XWS_CLASSNAME = "" where XWS_CLASSNAME = 'internal'; delete s1 from xwikistatsreferer s1 join xwikistatsreferer s2 on s1.XWR_NUMBER=s2.XWR_NUMBER and s1.XWR_NAME=s2.XWR_NAME where s1.XWR_CLASSNAME = 'internal' and (s2.XWR_CLASSNAME != 'internal' or s2.XWR_CLASSNAME is null); update xwikistatsreferer set XWR_CLASSNAME = "" where XWR_CLASSNAME = 'internal'; delete s1 from xwikistatsvisit s1 join xwikistatsvisit s2 on s1.XWV_NUMBER=s2.XWV_NUMBER and s1.XWV_NAME=s2.XWV_NAME where s1.XWV_CLASSNAME = 'internal' and (s2.XWV_CLASSNAME != 'internal' or s2.XWV_CLASSNAME is null); update xwikistatsvisit set XWV_CLASSNAME = "" where XWV_CLASSNAME = 'internal';
Issue Links
- relates to
-
SOC-2 Loading...
I run in the same problem on migration 3.1.1 --> 4.2.
The sql workaround for postgresql is:
delete from xwikistatsdoc where xws_id in ( select s1.xws_id from xwikistatsdoc s1 join xwikistatsdoc s2 on s1.XWS_NUMBER=s2.XWS_NUMBER and s1.XWS_NAME=s2.XWS_NAME where s1.XWS_CLASSNAME = 'internal' and (s2.XWS_CLASSNAME != 'internal' or s2.XWS_CLASSNAME is null) ); update xwikistatsdoc set XWS_CLASSNAME = '' where XWS_CLASSNAME = 'internal'; delete from xwikistatsreferer where xwr_id in ( select s1.xwr_id from xwikistatsreferer s1 join xwikistatsreferer s2 on s1.XWR_NUMBER=s2.XWR_NUMBER and s1.XWR_NAME=s2.XWR_NAME where s1.XWR_CLASSNAME = 'internal' and (s2.XWR_CLASSNAME != 'internal' or s2.XWR_CLASSNAME is null) ); update xwikistatsreferer set XWR_CLASSNAME = '' where XWR_CLASSNAME = 'internal'; delete from xwikistatsvisit where xwv_id in ( select s1.xwv_id from xwikistatsvisit s1 join xwikistatsvisit s2 on s1.XWV_NUMBER=s2.XWV_NUMBER and s1.XWV_NAME=s2.XWV_NAME where s1.XWV_CLASSNAME = 'internal' and (s2.XWV_CLASSNAME != 'internal' or s2.XWV_CLASSNAME is null) ); update xwikistatsvisit set XWV_CLASSNAME = '' where XWV_CLASSNAME = 'internal';