enonic / xp

Enonic XP
https://enonic.com
GNU General Public License v3.0
201 stars 34 forks source link

NodeVersion serialization - Modification of order of pattern configs on each update #6779

Closed GlennRicaud closed 5 years ago

GlennRicaud commented 5 years ago

The ordering of patternConfigs when reading a node version is not maintained. NodeVersionJsonSerializer.toNodeVersion:

GlennRicaud commented 5 years ago

Reproduced with contents created in 7.0 I guess this problem has always been there but was not problematic before https://github.com/enonic/xp/issues/6806

GlennRicaud commented 5 years ago

The fact that the path index configs are sorted is not a problem. But the real bug here is that the order keeps changing at every update (while the index config does not change).

Two sequential reads will return the index configs in the same order. But after the system writes down the index config with this new sorted order, the next read will sort into a new order...

GlennRicaud commented 5 years ago

The problem is to use hashCode for compareTo. You get cases like this one 1993588812-(-1900122230) = -401256254

Details

Order of configs after upgrade: modifier owner attachment page site type data creator createdTime modifiedTime

After upgrade: creator createdTime modifiedTime modifier owner attachment page site type data

After upgrade: page site type data creator createdTime modifiedTime modifier owner attachment

After upgrade: <exactly like the 1st one, same blob key since timestamp is removed>

After upgrade: <exactly like the 2nd one, same blob key since timestamp is removed>

After upgrade: <exactly like the 3rd one, same blob key since timestamp is removed>

After upgrade: <exactly like the 1st one, same blob key since timestamp is removed>

After upgrade: <exactly like the 2nd one, same blob key since timestamp is removed>

After upgrade: <exactly like the 3rd one, same blob key since timestamp is removed>