diff --git a/lib/storage/storage.go b/lib/storage/storage.go index 21c3a3528..dc2dc5b53 100644 --- a/lib/storage/storage.go +++ b/lib/storage/storage.go @@ -903,8 +903,6 @@ func (s *Storage) mustLoadHourMetricIDs(hour uint64, name string) *hourMetricIDs } // Unmarshal header - isFull := encoding.UnmarshalUint64(src) - src = src[8:] hourLoaded := encoding.UnmarshalUint64(src) src = src[8:] if hourLoaded != hour { @@ -923,7 +921,6 @@ func (s *Storage) mustLoadHourMetricIDs(hour uint64, name string) *hourMetricIDs return hm } hm.m = m - hm.isFull = isFull != 0 logger.Infof("loaded %s from %q in %.3f seconds; entriesCount: %d; sizeBytes: %d", name, path, time.Since(startTime).Seconds(), m.Len(), srcOrigLen) return hm } @@ -952,13 +949,8 @@ func (s *Storage) mustSaveHourMetricIDs(hm *hourMetricIDs, name string) { logger.Infof("saving %s to %q...", name, path) startTime := time.Now() dst := make([]byte, 0, hm.m.Len()*8+24) - isFull := uint64(0) - if hm.isFull { - isFull = 1 - } // Marshal header - dst = encoding.MarshalUint64(dst, isFull) dst = encoding.MarshalUint64(dst, hm.hour) // Marshal hm.m @@ -2347,18 +2339,15 @@ func (s *Storage) updateCurrHourMetricIDs(hour uint64) { // Slow path: hm.m must be updated with non-empty s.pendingHourEntries. var m *uint64set.Set - isFull := hm.isFull if hm.hour == hour { m = hm.m.Clone() } else { m = &uint64set.Set{} - isFull = true } m.Union(newMetricIDs.At(hour)) hmNew := &hourMetricIDs{ - m: m, - hour: hour, - isFull: isFull, + m: m, + hour: hour, } s.currHourMetricIDs.Store(hmNew) if hm.hour != hour { @@ -2372,9 +2361,8 @@ func (s *Storage) updateCurrHourMetricIDs(hour uint64) { } type hourMetricIDs struct { - m *uint64set.Set - hour uint64 - isFull bool + m *uint64set.Set + hour uint64 } type generationTSID struct { diff --git a/lib/storage/storage_test.go b/lib/storage/storage_test.go index 03d48a362..6dc94a4a0 100644 --- a/lib/storage/storage_test.go +++ b/lib/storage/storage_test.go @@ -171,9 +171,6 @@ func TestUpdateCurrHourMetricIDs(t *testing.T) { if hmCurr.m.Len() != 0 { t.Fatalf("unexpected length of hm.m; got %d; want %d", hmCurr.m.Len(), 0) } - if !hmCurr.isFull { - t.Fatalf("unexpected hmCurr.isFull; got %v; want %v", hmCurr.isFull, true) - } hmPrev := s.prevHourMetricIDs.Load().(*hourMetricIDs) if !reflect.DeepEqual(hmPrev, hmOrig) { @@ -202,9 +199,6 @@ func TestUpdateCurrHourMetricIDs(t *testing.T) { if !reflect.DeepEqual(hmCurr, hmOrig) { t.Fatalf("unexpected hmCurr; got %v; want %v", hmCurr, hmOrig) } - if hmCurr.isFull { - t.Fatalf("unexpected hmCurr.isFull; got %v; want %v", hmCurr.isFull, false) - } hmPrev := s.prevHourMetricIDs.Load().(*hourMetricIDs) hmEmpty := &hourMetricIDs{} @@ -241,9 +235,6 @@ func TestUpdateCurrHourMetricIDs(t *testing.T) { if !hmCurr.m.Equal(pendingHourEntries) { t.Fatalf("unexpected hmCurr.m; got %v; want %v", hmCurr.m, pendingHourEntries) } - if !hmCurr.isFull { - t.Fatalf("unexpected hmCurr.isFull; got %v; want %v", hmCurr.isFull, true) - } hmPrev := s.prevHourMetricIDs.Load().(*hourMetricIDs) if !reflect.DeepEqual(hmPrev, hmOrig) { @@ -287,9 +278,6 @@ func TestUpdateCurrHourMetricIDs(t *testing.T) { if !hmCurr.m.Equal(m) { t.Fatalf("unexpected hm.m; got %v; want %v", hmCurr.m, m) } - if hmCurr.isFull { - t.Fatalf("unexpected hmCurr.isFull; got %v; want %v", hmCurr.isFull, false) - } hmPrev := s.prevHourMetricIDs.Load().(*hourMetricIDs) hmEmpty := &hourMetricIDs{}