-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Disc 5634 pluggable document store #5644
Disc 5634 pluggable document store #5644
Conversation
bdf7419
to
450e422
Compare
450e422
to
1a49357
Compare
I started by squashing your commits into a single commit and rebasing on main (which involved making a few tweaks based on changes already on main). Before merging I'm going to do the following:
|
- Remove `experimental_approximateDocumentStoreMiB` (but add InMemoryLRUCache.jsonBytesSizeCalculator which makes it easier to reproduce) - Remove `documentStore: boolean`; instead `documentStore: null`
OK, feeling good about this. I probably won't do the actual merge and release until Monday; if you object to any of the changes I've made please let me know @owenallenaz! There's some formatting issues with the code snippet I added in the API reference doc page. @trevorblades @StephenBarlow thoughts? |
|
||
To use `InMemoryLRUCache` but change its size to an amount `approximateDocumentStoreMiB`: | ||
|
||
<div style="max-width: 400px;"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It scrolls sideways but at least only this scrolls sideways.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
haha yes, in a world where this codeblock is helpful, this is the preferable solution for its rendering
Unfortunately, if this feature was used in Apollo Gateway (ie, any The fix is that we now always prefix keys in the document store with a random string that is refreshed each time a new schema is received. We apply this fix in the non-Gateway case too. The fix to the issue also means that the caveat in the docs about not sharing a documentSource across ApolloServer objects has been removed, as this random prefix helps with that case as well. |
This was discussed in #5634 . I wasn't sure if you wanted me to revoke the
experimental_approximateDocumentStoreMiB
or, since that would become a breaking change, if you wanted to keep it out of this PR. I kept it, so that it functions exactly as it did prior. If we are going to keep it, we should probably add a test to the documentStore test file to verify it's actually passing in correctly.Couple key things I want to call out:
DocumentStore
totypes.ts
this way we aren't re-specifying the contents ofdocumentStore
across many different files. It's definition is usingKeyValueCache
as suggested.true
,false
,undefined
or custom object. The downstream code already handled an undefined store luckily so I didn't have to change that at all.DocumentStore
rather than theDocumentStore | boolean
complexity that the external constructor accepts.ApolloServerBase
so that I could externally call the protectedgraphQLServerOptions
. There might be a better way to accomplish this...Let me know what you'd like to tweak.