[#221] pool: Make sampler safe for concurrent using #222

Merged
fyrchik merged 1 commits from dkirillov/frostfs-sdk-go:bugfix/221-pool_sampler into master 2024-05-20 12:46:53 +00:00
Collaborator

close #221

Signed-off-by: Denis Kirillov d.kirillov@yadro.com

close #221 Signed-off-by: Denis Kirillov <d.kirillov@yadro.com>
dkirillov self-assigned this 2024-05-08 11:56:02 +00:00
dkirillov added 1 commit 2024-05-08 11:56:04 +00:00
DCO / DCO (pull_request) Successful in 1m8s Details
Tests and linters / Tests (1.21) (pull_request) Successful in 1m32s Details
Tests and linters / Tests (1.20) (pull_request) Successful in 1m39s Details
Tests and linters / Lint (pull_request) Successful in 2m39s Details
1d3fe47e69
[#221] pool: Make sampler safe for concurrent using
Signed-off-by: Denis Kirillov <d.kirillov@yadro.com>
dkirillov requested review from storage-core-committers 2024-05-08 11:56:17 +00:00
dkirillov requested review from storage-core-developers 2024-05-08 11:56:19 +00:00
dkirillov requested review from storage-sdk-committers 2024-05-08 11:56:22 +00:00
dkirillov requested review from storage-sdk-developers 2024-05-08 11:56:29 +00:00
dkirillov requested review from storage-services-committers 2024-05-08 11:56:32 +00:00
dkirillov requested review from storage-services-developers 2024-05-08 11:56:32 +00:00
fyrchik reviewed 2024-05-08 12:00:00 +00:00
@ -40,6 +41,28 @@ func TestSamplerStability(t *testing.T) {
}
}
func TestConcurrentSampler(t *testing.T) {

How long does it take for this test to execute?
If it triggers panic, we could use 2 goroutines and -race flag instead, should fail too.

How long does it take for this test to execute? If it triggers panic, we could use 2 goroutines and `-race` flag instead, should fail too.
Poster
Collaborator
--- PASS: TestConcurrentSampler (0.82s)
``` --- PASS: TestConcurrentSampler (0.82s) ```
Poster
Collaborator

If it triggers panic, we could use 2 goroutines and -race flag instead, should fail too.

Yes, we can add -race to test makefile target

> If it triggers panic, we could use 2 goroutines and -race flag instead, should fail too. Yes, we can add `-race` to `test` makefile target

No, I mean the test itself is not worth having IMO:

  1. -race should catch the race even with 2 concurrent threads, 10_000 threads create a noticeable increase in test running time.
  2. We have lots of other places that use mutexes but don't have similar tests, changes for sampler are trivial enough IMO, it has 1 public method and 1 field we need to protect.
No, I mean the test itself is not worth having IMO: 1. `-race` should catch the race even with 2 concurrent threads, 10_000 threads create a noticeable increase in test running time. 2. We have _lots_ of other places that use mutexes but don't have similar tests, changes for `sampler` are trivial enough IMO, it has 1 public method and 1 field we need to protect.
fyrchik approved these changes 2024-05-08 12:01:48 +00:00
aarifullin approved these changes 2024-05-14 12:46:07 +00:00
dkirillov force-pushed bugfix/221-pool_sampler from 1d3fe47e69 to c5c6272029 2024-05-20 11:14:52 +00:00 Compare
fyrchik approved these changes 2024-05-20 12:46:43 +00:00
fyrchik merged commit c5c6272029 into master 2024-05-20 12:46:53 +00:00
dkirillov deleted branch bugfix/221-pool_sampler 2024-05-20 14:37:18 +00:00
Sign in to join this conversation.
No reviewers
TrueCloudLab/storage-sdk-developers
TrueCloudLab/storage-services-committers
TrueCloudLab/storage-services-developers
No Milestone
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-sdk-go#222
There is no content yet.