blobovnicza: Use TTL for blobovnicza tree cache #1017

Merged
fyrchik merged 1 commit from acid-ant/frostfs-node:bugfix/1004-stuck-close-blob into master 2024-04-27 10:48:47 +00:00
Member

Postponed till 0.38 released.

Close #1004, #866

Need to use a cache with control on how many times executed evict function for cache item.
Because most of the cache implementations just rewrite expired item without calling onEvict on put, event if key have the same value.

Signed-off-by: Anton Nikiforov an.nikiforov@yadro.com

Postponed till 0.38 released. Close #1004, #866 Need to use a cache with control on how many times executed evict function for cache item. Because most of the cache implementations just rewrite expired item without calling `onEvict` on `put`, event if `key` have the same `value`. Signed-off-by: Anton Nikiforov <an.nikiforov@yadro.com>
acid-ant requested review from storage-core-committers 2024-03-01 11:55:24 +00:00
acid-ant requested review from storage-core-developers 2024-03-01 11:55:26 +00:00
dstepanov-yadro reviewed 2024-03-01 12:11:08 +00:00
@ -33,0 +35,4 @@
res := &dbCache{
cacheGuard: &sync.Mutex{},
wg: sync.WaitGroup{},
cancel: cancel,

I suppose to not to pass parentCtx but use done channel. This will reduce changes count.

I suppose to not to pass parentCtx but use `done` channel. This will reduce changes count.
Author
Member

Disagree. We spent a lot of time to exclude using of the close channel approach. Routine for eviction may stop earlier than blobstor closed, but don't see any obstacles. When parent context cancelled, we need to stop service as faster as we can, because we have only 1m and a half until SIGKILL.

Disagree. We spent a lot of time to exclude using of the `close channel` approach. Routine for eviction may stop earlier than `blobstor` closed, but don't see any obstacles. When parent context cancelled, we need to stop service as faster as we can, because we have only 1m and a half until SIGKILL.
dstepanov-yadro marked this conversation as resolved
Owner

I have asked this exact question when we were implementing this feature:
#875 (comment)
Has something changed?

Frankly, I would rather remove TTL handling for now (in v0.38, and reintroduce it in v0.39, with better testing). Seems safer than introducing another untested dependency.

I have asked this exact question when we were implementing this feature: https://git.frostfs.info/TrueCloudLab/frostfs-node/pulls/875#issuecomment-29403 Has something changed? Frankly, I would rather remove TTL handling for now (in v0.38, and reintroduce it in v0.39, with better testing). Seems safer than introducing another untested dependency.
acid-ant changed title from blobovnicza: Use another expirable cache to WIP: blobovnicza: Use another expirable cache 2024-03-04 08:24:46 +00:00
acid-ant changed title from WIP: blobovnicza: Use another expirable cache to WIP: blobovnicza: Use TTL for blobovnicza tree cache 2024-03-04 19:48:48 +00:00
acid-ant force-pushed bugfix/1004-stuck-close-blob from f85e12cd39 to 9b54e8558b 2024-03-05 06:47:39 +00:00 Compare
acid-ant force-pushed bugfix/1004-stuck-close-blob from 9b54e8558b to e896127e5d 2024-03-05 08:43:09 +00:00 Compare
Author
Member

I have asked this exact question when we were implementing this feature:
#875 (comment)
Has something changed?

Frankly, I would rather remove TTL handling for now (in v0.38, and reintroduce it in v0.39, with better testing). Seems safer than introducing another untested dependency.

Previous implementation of TTL for blobovnicza cache reverted in scope of #1018
Tested with dev-env&k6

> I have asked this exact question when we were implementing this feature: > https://git.frostfs.info/TrueCloudLab/frostfs-node/pulls/875#issuecomment-29403 > Has something changed? > > Frankly, I would rather remove TTL handling for now (in v0.38, and reintroduce it in v0.39, with better testing). Seems safer than introducing another untested dependency. Previous implementation of TTL for blobovnicza cache reverted in scope of https://git.frostfs.info/TrueCloudLab/frostfs-node/pulls/1018 Tested with dev-env&k6
acid-ant changed title from WIP: blobovnicza: Use TTL for blobovnicza tree cache to blobovnicza: Use TTL for blobovnicza tree cache 2024-03-05 12:02:59 +00:00
acid-ant force-pushed bugfix/1004-stuck-close-blob from e896127e5d to 835e8119e9 2024-03-05 12:03:51 +00:00 Compare
fyrchik added the
blocked
label 2024-03-05 12:34:17 +00:00
dstepanov-yadro requested changes 2024-03-05 14:43:46 +00:00
@ -122,3 +149,1 @@
if !isNonCached && !c.closed {
c.cache.Add(path, db)
return true
if isNonCached && c.closed {

It must be if isNonCached || c.closed {

It must be `if isNonCached || c.closed {`
Author
Member

Thanks, fixed.

Thanks, fixed.
acid-ant force-pushed bugfix/1004-stuck-close-blob from 835e8119e9 to 84370776f9 2024-03-05 14:56:26 +00:00 Compare
acid-ant force-pushed bugfix/1004-stuck-close-blob from 84370776f9 to 8d367518e9 2024-03-05 14:56:38 +00:00 Compare
acid-ant requested review from dstepanov-yadro 2024-03-05 14:56:52 +00:00
acid-ant force-pushed bugfix/1004-stuck-close-blob from 8d367518e9 to 06725e85f3 2024-03-11 18:45:31 +00:00 Compare
acid-ant force-pushed bugfix/1004-stuck-close-blob from 0fc8e092df to 332d4d5a55 2024-03-12 10:49:06 +00:00 Compare
acid-ant force-pushed bugfix/1004-stuck-close-blob from 332d4d5a55 to 2d8b5d207f 2024-03-12 18:25:11 +00:00 Compare
acid-ant force-pushed bugfix/1004-stuck-close-blob from 2d8b5d207f to ff93f2c928 2024-03-13 12:02:43 +00:00 Compare
acid-ant force-pushed bugfix/1004-stuck-close-blob from ff93f2c928 to 136fd4108f 2024-03-13 18:37:03 +00:00 Compare
acid-ant force-pushed bugfix/1004-stuck-close-blob from 136fd4108f to 0aa1bdb472 2024-03-15 07:02:35 +00:00 Compare
acid-ant force-pushed bugfix/1004-stuck-close-blob from 0aa1bdb472 to f18792eeee 2024-03-15 10:49:28 +00:00 Compare
acid-ant force-pushed bugfix/1004-stuck-close-blob from f18792eeee to c92090a1b9 2024-03-18 12:12:13 +00:00 Compare
acid-ant force-pushed bugfix/1004-stuck-close-blob from c92090a1b9 to e76c7cd8b1 2024-03-24 19:30:04 +00:00 Compare
acid-ant force-pushed bugfix/1004-stuck-close-blob from e76c7cd8b1 to 64567a2218 2024-04-09 09:35:10 +00:00 Compare
fyrchik removed the
blocked
label 2024-04-16 09:30:09 +00:00
fyrchik requested changes 2024-04-16 10:17:09 +00:00
@ -40,0 +44,4 @@
if ttl > 0 {
res.wg.Add(1)
go func() {
ticker := time.NewTicker(ttl / 100)
Owner

Magic constant
Also, why 100?

Magic constant Also, why 100?
Owner

IMO some fixed interval is ok, so that we can say blobovnicza is closed after the time specified in config + e.g. 15 seconds.

IMO some fixed interval is ok, so that we can say blobovnicza is closed after the time specified in config + e.g. 15 seconds.
Owner
@acid-ant
Author
Member

Thanks for the reminder, updated.

Thanks for the reminder, updated.
acid-ant force-pushed bugfix/1004-stuck-close-blob from 64567a2218 to d444988ee7 2024-04-26 16:41:31 +00:00 Compare
acid-ant force-pushed bugfix/1004-stuck-close-blob from d444988ee7 to 411a8d0245 2024-04-26 16:54:52 +00:00 Compare
dstepanov-yadro refused to review 2024-04-27 09:49:08 +00:00

Approved.
Sorry, I can't press Approve button because of Forgejo error.

Approved. Sorry, I can't press Approve button because of Forgejo error.
fyrchik approved these changes 2024-04-27 10:48:39 +00:00
fyrchik merged commit 411a8d0245 into master 2024-04-27 10:48:47 +00:00
Sign in to join this conversation.
No reviewers
TrueCloudLab/storage-core-developers
No milestone
No project
No assignees
3 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: TrueCloudLab/frostfs-node#1017
No description provided.