mirror of
https://github.com/prometheus/prometheus.git
synced 2025-01-22 11:11:02 -08:00
tsdb: call StableHash as appropriate
labels.Labels.Hash() is not guaranteed to be stable over time.
This commit is contained in:
parent
6009066423
commit
cc8eb55a22
|
@ -593,7 +593,7 @@ func TestCompaction_CompactWithSplitting(t *testing.T) {
|
|||
ref := p.At()
|
||||
require.NoError(t, idxr.Series(ref, &lbls, nil))
|
||||
|
||||
require.Equal(t, uint64(shardIndex), lbls.Labels().Hash()%shardCount)
|
||||
require.Equal(t, uint64(shardIndex), labels.StableHash(lbls.Labels())%shardCount)
|
||||
|
||||
// Collect all symbols used by series.
|
||||
lbls.Labels().Range(func(l labels.Label) {
|
||||
|
|
|
@ -2495,7 +2495,7 @@ func TestHeadShardedPostings(t *testing.T) {
|
|||
var lbls labels.ScratchBuilder
|
||||
|
||||
require.NoError(t, ir.Series(id, &lbls, nil))
|
||||
require.Equal(t, shardIndex, lbls.Labels().Hash()%shardCount)
|
||||
require.Equal(t, shardIndex, labels.StableHash(lbls.Labels())%shardCount)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -292,7 +292,7 @@ func TestIndexRW_Postings(t *testing.T) {
|
|||
var lbls labels.ScratchBuilder
|
||||
|
||||
require.NoError(t, ir.Series(id, &lbls, nil))
|
||||
require.Equal(t, shardIndex, lbls.Labels().Hash()%shardCount)
|
||||
require.Equal(t, shardIndex, labels.StableHash(lbls.Labels())%shardCount)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
|
Loading…
Reference in a new issue