Seal writecache async #1284

Merged
fyrchik merged 2 commits from dstepanov-yadro/frostfs-node:feat/writecache_seal_async into master 2024-09-04 19:51:10 +00:00

This PR makes it possible to seal writecache async (in background).

This PR makes it possible to seal writecache async (in background).
dstepanov-yadro force-pushed feat/writecache_seal_async from 1fad15aa87 to c828df5e1f 2024-07-31 13:52:14 +00:00 Compare
dstepanov-yadro reviewed 2024-07-31 13:56:18 +00:00
@ -102,0 +133,4 @@
if !m.NoMetabase() {
s.rb.Start(ctx, s.blobStor, s.metaBase, s.log)
}
s.writecacheSealCancel.Store(dummyCancel)
Author
Member

To allow writecache seal only after Init

To allow writecache seal only after `Init`
dstepanov-yadro force-pushed feat/writecache_seal_async from c828df5e1f to 44975773a7 2024-08-06 07:53:39 +00:00 Compare
dstepanov-yadro reviewed 2024-08-06 07:56:59 +00:00
@ -102,0 +133,4 @@
if !m.NoMetabase() {
s.rb.Start(ctx, s.blobStor, s.metaBase, s.log)
}
s.writecacheSealCancel.Store(dummyCancel)
Author
Member

Functional change. Other diff is just code refactor (method extract).

Functional change. Other diff is just code refactor (method extract).
dstepanov-yadro changed title from WIP: Seal writecache async to Seal writecache async 2024-08-06 08:01:33 +00:00
dstepanov-yadro requested review from storage-core-committers 2024-08-06 08:01:39 +00:00
dstepanov-yadro requested review from storage-core-developers 2024-08-06 08:01:39 +00:00
aarifullin reviewed 2024-08-06 08:59:21 +00:00
@ -78,1 +98,3 @@
defer s.m.RUnlock()
if p.sync() {
defer func() {
Member

What do you think about this non-functional change:

cleanup := func() {
   s.m.RUnlock()
   s.writecacheSealCancel.Store(dummyCancel)
}

and use it in this line and below? :) Just make it little bit readable

What do you think about this non-functional change: ```go cleanup := func() { s.m.RUnlock() s.writecacheSealCancel.Store(dummyCancel) } ``` and use it in this line and below? :) Just make it little bit readable
Author
Member

done

done
dstepanov-yadro force-pushed feat/writecache_seal_async from 44975773a7 to d824ee31be 2024-08-06 10:26:06 +00:00 Compare
fyrchik reviewed 2024-08-06 12:39:20 +00:00
@ -351,2 +359,4 @@
if s.hasWriteCache() {
prev := s.writecacheSealCancel.Swap(notInitializedCancel)
prev.cancel() // no need to wait: writecache.Seal and writecache.Close lock the same mutex
Owner

Could you explain, how having the same mutex makes it ok not to wait?

Could you explain, how having the same mutex makes it ok not to wait?
Author
Member

writecache.Close will wait for the writecache.Seal end.

`writecache.Close` will wait for the `writecache.Seal` end.
@ -79,0 +101,4 @@
s.writecacheSealCancel.Store(dummyCancel)
}
if p.sync() {
Owner

To me it makes reading harder: here it is p.sync(), below p.Async, I needed to look at p.sync definition to see if they correspond to the same thing.

To me it makes reading harder: here it is `p.sync()`, below `p.Async`, I needed to look at `p.sync` definition to see if they correspond to the same thing.
Author
Member

A controversial statement, but fixed.

A controversial statement, but fixed.
dstepanov-yadro force-pushed feat/writecache_seal_async from d824ee31be to 33823f984b 2024-08-06 12:50:53 +00:00 Compare
acid-ant approved these changes 2024-08-06 13:34:01 +00:00
fyrchik reviewed 2024-08-07 08:09:07 +00:00
@ -86,1 +116,4 @@
defer cleanup()
s.log.Info(logs.StartedWritecacheSealAsync)
if err := s.writeCache.Seal(context.WithoutCancel(ctx), p.IgnoreErrors); err != nil {
Owner

Is seal uncancellable?

Is `seal` uncancellable?
Author
Member

fixed

fixed
dstepanov-yadro force-pushed feat/writecache_seal_async from 33823f984b to bf8919333e 2024-08-07 08:16:45 +00:00 Compare
acid-ant approved these changes 2024-08-07 09:23:34 +00:00
Owner

please, rebase

please, rebase
dstepanov-yadro force-pushed feat/writecache_seal_async from bf8919333e to 0dcc5e75e0 2024-08-09 07:50:25 +00:00 Compare
Author
Member

please, rebase

done

> please, rebase done
acid-ant approved these changes 2024-08-09 08:31:23 +00:00
aarifullin approved these changes 2024-08-09 09:02:18 +00:00
fyrchik reviewed 2024-08-09 10:13:25 +00:00
@ -83,2 +110,4 @@
defer cleanup()
}
if s.info.Mode.ReadOnly() {
Owner

If p.Async == true && s.info.Mode.ReadOnly() we will have non-dummy canceler in writecacheSealCancel and it won't be called on exit.
It this intentional?

If `p.Async == true && s.info.Mode.ReadOnly()` we will have non-dummy canceler in `writecacheSealCancel` and it won't be called on exit. It this intentional?
Author
Member

Shame on me! Thx! Fixed.

Shame on me! Thx! Fixed.
dstepanov-yadro force-pushed feat/writecache_seal_async from 0dcc5e75e0 to 80ce7c3a00 2024-08-09 10:23:55 +00:00 Compare
fyrchik approved these changes 2024-08-09 10:42:19 +00:00
dstepanov-yadro requested review from aarifullin 2024-08-09 11:16:18 +00:00
dstepanov-yadro requested review from acid-ant 2024-08-09 11:16:22 +00:00
acid-ant approved these changes 2024-08-09 12:38:48 +00:00
fyrchik referenced this pull request from a commit 2024-08-09 12:46:28 +00:00
fyrchik merged commit 80ce7c3a00 into master 2024-08-09 12:46:29 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
4 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#1284
No description provided.