Skip to content

Commit 82f8e13

Browse files
committed
fix sort
1 parent 48a1853 commit 82f8e13

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

server/src/main/java/org/elasticsearch/cluster/routing/TsidBuilder.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -221,8 +221,6 @@ public MurmurHash3.Hash128 hash() {
221221
}
222222

223223
public final BytesRef buildTsid(IndexVersion indexVersion) {
224-
throwIfEmpty();
225-
Collections.sort(dimensions);
226224
if (indexVersion.onOrAfter(IndexVersions.CLUSTERING_TSID)) {
227225
return buildClusteringTsid();
228226
} else {
@@ -253,6 +251,9 @@ public final BytesRef buildTsid(IndexVersion indexVersion) {
253251
* @throws IllegalArgumentException if no dimensions have been added
254252
*/
255253
public BytesRef buildLegacyTsid() {
254+
throwIfEmpty();
255+
Collections.sort(dimensions);
256+
256257
int numberOfValues = Math.min(MAX_TSID_VALUE_SIMILARITY_FIELDS, dimensions.size());
257258
byte[] hash = new byte[1 + numberOfValues + 16];
258259
int index = 0;
@@ -293,6 +294,9 @@ public BytesRef buildLegacyTsid() {
293294
}
294295

295296
private BytesRef buildClusteringTsid() {
297+
throwIfEmpty();
298+
Collections.sort(dimensions);
299+
296300
final byte[] tsid = new byte[16];
297301
murmur3Hasher.reset();
298302
MurmurHash3.Hash128 hashBuffer = new MurmurHash3.Hash128();

0 commit comments

Comments
 (0)