Skip to content
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

CBG-4134: link rev cache memory limit config option to rev cache #7084

Merged
merged 5 commits into from
Sep 6, 2024

Conversation

gregns1
Copy link
Contributor

@gregns1 gregns1 commented Aug 21, 2024

CBG-4134

  • links db config option to rev cache
  • Added warning for when someone tries to configure it in community edition
  • Probably should hold off merging till the memory based rev cache work is in main

Pre-review checklist

  • Removed debug logging (fmt.Print, log.Print, ...)
  • Logging sensitive data? Make sure it's tagged (e.g. base.UD(docID), base.MD(dbName))
  • Updated relevant information in the API specifications (such as endpoint descriptions, schemas, ...) in docs/api

Dependencies (if applicable)

Integration Tests

@gregns1 gregns1 self-assigned this Aug 21, 2024
@@ -246,8 +246,9 @@ type DeprecatedCacheConfig struct {
}

type RevCacheConfig struct {
Size *uint32 `json:"size,omitempty"` // Maximum number of revisions to store in the revision cache
Copy link
Member

Choose a reason for hiding this comment

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

We can't remove config options like this, it would be a breaking change for customers with existing configuration.

If we want to keep the size JSON field name, and rename the internal struct field to MaxItemCount to better represent the behaviour in the codebase, we can do that. The alternatve would be adding a new property, deprecating Size but still allowing it as a fallback.

Both of these options come with downsides.

rest/config.go Outdated
Comment on lines 249 to 250
MaxItemCount *uint32 `json:"max_item_count,omitempty"` // Maximum number of revisions to store in the revision cache
MaxMemoryCountMB *uint32 `json:"max_memory_count_mb"` // Maximum amount of memory the rev cache should consume in MB
Copy link
Member

Choose a reason for hiding this comment

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

What's the behaviour when both of these are set? The lower of the two?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Correct, both will work in tandem with one another when memory limit is set. I have added a comment to MaxMemoryCountMB to reflect this info, let me know if it needs work.

rest/config.go Show resolved Hide resolved
@bbrks bbrks assigned gregns1 and unassigned bbrks Sep 3, 2024
Copy link

github-actions bot commented Sep 4, 2024

Redocly previews

Signed-off-by: Gregory Newman-Smith <gregory.newmansmith@couchbase.com>
@gregns1 gregns1 assigned bbrks and unassigned gregns1 Sep 5, 2024
@gregns1 gregns1 merged commit 2f5dcd6 into main Sep 6, 2024
43 checks passed
@gregns1 gregns1 deleted the CBG-4134 branch September 6, 2024 16:22
bbrks pushed a commit that referenced this pull request Sep 26, 2024
* CBG-4134: link rev cache memory limit config option to rev cache

* failing tests

* address commnets

* fix yaml lint

* fix failing test + mistake in docs

Signed-off-by: Gregory Newman-Smith <gregory.newmansmith@couchbase.com>

---------

Signed-off-by: Gregory Newman-Smith <gregory.newmansmith@couchbase.com>
gregns1 added a commit that referenced this pull request Sep 27, 2024
* CBG-4023: Removal unmarshalled body on the rev cache (#7030)

* CBG-4135: new stat for rev cache capacity (#7049)

* CBG-4135: new stat for rev cache capacity

* updated based on review

* fix linter

* lint again

* CBG-4032: memory based rev cache implementation (#7040)

* CBG-4032: memory based rev cache implementation

* make test pass with default collection + missing return param

* more issues with default collection test

* touch ups on comment + remove unused function

* updated for review

* further tidy up

* lint fix after refector test

* fixes from rebase

* updates based off review + some more refactoring

* CBG-4134: link rev cache memory limit config option to rev cache (#7084)

* CBG-4134: link rev cache memory limit config option to rev cache

* failing tests

* address commnets

* fix yaml lint

* fix failing test + mistake in docs

Signed-off-by: Gregory Newman-Smith <gregory.newmansmith@couchbase.com>

---------

Signed-off-by: Gregory Newman-Smith <gregory.newmansmith@couchbase.com>

* CBG-4234: clean up rev cache work (#7113)

* CBG-4234: clean up rev cache work

* new test

* CBG-4277: Remove unused totalBytesForHistory from getHistory (#7137)

---------

Signed-off-by: Gregory Newman-Smith <gregory.newmansmith@couchbase.com>
Co-authored-by: Gregory Newman-Smith <109068393+gregns1@users.noreply.github.com>
bbrks added a commit that referenced this pull request Oct 8, 2024
* CBG-4023: Removal unmarshalled body on the rev cache (#7030)

* CBG-4135: new stat for rev cache capacity (#7049)

* CBG-4135: new stat for rev cache capacity

* updated based on review

* fix linter

* lint again

* CBG-4032: memory based rev cache implementation (#7040)

* CBG-4032: memory based rev cache implementation

* make test pass with default collection + missing return param

* more issues with default collection test

* touch ups on comment + remove unused function

* updated for review

* further tidy up

* lint fix after refector test

* fixes from rebase

* updates based off review + some more refactoring

* CBG-4134: link rev cache memory limit config option to rev cache (#7084)

* CBG-4134: link rev cache memory limit config option to rev cache

* failing tests

* address commnets

* fix yaml lint

* fix failing test + mistake in docs

Signed-off-by: Gregory Newman-Smith <gregory.newmansmith@couchbase.com>

---------

Signed-off-by: Gregory Newman-Smith <gregory.newmansmith@couchbase.com>

* CBG-4234: clean up rev cache work (#7113)

* CBG-4234: clean up rev cache work

* new test

* CBG-4277: Remove unused totalBytesForHistory from getHistory (#7137)

---------

Signed-off-by: Gregory Newman-Smith <gregory.newmansmith@couchbase.com>
Co-authored-by: Gregory Newman-Smith <109068393+gregns1@users.noreply.github.com>
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.

2 participants