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

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

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 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) {
Owner

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.
Author
Member
--- PASS: TestConcurrentSampler (0.82s)
``` --- PASS: TestConcurrentSampler (0.82s) ```
Author
Member

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
Owner

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 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-sdk-go#222
No description provided.