diff --git a/prompb/write/v2/types.pb.go b/prompb/write/v2/types.pb.go index 8ebd561fd..1edb6a748 100644 --- a/prompb/write/v2/types.pb.go +++ b/prompb/write/v2/types.pb.go @@ -27,36 +27,36 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package type Metadata_MetricType int32 const ( - Metadata_UNKNOWN Metadata_MetricType = 0 - Metadata_COUNTER Metadata_MetricType = 1 - Metadata_GAUGE Metadata_MetricType = 2 - Metadata_HISTOGRAM Metadata_MetricType = 3 - Metadata_GAUGEHISTOGRAM Metadata_MetricType = 4 - Metadata_SUMMARY Metadata_MetricType = 5 - Metadata_INFO Metadata_MetricType = 6 - Metadata_STATESET Metadata_MetricType = 7 + Metadata_METRIC_TYPE_UNSPECIFIED Metadata_MetricType = 0 + Metadata_METRIC_TYPE_COUNTER Metadata_MetricType = 1 + Metadata_METRIC_TYPE_GAUGE Metadata_MetricType = 2 + Metadata_METRIC_TYPE_HISTOGRAM Metadata_MetricType = 3 + Metadata_METRIC_TYPE_GAUGEHISTOGRAM Metadata_MetricType = 4 + Metadata_METRIC_TYPE_SUMMARY Metadata_MetricType = 5 + Metadata_METRIC_TYPE_INFO Metadata_MetricType = 6 + Metadata_METRIC_TYPE_STATESET Metadata_MetricType = 7 ) var Metadata_MetricType_name = map[int32]string{ - 0: "UNKNOWN", - 1: "COUNTER", - 2: "GAUGE", - 3: "HISTOGRAM", - 4: "GAUGEHISTOGRAM", - 5: "SUMMARY", - 6: "INFO", - 7: "STATESET", + 0: "METRIC_TYPE_UNSPECIFIED", + 1: "METRIC_TYPE_COUNTER", + 2: "METRIC_TYPE_GAUGE", + 3: "METRIC_TYPE_HISTOGRAM", + 4: "METRIC_TYPE_GAUGEHISTOGRAM", + 5: "METRIC_TYPE_SUMMARY", + 6: "METRIC_TYPE_INFO", + 7: "METRIC_TYPE_STATESET", } var Metadata_MetricType_value = map[string]int32{ - "UNKNOWN": 0, - "COUNTER": 1, - "GAUGE": 2, - "HISTOGRAM": 3, - "GAUGEHISTOGRAM": 4, - "SUMMARY": 5, - "INFO": 6, - "STATESET": 7, + "METRIC_TYPE_UNSPECIFIED": 0, + "METRIC_TYPE_COUNTER": 1, + "METRIC_TYPE_GAUGE": 2, + "METRIC_TYPE_HISTOGRAM": 3, + "METRIC_TYPE_GAUGEHISTOGRAM": 4, + "METRIC_TYPE_SUMMARY": 5, + "METRIC_TYPE_INFO": 6, + "METRIC_TYPE_STATESET": 7, } func (x Metadata_MetricType) String() string { @@ -70,24 +70,24 @@ func (Metadata_MetricType) EnumDescriptor() ([]byte, []int) { type Histogram_ResetHint int32 const ( - Histogram_UNKNOWN Histogram_ResetHint = 0 - Histogram_YES Histogram_ResetHint = 1 - Histogram_NO Histogram_ResetHint = 2 - Histogram_GAUGE Histogram_ResetHint = 3 + Histogram_RESET_HINT_UNSPECIFIED Histogram_ResetHint = 0 + Histogram_RESET_HINT_YES Histogram_ResetHint = 1 + Histogram_RESET_HINT_NO Histogram_ResetHint = 2 + Histogram_RESET_HINT_GAUGE Histogram_ResetHint = 3 ) var Histogram_ResetHint_name = map[int32]string{ - 0: "UNKNOWN", - 1: "YES", - 2: "NO", - 3: "GAUGE", + 0: "RESET_HINT_UNSPECIFIED", + 1: "RESET_HINT_YES", + 2: "RESET_HINT_NO", + 3: "RESET_HINT_GAUGE", } var Histogram_ResetHint_value = map[string]int32{ - "UNKNOWN": 0, - "YES": 1, - "NO": 2, - "GAUGE": 3, + "RESET_HINT_UNSPECIFIED": 0, + "RESET_HINT_YES": 1, + "RESET_HINT_NO": 2, + "RESET_HINT_GAUGE": 3, } func (x Histogram_ResetHint) String() string { @@ -416,7 +416,7 @@ func (m *Metadata) GetType() Metadata_MetricType { if m != nil { return m.Type } - return Metadata_UNKNOWN + return Metadata_METRIC_TYPE_UNSPECIFIED } func (m *Metadata) GetHelpRef() uint32 { @@ -653,7 +653,7 @@ func (m *Histogram) GetResetHint() Histogram_ResetHint { if m != nil { return m.ResetHint } - return Histogram_UNKNOWN + return Histogram_RESET_HINT_UNSPECIFIED } func (m *Histogram) GetTimestamp() int64 { @@ -748,59 +748,62 @@ func init() { func init() { proto.RegisterFile("write/v2/types.proto", fileDescriptor_4919b8b88a093366) } var fileDescriptor_4919b8b88a093366 = []byte{ - // 831 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x55, 0xdd, 0x6e, 0xe3, 0x44, - 0x14, 0xee, 0xc4, 0x49, 0x6c, 0x9f, 0xfc, 0xac, 0x3b, 0x14, 0x64, 0x10, 0xdb, 0x0d, 0x91, 0x80, - 0x08, 0xa4, 0x14, 0xc2, 0x0a, 0x09, 0xd4, 0x9b, 0x64, 0xc9, 0x36, 0x15, 0x6a, 0x22, 0x8d, 0x5d, - 0xad, 0x96, 0x9b, 0x68, 0x9a, 0x4c, 0x12, 0x0b, 0xff, 0xe1, 0x99, 0x04, 0xca, 0x7b, 0xf1, 0x08, - 0x48, 0x7b, 0xc9, 0x13, 0x20, 0xd4, 0x07, 0xe0, 0x19, 0xd0, 0x8c, 0x7f, 0xa6, 0x2d, 0x5a, 0xed, - 0xdd, 0x9c, 0xef, 0x7c, 0xdf, 0x9c, 0xef, 0x1c, 0x9f, 0x91, 0xe1, 0xe4, 0xd7, 0x2c, 0x10, 0xec, - 0xec, 0x30, 0x3a, 0x13, 0xb7, 0x29, 0xe3, 0xc3, 0x34, 0x4b, 0x44, 0x82, 0x2d, 0x85, 0x0e, 0x0f, - 0xa3, 0x8f, 0x4e, 0xb6, 0xc9, 0x36, 0x51, 0xe0, 0x99, 0x3c, 0xe5, 0xf9, 0xfe, 0x1a, 0xda, 0xaf, - 0x24, 0x83, 0xb0, 0x5f, 0xf6, 0x8c, 0x0b, 0xec, 0x82, 0xc9, 0x6f, 0xa3, 0x9b, 0x24, 0xe4, 0x2e, - 0xea, 0x19, 0x03, 0x9b, 0x94, 0x21, 0xfe, 0x1e, 0x40, 0x04, 0x11, 0x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9, 0x73, 0x80, - 0x8c, 0x71, 0x26, 0x96, 0x3b, 0x39, 0xf9, 0xee, 0xe3, 0x87, 0x50, 0x6d, 0xce, 0x90, 0x48, 0xd6, - 0x2c, 0x88, 0x05, 0xb1, 0xb3, 0xf2, 0xf8, 0xf0, 0xad, 0x3d, 0x79, 0xfc, 0xd6, 0x9e, 0x83, 0x5d, - 0xa9, 0x1e, 0x2e, 0xbd, 0x09, 0xc6, 0xeb, 0xa9, 0xe7, 0x20, 0xdc, 0x84, 0xda, 0x7c, 0xe1, 0xd4, - 0xf4, 0xe2, 0x1b, 0x13, 0x13, 0x1a, 0xca, 0xf1, 0xa4, 0x0d, 0xa0, 0x3f, 0x78, 0xff, 0x1c, 0x40, - 0x4f, 0x47, 0xee, 0x5c, 0xb2, 0xd9, 0x70, 0x96, 0x2f, 0xf1, 0x31, 0x29, 0x22, 0x89, 0x87, 0x2c, - 0xde, 0x8a, 0x9d, 0xda, 0xdd, 0x0e, 0x29, 0xa2, 0xc9, 0xfb, 0x6f, 0xee, 0x4e, 0xd1, 0x5f, 0x77, - 0xa7, 0xe8, 0x9f, 0xbb, 0x53, 0xf4, 0x93, 0xa9, 0xfa, 0x3b, 0x8c, 0x6e, 0x9a, 0xea, 0x8f, 0xf2, - 0xcd, 0x7f, 0x01, 0x00, 0x00, 0xff, 0xff, 0x5f, 0x13, 0xc8, 0xac, 0x89, 0x06, 0x00, 0x00, + // 875 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x55, 0x5b, 0x6f, 0x1b, 0x45, + 0x14, 0xce, 0x78, 0x7d, 0x3d, 0x89, 0xdd, 0xf5, 0xd4, 0x69, 0xb7, 0x81, 0xa6, 0xc6, 0x12, 0x60, + 0x81, 0xe4, 0x80, 0x41, 0x48, 0xa0, 0xbc, 0xd8, 0xe9, 0x26, 0xf6, 0x83, 0x9d, 0x6a, 0x76, 0x23, + 0x14, 0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 0xb7, 0xba, 0xa1, 0x22, + 0xdc, 0x86, 0x66, 0x01, 0x9b, 0x5f, 0xab, 0x25, 0xb1, 0xfa, 0x05, 0x28, 0x7e, 0x64, 0xca, 0xb8, + 0x06, 0x15, 0x79, 0xc3, 0xf1, 0x11, 0x40, 0xbe, 0x20, 0xbd, 0x73, 0x80, 0x7c, 0x9a, 0x62, 0x47, + 0x83, 0xd5, 0x8a, 0xd1, 0x78, 0xe9, 0xdb, 0x24, 0xa9, 0x04, 0xee, 0x52, 0x7f, 0xcd, 0x37, 0x72, + 0xd7, 0x9b, 0x24, 0xa9, 0xc6, 0xc7, 0x6f, 0x1f, 0x4e, 0xd1, 0x9f, 0x0f, 0xa7, 0xe8, 0xdf, 0x87, + 0x53, 0xf4, 0x53, 0x4d, 0xce, 0x63, 0x37, 0xbc, 0xab, 0xca, 0x9f, 0xb9, 0x6f, 0xfe, 0x0f, 0x00, + 0x00, 0xff, 0xff, 0x68, 0x88, 0x14, 0xcb, 0x1e, 0x07, 0x00, 0x00, } func (m *WriteRequest) Marshal() (dAtA []byte, err error) { diff --git a/prompb/write/v2/types.proto b/prompb/write/v2/types.proto index c225aa9ac..ad225025e 100644 --- a/prompb/write/v2/types.proto +++ b/prompb/write/v2/types.proto @@ -61,14 +61,14 @@ message Sample { message Metadata { enum MetricType { - UNKNOWN = 0; - COUNTER = 1; - GAUGE = 2; - HISTOGRAM = 3; - GAUGEHISTOGRAM = 4; - SUMMARY = 5; - INFO = 6; - STATESET = 7; + METRIC_TYPE_UNSPECIFIED = 0; + METRIC_TYPE_COUNTER = 1; + METRIC_TYPE_GAUGE = 2; + METRIC_TYPE_HISTOGRAM = 3; + METRIC_TYPE_GAUGEHISTOGRAM = 4; + METRIC_TYPE_SUMMARY = 5; + METRIC_TYPE_INFO = 6; + METRIC_TYPE_STATESET = 7; } MetricType type = 1; uint32 help_ref = 3; @@ -83,10 +83,10 @@ message Metadata { // integer histogram as well as a float histogram. message Histogram { enum ResetHint { - UNKNOWN = 0; // Need to test for a counter reset explicitly. - YES = 1; // This is the 1st histogram after a counter reset. - NO = 2; // There was no counter reset between this and the previous Histogram. - GAUGE = 3; // This is a gauge histogram where counter resets don't happen. + RESET_HINT_UNSPECIFIED = 0; // Need to test for a counter reset explicitly. + RESET_HINT_YES = 1; // This is the 1st histogram after a counter reset. + RESET_HINT_NO = 2; // There was no counter reset between this and the previous Histogram. + RESET_HINT_GAUGE = 3; // This is a gauge histogram where counter resets don't happen. } oneof count { // Count of observations in the histogram. diff --git a/promql/engine_test.go b/promql/engine_test.go index b3e7d4094..105cdc10d 100644 --- a/promql/engine_test.go +++ b/promql/engine_test.go @@ -18,6 +18,7 @@ import ( "errors" "fmt" "math" + "os" "sort" "testing" "time" @@ -46,7 +47,9 @@ func TestMain(m *testing.M) { func TestQueryConcurrency(t *testing.T) { maxConcurrency := 10 - dir := t.TempDir() + dir, err := os.MkdirTemp("", "test_concurrency") + require.NoError(t, err) + defer os.RemoveAll(dir) queryTracker := NewActiveQueryTracker(dir, maxConcurrency, nil) t.Cleanup(queryTracker.Close) diff --git a/tsdb/agent/db_test.go b/tsdb/agent/db_test.go index a4571d59a..1726d5db7 100644 --- a/tsdb/agent/db_test.go +++ b/tsdb/agent/db_test.go @@ -84,7 +84,7 @@ func TestDB_InvalidSeries(t *testing.T) { }) } -func createTestAgentDB(t *testing.T, reg prometheus.Registerer, opts *Options) *DB { +func createTestAgentDB(t testing.TB, reg prometheus.Registerer, opts *Options) *DB { t.Helper() dbDir := t.TempDir() @@ -878,3 +878,21 @@ func TestDBAllowOOOSamples(t *testing.T) { require.Equal(t, float64(80), m.Metric[1].Counter.GetValue(), "agent wal mismatch of total appended histograms") require.NoError(t, db.Close()) } + +func BenchmarkCreateSeries(b *testing.B) { + s := createTestAgentDB(b, nil, DefaultOptions()) + defer s.Close() + + app := s.Appender(context.Background()).(*appender) + lbls := make([]labels.Labels, b.N) + + for i, l := range labelsForTest("benchmark", b.N) { + lbls[i] = labels.New(l...) + } + + b.ResetTimer() + + for _, l := range lbls { + app.getOrCreate(l) + } +} diff --git a/tsdb/agent/series.go b/tsdb/agent/series.go index d38518f71..76e734217 100644 --- a/tsdb/agent/series.go +++ b/tsdb/agent/series.go @@ -45,14 +45,23 @@ func (m *memSeries) updateTimestamp(newTs int64) bool { return false } -// seriesHashmap is a simple hashmap for memSeries by their label set. -// It is built on top of a regular hashmap and holds a slice of series to -// resolve hash collisions. Its methods require the hash to be submitted +// seriesHashmap lets agent find a memSeries by its label set, via a 64-bit hash. +// There is one map for the common case where the hash value is unique, and a +// second map for the case that two series have the same hash value. +// Each series is in only one of the maps. Its methods require the hash to be submitted // with the label set to avoid re-computing hash throughout the code. -type seriesHashmap map[uint64][]*memSeries +type seriesHashmap struct { + unique map[uint64]*memSeries + conflicts map[uint64][]*memSeries +} -func (m seriesHashmap) Get(hash uint64, lset labels.Labels) *memSeries { - for _, s := range m[hash] { +func (m *seriesHashmap) Get(hash uint64, lset labels.Labels) *memSeries { + if s, found := m.unique[hash]; found { + if labels.Equal(s.lset, lset) { + return s + } + } + for _, s := range m.conflicts[hash] { if labels.Equal(s.lset, lset) { return s } @@ -60,28 +69,49 @@ func (m seriesHashmap) Get(hash uint64, lset labels.Labels) *memSeries { return nil } -func (m seriesHashmap) Set(hash uint64, s *memSeries) { - seriesSet := m[hash] +func (m *seriesHashmap) Set(hash uint64, s *memSeries) { + if existing, found := m.unique[hash]; !found || labels.Equal(existing.lset, s.lset) { + m.unique[hash] = s + return + } + if m.conflicts == nil { + m.conflicts = make(map[uint64][]*memSeries) + } + seriesSet := m.conflicts[hash] for i, prev := range seriesSet { if labels.Equal(prev.lset, s.lset) { seriesSet[i] = s return } } - m[hash] = append(seriesSet, s) + m.conflicts[hash] = append(seriesSet, s) } -func (m seriesHashmap) Delete(hash uint64, ref chunks.HeadSeriesRef) { +func (m *seriesHashmap) Delete(hash uint64, ref chunks.HeadSeriesRef) { var rem []*memSeries - for _, s := range m[hash] { - if s.ref != ref { - rem = append(rem, s) + unique, found := m.unique[hash] + switch { + case !found: // Supplied hash is not stored. + return + case unique.ref == ref: + conflicts := m.conflicts[hash] + if len(conflicts) == 0 { // Exactly one series with this hash was stored + delete(m.unique, hash) + return + } + m.unique[hash] = conflicts[0] // First remaining series goes in 'unique'. + rem = conflicts[1:] // Keep the rest. + default: // The series to delete is somewhere in 'conflicts'. Keep all the ones that don't match. + for _, s := range m.conflicts[hash] { + if s.ref != ref { + rem = append(rem, s) + } } } if len(rem) == 0 { - delete(m, hash) + delete(m.conflicts, hash) } else { - m[hash] = rem + m.conflicts[hash] = rem } } @@ -117,7 +147,10 @@ func newStripeSeries(stripeSize int) *stripeSeries { s.series[i] = map[chunks.HeadSeriesRef]*memSeries{} } for i := range s.hashes { - s.hashes[i] = seriesHashmap{} + s.hashes[i] = seriesHashmap{ + unique: map[uint64]*memSeries{}, + conflicts: nil, // Initialized on demand in set(). + } } for i := range s.exemplars { s.exemplars[i] = map[chunks.HeadSeriesRef]*exemplar.Exemplar{} @@ -136,40 +169,49 @@ func (s *stripeSeries) GC(mint int64) map[chunks.HeadSeriesRef]struct{} { defer s.gcMut.Unlock() deleted := map[chunks.HeadSeriesRef]struct{}{} + + // For one series, truncate old chunks and check if any chunks left. If not, mark as deleted and collect the ID. + check := func(hashLock int, hash uint64, series *memSeries) { + series.Lock() + + // Any series that has received a write since mint is still alive. + if series.lastTs >= mint { + series.Unlock() + return + } + + // The series is stale. We need to obtain a second lock for the + // ref if it's different than the hash lock. + refLock := int(series.ref) & (s.size - 1) + if hashLock != refLock { + s.locks[refLock].Lock() + } + + deleted[series.ref] = struct{}{} + delete(s.series[refLock], series.ref) + s.hashes[hashLock].Delete(hash, series.ref) + + // Since the series is gone, we'll also delete + // the latest stored exemplar. + delete(s.exemplars[refLock], series.ref) + + if hashLock != refLock { + s.locks[refLock].Unlock() + } + series.Unlock() + } + for hashLock := 0; hashLock < s.size; hashLock++ { s.locks[hashLock].Lock() - for hash, all := range s.hashes[hashLock] { + for hash, all := range s.hashes[hashLock].conflicts { for _, series := range all { - series.Lock() - - // Any series that has received a write since mint is still alive. - if series.lastTs >= mint { - series.Unlock() - continue - } - - // The series is stale. We need to obtain a second lock for the - // ref if it's different than the hash lock. - refLock := int(series.ref) & (s.size - 1) - if hashLock != refLock { - s.locks[refLock].Lock() - } - - deleted[series.ref] = struct{}{} - delete(s.series[refLock], series.ref) - s.hashes[hashLock].Delete(hash, series.ref) - - // Since the series is gone, we'll also delete - // the latest stored exemplar. - delete(s.exemplars[refLock], series.ref) - - if hashLock != refLock { - s.locks[refLock].Unlock() - } - series.Unlock() + check(hashLock, hash, series) } } + for hash, series := range s.hashes[hashLock].unique { + check(hashLock, hash, series) + } s.locks[hashLock].Unlock() } diff --git a/tsdb/agent/series_test.go b/tsdb/agent/series_test.go index 480f6c026..ae327d858 100644 --- a/tsdb/agent/series_test.go +++ b/tsdb/agent/series_test.go @@ -74,3 +74,63 @@ func TestNoDeadlock(t *testing.T) { require.FailNow(t, "deadlock detected") } } + +func labelsWithHashCollision() (labels.Labels, labels.Labels) { + // These two series have the same XXHash; thanks to https://github.com/pstibrany/labels_hash_collisions + ls1 := labels.FromStrings("__name__", "metric", "lbl1", "value", "lbl2", "l6CQ5y") + ls2 := labels.FromStrings("__name__", "metric", "lbl1", "value", "lbl2", "v7uDlF") + + if ls1.Hash() != ls2.Hash() { + // These ones are the same when using -tags stringlabels + ls1 = labels.FromStrings("__name__", "metric", "lbl", "HFnEaGl") + ls2 = labels.FromStrings("__name__", "metric", "lbl", "RqcXatm") + } + + if ls1.Hash() != ls2.Hash() { + panic("This code needs to be updated: find new labels with colliding hash values.") + } + + return ls1, ls2 +} + +// stripeSeriesWithCollidingSeries returns a stripeSeries with two memSeries having the same, colliding, hash. +func stripeSeriesWithCollidingSeries(_ *testing.T) (*stripeSeries, *memSeries, *memSeries) { + lbls1, lbls2 := labelsWithHashCollision() + ms1 := memSeries{ + lset: lbls1, + } + ms2 := memSeries{ + lset: lbls2, + } + hash := lbls1.Hash() + s := newStripeSeries(1) + + s.Set(hash, &ms1) + s.Set(hash, &ms2) + + return s, &ms1, &ms2 +} + +func TestStripeSeries_Get(t *testing.T) { + s, ms1, ms2 := stripeSeriesWithCollidingSeries(t) + hash := ms1.lset.Hash() + + // Verify that we can get both of the series despite the hash collision + got := s.GetByHash(hash, ms1.lset) + require.Same(t, ms1, got) + got = s.GetByHash(hash, ms2.lset) + require.Same(t, ms2, got) +} + +func TestStripeSeries_gc(t *testing.T) { + s, ms1, ms2 := stripeSeriesWithCollidingSeries(t) + hash := ms1.lset.Hash() + + s.GC(1) + + // Verify that we can get neither ms1 nor ms2 after gc-ing corresponding series + got := s.GetByHash(hash, ms1.lset) + require.Nil(t, got) + got = s.GetByHash(hash, ms2.lset) + require.Nil(t, got) +} diff --git a/tsdb/tsdbutil/dir_locker_testutil.go b/tsdb/tsdbutil/dir_locker_testutil.go index a7f43d8ee..a4cf5abd6 100644 --- a/tsdb/tsdbutil/dir_locker_testutil.go +++ b/tsdb/tsdbutil/dir_locker_testutil.go @@ -60,8 +60,12 @@ func TestDirLockerUsage(t *testing.T, open func(t *testing.T, data string, creat for _, c := range cases { t.Run(fmt.Sprintf("%+v", c), func(t *testing.T) { - tmpdir := t.TempDir() - + tmpdir, err := os.MkdirTemp("", "test") + require.NoError(t, err) + t.Cleanup(func() { + require.NoError(t, os.RemoveAll(tmpdir)) + }) + // Test preconditions (file already exists + lockfile option) if c.fileAlreadyExists { tmpLocker, err := NewDirLocker(tmpdir, "tsdb", log.NewNopLogger(), nil) @@ -78,7 +82,7 @@ func TestDirLockerUsage(t *testing.T, open func(t *testing.T, data string, creat // Check that the lockfile is always deleted if !c.lockFileDisabled { - _, err := os.Stat(locker.path) + _, err = os.Stat(locker.path) require.True(t, os.IsNotExist(err), "lockfile was not deleted") } })