Skip to content

Add retention time to keep data during the last X hours. #9

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: RetentionTime
Choose a base branch
from

Conversation

CatherineF-dev
Copy link
Collaborator

Add retention time to keep data during the last X hours.

Add retention time to keep data during the last X hours.
outdated = true
}
}
if d.totalDiskSpaceUsed+expectedBytesIncrease <= d.maxBytesDiskSpace && !outdated {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The outdated files are deleted when diskqueue reaches size limit. in other words, they stay and will still be read as long as total size is within limit. In this case there seems not much improvement on setting total size limit alone.

I think it makes more sense (if a retention time is set) that expired files would not even be read and be deleted as soon as they expire. so that total size limit and the time limit both serves to reduce space usage and which ever comes first would take effect.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 I was wondering if you could check retention size:

  • within the ioloop inside the select using a time.NewTicker() similar to syncTicker. The ticker will start if it is null and a log file exists, for the duration of retentionTime - (currentTime - oldestFileCreateTime). When the ticker goes off it will iterate starting from the oldest file and delete outdated files.
  • before reading a log from a file in readOne()

This way. as Leon mentioned above, the retention size and retention time both serve to reduce space usage and whichever occurs first would take effect.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we want to use this now and go with the current approach I would suggest either:

  • use a name other than retentionTime, because it's only enforcing retention time in the size limit exceeding case;
  • or, keep the retentionTime name but add more comments/descriptions and a TODO as a reminder to implement the other half (enforcing retention time under the size limit).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants