SenseNet / sensenet

Open Source Content Services Platform written in .NET
https://sensenet.com
GNU General Public License v2.0
173 stars 112 forks source link

Node load sorting fails when the results come from only db (not cache) #162

Closed tusmester closed 6 years ago

tusmester commented 7 years ago

In that rare case when a set of node heads are not in cache (none of them!), the DataBackingStore.GetNodeHeads method fails to preserve the original order.

https://github.com/SenseNet/sensenet/blob/aa31792ae03ee53a1213b8cdc68197dbad544471/src/Storage/DataBackingStore.cs#L97

If in the method above all loaded heads go to the unloadHeads collection (the nodeHeads collection remains empty), sorting is switched off (probably for performance reasons). In this case the result list will contain ids in the raw db order, instead of the original, sorted order.

Solution

Maybe the solution is to remove the condition and sort the result list always.

kavics commented 6 years ago

This bug blocks any unit test that use sorting.

tusmester commented 6 years ago

@kavics please connect this to the closed pr and move it to the done column, I checked the code, it's ok. Please also add an estimation.

tusmester commented 6 years ago

Fixed by #163