Comment 2 for bug 1511828

Revision history for this message
Josh Stompro (u-launchpad-stompro-org) wrote :

Example of what we are seeing, it is sorting like this.

select * from action.hold_copy_map where hold=169510 order by proximity::text;
   id | hold | target_copy | proximity
--------+--------+-------------+-----------
 604706 | 169510 | 2914854 | 1
 604703 | 169510 | 2929823 | 10
 604697 | 169510 | 2933092 | 105
 604696 | 169510 | 2950820 | 106
 604695 | 169510 | 2949622 | 106
 604698 | 169510 | 2917079 | 107
 604699 | 169510 | 2933059 | 107
 604691 | 169510 | 2951885 | 108
 604693 | 169510 | 2940831 | 109
 604692 | 169510 | 2938076 | 109
 604688 | 169510 | 2944898 | 110
 604687 | 169510 | 2915112 | 110
 604694 | 169510 | 2956799 | 111
 604689 | 169510 | 2920644 | 112
 604690 | 169510 | 2921416 | 112
 604702 | 169510 | 2934336 | 12
 604704 | 169510 | 2928317 | 13
 604685 | 169510 | 2942927 | 14
 604707 | 169510 | 2948626 | 4
 604708 | 169510 | 2950746 | 4
 604700 | 169510 | 2923177 | 5
 604705 | 169510 | 2939696 | 6
 604686 | 169510 | 2914459 | 7
 604701 | 169510 | 2920388 | 9

Not like this
select * from action.hold_copy_map where hold=169510 order by proximity;
   id | hold | target_copy | proximity
--------+--------+-------------+-----------
 604706 | 169510 | 2914854 | 1
 604708 | 169510 | 2950746 | 4
 604707 | 169510 | 2948626 | 4
 604700 | 169510 | 2923177 | 5
 604705 | 169510 | 2939696 | 6
 604686 | 169510 | 2914459 | 7
 604701 | 169510 | 2920388 | 9
 604703 | 169510 | 2929823 | 10
 604702 | 169510 | 2934336 | 12
 604704 | 169510 | 2928317 | 13
 604685 | 169510 | 2942927 | 14
 604697 | 169510 | 2933092 | 105
 604696 | 169510 | 2950820 | 106
 604695 | 169510 | 2949622 | 106
 604698 | 169510 | 2917079 | 107
 604699 | 169510 | 2933059 | 107
 604691 | 169510 | 2951885 | 108
 604693 | 169510 | 2940831 | 109
 604692 | 169510 | 2938076 | 109
 604688 | 169510 | 2944898 | 110
 604687 | 169510 | 2915112 | 110
 604694 | 169510 | 2956799 | 111
 604690 | 169510 | 2921416 | 112
 604689 | 169510 | 2920644 | 112

I think the culprit must be line 1992 of
http://git.evergreen-ils.org/?p=Evergreen.git;a=blob;f=Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/action.pm;hb=HEAD#l1992

   for my $p ( sort keys %$prox_list ) {

Changing it to
   for my $p ( sort {$a<=>$b} keys %$prox_list ) {

On a test system appears to correct the issue.

There is another instance of sorting the proximity that probably needs to be fixed also. I'm not sure what it is doing, but a bad sort probably isn't good.
http://git.evergreen-ils.org/?p=Evergreen.git;a=blob;f=Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/action.pm;hb=HEAD#l1436

Josh