Conversation
keegancsmith
left a comment
There was a problem hiding this comment.
nice! Looking forward to approving this :)
For simplicity, a hard cap of 500 is placed on reads, so that the reader does not need to implement conf watching.
elegant :D
Given most uses of FIFOList have this pattern I wonder if the constructor should take a getter for MaxSize. Would simplify code in a few places.
|
Codenotify: Notifying subscribers in CODENOTIFY files for diff 02c985e...85fc2b3.
|
…ob-records-fifolist
|
Was considering how this will tie in with https://github.com/sourcegraph/sourcegraph/issues/46078, since I just noticed that work has begun in earnest on DB-backed permissions sync - this query and cache was created to make it possible to validate that every authz provider configured has started permissions syncing successfully as part of prep work for https://github.com/sourcegraph/customer/issues/1525, so that we can offer guarantees of successful migration. Looking at the newly introduced It looks like the DB-backed sync might still be a few releases away, so I ended up deciding it's worthwhile to get this updated for now and deprecate/remove it later - the query is marked as experimental so I don't believe there's much issue in getting rid of it eventually. |
| r.cache = rcache.NewWithTTL(syncJobsRecordsPrefix, ttlSeconds) | ||
| r.logger.Debug("enabled records store cache", log.Int("ttlSeconds", ttlSeconds)) | ||
| // Setting cache size to 0 disables it | ||
| r.cache.SetMaxSize(recordsLimit) |
There was a problem hiding this comment.
I'm unsure how FIFOList behaves with a negative size. It likely needs to be updated (will be a tiny update) to special case that. Alternatively here if < 0 you make the number 0
There was a problem hiding this comment.
I did the former here https://github.com/sourcegraph/sourcegraph/pull/46702
I might land this for ya since I am now basing some other work of this PR.
@bobheadxi Work is in progress and @thenamankumar and @sashaostrikov are making great progress. It's not "a few releases" away, I'd say. But Naman can probably say more to when he expects to remove your Redis-based solution. |
|
@bobheadxi, we are targeting to release DB backed perms syncer, thoroughly tested along with a new permissions sync job API by the end of Feb. March release will definitely have it, and if things go well, we can release it in the Feb release itself. |
|
Happy to work with y'all on its removal - feel free to cc me on anything! |
Migrates
syncjobsto use the newrcache.FIFOList- this allows us to avoid scanning all Redis keys to find relevant records.The experimental setting
authz.syncJobsRecordsTTLhas been changed toauthz.syncJobsRecordsLimit- records are no longer retained based on age, but based on this size cap. The setting is clearly marked as experimental and is not advertised, so I think this is fine to change.For simplicity, a hard cap of 500 is placed on reads, so that the reader does not need to implement conf watching.
Addresses https://github.com/sourcegraph/sourcegraph/pull/44387/files#r1080897926
Test plan
Test coverage, and a quick manual test via
sg startand some dev-private config