Skip to content

Issue with findGenerations caching depending on input #26680

@devanbenz

Description

@devanbenz

In the following code path

func (c *DefaultPlanner) findGenerations(skipInUse bool) tsmGenerations {
c.mu.Lock()
defer c.mu.Unlock()
last := c.lastFindGenerations
lastGen := c.lastGenerations
if !last.IsZero() && c.FileStore.LastModified().Equal(last) {
return lastGen
}

We see a problem when skipInUse alternates between true and false which can cause invalid caching behavior.

Steps to reproduce:
List the minimal actions needed to reproduce the behavior.

  1. findGenerations gets called with skipInUse set to true
  2. Data is returned and set in last & lastGen
  3. findGenerations is called with skipInUse set to false
  4. lastGen will be returned due to cached data

Expected behaviour:
I would expect changing the input to invalidate the cache

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions