This is a created article in which the information may have evolved or changed.
Scene
Online advertising system needs to sort ads, this piece is actually quite complex, involving traffic planning, click Feedback. But in order to get online quickly, these are not considered, using the official library sort to sort, as long as the implementation of less Swap Len three of the number can be, very simple.
Problem
For different types of ads, formal, pre-launch, operating cards, strict adherence to the sorting, but the same type to random one location, so that the user matches from the array over the beginning of the match. After you upgrade go1.6, the sort panic occurs irregularly
Panic
Our Swap function is implemented roughly as follows:
Original sort
For the same status of the ad to do random sequencing, using RAND, the pressure measurement of stable recurrence panic. The rand logic was later thrown out, and when the ad was generated, it was randomly given a weight, not using Rand, and would not replicate after the test.
New sort
At last
This is a known issue that has been mentioned in the official issue and has been fix. Related to the underlying fast ordering algorithm, the author introduced a bug in order to optimize performance, the author has fixed, but there is no go binary release, and so on, temporarily with the new version of sort to avoid.
Here are the test procedures, interested can see.