Project

General

Profile

Subtask #5527

Feature #4929: Erasure encoded placement group

Subtask #5487: Factor out ObjectContext / ReplicatedPG::object_contexts

unit tests for common/sharedptr_registry.hpp

Added by Loic Dachary about 6 years ago. Updated over 5 years ago.

Status:
Resolved
Priority:
Normal
Assignee:
Category:
OSD
Target version:
-
Start date:
07/09/2013
Due date:
08/14/2013
% Done:

100%

Estimated time:
0.00 h
Spent time:
Source:
Tags:
Backport:
Reviewed:
Affected Versions:
Pull request ID:

Description

Associated revisions

Revision 6b16cd1a (diff)
Added by Loic Dachary about 6 years ago

unit tests for sharedptr_registry

Covers 100% of the LOC and all the expected behavior, including thread
safety.

The sharedptr_registry is made friend of the test class so that it can
synthetize race conditions. The lookup and lookup_or_create methods
set the new in_method data member before calling cond.Wait() so that
the caller knows it is waiting.

http://tracker.ceph.com/issues/5527 refs #5527

Signed-off-by: Loic Dachary <>

Revision 2ec480b1 (diff)
Added by Loic Dachary about 6 years ago

replace in_method_t with a counter

A single counter ( waiting ) accurately reflects the number of
waiters, regardless of the method waiting. It is enough to allow
unit tests to synthetise all situations, including:

T1: x = lookup_or_create(0)
T1: release x part 1 (weak_ptrs now fail to lock)
T2: y = lookup_or_create(0)
T2: block in lookup_or_create (waiting == 1)
T1: z = lookup_or_create(1) (does not block because the key is different)
while holding the lock it waiting++ and waiting 2
and before returning it waiting-- and waiting is back to 1
T1: complete release x
T2: complete lookup_or_create(0) (waiting == 0)

The unit tests are modified to add a lookup on an unrelated key to
demonstrate that it does not reset waiting counter.

http://tracker.ceph.com/issues/5527 refs #5527

Signed-off-by: Loic Dachary <>

Revision d236a93b (diff)
Added by Loic Dachary almost 5 years ago

unit tests for sharedptr_registry

Covers 100% of the LOC and all the expected behavior, including thread
safety.

The sharedptr_registry is made friend of the test class so that it can
synthetize race conditions. The lookup and lookup_or_create methods
set the new in_method data member before calling cond.Wait() so that
the caller knows it is waiting.

http://tracker.ceph.com/issues/5527 refs #5527

Signed-off-by: Loic Dachary <>
(cherry picked from commit 6b16cd1aaaf818db0a6063f3a3ebb02eeefa3056)

Revision e0f4162e (diff)
Added by Loic Dachary almost 5 years ago

replace in_method_t with a counter

A single counter ( waiting ) accurately reflects the number of
waiters, regardless of the method waiting. It is enough to allow
unit tests to synthetise all situations, including:

T1: x = lookup_or_create(0)
T1: release x part 1 (weak_ptrs now fail to lock)
T2: y = lookup_or_create(0)
T2: block in lookup_or_create (waiting == 1)
T1: z = lookup_or_create(1) (does not block because the key is different)
while holding the lock it waiting++ and waiting 2
and before returning it waiting-- and waiting is back to 1
T1: complete release x
T2: complete lookup_or_create(0) (waiting == 0)

The unit tests are modified to add a lookup on an unrelated key to
demonstrate that it does not reset waiting counter.

http://tracker.ceph.com/issues/5527 refs #5527

Signed-off-by: Loic Dachary <>
(cherry picked from commit 2ec480b1ba00ff02f99a43963a321efc8edf247e)

History

#1 Updated by Loic Dachary about 6 years ago

  • Parent task set to #5487

#2 Updated by Loic Dachary about 6 years ago

  • Description updated (diff)
  • % Done changed from 0 to 90

#3 Updated by Loic Dachary about 6 years ago

  • Category changed from common to OSD

#4 Updated by Loic Dachary about 6 years ago

  • Due date set to 08/14/2013
  • Status changed from In Progress to Resolved
  • % Done changed from 90 to 100
  • translation missing: en.field_remaining_hours set to 0.00

#5 Updated by Loic Dachary over 5 years ago

  • Estimated time set to 0.00 h

Also available in: Atom PDF