mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-11-21 14:44:00 +00:00
lib/storage: remove unused isFull field from hourMetricIDs struct
This commit is contained in:
parent
4c2963e015
commit
99e6a937a5
2 changed files with 0 additions and 24 deletions
|
@ -916,8 +916,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 {
|
||||
|
@ -971,7 +969,6 @@ func (s *Storage) mustLoadHourMetricIDs(hour uint64, name string) *hourMetricIDs
|
|||
|
||||
hm.m = m
|
||||
hm.byTenant = byTenant
|
||||
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
|
||||
}
|
||||
|
@ -1000,13 +997,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
|
||||
|
@ -2470,7 +2462,6 @@ func (s *Storage) updateCurrHourMetricIDs() {
|
|||
// Slow path: hm.m must be updated with non-empty s.pendingHourEntries.
|
||||
var m *uint64set.Set
|
||||
var byTenant map[accountProjectKey]*uint64set.Set
|
||||
isFull := hm.isFull
|
||||
if hm.hour == hour {
|
||||
m = hm.m.Clone()
|
||||
byTenant = make(map[accountProjectKey]*uint64set.Set, len(hm.byTenant))
|
||||
|
@ -2480,7 +2471,6 @@ func (s *Storage) updateCurrHourMetricIDs() {
|
|||
} else {
|
||||
m = &uint64set.Set{}
|
||||
byTenant = make(map[accountProjectKey]*uint64set.Set)
|
||||
isFull = true
|
||||
}
|
||||
|
||||
for _, x := range newEntries {
|
||||
|
@ -2501,7 +2491,6 @@ func (s *Storage) updateCurrHourMetricIDs() {
|
|||
m: m,
|
||||
byTenant: byTenant,
|
||||
hour: hour,
|
||||
isFull: isFull,
|
||||
}
|
||||
s.currHourMetricIDs.Store(hmNew)
|
||||
if hm.hour != hour {
|
||||
|
@ -2513,7 +2502,6 @@ type hourMetricIDs struct {
|
|||
m *uint64set.Set
|
||||
byTenant map[accountProjectKey]*uint64set.Set
|
||||
hour uint64
|
||||
isFull bool
|
||||
}
|
||||
|
||||
type generationTSID struct {
|
||||
|
|
|
@ -174,9 +174,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) {
|
||||
|
@ -211,9 +208,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{}
|
||||
|
@ -272,9 +266,6 @@ func TestUpdateCurrHourMetricIDs(t *testing.T) {
|
|||
if !reflect.DeepEqual(hmCurr.byTenant, byTenantExpected) {
|
||||
t.Fatalf("unexpected hmPrev.byTenant; got %v; want %v", hmCurr.byTenant, byTenantExpected)
|
||||
}
|
||||
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) {
|
||||
|
@ -341,9 +332,6 @@ func TestUpdateCurrHourMetricIDs(t *testing.T) {
|
|||
if !reflect.DeepEqual(hmCurr.byTenant, byTenantExpected) {
|
||||
t.Fatalf("unexpected hmPrev.byTenant; got %v; want %v", hmCurr.byTenant, byTenantExpected)
|
||||
}
|
||||
if hmCurr.isFull {
|
||||
t.Fatalf("unexpected hmCurr.isFull; got %v; want %v", hmCurr.isFull, false)
|
||||
}
|
||||
|
||||
hmPrev := s.prevHourMetricIDs.Load().(*hourMetricIDs)
|
||||
hmEmpty := &hourMetricIDs{}
|
||||
|
|
Loading…
Reference in a new issue