Skip to content
This repository has been archived by the owner on Jan 8, 2024. It is now read-only.

internal/server/singleprocess/state: Add ability to prune jobs and deployments #1193

Merged
merged 7 commits into from
Mar 19, 2021

Conversation

evanphx
Copy link
Contributor

@evanphx evanphx commented Mar 12, 2021

This limits deployments and jobs to 10,000 records each. The code only prunes the data from the memory indexes, it leaves in the disk.

The pruning of data is done on a regular interval rather than inline during data inserts (ie, it's like a typical garbage collection process). The pruning logic is shared between app records and jobs as well.

Pruning the data from disk would come later.

@evanphx evanphx requested a review from a team March 12, 2021 19:57
@github-actions github-actions bot added the core label Mar 12, 2021
Copy link
Contributor

@mitchellh mitchellh left a comment

Choose a reason for hiding this comment

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

  • I like only pruning the indexes. That way if we mess anything up we aren't deleting real data.
  • I'd introduce total record counts as package vars to avoid the iteration in jobs since that seems pretty easy.
  • For the app ops, I feel like we should just use the cursor at all times rather than ForEach. The existence of the secondary unmarshal, index, seq number tracking, etc. logic makes me nervous. Seems easy to introduce a bug that only exists in one or the other "mode".
  • Similar to above with jobs, I'd add functions to *Job that is like IsComplete() bool rather than reproducing that state logic over and over where its easy to introduce a bug.

@evanphx
Copy link
Contributor Author

evanphx commented Mar 12, 2021

  1. No prob adding total record counts 👍
  2. I'll dry up that iteration code 👍
  3. Totes, another good drying 👍

Copy link
Contributor

@mitchellh mitchellh left a comment

Choose a reason for hiding this comment

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

This did end up really nice. Great job. A few non-trivial comments but this is great stuff.

internal/server/singleprocess/state/app_operation.go Outdated Show resolved Hide resolved
internal/server/singleprocess/state/prune.go Outdated Show resolved Hide resolved
internal/server/singleprocess/state/state.go Show resolved Hide resolved
internal/server/singleprocess/state/prune.go Show resolved Hide resolved
@mitchellh
Copy link
Contributor

If you rebase this on main the tests should be fixed 👍

@evanphx evanphx merged commit 0b97ac0 into main Mar 19, 2021
@evanphx evanphx deleted the f-pruning branch March 19, 2021 17:27
@koesbong koesbong linked an issue Mar 26, 2021 that may be closed by this pull request
@koesbong koesbong added this to the 0.3.0 milestone Mar 26, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Manage the memory used by waypoint server better
3 participants