Skip to content

Speed up writecache initialization#2068

Merged
fyrchik merged 5 commits intonspcc-dev:masterfrom
fyrchik:fix-writecache-flush
Dec 2, 2022
Merged

Speed up writecache initialization#2068
fyrchik merged 5 commits intonspcc-dev:masterfrom
fyrchik:fix-writecache-flush

Conversation

@fyrchik
Copy link
Contributor

@fyrchik fyrchik commented Nov 17, 2022

No description provided.

@codecov
Copy link

codecov bot commented Nov 17, 2022

Codecov Report

Merging #2068 (7b2f805) into master (816c74d) will increase coverage by 0.26%.
The diff coverage is 86.20%.

@@            Coverage Diff             @@
##           master    #2068      +/-   ##
==========================================
+ Coverage   30.61%   30.88%   +0.26%     
==========================================
  Files         380      381       +1     
  Lines       28130    28179      +49     
==========================================
+ Hits         8613     8702      +89     
+ Misses      18778    18738      -40     
  Partials      739      739              
Impacted Files Coverage Δ
pkg/local_object_storage/blobstor/exists.go 61.90% <0.00%> (-14.57%) ⬇️
pkg/local_object_storage/writecache/options.go 56.09% <ø> (ø)
pkg/local_object_storage/writecache/storage.go 26.38% <0.00%> (-0.76%) ⬇️
pkg/local_object_storage/writecache/init.go 93.54% <93.54%> (+48.54%) ⬆️
pkg/local_object_storage/blobovnicza/exists.go 100.00% <100.00%> (ø)
..._object_storage/blobstor/blobovniczatree/exists.go 84.00% <100.00%> (+6.22%) ⬆️
pkg/local_object_storage/engine/put.go 76.71% <0.00%> (+2.73%) ⬆️
...object_storage/blobstor/blobovniczatree/control.go 73.97% <0.00%> (+5.47%) ⬆️
pkg/local_object_storage/writecache/get.go 75.86% <0.00%> (+75.86%) ⬆️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

func (c *cache) isFlushed(addr oid.Address) bool {
var prm meta.StorageIDPrm
prm.SetAddress(addr)
func (c *cache) flushStatus(addr oid.Address) (bool, bool) {
Copy link
Member

Choose a reason for hiding this comment

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

add docs about duplicated returned types?

Signed-off-by: Evgenii Stratonikov <evgeniy@morphbits.ru>
Signed-off-by: Evgenii Stratonikov <evgeniy@morphbits.ru>
Signed-off-by: Evgenii Stratonikov <evgeniy@morphbits.ru>
Signed-off-by: Evgenii Stratonikov <evgeniy@morphbits.ru>
Signed-off-by: Evgenii Stratonikov <evgeniy@morphbits.ru>
@sami-nspcc
Copy link

I have recieved a notification of a new pull request. I am starting the build of images and binaries for further testing. Build number is 3722

@sami-nspcc
Copy link

I am running integration tests

@sami-nspcc
Copy link

Test run is finished. Please download the tarball from link. Untar and use allure open to watch the report

@fyrchik fyrchik merged commit 42554a9 into nspcc-dev:master Dec 2, 2022
roman-khimov added a commit that referenced this pull request Jun 24, 2025
The problem is that it can take a significant amount of time to perform while
the value is questionable.

It was initially added in 8717820 (#1462)
when write cache had completely different structure and function.
733a792 tried to optimize it in #2068, but
most of the code was subsequently deleted and as write cache is no longer a
read cache this lead to the remaining code doing only the following:
 * checking objects against the metabase
 * checking objects against the underlying long-term storage

If the first one is ever triggered (we detect non-existent object) this just
means WC is out of sync with metabase which can happen for a number of other
reasons. Lower level blobstor can also get out of sync with metabase in some
cases, so it's not like this is something unique. If we're to drop this check
we'd just flush some dead object, but then GC should still be able to remove
it if it's deleted normally. If it's some other type of race --- like WC
accepted an object and metabase not yet then we shouldn't delete it at all
for safety reasons.

Then if some valid object was previously flushed already we'll retry flushing
it again and it's not a problem, EEXIST is not an error (but #2563), so we'd
waste some time, but it's not very likely we're going to since this case is
rare.

So it should be safe to drop this useless code.

Signed-off-by: Roman Khimov <roman@nspcc.ru>
roman-khimov added a commit that referenced this pull request Jun 24, 2025
The problem is that it can take a significant amount of time to perform while
the value is questionable.

It was initially added in 8717820 (#1462)
when write cache had completely different structure and function.
733a792 tried to optimize it in #2068, but
most of the code was subsequently deleted and as write cache is no longer a
read cache this lead to the remaining code doing only the following:
 * checking objects against the metabase
 * checking objects against the underlying long-term storage

If the first one is ever triggered (we detect non-existent object) this just
means WC is out of sync with metabase which can happen for a number of other
reasons. Lower level blobstor can also get out of sync with metabase in some
cases, so it's not like this is something unique. If we're to drop this check
we'd just flush some dead object, but then GC should still be able to remove
it if it's deleted normally. If it's some other type of race --- like WC
accepted an object and metabase not yet then we shouldn't delete it at all
for safety reasons.

Then if some valid object was previously flushed already we'll retry flushing
it again and it's not a problem, EEXIST is not an error (but #2563), so we'd
waste some time, but it's not very likely we're going to since this case is
rare.

So it should be safe to drop this useless code.

Signed-off-by: Roman Khimov <roman@nspcc.ru>
roman-khimov added a commit that referenced this pull request Jun 24, 2025
The problem is that it can take a significant amount of time to perform while
the value is questionable.

It was initially added in 8717820 (#1462)
when write cache had completely different structure and function.
733a792 tried to optimize it in #2068, but
most of the code was subsequently deleted and as write cache is no longer a
read cache this lead to the remaining code doing only the following:
 * checking objects against the metabase
 * checking objects against the underlying long-term storage

If the first one is ever triggered (we detect non-existent object) this just
means WC is out of sync with metabase which can happen for a number of other
reasons. Lower level blobstor can also get out of sync with metabase in some
cases, so it's not like this is something unique. If we're to drop this check
we'd just flush some dead object, but then GC should still be able to remove
it if it's deleted normally. If it's some other type of race --- like WC
accepted an object and metabase not yet then we shouldn't delete it at all
for safety reasons.

Then if some valid object was previously flushed already we'll retry flushing
it again and it's not a problem, EEXIST is not an error (but #2563), so we'd
waste some time, but it's not very likely we're going to since this case is
rare.

So it should be safe to drop this useless code.

Signed-off-by: Roman Khimov <roman@nspcc.ru>
roman-khimov added a commit that referenced this pull request Jun 24, 2025
The problem is that it can take a significant amount of time to perform while
the value is questionable.

It was initially added in 8717820 (#1462)
when write cache had completely different structure and function.
733a792 tried to optimize it in #2068, but
most of the code was subsequently deleted and as write cache is no longer a
read cache this lead to the remaining code doing only the following:
 * checking objects against the metabase
 * checking objects against the underlying long-term storage

If the first one is ever triggered (we detect non-existent object) this just
means WC is out of sync with metabase which can happen for a number of other
reasons. Lower level blobstor can also get out of sync with metabase in some
cases, so it's not like this is something unique. If we're to drop this check
we'd just flush some dead object, but then GC should still be able to remove
it if it's deleted normally. If it's some other type of race --- like WC
accepted an object and metabase not yet then we shouldn't delete it at all
for safety reasons.

Then if some valid object was previously flushed already we'll retry flushing
it again and it's not a problem, EEXIST is not an error (but #2563), so we'd
waste some time, but it's not very likely we're going to since this case is
rare.

So it should be safe to drop this useless code.

Signed-off-by: Roman Khimov <roman@nspcc.ru>
roman-khimov added a commit that referenced this pull request Jun 25, 2025
The problem is that it can take a significant amount of time to perform while
the value is questionable.

It was initially added in 8717820 (#1462)
when write cache had completely different structure and function.
733a792 tried to optimize it in #2068, but
most of the code was subsequently deleted and as write cache is no longer a
read cache this lead to the remaining code doing only the following:
 * checking objects against the metabase
 * checking objects against the underlying long-term storage

If the first one is ever triggered (we detect non-existent object) this just
means WC is out of sync with metabase which can happen for a number of other
reasons. Lower level blobstor can also get out of sync with metabase in some
cases, so it's not like this is something unique. If we're to drop this check
we'd just flush some dead object, but then GC should still be able to remove
it if it's deleted normally. If it's some other type of race --- like WC
accepted an object and metabase not yet then we shouldn't delete it at all
for safety reasons.

Then if some valid object was previously flushed already we'll retry flushing
it again and it's not a problem, EEXIST is not an error (but #2563), so we'd
waste some time, but it's not very likely we're going to since this case is
rare.

So it should be safe to drop this useless code.

Signed-off-by: Roman Khimov <roman@nspcc.ru>
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.

4 participants