mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2025-03-01 15:33:35 +00:00
lib/storage: remove unused isFull field from hourMetricIDs struct
This commit is contained in:
parent
ba92ea96da
commit
edfb7fa4d2
2 changed files with 0 additions and 24 deletions
|
@ -919,8 +919,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 {
|
||||
|
@ -974,7 +972,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
|
||||
}
|
||||
|
@ -1003,13 +1000,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
|
||||
|
@ -2523,7 +2515,6 @@ func (s *Storage) updateCurrHourMetricIDs(hour uint64) {
|
|||
// 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))
|
||||
|
@ -2533,7 +2524,6 @@ func (s *Storage) updateCurrHourMetricIDs(hour uint64) {
|
|||
} else {
|
||||
m = &uint64set.Set{}
|
||||
byTenant = make(map[accountProjectKey]*uint64set.Set)
|
||||
isFull = true
|
||||
}
|
||||
if hm.hour == hour || hour%24 != 0 {
|
||||
// Do not add pending metricIDs from the previous hour on the previous day to the current hour,
|
||||
|
@ -2558,7 +2548,6 @@ func (s *Storage) updateCurrHourMetricIDs(hour uint64) {
|
|||
m: m,
|
||||
byTenant: byTenant,
|
||||
hour: hour,
|
||||
isFull: isFull,
|
||||
}
|
||||
s.currHourMetricIDs.Store(hmNew)
|
||||
if hm.hour != hour {
|
||||
|
@ -2570,7 +2559,6 @@ type hourMetricIDs struct {
|
|||
m *uint64set.Set
|
||||
byTenant map[accountProjectKey]*uint64set.Set
|
||||
hour uint64
|
||||
isFull bool
|
||||
}
|
||||
|
||||
type generationTSID struct {
|
||||
|
|
|
@ -178,9 +178,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) {
|
||||
|
@ -215,9 +212,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{}
|
||||
|
@ -279,9 +273,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) {
|
||||
|
@ -348,9 +339,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